[svn-commits] dvossel: branch dvossel/funk_effects r250915 - /team/dvossel/funk_effects/funcs/
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Thu Mar 4 22:43:20 CST 2010
Author: dvossel
Date: Thu Mar 4 22:43:16 2010
New Revision: 250915
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=250915
Log:
fixes tx/rx mess up, adds new options
Modified:
team/dvossel/funk_effects/funcs/func_pitchshift.c
Modified: team/dvossel/funk_effects/funcs/func_pitchshift.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/funk_effects/funcs/func_pitchshift.c?view=diff&rev=250915&r1=250914&r2=250915
==============================================================================
--- team/dvossel/funk_effects/funcs/func_pitchshift.c (original)
+++ team/dvossel/funk_effects/funcs/func_pitchshift.c Thu Mar 4 22:43:16 2010
@@ -18,7 +18,7 @@
/*! \file
*
- * \brief Audio Effects
+ * \brief Pitch Shift Audio Effect
*
* \author David Vossel <dvossel at digium.com>
*
@@ -76,22 +76,46 @@
</synopsis>
<syntax>
<parameter name="channel direction" required="true">
- <para>This can be either <literal>rx</literal> or <literal>tx</literal> and
- must be set to a valid floating point number between 0.1 and 4.0. A value
+ <para>Direction can be either <literal>rx</literal>, <literal>tx</literal>, or
+ <literal>both</literal>. The direction can either be set to a valid floating
+ point number between 0.1 and 4.0 or one of the enum values listed below. A value
of 1.0 has no effect. Greater than 1 raises the pitch. Lower than 1 lowers
the pitch.</para>
+
+ <para>The pitch amount can also be set by the following values</para>
+ <enumlist>
+ <enum name = "highest" />
+ <enum name = "higher" />
+ <enum name = "high" />
+ <enum name = "low" />
+ <enum name = "lower" />
+ <enum name = "lowest" />
</parameter>
</syntax>
<description>
<para>Examples:</para>
- <para>exten => 1,1,Set(PITCH_SHIFT(rx)=0.8) ; lowers pitch</para>
- <para>exten => 2,1,Set(PITCH_SHIFT(tx)=1.5) ; raises pitch</para>
+ <para>exten => 1,1,Set(PITCH_SHIFT(tx)=highest); raises pitch an octave </para>
+ <para>exten => 1,1,Set(PITCH_SHIFT(rx)=higher) ; raises pitch more </para>
+ <para>exten => 1,1,Set(PITCH_SHIFT(both)=high) ; raises pitch </para>
+ <para>exten => 1,1,Set(PITCH_SHIFT(rx)=low) ; lowers pitch </para>
+ <para>exten => 1,1,Set(PITCH_SHIFT(tx)=lower) ; lowers pitch more </para>
+ <para>exten => 1,1,Set(PITCH_SHIFT(both)=lowest) ; lowers pitch an octave </para>
+
+ <para>exten => 1,1,Set(PITCH_SHIFT(rx)=0.8) ; lowers pitch </para>
+ <para>exten => 1,1,Set(PITCH_SHIFT(tx)=1.5) ; raises pitch </para>
</description>
</function>
***/
#define M_PI 3.14159265358979323846
#define MAX_FRAME_LENGTH 8192
+
+#define HIGHEST 2
+#define HIGHER 1.65
+#define HIGH 1.3
+#define LOW .85
+#define LOWER .7
+#define LOWEST .5
struct fft_data {
float in_fifo[MAX_FRAME_LENGTH];
@@ -154,8 +178,7 @@
shift = datastore->data;
- /* READ for tx WRITE for rx */
- if (direction == AST_AUDIOHOOK_DIRECTION_READ) {
+ if (direction == AST_AUDIOHOOK_DIRECTION_WRITE) {
pitch_shift(f, shift->tx.shift_amount, &shift->tx);
} else {
pitch_shift(f, shift->rx.shift_amount, &shift->rx);
@@ -191,16 +214,34 @@
shift = datastore->data;
}
- if (!sscanf(value, "%30f", &amount) || amount <= 0) {
- goto cleanup_error;
+
+ if (!strcasecmp(value, "highest")) {
+ amount = HIGHEST;
+ } else if (!strcasecmp(value, "higher")) {
+ amount = HIGHER;
+ } else if (!strcasecmp(value, "high")) {
+ amount = HIGH;
+ } else if (!strcasecmp(value, "lowest")) {
+ amount = LOWEST;
+ } else if (!strcasecmp(value, "lower")) {
+ amount = LOWER;
+ } else if (!strcasecmp(value, "low")) {
+ amount = LOW;
+ } else {
+ if (!sscanf(value, "%30f", &amount) || (amount <= 0) || (amount > 4)) {
+ goto cleanup_error;
+ }
}
if (!strcasecmp(data, "rx")) {
shift->rx.shift_amount = amount;
- }
-
- if (!strcasecmp(data, "tx")) {
+ } else if (!strcasecmp(data, "tx")) {
shift->tx.shift_amount = amount;
+ } else if (!strcasecmp(data, "both")) {
+ shift->rx.shift_amount = amount;
+ shift->tx.shift_amount = amount;
+ } else {
+ goto cleanup_error;
}
if (new) {
More information about the svn-commits
mailing list