Browse Source

Add AudioNoInterrupts() and AudioInterrupts()

dds
PaulStoffregen 11 years ago
parent
commit
67e7db35a6
1 changed files with 15 additions and 0 deletions
  1. +15
    -0
      Audio.h

+ 15
- 0
Audio.h View File

#include "AudioStream.h" #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 // waveforms.c
extern "C" { extern "C" {
extern const int16_t AudioWaveformSine[257]; extern const int16_t AudioWaveformSine[257];

Loading…
Cancel
Save