Sound Library


Abstract

The VCSSL Sound library is a standard library for handling sound.

The basic flow of sound playback in VCSSL is as follows.

First, load sound data from a file with the newSound function.Currently, the only sound format available in VCSSL is the WAVE format, with the file extension .wav.

Next, set the volume with the setSoundGain function,and then start playback with the startSound function.Sound playback is performed asynchronously with respect to VCSSL program execution.In other words, VCSSL processing continues without waiting for the sound playback to finish.The same applies when multiple sounds are played. Sounds are played asynchronously without waiting for one another to finish.

When sound playback finishes, the onSoundEnd event handler is called.If you want to repeat playback of a sound, specify the frame value 0 to the setSoundFramefunction there to rewind the sound, and then play it again with the startSound function.


Index

int newSound(string filePath)
Loads a sound file, creates sound data from it, assigns its unique identifier, called the sound data ID, and returns it.
void deleteSound(int soundID)
Disposes of sound data.
void startSound(int soundID)
Starts playback of a sound.
void stopSound(int soundID)
Stops playback of a sound temporarily.
void setSoundGain(int soundID, float gain)
Sets the volume gain of a sound.
void setSoundFrame(int soundID, int frame)
Sets the playback position of a sound in units of frames.
int getSoundFrame(int soundID)
Gets the playback position of a sound in units of frames.
int getSoundFrameLength(int soundID)
Gets the length of a sound in units of frames.
void setSoundTime(int soundID, int milliSec)
Sets the playback position of a sound in units of time, in milliseconds.
int getSoundTime(int soundID)
Gets the playback position of a sound in units of time, in milliseconds.
int getSoundTimeLength(int soundID)
Gets the length of a sound in units of time, in milliseconds.

Event Handlers

void onSoundStart( int soundID )
Called when sound playback starts.
void onSoundStop( int soundID )
Called when sound playback stops.
void onSoundEnd( int soundID )
Called when sound playback ends.

Structs

- None -


Variables

- None -


Functions

Name newSound
Declaration int newSound(string filePath)
Description Loads a sound file, creates sound data from it, assigns its unique identifier, called the sound data ID, and returns it.
Parameters (string type) filePath : The name or path of the sound file to be loaded. At present, only the WAV format is supported.
Return (int type) The sound data ID assigned to the created sound data.
Name deleteSound
Declaration void deleteSound(int soundID)
Description Disposes of sound data.
Parameters (int type) soundID : The ID of the target sound data.
Return (void type)
Name startSound
Declaration void startSound(int soundID)
Description Starts playback of a sound.
Parameters (int type) soundID : The ID of the target sound data.
Return (void type)
Name stopSound
Declaration void stopSound(int soundID)
Description Stops playback of a sound temporarily.
Parameters (int type) soundID : The ID of the target sound data.
Return (void type)
Name setSoundGain
Declaration void setSoundGain(int soundID, float gain)
Description Sets the volume gain of a sound.
Parameters (int type) soundID : The ID of the target sound data.
(float type) gain : The volume gain.
Return (void type)
Name setSoundFrame
Declaration void setSoundFrame(int soundID, int frame)
Description Sets the playback position of a sound in units of frames.
Parameters (int type) soundID : The ID of the target sound data.
gain : The playback position frame.
Return (void type)
Name getSoundFrame
Declaration int getSoundFrame(int soundID)
Description Gets the playback position of a sound in units of frames.
Parameters (int type) soundID : The ID of the target sound data.
Return (int type) The current playback position frame.
Name getSoundFrameLength
Declaration int getSoundFrameLength(int soundID)
Description Gets the length of a sound in units of frames.
Parameters (int type) soundID : The ID of the target sound data.
Return (int type) The total number of frames.
Name setSoundTime
Declaration void setSoundTime(int soundID, int milliSec)
Description Sets the playback position of a sound in units of time, in milliseconds.
Parameters (int type) soundID : The ID of the target sound data.
(int type) milliSec : The playback position time in milliseconds.
Return (void type)
Name getSoundTime
Declaration int getSoundTime(int soundID)
Description Gets the playback position of a sound in units of time, in milliseconds.
Parameters (int type) soundID : The ID of the target sound data.
Return (int type) The playback position time in milliseconds.
Name getSoundTimeLength
Declaration int getSoundTimeLength(int soundID)
Description Gets the length of a sound in units of time, in milliseconds.
Parameters (int type) soundID : The ID of the target sound data.
Return (int type) The total number of milliseconds.

Event Handlers

Name onSoundStart
Declaration void onSoundStart( int soundID )
Description Called when sound playback starts.
Parameters (int type) soundID : The ID of the sound data where the event occurred.
Return (void type)
Name onSoundStop
Declaration void onSoundStop( int soundID )
Description Called when sound playback stops.
Parameters (int type) soundID : The ID of the sound data where the event occurred.
Return (void type)
Name onSoundEnd
Declaration void onSoundEnd( int soundID )
Description Called when sound playback ends.
Parameters (int type) soundID : The ID of the sound data where the event occurred.
Return (void type)