-
Notifications
You must be signed in to change notification settings - Fork 0
class_sample
####Inherits: Resource ####Category: Core
Audio Sample (sound) class.
- void
create( int format, bool stereo, int length ) -
int
get_format( ) const -
bool
is_stereo( ) const -
int
get_length( ) const - void
set_data( RawArray data ) -
RawArray
get_data( ) const - void
set_mix_rate( int hz ) -
int
get_mix_rate( ) const - void
set_loop_format( int format ) -
int
get_loop_format( ) const - void
set_loop_begin( int pos ) -
int
get_loop_begin( ) const - void
set_loop_end( int pos ) -
int
get_loop_end( ) const
- FORMAT_PCM8 = 0 - 8-Bits signed little endian PCM audio.
- FORMAT_PCM16 = 1 - 16-Bits signed little endian PCM audio.
- FORMAT_IMA_ADPCM = 2 - Ima-ADPCM Audio.
- LOOP_NONE = 0 - No loop enabled.
- LOOP_FORWARD = 1 - Forward looping (when playback reaches loop end, goes back to loop begin)
- LOOP_PING_PONG = 2 - Ping-Pong looping (when playback reaches loop end, plays backward untilloop begin). Not available in all platforms.
Sample provides an audio sample class, containing audio data, together with some information for playback, such as format, mix rate and loop. It is used by sound playback routines.
Create new data for the sample, with format "format" (see FORMAT_* enum), stereo hint, and length in frames (not samples or bytes!) "frame". Calling create overrides previous existing data if it exists. Stereo samples are interleaved pairs of left and right (in that order) points
-
int
get_format( ) const
Return the sample format (see FORMAT_* enum).
-
bool
is_stereo( ) const
Return true if the sample was created stereo.
-
int
get_length( ) const
Return the sample length in frames.
- void
set_data( RawArray data )
Set sample data. Data must be little endian, no matter the host platform, and exactly as long to fit all frames. Example, if data is Stereo, 16 bits, 256 frames, it will be 1024 bytes long.
-
RawArray
get_data( ) const
Return sample data. Data will be endian, no matter with the host platform, and exactly as long to fit all frames. Example, if data is Stereo, 16 bits, 256 frames, it will be 1024 bytes long.
- void
set_mix_rate( int hz )
Set the mix rate for the sample (expected playback frequency).
-
int
get_mix_rate( ) const
Return the mix rate for the sample (expected playback frequency).
- void
set_loop_format( int format )
Set the loop format, see LOOP_* enum
-
int
get_loop_format( ) const
Return the loop format, see LOOP_* enum.
- void
set_loop_begin( int pos )
Set the loop begin position, it must be a valid frame and less than the loop end position.
-
int
get_loop_begin( ) const
Return the loop begin position.
- void
set_loop_end( int pos )
Set the loop end position, it must be a valid frame and greater than the loop begin position.
-
int
get_loop_end( ) const
Return the loop begin position.