-
-
Notifications
You must be signed in to change notification settings - Fork 309
Change Input #185
-
is it posible to change the input after setup in Runtime so that my following code will run
void testAuxIn(bool Detect) {
Serial.println();
Serial.print("Detect");
Serial.println(Detect);
if(!Detect) {
kitcfg.input_device = AUDIO_HAL_ADC_INPUT_LINE2; //LineIn
if(Analogin==1) {
//Last Mic
OUTon = true;
Analogin = 2;
}
} else {
kitcfg.input_device = AUDIO_HAL_ADC_INPUT_LINE1; //Mic
if(Analogin==2) {
//Last Linein
Analogin = 1;
if(BlueAudioState<1) {
//No BlueAudio
OUTon = false;
}
}
}
AuxInChange--;
}
with regarts bernhard
Beta Was this translation helpful? Give feedback.
All reactions
I am not really sure what you are trying to do: But if you want to change the input_device you have to call kit.end() and kit:begin(kitcfg) with the changed configuration.
Replies: 6 comments 11 replies
-
I am not really sure what you are trying to do: But if you want to change the input_device you have to call kit.end() and kit:begin(kitcfg) with the changed configuration.
Beta Was this translation helpful? Give feedback.
All reactions
-
ok thanks
What i want do have ist that my input is change when i plug the LineIN conector in or out and also the output will mute if Mic is activatet
Beta Was this translation helpful? Give feedback.
All reactions
-
To my knowledge there is no functionality to detect if LineIn is plugged in.
The only strategy I could think of is actually switch alternatively between the 2 in order to detect if you have a signal. You could use the VolumePrint class to determine the volume.
This will however only work if your board is not messed up and can separate between line 1 (microphone) and line 2 (aux in).
Beta Was this translation helpful? Give feedback.
All reactions
-
there is functionality
byte AuxDetectPin = kit.pinAuxin(); give me the corect pinnuber on my lyrat
digitalRead(AuxDetectPin) would give me on setup the right value
attachInterrupt(AuxDetectPin, AuxDetectIRQ, CHANGE); call an funtion to raise an int who is corect check in loop and call my change analogin function
but now i have the proplem the kit.end(); call brings my system to reboot even i have comment out all core0 function
but without change all will run on core1 kit and core0 ArduinoFFT with Output on Oled and i hope soon also on FastLed
very Strange also that all my Oled libs that works well on normal ESP32 Devkit not do on lyrat on Defauld Core1
Beta Was this translation helpful? Give feedback.
All reactions
-
Oh, I didn't know that this is working. Did you do a pinMode(AuxDetectPin, INPUT_PULLUP); ?
If you are using SPI for your Oled I suggest to change AUDIOKIT_SETUP_SD in AudioKitSettings.h to #define AUDIOKIT_SETUP_SD 0 to deactivate the SPI used by the SD card
Beta Was this translation helpful? Give feedback.
All reactions
-
has the same result
the call of kit.end wil bring reboot
when i coment out kit.end and begin the function would print the corect valus but not change input
is there ah plan to have more then one input channels on futur kit version so it is able to have both input and only change the mix or read command?
Beta Was this translation helpful? Give feedback.
All reactions
-
and my oled is I2C
and also have kitcfg.sd_active = false; in my setup for no SD fntionality
Beta Was this translation helpful? Give feedback.
All reactions
-
Oh, I didn't know that this is working. Did you do a pinMode(AuxDetectPin, INPUT_PULLUP); ? If you are using SPI for your Oled I suggest to change AUDIOKIT_SETUP_SD in AudioKitSettings.h to #define AUDIOKIT_SETUP_SD 0 to deactivate the SPI used by the SD card
yes i did pinMode(AuxDetectPin, INPUT_PULLUP);
but i must also tell you than you must give ah delay after couse
InitAlnalogAudio(digitalRead(AuxDetectPin)); will fail without delay before //or better not fail bring wrong value
so my solution was one digitalRead for trash between pinmode and initanalogaudio
with greets bernhard
Beta Was this translation helpful? Give feedback.
All reactions
-
Well, you could directly use the driver functions. I assume that you have a es8388 based board:
https://github.com/pschatzmann/arduino-audiokit/blob/main/src/audio_driver/es8388/es8388.h
Beta Was this translation helpful? Give feedback.
All reactions
-
yes it have 8388 codec chip
but when i read the link this look i must be back from "AudioLibs/AudioKit.h" to "AudioKitHAL.h" wehre the
auto cfg = kit.defaultConfig(AudioInputOutput); not was corect work and i was nothing here on output what i have write there
so it look i must to be satisfied with your great work on audioKit and have only one analog input on boot and hope i be abel to bring A2DP as second input to run
thanks in advance Bernhard
Beta Was this translation helpful? Give feedback.
All reactions
-
yes it have 8388 codec chip
but when i read the link this look i must be back from "AudioLibs/AudioKit.h" to "AudioKitHAL.h" wehre the auto cfg = kit.defaultConfig(AudioInputOutput); not was corect work and i was nothing here on output what i have write there
so it look i must to be satisfied with your great work on audioKit and have only one analog input on boot and hope i be abel to bring A2DP as second input to run
thanks in advance Bernhard
I thought you wanted to switch the input which could be done with es8388_config_adc_input
Beta Was this translation helpful? Give feedback.
All reactions
-
I2C is used to communicate with the Codec. I am not sure what you need to do to avoid any conflicts. If you selected the Wire library to be used in the config here is the implementation: https://github.com/pschatzmann/arduino-audiokit/blob/main/src/audio_hal/i2c_wire.cpp
I just double checked: you would need to use Wire1 for your oled
Beta Was this translation helpful? Give feedback.
All reactions
-
Wire1??? is ther any other I2C on Lyrat
Beta Was this translation helpful? Give feedback.
All reactions
-
Yes read the first sentence of my last answer! You will need to use another channel...
Beta Was this translation helpful? Give feedback.
All reactions
-
it look i am too stupid for i do not find any other I2C on hardware referene but thanks for your help
Beta Was this translation helpful? Give feedback.
All reactions
-
Oh, this has nothing to do with hardware. Wire and Wire1 are defined in the ESP32 Wire library
Beta Was this translation helpful? Give feedback.
All reactions
-
there is good news now after my afternoon nap the A2DP work as second but primary input is meanig when bluetoothaudio state lower 1 it is read the analogin
thanks
Beta Was this translation helpful? Give feedback.