Skip to content

Commit 344201b

Browse files
committed
Fix broken generator
1 parent 18dece2 commit 344201b

File tree

12 files changed

+24
-24
lines changed

12 files changed

+24
-24
lines changed

examples-desktop/generator/generator.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ using namespace audio_tools;
55
uint16_t sample_rate=44100;
66
uint8_t channels = 1; // The stream will have 2 channels
77
SineWaveGenerator<int16_t> sineWave(32000); // subclass of SoundGenerator with max amplitude of 32000
8-
GeneratedSoundStream<int16_t> in(sineWave, channels); // Stream generated from sine wave
8+
GeneratedSoundStream<int16_t> in(sineWave); // Stream generated from sine wave
99
DefaultStream out; // On desktop we use
1010
StreamCopy copier(out, in); // copy in to out
1111

examples/streams-generator-a2dp/streams-generator-a2dp.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ typedef int16_t sound_t; // sound will be repre
1616
uint16_t sample_rate=44100;
1717
uint8_t channels = 2; // The stream will have 2 channels
1818
SineWaveGenerator<sound_t> sineWave(32000); // subclass of SoundGenerator with max amplitude of 32000
19-
GeneratedSoundStream<sound_t> in(sineWave, channels); // Stream generated from sine wave
19+
GeneratedSoundStream<sound_t> in(sineWave); // Stream generated from sine wave
2020
A2DPStream out = A2DPStream::instance() ; // A2DP input - A2DPStream is a singleton!
2121
StreamCopy copier(out, in); // copy in to out
2222

@@ -30,7 +30,7 @@ void setup(void) {
3030
Serial.println("A2DP is connected now...");
3131

3232
// Setup sine wave
33-
sineWave.begin(sample_rate, N_B4);
33+
sineWave.begin(channels, sample_rate, N_B4);
3434

3535
}
3636

examples/streams-generator-dac/streams-generator-dac.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ typedef int16_t sound_t; // sound will be repr
1515
uint16_t sample_rate=44100;
1616
uint8_t channels = 2; // The stream will have 2 channels
1717
SineWaveGenerator<sound_t> sineWave(32000); // subclass of SoundGenerator with max amplitude of 32000
18-
GeneratedSoundStream<sound_t> sound(sineWave, channels); // Stream generated from sine wave
18+
GeneratedSoundStream<sound_t> sound(sineWave); // Stream generated from sine wave
1919
AnalogAudioStream out;
2020
StreamCopy copier(out, sound); // copies sound into i2s
2121

@@ -31,7 +31,7 @@ void setup(void) {
3131
out.begin(config);
3232

3333
// Setup sine wave
34-
sineWave.begin(sample_rate, N_B4);
34+
sineWave.begin(channels, sample_rate, N_B4);
3535
}
3636

3737
// Arduino loop - copy sound to out

examples/streams-generator-i2s/streams-generator-i2s.ino

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ typedef int16_t sound_t; // sound will be repr
1515
uint16_t sample_rate=44100;
1616
uint8_t channels = 2; // The stream will have 2 channels
1717
SineWaveGenerator<sound_t> sineWave(32000); // subclass of SoundGenerator with max amplitude of 32000
18-
GeneratedSoundStream<sound_t> sound(sineWave, channels); // Stream generated from sine wave
18+
GeneratedSoundStream<sound_t> sound(sineWave); // Stream generated from sine wave
1919
I2SStream out;
2020
StreamCopy copier(out, sound); // copies sound into i2s
2121

@@ -28,12 +28,12 @@ void setup(void) {
2828
Serial.println("starting I2S...");
2929
I2SConfig config = out.defaultConfig(TX_MODE);
3030
config.sample_rate = sample_rate;
31-
config.channels = 2;
31+
config.channels = channels;
3232
config.bits_per_sample = 16;
3333
out.begin(config);
3434

3535
// Setup sine wave
36-
sineWave.begin(sample_rate, N_B4);
36+
sineWave.begin(channels, sample_rate, N_B4);
3737
}
3838

3939
// Arduino loop - copy sound to out

examples/streams-generator-pwm/streams-generator-pwm.ino

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111
using namespace audio_tools;
1212

