summaryrefslogtreecommitdiff
path: root/pjmedia
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2008-09-16 16:28:40 +0000
committerBenny Prijono <bennylp@teluu.com>2008-09-16 16:28:40 +0000
commit611d921d61c175f4346cd4441690ce09e3a282fb (patch)
tree5437bfb0e2b2ab87e326a5ca7fefb2acda3c3647 /pjmedia
parent9c41f0a3aadb8ca284613dd552128338af16dc2e (diff)
More ticket #619: fix the difference of volume in the fixed point version of the tone generator, added PJMEDIA_TONEGEN_VOLUME setting to control the default amplitude, and increase default tone volume by about 50%
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@2284 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjmedia')
-rw-r--r--pjmedia/include/pjmedia/config.h10
-rw-r--r--pjmedia/include/pjmedia/tonegen.h6
-rw-r--r--pjmedia/src/pjmedia/tonegen.c4
3 files changed, 16 insertions, 4 deletions
diff --git a/pjmedia/include/pjmedia/config.h b/pjmedia/include/pjmedia/config.h
index e592fcfb..1ba0f040 100644
--- a/pjmedia/include/pjmedia/config.h
+++ b/pjmedia/include/pjmedia/config.h
@@ -604,6 +604,16 @@
/**
+ * The default tone generator amplitude (1-32767).
+ *
+ * Default value: 12288
+ */
+#ifndef PJMEDIA_TONEGEN_VOLUME
+# define PJMEDIA_TONEGEN_VOLUME 12288
+#endif
+
+
+/**
* Enable support for SRTP media transport. This will require linking
* with libsrtp from the third_party directory.
*
diff --git a/pjmedia/include/pjmedia/tonegen.h b/pjmedia/include/pjmedia/tonegen.h
index 108e5f0e..655f23cd 100644
--- a/pjmedia/include/pjmedia/tonegen.h
+++ b/pjmedia/include/pjmedia/tonegen.h
@@ -63,7 +63,8 @@ typedef struct pjmedia_tone_desc
short freq2; /**< Optional second frequency. */
short on_msec; /**< Playback ON duration, in miliseconds. */
short off_msec; /**< Playback OFF duration, ini miliseconds. */
- short volume; /**< Volume (1-16383), or 0 for default. */
+ short volume; /**< Volume (1-32767), or 0 for default, which
+ PJMEDIA_TONEGEN_VOLUME will be used. */
} pjmedia_tone_desc;
@@ -77,7 +78,8 @@ typedef struct pjmedia_tone_digit
char digit; /**< The ASCI identification for the digit. */
short on_msec; /**< Playback ON duration, in miliseconds. */
short off_msec; /**< Playback OFF duration, ini miliseconds. */
- short volume; /**< Volume (1-16383), or 0 for default. */
+ short volume; /**< Volume (1-32767), or 0 for default, which
+ PJMEDIA_TONEGEN_VOLUME will be used. */
} pjmedia_tone_digit;
diff --git a/pjmedia/src/pjmedia/tonegen.c b/pjmedia/src/pjmedia/tonegen.c
index 562195d5..60732500 100644
--- a/pjmedia/src/pjmedia/tonegen.c
+++ b/pjmedia/src/pjmedia/tonegen.c
@@ -30,7 +30,7 @@
#define DATA double
/* amplitude */
-#define AMP 8192
+#define AMP PJMEDIA_TONEGEN_VOLUME
#ifndef M_PI
@@ -115,7 +115,7 @@
# define MAXI ((unsigned)0xFFFFFFFF)
# define SIN approximate_sin3
# if 1 /* set this to 0 to disable volume adjustment */
-# define VOL(var,v) (((v) * var.vol) >> 16)
+# define VOL(var,v) (((v) * var.vol) >> 15)
# else
# define VOL(var,v) (v)
# endif