My hardware application requires me to be able to switch between the Headset Microphone and an external Mic' connected to LineIn. I'm initially setting the SGTL5000 to headset using sgtl5000_1.inputSelect(AUDIO_INPUT_MIC); which works exactly as expected.
I encounter my problem once the rest of the code is in operation. It's a couple of thousand lines so I'm not going to attach the whole thing, but the area where I am hoping to switch between inputs is this:
if(NewMicrophoneInputMode){ // case 104
Serial.print("Mic Input mode ");
Serial.println(MicrophoneInputMode);
if(MicrophoneInputMode == 1){
Serial.println("Setting Mic to Handset");
delay(100);
sgtl5000_1.inputSelect(AUDIO_INPUT_LINEIN); // set to get handset mic
}
if(MicrophoneInputMode == 2){
Serial.println("Setting Mic to Headset");
delay(100);
sgtl5000_1.inputSelect(AUDIO_INPUT_MIC); // set to get headset mic
}
/********* no need to update screen ************************/
UpdateScreen = false;
NewMicrophoneInputMode = false; // clear flag
}
All the code executes fine, however, once I have run the inputSelect(AUDIO_INPUT_LINEIN), running inputSelect(AUDIO_INPUT_MIC) does not disable the LineIn, and it seems like both inputs are active together, although it's not very easy to test that idea.
The Audio configuration is this:
// GUItool: begin automatically generated code
AudioInputI2S i2s1; //xy=305,254
AudioInputUSB usb2; //xy=305,365
AudioOutputI2S i2s2; //xy=961,369
AudioOutputUSB usb1; //xy=964,261
AudioConnection patchCord1(i2s1, 0, usb1, 0);
AudioConnection patchCord2(i2s1, 1, usb1, 1);
AudioConnection patchCord3(usb2, 0, i2s2, 0);
AudioConnection patchCord4(usb2, 1, i2s2, 1);
AudioControlSGTL5000 sgtl5000_1; //xy=605,462
// GUItool: end automatically generated code
There's clearly something I'm missing about this operation, so I would greatly appreciate any suggestions.
I encounter my problem once the rest of the code is in operation. It's a couple of thousand lines so I'm not going to attach the whole thing, but the area where I am hoping to switch between inputs is this:
if(NewMicrophoneInputMode){ // case 104
Serial.print("Mic Input mode ");
Serial.println(MicrophoneInputMode);
if(MicrophoneInputMode == 1){
Serial.println("Setting Mic to Handset");
delay(100);
sgtl5000_1.inputSelect(AUDIO_INPUT_LINEIN); // set to get handset mic
}
if(MicrophoneInputMode == 2){
Serial.println("Setting Mic to Headset");
delay(100);
sgtl5000_1.inputSelect(AUDIO_INPUT_MIC); // set to get headset mic
}
/********* no need to update screen ************************/
UpdateScreen = false;
NewMicrophoneInputMode = false; // clear flag
}
All the code executes fine, however, once I have run the inputSelect(AUDIO_INPUT_LINEIN), running inputSelect(AUDIO_INPUT_MIC) does not disable the LineIn, and it seems like both inputs are active together, although it's not very easy to test that idea.
The Audio configuration is this:
// GUItool: begin automatically generated code
AudioInputI2S i2s1; //xy=305,254
AudioInputUSB usb2; //xy=305,365
AudioOutputI2S i2s2; //xy=961,369
AudioOutputUSB usb1; //xy=964,261
AudioConnection patchCord1(i2s1, 0, usb1, 0);
AudioConnection patchCord2(i2s1, 1, usb1, 1);
AudioConnection patchCord3(usb2, 0, i2s2, 0);
AudioConnection patchCord4(usb2, 1, i2s2, 1);
AudioControlSGTL5000 sgtl5000_1; //xy=605,462
// GUItool: end automatically generated code
There's clearly something I'm missing about this operation, so I would greatly appreciate any suggestions.