Skip to content

Commit

Permalink
enable amplifier when needed
Browse files Browse the repository at this point in the history
  • Loading branch information
hubbe committed Aug 29, 2018
1 parent 67c4d2f commit faa38ae
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion sound/beeper.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class Beeper : public AudioStream {
}

void Beep(float length, float freq) {
digitalWrite(amplifierPin, HIGH); // turn on the amplifier
EnableAmplifier();
x_ = f_ = AUDIO_RATE / freq / 2.0;
samples_ = AUDIO_RATE * length;
}
Expand Down
2 changes: 2 additions & 0 deletions sound/buffered_wav_player.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
class BufferedWavPlayer : public VolumeOverlay<BufferedAudioStream<512> > {
public:
void Play(const char* filename) {
EnableAmplifier();
pause_ = true;
clear();
wav.Play(filename);
Expand All @@ -20,6 +21,7 @@ class BufferedWavPlayer : public VolumeOverlay<BufferedAudioStream<512> > {
}

void PlayOnce(Effect* effect, float start = 0.0) {
EnableAmplifier();
STDOUT.print("unit = ");
STDOUT.print(WhatUnit(this));
STDOUT.print(" vol = ");
Expand Down

0 comments on commit faa38ae

Please sign in to comment.