mirror of
https://github.com/gnif/LookingGlass.git
synced 2026-07-28 10:52:02 +00:00
[client] audio: fix microphone restart bookkeeping
This commit is contained in:
@@ -148,6 +148,7 @@ typedef struct
|
|||||||
PlaybackDeviceTick;
|
PlaybackDeviceTick;
|
||||||
|
|
||||||
static void playbackStop(void);
|
static void playbackStop(void);
|
||||||
|
static void realRecordStop(void);
|
||||||
|
|
||||||
void audio_init(void)
|
void audio_init(void)
|
||||||
{
|
{
|
||||||
@@ -800,15 +801,15 @@ void audio_recordStart(int channels, int sampleRate, PSAudioFormat format)
|
|||||||
if (!audio.audioDev)
|
if (!audio.audioDev)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
static int lastChannels = 0;
|
const bool restart = audio.record.started;
|
||||||
static int lastSampleRate = 0;
|
|
||||||
|
|
||||||
if (audio.record.started)
|
if (audio.record.started)
|
||||||
{
|
{
|
||||||
if (channels != lastChannels || sampleRate != lastSampleRate)
|
if (channels == audio.record.lastChannels &&
|
||||||
audio.audioDev->record.stop();
|
sampleRate == audio.record.lastSampleRate &&
|
||||||
else
|
format == audio.record.lastFormat)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
realRecordStop();
|
||||||
}
|
}
|
||||||
|
|
||||||
audio.record.requested = true;
|
audio.record.requested = true;
|
||||||
@@ -816,7 +817,7 @@ void audio_recordStart(int channels, int sampleRate, PSAudioFormat format)
|
|||||||
audio.record.lastSampleRate = sampleRate;
|
audio.record.lastSampleRate = sampleRate;
|
||||||
audio.record.lastFormat = format;
|
audio.record.lastFormat = format;
|
||||||
|
|
||||||
if (audio.record.started)
|
if (restart)
|
||||||
realRecordStart(channels, sampleRate, format);
|
realRecordStart(channels, sampleRate, format);
|
||||||
else if (g_state.micDefaultState == MIC_DEFAULT_DENY)
|
else if (g_state.micDefaultState == MIC_DEFAULT_DENY)
|
||||||
DEBUG_INFO("Microphone access denied by default");
|
DEBUG_INFO("Microphone access denied by default");
|
||||||
|
|||||||
Reference in New Issue
Block a user