Actions

Customer application framework:play audio files: Difference between revisions

(Starting to write this page)
 
No edit summary
Line 2: Line 2:
The CAF (customer application framework) API offers functions to play or record audio files:
The CAF (customer application framework) API offers functions to play or record audio files:


On call legs (CTBCAFCallLeg):
On call legs (''CTBCAFCallLeg''):
* PlayStream()
* ''PlayStream()''
* RecordStream()
* ''RecordStream()''


On audio mixers (CTBCAFMixer):
On audio mixers (''CTBCAFMixer''):
* MixerPlayStream()
* ''MixerPlayStream()''
* MixerRecordStream()
* ''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:
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()
* ''OnStreamPlayingStarted()''
* OnStreamPlayingDone()
* ''OnStreamPlayingDone()''
* OnStreamRecordingStarted()
* ''OnStreamRecordingStarted()''
* OnStreamRecordingDone()
* ''OnStreamRecordingDone()''
* OnMixerStreamPlayingStarted()
* ''OnMixerStreamPlayingStarted()''
* OnMixerStreamPlayingDone()
* ''OnMixerStreamPlayingDone()''
* OnMixerStreamRecordingStarted()
* ''OnMixerStreamRecordingStarted()''
* OnMixerStreamRecordingDone()
* ''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


= Features for playing files =
= Features for playing files =
Line 24: Line 40:
== Playing a chain of multiple files ==
== Playing a chain of multiple files ==
== Start/end offsets, repeat count ==
== Start/end offsets, repeat count ==
== Pause/Resume ==
== Live transcoding ==
== Live transcoding ==
== Audio gain ==
== Playing remote (HTTP) files ==
== Playing remote (HTTP) files ==
== RAM caching ==
== RAM caching ==

Revision as of 11:28, 20 November 2012

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

Features for playing files

Load sharing

Playing a chain of multiple files

Start/end offsets, repeat count

Pause/Resume

Live transcoding

Audio gain

Playing remote (HTTP) files

RAM caching

Features for recording files

Load sharing

Live transcoding

Performance

Expected performance

Simultaneous playing files

Number of file play per second

Typical bottlenecks

Good example of well-balanced host hardware