PnAudioData

Name

PnAudioData -- an object containing audio data

Synopsis


#include <pn/pn.h>


struct      PnAudioData;
PnAudioData* pn_audio_data_new              (void);
void        pn_audio_data_set_stereo        (PnAudioData *audio_data,
                                             gboolean stereo);
void        pn_audio_data_set_pcm_samples   (PnAudioData *audio_data,
                                             guint samples);
void        pn_audio_data_set_freq_bands    (PnAudioData *audio_data,
                                             guint bands);
gfloat      pn_audio_data_get_volume        (PnAudioData *audio_data);
void        pn_audio_data_update            (PnAudioData *audio_data);

Object Hierarchy


  GObject
   +----PnObject
         +----PnAudioData

Description

PnAudioData objects contain audio data that is used by actuators that render audio-based effects.

Details

struct PnAudioData

struct PnAudioData {

  /* PCM and frequency data are floats in the range of 0 to 1 */

  /* PCM Data */
  guint pcm_samples;    /* read-only */
  gfloat *pcm_data[3];  /* read-write */

  /* Frequency Data */
  guint freq_bands;     /* read-only */
  gfloat *freq_data[3]; /* read-write */

};


pn_audio_data_new ()

PnAudioData* pn_audio_data_new              (void);

Creates a new PnAudioData object.

Returns : The new PnAudioData object


pn_audio_data_set_stereo ()

void        pn_audio_data_set_stereo        (PnAudioData *audio_data,
                                             gboolean stereo);

Sets whether audio_data will use stereo audio data. If stereo is FALSE, each channel buffer points to the same memory location; otherwise they are separate buffers.

audio_data : a PnAudioData
stereo : TRUE or FALSE


pn_audio_data_set_pcm_samples ()

void        pn_audio_data_set_pcm_samples   (PnAudioData *audio_data,
                                             guint samples);

Sets the number of samples that audio_data's pcm data contains.

audio_data : a PnAudioData
samples : the number of samples


pn_audio_data_set_freq_bands ()

void        pn_audio_data_set_freq_bands    (PnAudioData *audio_data,
                                             guint bands);

Sets the number of bands that audio_data's frequency data contains.

audio_data : a PnAudioData
bands : the number of bands


pn_audio_data_get_volume ()

gfloat      pn_audio_data_get_volume        (PnAudioData *audio_data);

Retrieves the volume level (from 0.0 to 1.0) of the audio frame contained within a PnAudioData object.

audio_data : a PnAudioData
Returns : The volume level


pn_audio_data_update ()

void        pn_audio_data_update            (PnAudioData *audio_data);

Updates the information about the audio data frame in a PnAudioData. This function should be called after all updates to pcm_data or freq_data.

audio_data : a PnAudioData