@@ -28,7 +28,10 @@ | |||
#define Audio_h_ | |||
#if TEENSYDUINO < 120 | |||
#error "Teensyduino version 1.20 or later is required to compile the Audio library" | |||
#error "Teensyduino version 1.20 or later is required to compile the Audio library." | |||
#endif | |||
#ifdef __AVR__ | |||
#error "The Audio Library only works with Teensy 3.X. Teensy 2.0 is unsupported." | |||
#endif | |||
// When changing multiple audio object settings that must update at | |||
@@ -81,7 +84,4 @@ | |||
#include "synth_whitenoise.h" | |||
#include "synth_pinknoise.h" | |||
// TODO: more audio processing objects.... | |||
// waveforms with bandwidth limited tables for synth | |||
#endif |
@@ -78,5 +78,6 @@ void AudioSynthNoiseWhite::update(void) | |||
release(block); | |||
} | |||
uint16_t AudioSynthNoiseWhite::instance_count = 0; | |||
@@ -32,7 +32,10 @@ | |||
class AudioSynthNoiseWhite : public AudioStream | |||
{ | |||
public: | |||
AudioSynthNoiseWhite() : AudioStream(0, NULL), level(0), seed(1) {} | |||
AudioSynthNoiseWhite() : AudioStream(0, NULL) { | |||
level = 0; | |||
seed = 1 + instance_count++; | |||
} | |||
void amplitude(float n) { | |||
if (n < 0.0) n = 0.0; | |||
else if (n > 1.0) n = 1.0; | |||
@@ -42,6 +45,7 @@ public: | |||
private: | |||
int32_t level; // 0=off, 65536=max | |||
uint32_t seed; // must start at 1 | |||
static uint16_t instance_count; | |||
}; | |||
#endif |