We will be using the proteaAudio engine to accomplish this task. First visit http://www.viremo.de/proteaAudio/index.html and download the binary package that comes with both Linux and Windows binaries (this tutorial focuses on the Windows distribution). Within this archive you will need to transfer proAudioRT.dll and lua51.dll to your main LOVE directory, this is all we will need. Unfortunately with using this engine, you will have to keep your game files in a folder in the LOVE directory if you don't already. My game is called Terus, so I keep my game files in C:\Love\Terus, for example.
Next we will need to have your game include the proteaAudio module in your code, so at the top of your love.load() function include this line:
Code: Select all
require("proAudioRt")
Code: Select all
proAudio.create(tracks,frequency,chunksize)
Now we can begin to load sound files for the module to use:
Code: Select all
soundname = proAudio.sampleFromFile('soundpath')
Don't forget that proteaAudio sees the LOVE directory as root, so you need to reference your game folder in your path as I have done. To play a sound we use the following:
Code: Select all
sound = proAudio.soundLoop(soundname) -- For looping sounds such as music
-- OR
sound = proAudio.soundPlay(soundname) -- For single sound effects
To stop a sound that is playing we use the following:
Code: Select all
proAudio.soundStop(sound) -- To stop a specific sound
-- OR
proAudio.soundStop() -- To stop all running sounds
In conclusion, I hope this tutorial helps some of our fellow LOVE developers apply a working sound engine, at least until the current one is repaired and usable.
Happy Coding!