[PATCHv2 2/4] module-sine: Add rate argument

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Peter Meerwald <p.meerwald@xxxxxxxxxxxxxxxxxx>

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.7.9.5



[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux