Attempt to fix audio playback issue

This commit is contained in:
Mike H 2018-02-19 20:32:08 +00:00 committed by GitHub
parent a7106d5009
commit e4f00c4ea4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -6,6 +6,7 @@
#define SAMPLERATE 48000
#define SAMPLESPERBUF (SAMPLERATE / 10)
#define BYTESPERSAMPLE 4
void fill_audio_buffer(void* audio_buffer, size_t offset, size_t size, int frequency) {
u32* dest = (u32*) audio_buffer;
@ -32,8 +33,8 @@ int main(int argc, char **argv)
7040, 3520, 1760, 880, 440
};
u32 raw_data[SAMPLESPERBUF * 2];
fill_audio_buffer(raw_data, 0, SAMPLESPERBUF * 2, notefreq[4]);
// Make sure the sample buffer is aligned to 0x1000 bytes
u8 raw_data[((SAMPLESPERBUF * BYTESPERSAMPLE * 2) + 0xfff) & ~0xfff];
gfxInitDefault();
@ -151,8 +152,11 @@ int main(int argc, char **argv)
source_buffer.data_offset = 0;
// Play this buffer once.
audoutPlayBuffer(&source_buffer, &released_buffer);
rc = audoutPlayBuffer(&source_buffer, &released_buffer);
play_tone = false;
if (!R_SUCCEEDED(rc))
printf("audoutPlayBuffer() returned 0x%x\n", rc);
}
gfxFlushBuffers();