Przeglądaj źródła

Add AudioNoInterrupts() and AudioInterrupts()

dds
PaulStoffregen 11 lat temu
rodzic
commit
67e7db35a6
1 zmienionych plików z 15 dodań i 0 usunięć
  1. +15
    -0
      Audio.h

+ 15
- 0
Audio.h Wyświetl plik

@@ -1,5 +1,20 @@
#include "AudioStream.h"


// When changing multiple audio object settings that must update at
// the same time, these functions allow the audio library interrupt
// to be disabled. For example, you may wish to begin playing a note
// in response to reading an analog sensor. If you have "velocity"
// information, you might start the sample playing and also adjust
// the gain of a mixer channel. Use AudioNoInterrupts() first, then
// make both changes to the 2 separate objects. Then allow the audio
// library to update with AudioInterrupts(). Both changes will happen
// at the same time, because AudioNoInterrupts() prevents any updates
// while you make changes.
#define AudioNoInterrupts() (NVIC_DISABLE_IRQ(IRQ_SOFTWARE))
#define AudioInterrupts() (NVIC_ENABLE_IRQ(IRQ_SOFTWARE))


// waveforms.c
extern "C" {
extern const int16_t AudioWaveformSine[257];

Ładowanie…
Anuluj
Zapisz