|
|
|
|
@ -203,13 +203,17 @@ void RadioAudioEngine::reconfigureCapture() {
|
|
|
|
|
int RadioAudioEngine::start(quint64 groupId) { |
|
|
|
|
if (m_active && m_groupId == groupId) return 0; |
|
|
|
|
stop(); |
|
|
|
|
if (!m_microphone.acquire()) { |
|
|
|
|
DEBUG_WARN(DEBUG_CATEGORY_RADIO, "RadioAudio: microphone owned by another operation"); return -1; |
|
|
|
|
} |
|
|
|
|
auto* inst = gui_bridge_get_inst(); |
|
|
|
|
if (!inst || radio_audio_start(groupId, 0) != 0) { |
|
|
|
|
DEBUG_ERROR(DEBUG_CATEGORY_RADIO, "RadioAudio: cannot start group=%016llx", (unsigned long long)groupId); |
|
|
|
|
m_microphone.release(); |
|
|
|
|
return -1; |
|
|
|
|
} |
|
|
|
|
m_groupId = groupId; |
|
|
|
|
if (!m_voice.start(VoiceAudioIo::Kind::Radio, groupId)) { radio_audio_stop(); m_groupId = 0; return -1; } |
|
|
|
|
if (!m_voice.start(VoiceAudioIo::Kind::Radio, groupId)) { radio_audio_stop(); m_groupId = 0; m_microphone.release(); return -1; } |
|
|
|
|
m_wantStereo = chat_setting_get_int(inst, "radio_capture_stereo", 0) != 0; |
|
|
|
|
m_active = true; |
|
|
|
|
m_capture.retryNow(); |
|
|
|
|
@ -300,6 +304,7 @@ void RadioAudioEngine::pauseDevices() {
|
|
|
|
|
void RadioAudioEngine::stop() { |
|
|
|
|
m_recoveryTimer.stop(); |
|
|
|
|
pauseDevices(); m_voice.stop(); |
|
|
|
|
m_microphone.release(); |
|
|
|
|
uint64_t group = m_groupId.exchange(0); |
|
|
|
|
bool talking = m_talking.exchange(false); |
|
|
|
|
m_buttonTalking = m_hotkeyTalking = false; |
|
|
|
|
|