only enable microphone when in a voice channel

This commit is contained in:
ouwou
2022-10-24 22:10:50 -04:00
parent f751037717
commit cb690b6def
3 changed files with 18 additions and 7 deletions

View File

@@ -98,13 +98,6 @@ AudioManager::AudioManager() {
return;
}
if (ma_device_start(&m_capture_device) != MA_SUCCESS) {
puts("failed to start capture");
ma_device_uninit(&m_capture_device);
m_ok = false;
return;
}
char device_name[MA_MAX_DEVICE_NAME_LENGTH + 1];
ma_device_get_name(&m_capture_device, ma_device_type_capture, device_name, sizeof(device_name), nullptr);
printf("using %s for capture\n", device_name);
@@ -168,6 +161,18 @@ void AudioManager::FeedMeOpus(uint32_t ssrc, const std::vector<uint8_t> &data) {
}
}
void AudioManager::StartCaptureDevice() {
if (ma_device_start(&m_capture_device) != MA_SUCCESS) {
puts("failed to start capture");
}
}
void AudioManager::StopCaptureDevice() {
if (ma_device_stop(&m_capture_device) != MA_SUCCESS) {
puts("failed to stop capture");
}
}
void AudioManager::SetCapture(bool capture) {
m_should_capture = capture;
}