diff options
author | Benny Prijono <bennylp@teluu.com> | 2008-06-14 20:33:44 +0000 |
---|---|---|
committer | Benny Prijono <bennylp@teluu.com> | 2008-06-14 20:33:44 +0000 |
commit | 849922592a1ae3c3088f362f48a45a8da3f03cbb (patch) | |
tree | f79e7ac21cf3d5abd428cdeb2f0057a43761c16c /pjmedia | |
parent | 4c1830ca1329c2d2d8d33a0210dd0458ed05773d (diff) |
Added pjmedia_tonegen_rewind()
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@2022 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjmedia')
-rw-r--r-- | pjmedia/include/pjmedia/tonegen.h | 11 | ||||
-rw-r--r-- | pjmedia/src/pjmedia/tonegen.c | 20 |
2 files changed, 31 insertions, 0 deletions
diff --git a/pjmedia/include/pjmedia/tonegen.h b/pjmedia/include/pjmedia/tonegen.h index dadc036d..ab591732 100644 --- a/pjmedia/include/pjmedia/tonegen.h +++ b/pjmedia/include/pjmedia/tonegen.h @@ -195,6 +195,17 @@ PJ_DECL(pj_status_t) pjmedia_tonegen_stop(pjmedia_port *tonegen); /** + * Rewind the playback. This will start the playback to the first + * tone in the playback list. + * + * @param tonegen The tone generator instance. + * + * @return PJ_SUCCESS on success. + */ +PJ_DECL(pj_status_t) pjmedia_tonegen_rewind(pjmedia_port *tonegen); + + +/** * Instruct the tone generator to play single or dual frequency tones * with the specified duration. The new tones will be appended to currently * playing tones, unless #pjmedia_tonegen_stop() is called before calling diff --git a/pjmedia/src/pjmedia/tonegen.c b/pjmedia/src/pjmedia/tonegen.c index 68d6634b..9333ab23 100644 --- a/pjmedia/src/pjmedia/tonegen.c +++ b/pjmedia/src/pjmedia/tonegen.c @@ -401,6 +401,26 @@ PJ_DEF(pj_status_t) pjmedia_tonegen_stop(pjmedia_port *port) /* + * Instruct the tone generator to stop current processing. + */ +PJ_DEF(pj_status_t) pjmedia_tonegen_rewind(pjmedia_port *port) +{ + struct tonegen *tonegen = (struct tonegen*) port; + PJ_ASSERT_RETURN(port->info.signature == SIGNATURE, PJ_EINVAL); + + TRACE_((THIS_FILE, "tonegen_rewind()")); + + /* Reset back to the first tone */ + pj_lock_acquire(tonegen->lock); + tonegen->cur_digit = 0; + tonegen->dig_samples = 0; + pj_lock_release(tonegen->lock); + + return PJ_SUCCESS; +} + + +/* * Callback to destroy tonegen */ static pj_status_t tonegen_destroy(pjmedia_port *port) |