1313
//int pins[] = {22, 23};
14-
int channels = 2;
14+
int channels = 1;
1515
uint16_t sample_rate=22000;
1616
SineWaveGenerator<int16_t> sineWave(32000); // subclass of SoundGenerator with max amplitude of 32000
17-
GeneratedSoundStream<int16_t> sound(sineWave, channels); // Stream generated from sine wave
17+
GeneratedSoundStream<int16_t> sound(sineWave); // Stream generated from sine wave
1818
PWMAudioStream pwm;
1919
StreamCopy copier(pwm, sound); // copy in to out
2020

@@ -24,7 +24,7 @@ void setup() {
2424
AudioLogger::instance().begin(Serial, AudioLogger::Warning);
2525

2626
// setup sine wave
27-
sineWave.begin(sample_rate, N_B4);
27+
sineWave.begin(channels, sample_rate, N_B4);
2828

2929
// setup PWM output
3030
auto config = pwm.defaultConfig();

examples/streams-generator-serial/streams-generator-serial.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ typedef int16_t sound_t; // sound will be repr
1414
uint16_t sample_rate=44100;
1515
uint8_t channels = 2; // The stream will have 2 channels
1616
SineWaveGenerator<sound_t> sineWave(32000); // subclass of SoundGenerator with max amplitude of 32000
17-
GeneratedSoundStream<sound_t> sound(sineWave, channels); // Stream generated from sine wave
17+
GeneratedSoundStream<sound_t> sound(sineWave); // Stream generated from sine wave
1818
CsvStream<sound_t> printer(Serial, channels); // ASCII stream
1919
StreamCopy copier(printer, sound); // copies sound into printer
2020

@@ -24,7 +24,7 @@ void setup(void) {
2424
Serial.begin(115200);
2525

2626
// Setup sine wave
27-
sineWave.begin(sample_rate, N_B4);
27+
sineWave.begin(channels, sample_rate, N_B4);
2828
}
2929

3030

examples/streams-generator-webserver_wav/streams-generator-server_wav.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const int sample_rate = 10000;
1313
const int channels = 1;
1414

1515
SineWaveGenerator<int16_t> sineWave; // subclass of SoundGenerator with max amplitude of 32000
16-
GeneratedSoundStream<int16_t> in(sineWave, channels); // Stream generated from sine wave
16+
GeneratedSoundStream<int16_t> in(sineWave); // Stream generated from sine wave
1717

1818

1919
void setup() {
@@ -24,7 +24,7 @@ void setup() {
2424
server.begin(in, sample_rate, channels);
2525

2626
// start generation of sound
27-
sineWave.begin(sample_rate, N_B4);
27+
sineWave.begin(channels, sample_rate, N_B4);
2828
in.begin();
2929
}
3030

sandbox/experiment-mozzi-udp/streams-mozzi-udp.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ using namespace audio_tools;
2323
typedef int16_t sound_t; // sound will be represented as int16_t (with 2 bytes)
2424
uint8_t channels = 2; // The stream will have 2 channels
2525
MozziGenerator mozzi(CONTROL_RATE); // subclass of SoundGenerator
26-
GeneratedSoundStream<sound_t> in(mozzi, channels); // Stream generated with mozzi
26+
GeneratedSoundStream<sound_t> in(mozzi); // Stream generated with mozzi
2727
UDPStream out; // UDP Output - A2DPStream is a singleton!
2828
StreamCopy copier(out, in); // copy in to out
2929

sandbox/experiment-mozzi-usb/streams-mozzi-usb.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ using namespace audio_tools;
2222
typedef int16_t sound_t; // sound will be represented as int16_t (with 2 bytes)
2323
uint8_t channels = 2; // The stream will have 2 channels
2424
MozziGenerator mozzi(CONTROL_RATE); // subclass of SoundGenerator
25-
GeneratedSoundStream<sound_t> in(mozzi, channels); // Stream generated with mozzi
25+
GeneratedSoundStream<sound_t> in(mozzi); // Stream generated with mozzi
2626
AudioUSB out; // UDP Output - A2DPStream is a singleton!
2727
StreamCopy copier(out, in); // copy in to out
2828

src/AudioTools.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ namespace audio_tools {
4343
#if defined(__linux__) || defined(_WIN32) || defined(__APPLE__)
4444
typedef PortAudioStream DefaultStream;
4545
#elif defined(ESP32) || defined(ESP8266) || defined(__SAMD21G18A__)
46-
typedef A2DPStream DefaultStream;
46+
typedef I2SStream DefaultStream;
4747
#endif
4848

4949
}

0 commit comments

Comments
 (0)