mirror of
https://github.com/trudnai/Steve2.git
synced 2024-06-13 09:29:36 +00:00
More efforts to make speaker even cleaner
This commit is contained in:
parent
24ce8a7db6
commit
24a45012da
|
@ -225,6 +225,8 @@ void spkr_fade(float fadeLevel) {
|
|||
|
||||
// // Fill with Zero to avoid pops
|
||||
// memset(spkr_samples + idx, 0, SPKR_SLOT_SIZE(1));
|
||||
|
||||
spkr_level = fadeLevel;
|
||||
}
|
||||
|
||||
|
||||
|
@ -838,7 +840,7 @@ void spkr_update() {
|
|||
// Need to Cool Down Speaker -- Soft Fade to Zero
|
||||
else {
|
||||
|
||||
spkr_fade(spkr_level_tema);
|
||||
spkr_fade(spkr_level);
|
||||
spkr_filter(SPKR_SLOT_SIZE(1));
|
||||
|
||||
#ifdef SPKR_DEBUG
|
||||
|
@ -855,7 +857,7 @@ void spkr_update() {
|
|||
spkr_sample_idx = 0;
|
||||
spkr_sample_last_idx = 0;
|
||||
|
||||
spkr_filter_reset();
|
||||
// spkr_filter_reset();
|
||||
}
|
||||
else {
|
||||
// push a click into the speaker buffer
|
||||
|
@ -901,8 +903,15 @@ void spkr_update() {
|
|||
|
||||
memset(spkr_samples + SPKR_SLOT_SIZE(1), 0, SPKR_SLOT_SIZE(1) );
|
||||
|
||||
spkr_sample_idx = 0;
|
||||
spkr_sample_last_idx = 0;
|
||||
spkr_sample_idx -= SPKR_SLOT_SIZE(1);
|
||||
if ((int)spkr_sample_idx < 0) {
|
||||
spkr_sample_idx = 0;
|
||||
}
|
||||
|
||||
spkr_sample_last_idx -= SPKR_SLOT_SIZE(1);
|
||||
if ((int)spkr_sample_last_idx < 0) {
|
||||
spkr_sample_last_idx = 0;
|
||||
}
|
||||
|
||||
// make sure it never goes below 0 (never overflows)
|
||||
if ( (int)spkr_play_time < 0 ) {
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
//#define SPKR_LEVEL_MAX (+3072)
|
||||
#define SPKR_LEVEL_MAX 32767 // 8192
|
||||
#define SPKR_LEVEL_MIN (-SPKR_LEVEL_MAX)
|
||||
#define SPKR_PLAY_TIMEOUT 8U
|
||||
#define SPKR_PLAY_TIMEOUT (2 * DEFAULT_FPS) // 2 seconds until make it super quiet
|
||||
#define SPKR_PLAY_QUIET 0
|
||||
//#define SPKR_PLAY_QUIET (SPKR_PLAY_TIMEOUT - 2)
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user