aboutsummaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorNebuleon Fumika2013-01-13 05:00:47 -0500
committerNebuleon Fumika2013-01-13 05:00:47 -0500
commit0d048d05ee50625f15d5235d362df6ee71903fc5 (patch)
treecb93b5f2cdbc91615836be915279091da55a9710 /source
parent5b33e3c903f87d17fec7b92e2cf2f578d0b8d7b5 (diff)
downloadsnes9x2005-0d048d05ee50625f15d5235d362df6ee71903fc5.tar.gz
snes9x2005-0d048d05ee50625f15d5235d362df6ee71903fc5.tar.bz2
snes9x2005-0d048d05ee50625f15d5235d362df6ee71903fc5.zip
Revert timer-interrupt audio, but not optimisations done since then. Get the controller status every scanline again.
Diffstat (limited to 'source')
-rw-r--r--source/nds/entry.cpp49
-rw-r--r--source/nds/gui.c3
2 files changed, 6 insertions, 46 deletions
diff --git a/source/nds/entry.cpp b/source/nds/entry.cpp
index f470a43..a389ebc 100644
--- a/source/nds/entry.cpp
+++ b/source/nds/entry.cpp
@@ -23,7 +23,6 @@
#include "ds2sound.h"
void S9xProcessSound (unsigned int);
-void NDSSFCProduceSound (unsigned int);
char *rom_filename = NULL;
char *SDD1_pack = NULL;
@@ -545,13 +544,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);
@@ -893,18 +885,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;
@@ -971,16 +951,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;
@@ -988,28 +965,19 @@ end:
void S9xProcessSound (unsigned int)
{
- // Nothing here! See the interrupt handling code below.
-}
-
-void NDSSFCProduceSound (unsigned int unused)
-{
- if (InInterrupt)
- return;
-
- InInterrupt = TRUE;
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;
@@ -1029,7 +997,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 */
@@ -1144,12 +1112,7 @@ void NDSSFCProduceSound (unsigned int unused)
/* All data sent. */
}
- IsSoundGenerated = FALSE;
-
so.samples_mixed_so_far -= sample_count;
-
-end:
- InInterrupt = FALSE;
}
void Init_Timer (void)
diff --git a/source/nds/gui.c b/source/nds/gui.c
index 01f08e3..2af3ff7 100644
--- a/source/nds/gui.c
+++ b/source/nds/gui.c
@@ -1651,7 +1651,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;
@@ -3850,8 +3849,6 @@ u32 menu(u16 *screen)
set_cpu_clock(clock_speed_number);
- runTimer(0 /* timer interrupt channel for sound */);
-
return return_value;
}