a binding/wrapper for the audio library Miniaudio to the language BlitzMax
The wrapper enables to use the C-library miniaudio (https://github.com/mackron/miniaudio) in the BASIC language BlitzMax (https://blitzmax.org/)
There is already a manual here: https://www.syntaxbomb.com/index.php/topic,8419.0.html
And a discussion forum here: https://www.syntaxbomb.com/index.php/topic,8388.0.html
The wrapper uses the MiniAudio V0.10.37. It is includes here as one file miniaudio.h
Runs perfect on BlitzMax Windows in RELEASE and DEBUG mode. Runs perfect on BlitzMax MAC OsX in RELEASE mode, but V1.28 crashes on Mac DEBUG mode. We work on a solution...
Here is a minimal example. It opens the device and makes some noise
Import mima.miniaudio
' Setup of the device:
Global MiniAudio:TMiniAudio=New TMiniAudio
MiniAudio.OpenDevice( MiniAudio.PLAYBACK, Miniaudio.FORMAT_S16, 1, 48000, MyCallBack)
' now start it:
MiniAudio.StartDevice()
'your main loop:
Repeat
Flip 1
Until AppTerminate()
' free the device:
Miniaudio.CloseDevice()
End
'data aree delivered via a callback procedure:
Function MyCallBack(void:Byte Ptr, PlayBuffer:Short Ptr, RecordingBuffer:Short Ptr, Frames:Int)
For Local i:Int=0 To Frames-1
PlayBuffer[i] = Rand(-32000,+32000)
Next
End Function
Audio-Playback and Recording with low latency below 30msec
Realtime Samples access of already playing samples
Playback and Capture MONO STEREO, 3-32 tracks
Full Duplex: Capture and Playback at the same time
Loopback: Record what is "on the speakers"
All backend devices on all plattforms are supported incl. WASAPI on Windows
access to USB hardware devices with upto 32 capture/playback channels
Formats: 8bit, 16bit, 32bit and 32bit-float
Samples-Rates from 8kHz-192kHzHz
CallBack-Access, Multithread
Opening MP3, OGG, FLAC and WAV files with Audioformats bejond 16bit
Opening OGG, FLAC and WAV files with Multichannels
Converting Audiofiles to old BlitzMax TAudioSample TSound objects
New extended TAudioSample object with multichannel and 32bit samples
Save WAV-files in various formats upto 32 tracks
Opens the Device.
Same as OpenDevice, but with independent parameters for Capture and Playback.
Starts the Device.
Stops the Device.
Close the Device.
Lists all avaiable Playback Devices.
Lists all avaiable Capture Devices.
Select the Devices.
Load Audio-File as BlitzMax TSound Object.
Load MP3, FLAC, WAV or OGG as BlitzMax TAudioSample Object.
Load MP3, FLAC, WAV or OGG as new extended ExTAudioSample Object.
Save BlitzMax TAudioSample as WAV.
Save new extended TAudioSample as WAV.
Save a TBank as WAV File.
Special Open WAV File for Writing.
Special Write data to WAV File.
Close special WAV File.
Convert TAudioSample into a ExTAudioSample.
Convert TAudioSample into a TBank.
Create Extended TAudio Object.
Sample-Pointer to audio data.
Extract one Channel from a ExTAudioSample.
Imports one Channel into a ExTAudioSample.
Clears the Sample Buffer.