mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-03 09:01:50 -05:00
module-sine: Add rate argument
useful for testing resampling Signed-off-by: Peter Meerwald <p.meerwald@bct-electronic.com>
This commit is contained in:
parent
e74d4244a2
commit
f8e0b86592
1 changed files with 7 additions and 0 deletions
|
|
@ -41,6 +41,7 @@ PA_MODULE_VERSION(PACKAGE_VERSION);
|
||||||
PA_MODULE_LOAD_ONCE(false);
|
PA_MODULE_LOAD_ONCE(false);
|
||||||
PA_MODULE_USAGE(
|
PA_MODULE_USAGE(
|
||||||
"sink=<sink to connect to> "
|
"sink=<sink to connect to> "
|
||||||
|
"rate=<sample rate> "
|
||||||
"frequency=<frequency in Hz>");
|
"frequency=<frequency in Hz>");
|
||||||
|
|
||||||
struct userdata {
|
struct userdata {
|
||||||
|
|
@ -53,6 +54,7 @@ struct userdata {
|
||||||
|
|
||||||
static const char* const valid_modargs[] = {
|
static const char* const valid_modargs[] = {
|
||||||
"sink",
|
"sink",
|
||||||
|
"rate",
|
||||||
"frequency",
|
"frequency",
|
||||||
NULL,
|
NULL,
|
||||||
};
|
};
|
||||||
|
|
@ -138,6 +140,11 @@ int pa__init(pa_module*m) {
|
||||||
ss.rate = sink->sample_spec.rate;
|
ss.rate = sink->sample_spec.rate;
|
||||||
ss.channels = 1;
|
ss.channels = 1;
|
||||||
|
|
||||||
|
if (pa_modargs_get_sample_rate(ma, &ss.rate) < 0) {
|
||||||
|
pa_log("Invalid rate specification");
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
|
||||||
frequency = 440;
|
frequency = 440;
|
||||||
if (pa_modargs_get_value_u32(ma, "frequency", &frequency) < 0 || frequency < 1 || frequency > ss.rate/2) {
|
if (pa_modargs_get_value_u32(ma, "frequency", &frequency) < 0 || frequency < 1 || frequency > ss.rate/2) {
|
||||||
pa_log("Invalid frequency specification");
|
pa_log("Invalid frequency specification");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue