BasicGain: improve comments and formatting of comments

pull/1/head
Chip Audette 8 years ago
parent d00c7a3d4a
commit 0418e490b8
  1. 32
      examples/BasicGain_Float/BasicGain_Float.ino

@ -7,12 +7,13 @@
Uses Teensy Audio Adapter. Uses Teensy Audio Adapter.
Assumes microphones (or whatever) are attached to the LINE IN (stereo) Assumes microphones (or whatever) are attached to the LINE IN (stereo)
Use potentiometer mounted to Audio Board to control the amount of gain.
MIT License. use at your own risk. MIT License. use at your own risk.
*/ */
//These are the includes from the Teensy Audio Library //These are the includes from the Teensy Audio Library
#include <Audio.h> //Teensy Audio Librarya #include <Audio.h> //Teensy Audio Library
#include <Wire.h> #include <Wire.h>
#include <SPI.h> #include <SPI.h>
#include <SD.h> #include <SD.h>
@ -22,19 +23,19 @@
//create audio library objects for handling the audio //create audio library objects for handling the audio
AudioControlSGTL5000 sgtl5000_1; //controller for the Teensy Audio Board AudioControlSGTL5000 sgtl5000_1; //controller for the Teensy Audio Board
AudioInputI2S i2s_in; //Digital audio *from* the Teensy Audio Board ADC. Sends Int16. Stereo. AudioInputI2S i2s_in; //Digital audio *from* the Teensy Audio Board ADC. Sends Int16. Stereo.
AudioOutputI2S i2s_out; //Digital audio *to* the Teensy Audio Board DAC. Expects Int16. Stereo AudioOutputI2S i2s_out; //Digital audio *to* the Teensy Audio Board DAC. Expects Int16. Stereo
AudioConvert_I16toF32 int2Float1, int2Float2; //Converts Int16 to Float. See class in AudioStream_F32.h AudioConvert_I16toF32 int2Float1, int2Float2; //Converts Int16 to Float. See class in AudioStream_F32.h
AudioConvert_F32toI16 float2Int1, float2Int2; //Converts Float to Int16. See class in AudioStream_F32.h
AudioEffectGain_F32 gain1, gain2; //Applies digital gain to audio data. Expected Float data. AudioEffectGain_F32 gain1, gain2; //Applies digital gain to audio data. Expected Float data.
AudioConvert_F32toI16 float2Int1, float2Int2; //Converts Float to Int16. See class in AudioStream_F32.h
//Make all of the audio connections //Make all of the audio connections
AudioConnection patchCord1(i2s_in, 0, int2Float1, 0); //connect the Left input to the Left Int->Float converter AudioConnection patchCord1(i2s_in, 0, int2Float1, 0); //connect the Left input to the Left Int->Float converter
AudioConnection patchCord2(i2s_in, 1, int2Float2, 0); //connect the Right input to the Right Int->Float converter AudioConnection patchCord2(i2s_in, 1, int2Float2, 0); //connect the Right input to the Right Int->Float converter
AudioConnection_F32 patchCord10(int2Float1, 0, gain1, 0); //Left. makes Float connections between objects AudioConnection_F32 patchCord10(int2Float1, 0, gain1, 0); //Left. makes Float connections between objects
AudioConnection_F32 patchCord11(int2Float2, 0, gain2, 0); //Right. makes Float connections between objects AudioConnection_F32 patchCord11(int2Float2, 0, gain2, 0); //Right. makes Float connections between objects
AudioConnection_F32 patchCord12(gain1, 0, float2Int1, 0); //Left. makes Float connections between objects AudioConnection_F32 patchCord12(gain1, 0, float2Int1, 0); //Left. makes Float connections between objects
AudioConnection_F32 patchCord13(gain2, 0, float2Int2, 0); //Right. makes Float connections between objects AudioConnection_F32 patchCord13(gain2, 0, float2Int2, 0); //Right. makes Float connections between objects
AudioConnection patchCord20(float2Int1, 0, i2s_out, 0); //connect the Left float processor to the Left output AudioConnection patchCord20(float2Int1, 0, i2s_out, 0); //connect the Left float processor to the Left output
AudioConnection patchCord21(float2Int2, 0, i2s_out, 1); //connect the Right float processor to the Right output AudioConnection patchCord21(float2Int2, 0, i2s_out, 1); //connect the Right float processor to the Right output
@ -49,12 +50,11 @@ const int myInput = AUDIO_INPUT_LINEIN;
void setup() { void setup() {
Serial.begin(115200); //open the USB serial link to enable debugging messages Serial.begin(115200); //open the USB serial link to enable debugging messages
delay(500); //give the computer's USB serial system a moment to catch up. delay(500); //give the computer's USB serial system a moment to catch up.
Serial.println("Teensy Hearing Aid: BasicGain_Float..."); //identify myself over the USB serial Serial.println("OpenAudio_ArduinoLibrary BasicGain_Float...");
// Audio connections require memory, and the record queue // Audio connections require memory
// uses this memory to buffer incoming audio. AudioMemory(10); //allocate Int16 audio data blocks
AudioMemory(10); //allocate Int16 audio data blocks AudioMemory_F32(10); //allocate Float32 audio data blocks
AudioMemory_F32(10); //allocate Float32 audio data blocks
// Enable the audio shield, select input, and enable output // Enable the audio shield, select input, and enable output
sgtl5000_1.enable(); //start the audio board sgtl5000_1.enable(); //start the audio board

Loading…
Cancel
Save