mirror of
https://github.com/mauiaaron/apple2.git
synced 2025-02-21 05:29:07 +00:00
Enable semi-hackish codepath to reduce audio glitching on fast loading
This commit is contained in:
parent
ab0c796249
commit
3a35404fa3
@ -31,6 +31,9 @@
|
|||||||
|
|
||||||
#define SPKR_SILENT_STEP 1
|
#define SPKR_SILENT_STEP 1
|
||||||
|
|
||||||
|
// TODO FIXME : still need to investigate better way to fix audio glitches when fast-loading (auto-adjusting speed) ...
|
||||||
|
#define HACKISHLY_REDUCE_AUDIO_GLITCHES_FOR_FAST_LOADING 1
|
||||||
|
|
||||||
static unsigned long bufferTotalSize = 0;
|
static unsigned long bufferTotalSize = 0;
|
||||||
static unsigned long bufferSizeIdealMin = 0;
|
static unsigned long bufferSizeIdealMin = 0;
|
||||||
static unsigned long bufferSizeIdealMax = 0;
|
static unsigned long bufferSizeIdealMax = 0;
|
||||||
@ -203,9 +206,13 @@ static void _speaker_update(/*bool toggled*/) {
|
|||||||
if (NUM_CHANNELS == 2) {
|
if (NUM_CHANNELS == 2) {
|
||||||
samples_buffer[samples_buffer_idx++] = speaker_data;
|
samples_buffer[samples_buffer_idx++] = speaker_data;
|
||||||
}
|
}
|
||||||
#if !defined(ANDROID)
|
#if HACKISHLY_REDUCE_AUDIO_GLITCHES_FOR_FAST_LOADING
|
||||||
if (speaker_going_silent && speaker_data) {
|
if (speaker_going_silent && speaker_data) {
|
||||||
speaker_data -= SPKR_SILENT_STEP;
|
if (speaker_data < 0) {
|
||||||
|
speaker_data += SPKR_SILENT_STEP;
|
||||||
|
} else {
|
||||||
|
speaker_data -= SPKR_SILENT_STEP;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
--num_samples;
|
--num_samples;
|
||||||
@ -465,7 +472,7 @@ void speaker_flush(void) {
|
|||||||
// After 0.2sec of //e cycles time set inactive flag (allows auto-switch to full speed for fast disk access)
|
// After 0.2sec of //e cycles time set inactive flag (allows auto-switch to full speed for fast disk access)
|
||||||
speaker_recently_active = false;
|
speaker_recently_active = false;
|
||||||
} else if ((speaker_data != 0) && (cycles_count_total - cycles_quiet_time > cycles_diff)) {
|
} else if ((speaker_data != 0) && (cycles_count_total - cycles_quiet_time > cycles_diff)) {
|
||||||
#if defined(ANDROID)
|
#if !HACKISHLY_REDUCE_AUDIO_GLITCHES_FOR_FAST_LOADING
|
||||||
// OpenSLES seems to be able to pause output without the nasty pops that I hear with OpenAL on Linux
|
// OpenSLES seems to be able to pause output without the nasty pops that I hear with OpenAL on Linux
|
||||||
// desktop. So this speaker_going_silent hack is not needed. There is also a noticeable glitch in
|
// desktop. So this speaker_going_silent hack is not needed. There is also a noticeable glitch in
|
||||||
// OpenSLES when this codepath is enabled.
|
// OpenSLES when this codepath is enabled.
|
||||||
@ -545,9 +552,10 @@ GLUE_C_READ(speaker_toggle)
|
|||||||
|
|
||||||
if (!is_fullspeed) {
|
if (!is_fullspeed) {
|
||||||
if (speaker_data == speaker_amplitude) {
|
if (speaker_data == speaker_amplitude) {
|
||||||
#ifdef ANDROID
|
#if defined(ANDROID)
|
||||||
speaker_data = -speaker_amplitude;
|
speaker_data = -speaker_amplitude;
|
||||||
#else
|
#else
|
||||||
|
# error FIXME TODO : investigate whether this is still needed
|
||||||
speaker_data = 0;
|
speaker_data = 0;
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user