File tree Expand file tree Collapse file tree 2 files changed +38
-2
lines changed
examples/examples-custom-boards/lyrat-mini/output Expand file tree Collapse file tree 2 files changed +38
-2
lines changed Original file line number Diff line number Diff line change 1+ // Demo to output audio on a lyrat-mini board: with headphone detection active
2+ // to switch the power amplifier on and off
3+
4+ #include " AudioTools.h"
5+ #include " AudioTools/AudioLibs/AudioBoardStream.h"
6+
7+ AudioInfo info (44100 , 2 , 16 );
8+ SineWaveGenerator<int16_t > sineWave (32000 ); // subclass of SoundGenerator with max amplitude of 32000
9+ GeneratedSoundStream<int16_t > sound (sineWave); // Stream generated from sine wave
10+ AudioBoardStream out (LyratMini);
11+ StreamCopy copier (out, sound); // copies sound into i2s
12+
13+ // Arduino Setup
14+ void setup (void ) {
15+ // Open Serial
16+ Serial.begin (115200 );
17+ AudioToolsLogger.begin (Serial, AudioToolsLogLevel::Warning);
18+
19+ // start I2S
20+ Serial.println (" starting I2S..." );
21+ auto config = out.defaultConfig (TX_MODE);
22+ config.copyFrom (info);
23+
24+ // additinal settings
25+ out.setVolume (0.5 );
26+ out.addHeadphoneDetectionAction ();
27+
28+ // start sine wave
29+ sineWave.begin (info, N_B4);
30+ Serial.println (" started..." );
31+ }
32+
33+ void loop () {
34+ copier.copy ();
35+ out.processActions ();
36+ }
Original file line number Diff line number Diff line change @@ -309,7 +309,7 @@ class AudioBoardStream : public I2SCodecStream {
309309 }
310310
311311 // / Adds headphone determination
312- void addHeadphonDetectionAction () {
312+ void addHeadphoneDetectionAction () {
313313 // pin conflicts with AIThinker A101: key6 and headphone detection
314314 int head_phone = pinHeadphoneDetect ();
315315 if (head_phone != -1 && (getPinID (PinFunction::KEY, 6 ) != head_phone)) {
@@ -323,7 +323,7 @@ class AudioBoardStream : public I2SCodecStream {
323323 */
324324 void addDefaultActions () {
325325 TRACEI ();
326- addHeadphonDetectionAction ();
326+ addHeadphoneDetectionAction ();
327327 addStartStopAction ();
328328 addVolumeActions ();
329329 }
You can’t perform that action at this time.
0 commit comments