BRL.AudioSample
The BlitzMax audiosample module contains commands to create and load audio samples for use with the BlitzMax BRL.Audio module.
Types
Type | Description |
---|---|
TAudioSample | Audio sample type |
TAudioSampleLoader | Audio sample loader type |
Functions
Function CreateAudioSample:TAudioSample( length:Int,hertz:Int,format:Int )
Create an audio sample
length is the number of samples to allocate for the sample. hertz is the frequency in samples per second (hz) the audio sample will be played. format should be one of:
Format | Description |
&SF_MONO8 | Mono unsigned 8 bit |
&SF_MONO16LE | Mono signed 16 bit little endian |
&SF_MONO16BE | Mono signed 16 bit big endian |
&SF_STEREO8 | Stereo unsigned 8 bit |
&SF_STEREO16LE | Stereo signed 16 bit little endian |
&SF_STEREO16BE | Stereo signed 16 bit big endian |
Returns
An audio sample object
Example
' createaudiosample.bmx
SuperStrict
Local sample:TAudioSample=CreateAudioSample( 32,11025,SF_MONO8 )
For Local k:Int = 0 Until 32
sample.samples[k]=Sin(k*360/32)*127.5+127.5
Next
Local sound:TSound=LoadSound( sample,True )
PlaySound(sound)
Input
Function CreateStaticAudioSample:TAudioSample( samples:Byte Ptr,length:Int,hertz:Int,format:Int )
Create an audio sample with existing data
The memory referenced by a static audio sample is not released when the audio sample is deleted.
See CreateAudioSample for possile format values.
Returns
An audio sample object that references an existing block of memory
Function LoadAudioSample:TAudioSample( url:Object )
Load an audio sample
Returns
An audio sample object