//-------------------------------------------------------------------------------------------------- le_result_t pa_audio_SetGain ( pa_audio_If_t interface, ///< [IN] audio interface uint32_t gain ///< [IN] gain value [0..100] (0 means 'muted', 100 is the /// maximum gain value) ) { LE_DEBUG("Set gain for [%d] to %d",interface,gain); if ((gain < 0) || (gain > 100)) { return LE_OUT_OF_RANGE; } switch (interface) { case PA_AUDIO_IF_CODEC_MIC: { if (gain > 66) { SetMixerParameter("ADC1 Volume","3"); } else if (gain > 33) { SetMixerParameter("ADC1 Volume","2"); } else if (gain > 0) { SetMixerParameter("ADC1 Volume","1"); } else { SetMixerParameter("ADC1 Volume","0"); } return LE_OK; } case PA_AUDIO_IF_CODEC_SPEAKER: { char gainPtr[10]; sprintf(gainPtr,"%d",(124*gain)/100); SetMixerParameter("RX1 Digital Volume", gainPtr); return LE_OK; } case PA_AUDIO_IF_DSP_FRONTEND_USB_RX: case PA_AUDIO_IF_DSP_FRONTEND_USB_TX: case PA_AUDIO_IF_DSP_BACKEND_MODEM_VOICE_RX: case PA_AUDIO_IF_DSP_BACKEND_MODEM_VOICE_TX: case PA_AUDIO_IF_DSP_FRONTEND_PCM_RX: case PA_AUDIO_IF_DSP_FRONTEND_PCM_TX: case PA_AUDIO_IF_FILE_PLAYING: case PA_AUDIO_IF_DSP_FRONTEND_I2S_RX: case PA_AUDIO_IF_DSP_FRONTEND_I2S_TX: case PA_AUDIO_IF_END: { break; } } LE_ERROR("This interface (%d) is not supported",interface); return LE_FAULT; }
void Voice::SetParameter(Module module, int parameter, double value) { if (module == Module::Osc1 || module == Module::Osc2 || module == Module::Osc3) SetOscParameter(module, (OscParameters)parameter, value); else if (module == Module::Mixer) SetMixerParameter(module, (MixerParameters)parameter, value); else if (module == Module::Character) SetCharacterParameter(module, (CharacterParameters)parameter, value); else if (module == Module::ModuleSwitches) SetModuleSwitchParameter(module, (ModuleSwitchParameters)parameter, value); else if (module == Module::Character) SetCharacterParameter(module, (CharacterParameters)parameter, value); else if (module == Module::FilterHp) SetFilterHpParameter(module, (FilterHpParameters)parameter, value); else if (module == Module::FilterMain) SetFilterMainParameter(module, (FilterMainParameters)parameter, value); else if (module == Module::Drive) SetDriveParameter(module, (DriveParameters)parameter, value); else if (module == Module::EnvAmp || module == Module::EnvFilter) SetEnvParameter(module, (EnvParameters)parameter, value); else if (module == Module::Mod1 || module == Module::Mod2 || module == Module::Mod3) SetModParameter(module, (ModParameters)parameter, value); else if (module == Module::Voices) SetVoiceParameter(module, (VoiceParameters)parameter, value); else if (module == Module::Macros) SetMacroParameter(module, (MacroParameters)parameter, value); else if (module == Module::ModMatrix) SetModMatrixParameter(module, (ModMatrixParameters)parameter, value); }
//-------------------------------------------------------------------------------------------------- le_result_t pa_audio_EnableCodecInput ( pa_audio_If_t interface ) { LE_DEBUG("Enable Codec input of %d", interface); switch (interface) { case PA_AUDIO_IF_CODEC_MIC: { SetMixerParameter("SLIM_0_TX Channels","One"); SetMixerParameter("SLIM TX1 MUX","DEC1"); SetMixerParameter("DEC1 MUX","ADC1"); SetMixerParameter("ADC1 Volume","2"); return LE_OK; } case PA_AUDIO_IF_CODEC_SPEAKER: case PA_AUDIO_IF_DSP_FRONTEND_USB_RX: case PA_AUDIO_IF_DSP_FRONTEND_USB_TX: case PA_AUDIO_IF_DSP_BACKEND_MODEM_VOICE_RX: case PA_AUDIO_IF_DSP_BACKEND_MODEM_VOICE_TX: case PA_AUDIO_IF_DSP_FRONTEND_PCM_RX: case PA_AUDIO_IF_DSP_FRONTEND_PCM_TX: case PA_AUDIO_IF_DSP_FRONTEND_I2S_RX: case PA_AUDIO_IF_DSP_FRONTEND_I2S_TX: case PA_AUDIO_IF_FILE_PLAYING: case PA_AUDIO_IF_END: { break; } } LE_ERROR("This interface (%d) is not supported",interface); return LE_FAULT; }
//-------------------------------------------------------------------------------------------------- le_result_t pa_audio_ResetDspAudioPath ( pa_audio_If_t inputInterface, ///< [IN] input audio interface pa_audio_If_t outputInterface ///< [IN] output audio interface ) { if (ConnectionMatrix[inputInterface][outputInterface] != NULL) { LE_DEBUG("Reset the following path: %s", ConnectionMatrix[inputInterface][outputInterface]); SetMixerParameter(ConnectionMatrix[inputInterface][outputInterface], "0"); } else { LE_DEBUG("DSP audio path not found in connexion matrix."); return LE_FAULT; } return LE_OK; }
//-------------------------------------------------------------------------------------------------- le_result_t pa_audio_DisableCodecOutput ( pa_audio_If_t interface ) { LE_DEBUG("Disable Codec output of %d", interface); switch (interface) { case PA_AUDIO_IF_CODEC_SPEAKER: { SetMixerParameter("SLIM_0_RX Channels","One"); SetMixerParameter("DAC3 MUX","ZERO"); SetMixerParameter("DAC2 MUX","ZERO"); SetMixerParameter("RX1 MIX1 INP1","ZERO"); SetMixerParameter("Speaker Function","Off"); // TODO change it SetMixerParameter("RX1 Digital Volume","0"); return LE_OK; } case PA_AUDIO_IF_CODEC_MIC: case PA_AUDIO_IF_DSP_FRONTEND_USB_RX: case PA_AUDIO_IF_DSP_FRONTEND_USB_TX: case PA_AUDIO_IF_DSP_BACKEND_MODEM_VOICE_RX: case PA_AUDIO_IF_DSP_BACKEND_MODEM_VOICE_TX: case PA_AUDIO_IF_DSP_FRONTEND_PCM_RX: case PA_AUDIO_IF_DSP_FRONTEND_PCM_TX: case PA_AUDIO_IF_DSP_FRONTEND_I2S_RX: case PA_AUDIO_IF_DSP_FRONTEND_I2S_TX: case PA_AUDIO_IF_FILE_PLAYING: case PA_AUDIO_IF_END: { break; } } LE_ERROR("This interface (%d) is not supported",interface); return LE_FAULT; }