mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-03 09:01:50 -05:00
Implement a set volume function to expose this capability to higher layers
This commit is contained in:
parent
36f2aad5f0
commit
e543e04ca7
2 changed files with 25 additions and 0 deletions
|
|
@ -342,6 +342,7 @@ static void rtsp_cb(pa_rtsp_client *rtsp, pa_rtsp_state state, pa_headerlist* he
|
|||
|
||||
case STATE_TEARDOWN:
|
||||
case STATE_SET_PARAMETER:
|
||||
pa_log_debug("RAOP: SET_PARAMETER");
|
||||
break;
|
||||
case STATE_DISCONNECTED:
|
||||
pa_assert(c->closed_callback);
|
||||
|
|
@ -439,6 +440,29 @@ int pa_raop_flush(pa_raop_client* c)
|
|||
}
|
||||
|
||||
|
||||
int pa_raop_client_set_volume(pa_raop_client* c, pa_volume_t volume)
|
||||
{
|
||||
int rv;
|
||||
double db;
|
||||
char *param;
|
||||
|
||||
pa_assert(c);
|
||||
|
||||
db = pa_sw_volume_to_dB(volume);
|
||||
if (db < VOLUME_MIN)
|
||||
db = VOLUME_MIN;
|
||||
else if (db > VOLUME_MAX)
|
||||
db = VOLUME_MAX;
|
||||
|
||||
param = pa_sprintf_malloc("volume: %0.6f\r\n", db);
|
||||
|
||||
/* We just hit and hope, cannot wait for the callback */
|
||||
rv = pa_rtsp_setparameter(c->rtsp, param);
|
||||
pa_xfree(param);
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
int pa_raop_client_encode_sample(pa_raop_client* c, pa_memchunk* raw, pa_memchunk* encoded)
|
||||
{
|
||||
uint16_t len;
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ void pa_raop_client_free(pa_raop_client* c);
|
|||
int pa_raop_connect(pa_raop_client* c);
|
||||
int pa_raop_flush(pa_raop_client* c);
|
||||
|
||||
int pa_raop_client_set_volume(pa_raop_client* c, pa_volume_t volume);
|
||||
int pa_raop_client_encode_sample(pa_raop_client* c, pa_memchunk* raw, pa_memchunk* encoded);
|
||||
|
||||
typedef void (*pa_raop_client_cb_t)(int fd, void *userdata);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue