aboutsummaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
Diffstat (limited to 'source')
-rw-r--r--source/apu_blargg.c6
-rw-r--r--source/memmap.c8
-rw-r--r--source/soundux.c2
3 files changed, 10 insertions, 6 deletions
diff --git a/source/apu_blargg.c b/source/apu_blargg.c
index 20b8b50..cfa7aae 100644
--- a/source/apu_blargg.c
+++ b/source/apu_blargg.c
@@ -2849,7 +2849,7 @@ void spc_copy_state( uint8_t ** io, dsp_copy_func_t copy )
APU
***********************************************************************************/
-#define APU_DEFAULT_INPUT_RATE 32000
+#define APU_DEFAULT_INPUT_RATE 32040
#define APU_MINIMUM_SAMPLE_COUNT (512*8)
#define APU_MINIMUM_SAMPLE_BLOCK (128*8)
#define APU_NUMERATOR_NTSC 15664
@@ -3177,8 +3177,8 @@ bool S9xInitSound (int32_t buffer_ms, int32_t lag_ms)
lag_ms : allowable time-lag given in millisecond */
int32_t sample_count, lag_sample_count;
- sample_count = buffer_ms * 32000 / 1000;
- lag_sample_count = lag_ms * 32000 / 1000;
+ sample_count = buffer_ms * 32040 / 1000;
+ lag_sample_count = lag_ms * 32040 / 1000;
lag_master = lag_sample_count;
diff --git a/source/memmap.c b/source/memmap.c
index d7986e1..8db9f93 100644
--- a/source/memmap.c
+++ b/source/memmap.c
@@ -217,7 +217,7 @@ static int32_t ScoreLoROM(bool skip_header, int32_t romoff)
static char* Safe(const char* s)
{
- static char* safe;
+ static char* safe = NULL;
static int32_t safe_len = 0;
int32_t i;
int32_t len;
@@ -338,7 +338,7 @@ void S9xDeinitMemory(void)
Memory.BSRAM = NULL;
}
- for (t = 0; t < 2; t++)
+ for (t = 0; t <= TILE_8BIT; t++)
{
if (IPPU.TileCache[t])
{
@@ -351,6 +351,10 @@ void S9xDeinitMemory(void)
IPPU.TileCached[t] = NULL;
}
}
+
+ /* Ensure that we free the static char
+ * array allocated by Safe() */
+ Safe(NULL);
}
#ifndef LOAD_FROM_MEMORY
diff --git a/source/soundux.c b/source/soundux.c
index 42098ed..66b546b 100644
--- a/source/soundux.c
+++ b/source/soundux.c
@@ -211,7 +211,7 @@ void S9xSetEchoFeedback(int32_t feedback)
void S9xSetEchoDelay(int32_t delay)
{
- SoundData.echo_buffer_size = (512 * delay * so.playback_rate) / 32000;
+ SoundData.echo_buffer_size = (512 * delay * so.playback_rate) / 32040;
SoundData.echo_buffer_size <<= 1;
if (SoundData.echo_buffer_size)
SoundData.echo_ptr %= SoundData.echo_buffer_size;