mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-24 22:37:19 +00:00
[client] audio: update PureSpice and add support for volume control/mute
This commit is contained in:
parent
e408ea51e2
commit
433a5420cb
@ -50,6 +50,12 @@ struct LG_AudioDevOps
|
|||||||
|
|
||||||
/* called when SPICE reports the audio stream has stopped */
|
/* called when SPICE reports the audio stream has stopped */
|
||||||
void (*stop)(void);
|
void (*stop)(void);
|
||||||
|
|
||||||
|
/* [optional] called to set the volume of the channels */
|
||||||
|
void (*volume)(int channels, const uint16_t volume[]);
|
||||||
|
|
||||||
|
/* [optional] called to set muting of the output */
|
||||||
|
void (*mute)(bool mute);
|
||||||
};
|
};
|
||||||
|
|
||||||
#define ASSERT_LG_AUDIODEV_VALID(x) \
|
#define ASSERT_LG_AUDIODEV_VALID(x) \
|
||||||
|
@ -899,14 +899,26 @@ void audioStart(int channels, int sampleRate, PSAudioFormat format,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void audioStop(void)
|
static void audioStop(void)
|
||||||
{
|
{
|
||||||
if (g_state.audioDev)
|
if (g_state.audioDev)
|
||||||
g_state.audioDev->stop();
|
g_state.audioDev->stop();
|
||||||
g_state.audioStarted = false;
|
g_state.audioStarted = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void audioData(uint8_t * data, size_t size)
|
static void audioVolume(int channels, const uint16_t volume[])
|
||||||
|
{
|
||||||
|
if (g_state.audioDev && g_state.audioDev->volume)
|
||||||
|
g_state.audioDev->volume(channels, volume);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void audioMute(bool mute)
|
||||||
|
{
|
||||||
|
if (g_state.audioDev && g_state.audioDev->mute)
|
||||||
|
g_state.audioDev->mute(mute);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void audioData(uint8_t * data, size_t size)
|
||||||
{
|
{
|
||||||
if (g_state.audioDev)
|
if (g_state.audioDev)
|
||||||
g_state.audioDev->play(data, size);
|
g_state.audioDev->play(data, size);
|
||||||
@ -1001,6 +1013,8 @@ static int lg_run(void)
|
|||||||
if (g_params.useSpiceAudio)
|
if (g_params.useSpiceAudio)
|
||||||
spice_set_audio_cb(
|
spice_set_audio_cb(
|
||||||
audioStart,
|
audioStart,
|
||||||
|
audioVolume,
|
||||||
|
audioMute,
|
||||||
audioStop,
|
audioStop,
|
||||||
audioData);
|
audioData);
|
||||||
|
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit 3ea156974b65d87ea9c2e21d031af2b60d79074a
|
Subproject commit 1178cbb400719c026749a64e2f7f7992c49140d2
|
Loading…
Reference in New Issue
Block a user