Public Member Functions
Audio () | |
Audio (const InstanceHandle &instance, const AudioConfig &config, PPB_Audio_Callback callback, void *user_data) | |
Audio (const InstanceHandle &instance, const AudioConfig &config, PPB_Audio_Callback callback, void *user_data) | |
AudioConfig & | config () |
const AudioConfig & | config () const |
bool | StartPlayback () |
bool | StopPlayback () |
Detailed Description
An audio resource.
Refer to the Audio chapter in the Developer's Guide for information on using this interface.
Constructor & Destructor Documentation
pp::Audio::Audio | ( | ) | [inline] |
An empty constructor for an Audio resource.
pp::Audio::Audio | ( | const InstanceHandle & | instance, |
const AudioConfig & | config, | ||
PPB_Audio_Callback | callback, | ||
void * | user_data | ||
) |
A constructor that creates an Audio resource.
No sound will be heard until StartPlayback() is called. The callback is called with the buffer address and given user data whenever the buffer needs to be filled. From within the callback, you should not call PPB_Audio
functions. The callback will be called on a different thread than the one which created the interface. For performance-critical applications (such as low-latency audio), the callback should avoid blocking or calling functions that can obtain locks, such as malloc. The layout and the size of the buffer passed to the audio callback will be determined by the device configuration and is specified in the AudioConfig
documentation.
- Parameters:
[in] instance The instance with which this resource will be associated. [in] config An AudioConfig
containing the audio config resource.[in] callback A PPB_Audio_Callback
callback function that the browser calls when it needs more samples to play.[in] user_data A pointer to user data used in the callback function.
pp::Audio::Audio | ( | const InstanceHandle & | instance, |
const AudioConfig & | config, | ||
PPB_Audio_Callback_1_0 | callback, | ||
void * | user_data | ||
) |
A constructor that creates an Audio resource.
- Parameters:
[in] instance The instance with which this resource will be associated. [in] config An AudioConfig
containing the audio config resource.[in] callback A PPB_Audio_Callback
callback function that the browser calls when it needs more samples to play.[in] user_data A pointer to user data used in the callback function.
Member Function Documentation
AudioConfig& pp::Audio::config | ( | ) | [inline] |
Getter function for returning the internal PPB_AudioConfig
struct.
- Returns:
- A mutable reference to the PPB_AudioConfig struct.
const AudioConfig& pp::Audio::config | ( | ) | const [inline] |
Getter function for returning the internal PPB_AudioConfig
struct.
- Returns:
- A const reference to the internal
PPB_AudioConfig
struct.
bool pp::Audio::StartPlayback | ( | ) |
StartPlayback() starts playback of audio.
- Returns:
- true if successful, otherwise false.
bool pp::Audio::StopPlayback | ( | ) |
StopPlayback stops playback of audio.
- Returns:
- true if successful, otherwise false.
The documentation for this class was generated from the following file: