8-bit PCM data is expressed as an unsigned value over the range 0 to 255, 128 being an audio output level of zero. 16-bit PCM data is expressed as a signed value over the range -32768 to 32767, 0 being an audio output level of zero. Stereo data is expressed in interleaved format, left channel first.






class ILxAudioLoaderTarget

Public Functions

LxResult SetChannels(LXtObjectID self, unsigned channels)
LxResult SetType(LXtObjectID self, unsigned type)
LxResult SetFrequency(LXtObjectID self, unsigned frequency)
LxResult SetSamples(LXtObjectID self, unsigned samples)


class ILxAudio

Public Functions

unsigned int Channels(LXtObjectID self)

This returns the number of audio channels. 1 is mono, 2 is stereo.

unsigned int Type(LXtObjectID self)

This returns the sampling rate. 8 is unsigned byte (0-255), 16 is signed short (-32768 to 32767). 32 is 32 bits floating point value.

unsigned int Frequency(LXtObjectID self)

Frequency of buffer in Hz.

double TrimStart(LXtObjectID self)

The triming time from start in second.

double Duration(LXtObjectID self)

The time duration of buffer. This time is trimed.

const char *Filename(LXtObjectID self)

Audio file and format.

unsigned int Size(LXtObjectID self)

This returns the size of buffer in byte. This is trimed.

const void *Data(LXtObjectID self)

This returns the pointer of buffer. If trim start is set, it returns the offset position.

LxResult Sample(LXtObjectID self, double time, unsigned int type, void *value)

This returns the sampling value at the time.

void Seek(LXtObjectID self, unsigned int frame)

Seek the buffer position to the given frame.

unsigned int Tell(LXtObjectID self)

Return the current frame to read.

LxResult Read(LXtObjectID self, unsigned int *frames, void *buff, int *eof)

Read audio data to the buffer for the frames. The bytes of frames is frames * channels * bytes of type. This returns the write frames and it sets true to ‘eof’ if it reachs to the end of file.

void Metrics(LXtObjectID self, LXtAudioMetrics *metrics)


struct st_LXtAudioMetrics

Public Members

unsigned int channels
unsigned int type
unsigned int frequency
unsigned int samples
const char *filename


class ILxAudioWrite

Public Functions

LxResult WriteBegin(LXtObjectID self, LXtAudioMetrics *metrics, unsigned int *frameRange)

Initialize the audio object with the metrics. This must be called before writing frames. “WriteBegin” fills “frameRange” that is the start and end position in sample frames. The write data must be started from the start frame.

LxResult Write(LXtObjectID self, unsigned int *frames, const void *data)

Write the frame data to the object. This increments the data position. This updates “frames” with the written frames.

LxResult WriteEnd(LXtObjectID self)

This must be called after writing frames.

LxResult SetSample(LXtObjectID self, double time, unsigned int type, const void *value)

Set the sampling value at the time to the object.

LxResult SetStart(LXtObjectID self, double start)

Set the trim time from start.

LxResult SetDuration(LXtObjectID self, double duration)

Set the duration to play by second.


class ILxAudioDevice

Public Functions

LxResult Handle(LXtObjectID self, LXtObjectID audio, void **ppvObj)

The audio device is virtual audio device device. This provides the abstruct audio interaces. The real audio device in OS level is implemented in OPAL. This creates the audio handle with the audio object.

LxResult StopAll(LXtObjectID self)

Stop all audio handles on the device.

LxResult PlayFile(LXtObjectID self, const char *filePath)

Play the given audio file by non blocking mode.

int Playing(LXtObjectID self)

Return true if the device is in playing.

LxResult PlayRange(LXtObjectID self, LXtObjectID audio, double start, double end, double volume, double pitch)

Play the audio object in the limited range.

typedef unsigned int LXtAudioState

The audio handle is a context to play audio data by the system default device. This provides the abstruct audio interaces. The real audio device in OS level is implemented in OPAL.


The device state information.





class ILxAudioHandle

Public Functions

LXtObjectID Audio(LXtObjectID self)

This function returns the current audio object.

double Offset(LXtObjectID self)

The playback position in seconds.

LxResult SetOffset(LXtObjectID self, double offset)

Set the playback position in seconds. If the offset position is out of range, this function modulos the position in loop mode, otherwise it sets to the end of data.

double Pitch(LXtObjectID self)

Pitch multiplier.

LxResult SetPitch(LXtObjectID self, double pitch)
double Volume(LXtObjectID self)

Source gain.

LxResult SetVolume(LXtObjectID self, double volume)
LxResult Loop(LXtObjectID self)

Turn looping on (LXx_TRUE) or off (LXe_FALSE)

LxResult SetLoop(LXtObjectID self, unsigned int loop)
LxResult Play(LXtObjectID self, int forward)

Play the audio source. If “forward” is false, it plays to backward.

LxResult Stop(LXtObjectID self)

Stop the audio source.

LxResult Pause(LXtObjectID self)

Pause the audio source.

LxResult Resume(LXtObjectID self)

Resume the audio source.

LxResult State(LXtObjectID self, LXtAudioState *state)

Returns the state of the audio device.


struct st_AudioTargetData

Public Members

unsigned int channels
unsigned int type
unsigned int frequency
unsigned int samples