First working multiplayer version
This commit is contained in:
@@ -36,17 +36,18 @@ int dac_pin;
|
||||
void IRAM_ATTR onSoundTimer()
|
||||
{
|
||||
if (sound_on) {
|
||||
dacWrite(dac_pin, (sound_wave_high?sound_volume:0));
|
||||
//dacWrite(dac_pin, (sound_wave_high?sound_volume:0));
|
||||
sound_wave_high = ! sound_wave_high;
|
||||
}
|
||||
else
|
||||
dacWrite(dac_pin, 0);
|
||||
//else
|
||||
// dacWrite(dac_pin, 0);
|
||||
}
|
||||
|
||||
void sound_init(int pin){ // pin must be a DAC pin number !! (typically 25 or 26)
|
||||
return;
|
||||
dac_pin = pin;
|
||||
sound_on = false;
|
||||
pinMode(dac_pin, OUTPUT);
|
||||
//pinMode(dac_pin, OUTPUT);
|
||||
sound_volume = 0;
|
||||
|
||||
#ifdef OLD_CODE
|
||||
@@ -76,6 +77,7 @@ void sound_resume() // resume from pause ... after eeprom write
|
||||
}
|
||||
|
||||
bool sound(uint16_t freq, uint8_t volume){
|
||||
return true;
|
||||
if (volume == 0) {
|
||||
soundOff();
|
||||
return false;
|
||||
@@ -91,6 +93,7 @@ bool sound(uint16_t freq, uint8_t volume){
|
||||
}
|
||||
|
||||
void soundOff(){
|
||||
return;
|
||||
sound_on = false;
|
||||
sound_volume = 0;
|
||||
//timerAlarmWrite(sndTimer, ESP32_F_CPU/AUDIO_INTERRUPT_PRESCALER/(MIN_FREQ), true); // lower timer freq
|
||||
|
||||
Reference in New Issue
Block a user