[pulseaudio-discuss] [PATCH 1/4] module-sine: Add rate argument
Peter Meerwald
pmeerw at pmeerw.net
Thu Jul 18 00:22:08 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..3d97025 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_value_u32(ma, "rate", &ss.rate) < 0 || ss.rate <= 1) {
+ 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.7.9.5
More information about the pulseaudio-discuss
mailing list