[polypaudio-commits] r784 - in /trunk/src: modules/module-x11-bell.c polypcore/cli-command.c polypcore/core-scache.c polypcore/core-scache.h polypcore/protocol-esound.c polypcore/protocol-native.c
svnmailer-noreply at 0pointer.de
svnmailer-noreply at 0pointer.de
Sun Apr 23 12:49:03 PDT 2006
Author: lennart
Date: Sun Apr 23 21:49:01 2006
New Revision: 784
URL: http://0pointer.de/cgi-bin/viewcvs.cgi?rev=784&root=polypaudio&view=rev
Log:
* when playing back a sample from the sample cache, just take a pa_volume_t and not a pa_cvolume_t as argument for the volume. Usually it is not known to the player of theses samples how many channels it has, hence it doesn't make any sense to allow him to pass a by-channel volume structure here.
* fix volume calculation when playing samples from the sample cache
Modified:
trunk/src/modules/module-x11-bell.c
trunk/src/polypcore/cli-command.c
trunk/src/polypcore/core-scache.c
trunk/src/polypcore/core-scache.h
trunk/src/polypcore/protocol-esound.c
trunk/src/polypcore/protocol-native.c
Modified: trunk/src/modules/module-x11-bell.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/modules/module-x11-bell.c?rev=784&root=polypaudio&r1=783&r2=784&view=diff
==============================================================================
--- trunk/src/modules/module-x11-bell.c (original)
+++ trunk/src/modules/module-x11-bell.c Sun Apr 23 21:49:01 2006
@@ -66,7 +66,6 @@
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 @@
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;
}
Modified: trunk/src/polypcore/cli-command.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/polypcore/cli-command.c?rev=784&root=polypaudio&r1=783&r2=784&view=diff
==============================================================================
--- trunk/src/polypcore/cli-command.c (original)
+++ trunk/src/polypcore/cli-command.c Sun Apr 23 21:49:01 2006
@@ -597,7 +597,7 @@
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;
}
Modified: trunk/src/polypcore/core-scache.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/polypcore/core-scache.c?rev=784&root=polypaudio&r1=783&r2=784&view=diff
==============================================================================
--- trunk/src/polypcore/core-scache.c (original)
+++ trunk/src/polypcore/core-scache.c Sun Apr 23 21:49:01 2006
@@ -122,7 +122,8 @@
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 @@
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 @@
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 @@
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);
Modified: trunk/src/polypcore/core-scache.h
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/polypcore/core-scache.h?rev=784&root=polypaudio&r1=783&r2=784&view=diff
==============================================================================
--- trunk/src/polypcore/core-scache.h (original)
+++ trunk/src/polypcore/core-scache.h Sun Apr 23 21:49:01 2006
@@ -49,7 +49,7 @@
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);
Modified: trunk/src/polypcore/protocol-esound.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/polypcore/protocol-esound.c?rev=784&root=polypaudio&r1=783&r2=784&view=diff
==============================================================================
--- trunk/src/polypcore/protocol-esound.c (original)
+++ trunk/src/polypcore/protocol-esound.c Sun Apr 23 21:49:01 2006
@@ -742,7 +742,7 @@
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);
Modified: trunk/src/polypcore/protocol-native.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/polypcore/protocol-native.c?rev=784&root=polypaudio&r1=783&r2=784&view=diff
==============================================================================
--- trunk/src/polypcore/protocol-native.c (original)
+++ trunk/src/polypcore/protocol-native.c Sun Apr 23 21:49:01 2006
@@ -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_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 @@
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;
}
More information about the pulseaudio-commits
mailing list