Customer application framework:play audio files
From TBwiki
Contents |
Overview
The CAF (customer application framework) API offers functions to play or record audio files:
On call legs (CTBCAFCallLeg):
- PlayStream()
- RecordStream()
On audio mixers (CTBCAFMixer):
- MixerPlayStream()
- MixerRecordStream()
It also offers callbacks, on the call flow and call behavior classes (based on CTBCAFCallFlow or CTBCAFCallBehavior) to notify the application when files have started playing/recording, and stopped playing/recording:
- OnStreamPlayingStarted()
- OnStreamPlayingDone()
- OnStreamRecordingStarted()
- OnStreamRecordingDone()
- OnMixerStreamPlayingStarted()
- OnMixerStreamPlayingDone()
- OnMixerStreamRecordingStarted()
- OnMixerStreamRecordingDone()
API parameters
PlayStream/MixerPlayStream
Class CTBCAFPlayAttributes is used to build play attributes. Available attributes are:
- AddPlayFilePath: Add a file to the list of files to play. Has some parameters:
- File path (or URI)
- Start/end offsets (optional)
- Repeat count (optional) specific for this file in the sequence of files
- fAllowBargeInInterruption: Allow barge-in interruption (automatic stopping of playback upon detected DTMF)
- fPrepareForRecording: Prepare hardware resources for recording (pre-reserve recording resources)
- un32RepeatCount: Number of times to play the whole file sequence of files
- fNotifyStartOfNewFile: Asks for OnStreamPlayingStarted (or OnMixerStreamPlayingStarted) events for each file in the sequence of files (otherwise, one for the whole sequence)
- s8AudioGainDB: Gain (or loss) of audio level
- fAllowMixing: Allow this playing sequence to be mixed with another file sequence simultaneously playing to the same call leg (or mixer)
- un8PlayIndex: Sequence "index" (0 to 3) to assign to this playing sequence. Will replace a previous playing sequence using the same index, but will be mixed with simultaneously playing sequences with other indexes on the same call leg (or mixer).
- fPaused: Prepare the playback, but stay paused at start-up