123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- #ifndef __AUDIOTONE_H__
- #define __AUDIOTONE_H__
- #pragma once
- #ifdef __cplusplus
- extern "C" {
- #endif
- #include <apr_general.h>
- #include "audiostream.h"
- struct gen
- {
- float a, s0, s1;
- };
- struct gen_state
- {
- struct gen tone1;
- struct gen tone2;
- int has_tone2;
- };
- typedef struct audiotone_t {
- audiostream_t base;
- int options;
- int playback_options;
- int fade_in_len; /* fade in for this # of samples */
- int fade_out_len; /* fade out for this # of samples*/
- int clock;
- int ptime;
- /* Tone generation state */
- struct gen_state state;
- int dig_fi;
- int dig_samples; /* sample pos in cur digit */
- int freq1;
- int freq2;
- int on_msec;
- int off_msec;
- int volume;
- int flags;
- CRITICAL_SECTION lock;
- }audiotone_t;
- #define TONEGEN_LOOP 1
- apr_status_t audiotone_create(apr_pool_t *pool,
- audioengine_t *engine,
- int options,
- int clock,
- int ptime,
- audiotone_t **p_tone);
- void audiotone_destroy(audiotone_t *tone);
- // Volume (1-32767), or 0 for default
- apr_status_t audiotone_play_start_digit(audiotone_t *tone,
- int digit,
- int on_msec,
- int off_msec,
- int volume,
- int options);
- // freq 2 can be Optional
- apr_status_t audiotone_play_start_tone(audiotone_t *tone,
- int freq1,
- int freq2,
- int on_msec,
- int off_msec,
- int volume,
- int options);
- // stop play
- apr_status_t audiotone_play_end(audiotone_t *tone);
- #ifdef __cplusplus
- } // extern "C" {
- #endif
- #endif //__AUDIOTONE_H__
|