[pulseaudio-discuss] [PATCH 4/6] module-sine: Add rate argument
Peter Meerwald
pmeerw at pmeerw.net
Wed Aug 7 23:19:36 PDT 2013
From: Peter Meerwald <p.meerwald at bct-electronic.com>
useful for testing resampling
Signed-off-by: Peter Meerwald <p.meerwald at bct-electronic.com>
---
src/modules/module-sine.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/modules/module-sine.c b/src/modules/module-sine.c
index 573a7c0..6bf395e 100644
--- a/src/modules/module-sine.c
+++ b/src/modules/module-sine.c
@@ -41,6 +41,7 @@ PA_MODULE_VERSION(PACKAGE_VERSION);
PA_MODULE_LOAD_ONCE(false);
PA_MODULE_USAGE(
"sink=<sink to connect to> "
+ "rate=<sample rate> "
"frequency=<frequency in Hz>");
struct userdata {
@@ -53,6 +54,7 @@ struct userdata {
static const char* const valid_modargs[] = {
"sink",
+ "rate",
"frequency",
NULL,
};
@@ -138,6 +140,11 @@ int pa__init(pa_module*m) {
ss.rate = sink->sample_spec.rate;
ss.channels = 1;
+ if (pa_modargs_get_sample_rate(ma, &ss.rate) < 0) {
+ pa_log("Invalid rate specification");
+ goto fail;
+ }
+
frequency = 440;
if (pa_modargs_get_value_u32(ma, "frequency", &frequency) < 0 || frequency < 1 || frequency > ss.rate/2) {
pa_log("Invalid frequency specification");
--
1.8.3.4
More information about the pulseaudio-discuss
mailing list