From 0d5be16895ec6ffe9536c52774c4bf0645224f21 Mon Sep 17 00:00:00 2001 From: Nebuleon Fumika Date: Fri, 18 Jan 2013 03:33:14 -0500 Subject: Revert "Reinstate timer-interrupt audio." This reverts commit 944d9a729455de435c3d200752308ceedf250196. Conflicts: source/nds/entry.cpp --- Makefile | 3 +-- source/nds/entry.cpp | 48 ++++++------------------------------------------ source/nds/gui.c | 3 --- 3 files changed, 7 insertions(+), 47 deletions(-) diff --git a/Makefile b/Makefile index 23296ba..0d8faeb 100644 --- a/Makefile +++ b/Makefile @@ -70,8 +70,7 @@ DEFS := -DSPC700_C -DEXECUTE_SUPERFX_PER_LINE -DSDD1_DECOMP \ -DVAR_CYCLES -DCPU_SHUTDOWN -DSPC700_SHUTDOWN \ -DNO_INLINE_SET_GET -DNOASM -DHAVE_MKSTEMP '-DACCEPT_SIZE_T=size_t' \ -DUNZIP_SUPPORT -DFOREVER_16_BIT_SOUND -DFOREVER_STEREO \ - -DFOREVER_FORWARD_STEREO -# -DSYNC_JOYPAD_AT_HBLANK + -DFOREVER_FORWARD_STEREO -DSYNC_JOYPAD_AT_HBLANK .PHONY: clean makedirs .SUFFIXES: .elf .dat .plg diff --git a/source/nds/entry.cpp b/source/nds/entry.cpp index 1301ba7..cef73c1 100644 --- a/source/nds/entry.cpp +++ b/source/nds/entry.cpp @@ -24,7 +24,6 @@ #include "ds2sound.h" void S9xProcessSound (unsigned int); -void NDSSFCProduceSound (unsigned int); char *rom_filename = NULL; char *SDD1_pack = NULL; @@ -535,13 +534,6 @@ int sfc_main (int argc, char **argv) TRUE, #endif Settings.SoundBufferSize); - // Start a timer for the sound - initTimer(0 /* timer channel, 0 or 1 */, - INTERRUPT_TIME /* period in microseconds */, - NDSSFCProduceSound /* timer function, void (unsigned int) */, - 0 /* programmer-specified argument to ^ */); - runTimer(0 /* timer channel, 0 or 1 */); - #ifdef GFX_MULTI_FORMAT // S9xSetRenderPixelFormat (RGB565); S9xSetRenderPixelFormat (BGR555); @@ -854,18 +846,6 @@ bool8 S9xOpenSoundDevice (int mode, bool8 stereo, int buffer_size) return (TRUE); } -/* - * In the interrupt model, calls to NDSSFCProduceSound could happen even - * when the CPU or APU is being reset or reloaded from a file. Prevent - * glitches and/or crashes (!) from occurring while sound is not being - * generated. - */ -static volatile bool8 IsSoundGenerated = FALSE; -/* - * Also prevent an interrupt from triggering on top of another one. - */ -static volatile bool8 InInterrupt = FALSE; - void S9xGenerateSound () { block_signal = TRUE; @@ -932,16 +912,13 @@ void S9xGenerateSound () } while (samples_to_write > 0); } - IsSoundGenerated = TRUE; - end: if (pending_signal) { block_signal = FALSE; pending_signal = FALSE; - // S9xProcessSound (0); - NDSSFCProduceSound (0); + S9xProcessSound (0); } else block_signal = FALSE; @@ -949,31 +926,22 @@ end: void S9xProcessSound (unsigned int) { - // Nothing here! See the interrupt handling code below. -} - -void NDSSFCProduceSound (unsigned int unused) -{ - if (InInterrupt) - return; - - InInterrupt = TRUE; if (DelayingForEarlyFrame) set_cpu_clock(clock_speed_number); if (block_signal) { pending_signal = TRUE; - goto end; + return; } unsigned short *audiobuff; - if (Settings.Paused || !IsSoundGenerated || so.mute_sound || !game_enable_audio) - goto end; + if (Settings.Paused || so.mute_sound || !game_enable_audio) + return; if(ds2_checkAudiobuff() > 4) - goto end; + return; /* Number of samples to generate now */ int sample_count; @@ -993,7 +961,7 @@ void NDSSFCProduceSound (unsigned int unused) audiobuff = (unsigned short*)ds2_getAudiobuff(); if(NULL == audiobuff) //There are audio queue in sending or wait to send { - goto end; + return; } /* If we need more audio samples */ @@ -1108,15 +1076,11 @@ void NDSSFCProduceSound (unsigned int unused) /* All data sent. */ } - IsSoundGenerated = FALSE; - so.samples_mixed_so_far -= sample_count; end: if (DelayingForEarlyFrame) ds2_setCPUclocklevel(0); - - InInterrupt = FALSE; } /* diff --git a/source/nds/gui.c b/source/nds/gui.c index f668a5f..a7cd357 100644 --- a/source/nds/gui.c +++ b/source/nds/gui.c @@ -1654,7 +1654,6 @@ unsigned int frame_interval; --------------------------------------------------------*/ u32 menu(u16 *screen) { - stopTimer(0 /* timer interrupt channel for sound */); gui_action_type gui_action; u32 i; u32 repeat; @@ -3863,8 +3862,6 @@ u32 menu(u16 *screen) set_cpu_clock(clock_speed_number); - runTimer(0 /* timer interrupt channel for sound */); - return return_value; } -- cgit v1.2.3