mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-22 13:37:22 +00:00
[client] audio: cancel confirm dialog when a new recording starts
This commit is contained in:
parent
9afe170413
commit
8f45290beb
@ -124,6 +124,10 @@ typedef struct
|
|||||||
bool mute;
|
bool mute;
|
||||||
int stride;
|
int stride;
|
||||||
uint32_t time;
|
uint32_t time;
|
||||||
|
MsgBoxHandle confirmHandle;
|
||||||
|
int confirmChannels;
|
||||||
|
int confirmSampleRate;
|
||||||
|
PSAudioFormat confirmFormat;
|
||||||
}
|
}
|
||||||
record;
|
record;
|
||||||
}
|
}
|
||||||
@ -767,14 +771,17 @@ static void recordConfirm(bool yes, void * opaque)
|
|||||||
{
|
{
|
||||||
if (yes)
|
if (yes)
|
||||||
{
|
{
|
||||||
struct AudioFormat * format = opaque;
|
|
||||||
DEBUG_INFO("Microphone access granted");
|
DEBUG_INFO("Microphone access granted");
|
||||||
realRecordStart(format->channels, format->sampleRate, format->format);
|
realRecordStart(
|
||||||
|
audio.record.confirmChannels,
|
||||||
|
audio.record.confirmSampleRate,
|
||||||
|
audio.record.confirmFormat
|
||||||
|
);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
DEBUG_INFO("Microphone access denied");
|
DEBUG_INFO("Microphone access denied");
|
||||||
|
|
||||||
free(opaque);
|
audio.record.confirmHandle = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void audio_recordStart(int channels, int sampleRate, PSAudioFormat format)
|
void audio_recordStart(int channels, int sampleRate, PSAudioFormat format)
|
||||||
@ -803,15 +810,14 @@ void audio_recordStart(int channels, int sampleRate, PSAudioFormat format)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
struct AudioFormat * fmt = malloc(sizeof(*fmt));
|
if (audio.record.confirmHandle)
|
||||||
if (!format)
|
app_msgBoxClose(audio.record.confirmHandle);
|
||||||
DEBUG_FATAL("Failed to allocate memory!");
|
|
||||||
|
|
||||||
fmt->channels = channels;
|
audio.record.confirmChannels = channels;
|
||||||
fmt->sampleRate = sampleRate;
|
audio.record.confirmSampleRate = sampleRate;
|
||||||
fmt->format = format;
|
audio.record.confirmFormat = format;
|
||||||
|
audio.record.confirmHandle = app_confirmMsgBox(
|
||||||
app_confirmMsgBox("Microphone", recordConfirm, fmt,
|
"Microphone", recordConfirm, NULL,
|
||||||
"An application just opened the microphone!\n"
|
"An application just opened the microphone!\n"
|
||||||
"Do you want it to access your microphone?");
|
"Do you want it to access your microphone?");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user