a patch for @sampler stability + speaker idle noise malfunction issue
+ just don't give it message w/ note == 0. that breaks audio loop. and don't reach actual player.stop()
This commit is contained in:
parent
149b21e64a
commit
1daa4a5868
1 changed files with 23 additions and 17 deletions
|
|
@ -112,23 +112,29 @@ void sample_player_start() {
|
||||||
delay(10);
|
delay(10);
|
||||||
}
|
}
|
||||||
void sample_player_stop() {
|
void sample_player_stop() {
|
||||||
//filename buffer - 8.3 naming convension! 8+1+3+1 = 13
|
//if note == 0, just stop immediately w/o checking
|
||||||
char filename[13] = "NNN.WAV";
|
// + and this way of checking is not nice (AudioNoInterrupts + test + AudioInterrupts)
|
||||||
//search for the sound file
|
// what if sound files list could be generated @ setup time and later just react on that list?
|
||||||
int note = sample_now;
|
// i think that way is much more stable than stopping interrupts. (-> breaks audio engine sometimes.)
|
||||||
int nnn = (note % 1000); // 0~999
|
if (note != 0) {
|
||||||
int nn = (note % 100); // 0~99
|
//filename buffer - 8.3 naming convension! 8+1+3+1 = 13
|
||||||
filename[0] = '0' + (nnn / 100); // N__.WAV
|
char filename[13] = "NNN.WAV";
|
||||||
filename[1] = '0' + (nn / 10); // _N_.WAV
|
//search for the sound file
|
||||||
filename[2] = '0' + (nn % 10); // __N.WAV
|
int note = sample_now;
|
||||||
//TEST
|
int nnn = (note % 1000); // 0~999
|
||||||
Serial.println(filename);
|
int nn = (note % 100); // 0~99
|
||||||
AudioNoInterrupts();
|
filename[0] = '0' + (nnn / 100); // N__.WAV
|
||||||
bool test = SD.exists(filename);
|
filename[1] = '0' + (nn / 10); // _N_.WAV
|
||||||
AudioInterrupts();
|
filename[2] = '0' + (nn % 10); // __N.WAV
|
||||||
if (!test) {
|
//TEST
|
||||||
Serial.println("... does not exist.");
|
Serial.println(filename);
|
||||||
return;
|
AudioNoInterrupts();
|
||||||
|
bool test = SD.exists(filename);
|
||||||
|
AudioInterrupts();
|
||||||
|
if (!test) {
|
||||||
|
Serial.println("... does not exist.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//stop the player.
|
//stop the player.
|
||||||
if (playSdWav1.isPlaying() == true) {
|
if (playSdWav1.isPlaying() == true) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue