Преглед изворни кода

Fix multiple white noise instances

dds
PaulStoffregen пре 10 година
родитељ
комит
e1535addce
3 измењених фајлова са 10 додато и 5 уклоњено
  1. +4
    -4
      Audio.h
  2. +1
    -0
      synth_whitenoise.cpp
  3. +5
    -1
      synth_whitenoise.h

+ 4
- 4
Audio.h Прегледај датотеку

@@ -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

+ 1
- 0
synth_whitenoise.cpp Прегледај датотеку

@@ -78,5 +78,6 @@ void AudioSynthNoiseWhite::update(void)
release(block);
}

uint16_t AudioSynthNoiseWhite::instance_count = 0;



+ 5
- 1
synth_whitenoise.h Прегледај датотеку

@@ -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

Loading…
Откажи
Сачувај