diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/modules/module-x11-bell.c | 3 | ||||
-rw-r--r-- | src/polypcore/cli-command.c | 2 | ||||
-rw-r--r-- | src/polypcore/core-scache.c | 17 | ||||
-rw-r--r-- | src/polypcore/core-scache.h | 2 | ||||
-rw-r--r-- | src/polypcore/protocol-esound.c | 2 | ||||
-rw-r--r-- | src/polypcore/protocol-native.c | 8 |
6 files changed, 16 insertions, 18 deletions
diff --git a/src/modules/module-x11-bell.c b/src/modules/module-x11-bell.c index fe1711a5..e4d4020e 100644 --- a/src/modules/module-x11-bell.c +++ b/src/modules/module-x11-bell.c @@ -66,7 +66,6 @@ static const char* const valid_modargs[] = { static int ring_bell(struct userdata *u, int percent) { pa_sink *s; - pa_cvolume cv; assert(u); if (!(s = pa_namereg_get(u->core, u->sink_name, PA_NAMEREG_SINK, 1))) { @@ -74,7 +73,7 @@ static int ring_bell(struct userdata *u, int percent) { return -1; } - pa_scache_play_item(u->core, u->scache_item, s, pa_cvolume_set(&cv, PA_CHANNELS_MAX, (percent*PA_VOLUME_NORM)/100)); + pa_scache_play_item(u->core, u->scache_item, s, (percent*PA_VOLUME_NORM)/100); return 0; } diff --git a/src/polypcore/cli-command.c b/src/polypcore/cli-command.c index 0251ab0a..180c61e9 100644 --- a/src/polypcore/cli-command.c +++ b/src/polypcore/cli-command.c @@ -597,7 +597,7 @@ static int pa_cli_command_scache_play(pa_core *c, pa_tokenizer *t, pa_strbuf *bu return -1; } - if (pa_scache_play_item(c, n, sink, NULL) < 0) { + if (pa_scache_play_item(c, n, sink, PA_VOLUME_NORM) < 0) { pa_strbuf_puts(buf, "Failed to play sample.\n"); return -1; } diff --git a/src/polypcore/core-scache.c b/src/polypcore/core-scache.c index 6632a171..9c407623 100644 --- a/src/polypcore/core-scache.c +++ b/src/polypcore/core-scache.c @@ -122,7 +122,8 @@ static pa_scache_entry* scache_add_item(pa_core *c, const char *name) { e->lazy = 0; e->last_used_time = 0; - memset(&e->sample_spec, 0, sizeof(pa_sample_spec)); + memset(&e->sample_spec, 0, sizeof(e->sample_spec)); + pa_channel_map_init(&e->channel_map); pa_cvolume_reset(&e->volume, PA_CHANNELS_MAX); return e; @@ -240,7 +241,7 @@ void pa_scache_free(pa_core *c) { c->mainloop->time_free(c->scache_auto_unload_event); } -int pa_scache_play_item(pa_core *c, const char *name, pa_sink *sink, const pa_cvolume *volume) { +int pa_scache_play_item(pa_core *c, const char *name, pa_sink *sink, pa_volume_t volume) { pa_scache_entry *e; char *t; pa_cvolume r; @@ -257,7 +258,9 @@ int pa_scache_play_item(pa_core *c, const char *name, pa_sink *sink, const pa_cv return -1; pa_subscription_post(c, PA_SUBSCRIPTION_EVENT_SAMPLE_CACHE|PA_SUBSCRIPTION_EVENT_CHANGE, e->index); - e->volume.channels = e->sample_spec.channels; + + if (e->volume.channels > e->sample_spec.channels) + e->volume.channels = e->sample_spec.channels; } if (!e->memchunk.memblock) @@ -265,12 +268,8 @@ int pa_scache_play_item(pa_core *c, const char *name, pa_sink *sink, const pa_cv t = pa_sprintf_malloc("sample:%s", name); - if (volume) { - r = *volume; - r.channels = e->volume.channels; - pa_sw_cvolume_multiply(&r, &r, &e->volume); - } else - r = e->volume; + pa_cvolume_set(&r, e->volume.channels, volume); + pa_sw_cvolume_multiply(&r, &r, &e->volume); if (pa_play_memchunk(sink, t, &e->sample_spec, &e->channel_map, &e->memchunk, &r) < 0) { pa_xfree(t); diff --git a/src/polypcore/core-scache.h b/src/polypcore/core-scache.h index a383e50a..151d1761 100644 --- a/src/polypcore/core-scache.h +++ b/src/polypcore/core-scache.h @@ -49,7 +49,7 @@ int pa_scache_add_file_lazy(pa_core *c, const char *name, const char *filename, int pa_scache_add_directory_lazy(pa_core *c, const char *pathname); int pa_scache_remove_item(pa_core *c, const char *name); -int pa_scache_play_item(pa_core *c, const char *name, pa_sink *sink, const pa_cvolume *cvolume); +int pa_scache_play_item(pa_core *c, const char *name, pa_sink *sink, pa_volume_t volume); void pa_scache_free(pa_core *c); const char *pa_scache_get_name_by_id(pa_core *c, uint32_t id); diff --git a/src/polypcore/protocol-esound.c b/src/polypcore/protocol-esound.c index e29c44c9..2c956a7e 100644 --- a/src/polypcore/protocol-esound.c +++ b/src/polypcore/protocol-esound.c @@ -742,7 +742,7 @@ static int esd_proto_sample_free_or_play(struct connection *c, esd_proto_t reque pa_sink *sink; if ((sink = pa_namereg_get(c->protocol->core, c->protocol->sink_name, PA_NAMEREG_SINK, 1))) - if (pa_scache_play_item(c->protocol->core, name, sink, NULL) >= 0) + if (pa_scache_play_item(c->protocol->core, name, sink, PA_VOLUME_NORM) >= 0) ok = idx + 1; } else { assert(request == ESD_PROTO_SAMPLE_FREE); diff --git a/src/polypcore/protocol-native.c b/src/polypcore/protocol-native.c index 3f1d5ca2..f8c2d166 100644 --- a/src/polypcore/protocol-native.c +++ b/src/polypcore/protocol-native.c @@ -57,7 +57,7 @@ #include "protocol-native.h" /* Kick a client if it doesn't authenticate within this time */ -#define AUTH_TIMEOUT 5 +#define AUTH_TIMEOUT 60 /* Don't accept more connection than this */ #define MAX_CONNECTIONS 10 @@ -1165,14 +1165,14 @@ static void command_finish_upload_stream(PA_GCC_UNUSED pa_pdispatch *pd, PA_GCC_ static void command_play_sample(PA_GCC_UNUSED pa_pdispatch *pd, PA_GCC_UNUSED uint32_t command, uint32_t tag, pa_tagstruct *t, void *userdata) { struct connection *c = userdata; uint32_t sink_index; - pa_cvolume volume; + pa_volume_t volume; pa_sink *sink; const char *name, *sink_name; assert(c && t); if (pa_tagstruct_getu32(t, &sink_index) < 0 || pa_tagstruct_gets(t, &sink_name) < 0 || - pa_tagstruct_get_cvolume(t, &volume) < 0 || + pa_tagstruct_getu32(t, &volume) < 0 || pa_tagstruct_gets(t, &name) < 0 || !pa_tagstruct_eof(t)) { protocol_error(c); @@ -1190,7 +1190,7 @@ static void command_play_sample(PA_GCC_UNUSED pa_pdispatch *pd, PA_GCC_UNUSED ui CHECK_VALIDITY(c->pstream, sink, tag, PA_ERR_NOENTITY); - if (pa_scache_play_item(c->protocol->core, name, sink, &volume) < 0) { + if (pa_scache_play_item(c->protocol->core, name, sink, volume) < 0) { pa_pstream_send_error(c->pstream, tag, PA_ERR_NOENTITY); return; } |