Native Client

pp::Audio Class Reference

An audio resource. More...

Inheritance diagram for pp::Audio:

List of all members.

Public 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)
AudioConfigconfig ()
const AudioConfigconfig () 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 and Destructor Details

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]instanceThe instance with which this resource will be associated.
[in]configAn AudioConfig containing the audio config resource.
[in]callbackA PPB_Audio_Callback callback function that the browser calls when it needs more samples to play.
[in]user_dataA 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]instanceThe instance with which this resource will be associated.
[in]configAn AudioConfig containing the audio config resource.
[in]callbackA PPB_Audio_Callback callback function that the browser calls when it needs more samples to play.
[in]user_dataA pointer to user data used in the callback function.

Function Details

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:

Authentication required

You need to be signed in with Google+ to do that.

Signing you in...

Google Developers needs your permission to do that.