summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Meerwald <p.meerwald@bct-electronic.com>2013-11-29 15:32:42 +0100
committerTanu Kaskinen <tanu.kaskinen@linux.intel.com>2013-12-05 11:03:10 +0200
commitf8e0b8659216209fe75bb9f1f49da7682320ae42 (patch)
tree1de0e836dd3cea84b3c69a89ccd9a3fe2b495b72
parente74d4244a285a7e29300c19df7b202ba7c51ecef (diff)
module-sine: Add rate argument
useful for testing resampling Signed-off-by: Peter Meerwald <p.meerwald@bct-electronic.com>
-rw-r--r--src/modules/module-sine.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/modules/module-sine.c b/src/modules/module-sine.c
index 573a7c0f1..6bf395e8a 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");