diff options
author | Benny Prijono <bennylp@teluu.com> | 2007-01-24 02:02:09 +0000 |
---|---|---|
committer | Benny Prijono <bennylp@teluu.com> | 2007-01-24 02:02:09 +0000 |
commit | b7680744381c03eeaf56d600c30ba95c062cec1b (patch) | |
tree | 3ee9d55c6ddd44483c5b69c399da7d9e6c0f293f /pjmedia/include | |
parent | f362291d6e707ba5400937d89350f98827ff6e85 (diff) |
Implement ticket #62: option to play tones continuously, and added --play-tone option in pjsua
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@904 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjmedia/include')
-rw-r--r-- | pjmedia/include/pjmedia/tonegen.h | 51 |
1 files changed, 48 insertions, 3 deletions
diff --git a/pjmedia/include/pjmedia/tonegen.h b/pjmedia/include/pjmedia/tonegen.h index 21a4f063..c167e11d 100644 --- a/pjmedia/include/pjmedia/tonegen.h +++ b/pjmedia/include/pjmedia/tonegen.h @@ -98,6 +98,18 @@ typedef struct pjmedia_tone_digit_map } pjmedia_tone_digit_map; +/** + * Tone generator options. + */ +enum +{ + /** + * Play the tones in loop, restarting playing the first tone after + * the last tone has been played. + */ + PJMEDIA_TONEGEN_LOOP = 1 +}; + /** * Create an instance of tone generator with the specified parameters. @@ -111,7 +123,8 @@ typedef struct pjmedia_tone_digit_map * @param samples_per_frame Number of samples per frame. * @param bits_per_sample Number of bits per sample. This version of PJMEDIA * only supports 16bit per sample. - * @param options Option flags, must be zero for now. + * @param options Option flags. Application may specify + * PJMEDIA_TONEGEN_LOOP to play the tone in a loop. * @param p_port Pointer to receive the port instance. * * @return PJ_SUCCESS on success, or the appropriate @@ -127,6 +140,36 @@ PJ_DECL(pj_status_t) pjmedia_tonegen_create(pj_pool_t *pool, /** + * Create an instance of tone generator with the specified parameters. + * When the tone generator is first created, it will be loaded with the + * default digit map. + * + * @param pool Pool to allocate memory for the port structure. + * @param name Optional name for the tone generator. + * @param clock_rate Sampling rate. + * @param channel_count Number of channels. Currently only mono and stereo + * are supported. + * @param samples_per_frame Number of samples per frame. + * @param bits_per_sample Number of bits per sample. This version of PJMEDIA + * only supports 16bit per sample. + * @param options Option flags. Application may specify + * PJMEDIA_TONEGEN_LOOP to play the tone in a loop. + * @param p_port Pointer to receive the port instance. + * + * @return PJ_SUCCESS on success, or the appropriate + * error code. + */ +PJ_DECL(pj_status_t) pjmedia_tonegen_create2(pj_pool_t *pool, + const pj_str_t *name, + unsigned clock_rate, + unsigned channel_count, + unsigned samples_per_frame, + unsigned bits_per_sample, + unsigned options, + pjmedia_port **p_port); + + +/** * Check if the tone generator is still busy producing some tones. * * @param tonegen The tone generator instance. @@ -156,7 +199,8 @@ PJ_DECL(pj_status_t) pjmedia_tonegen_stop(pjmedia_port *tonegen); * @param tonegen The tone generator instance. * @param count The number of tones in the array. * @param tones Array of tones to be played. - * @param options Playback options, must be zero for now. + * @param options Option flags. Application may specify + * PJMEDIA_TONEGEN_LOOP to play the tone in a loop. * * @return PJ_SUCCESS on success, or PJ_ETOOMANY if * there are too many digits in the queue. @@ -178,7 +222,8 @@ PJ_DECL(pj_status_t) pjmedia_tonegen_play(pjmedia_port *tonegen, * @param tonegen The tone generator instance. * @param count Number of digits in the array. * @param digits Array of MF digits. - * @param options Playback options, must be zero for now. + * @param options Option flags. Application may specify + * PJMEDIA_TONEGEN_LOOP to play the tone in a loop. * * @return PJ_SUCCESS on success, or PJ_ETOOMANY if * there are too many digits in the queue, or |