Here, try this (attached). The test application is in the folder "example_DBP".
I wrote a DLL for dbp which can be loaded at runtime. This one uses SFML to play the music, so there are 3 DLLs in total (you only have to load one of them though).
NOTE: The DLL currently crashes when you either call
delete dll or close the application. I'm not sure why. I've included the source files for C++ as per usual, if anyone can tell me why the DLL isn't unloading correctly, I'd be very grateful.
Supported formats:
ogg, wav, flac, aiff, au, raw, paf, svx, nist, voc, ircam, w64, mat4, mat5 pvf, htk, sds, avr, sd2, caf, wve, mpc2k, rf64
Example application (DBP source, included in the download):
rem ------------------------------------------------------------
rem SimpleMusic example
rem by TheComet
rem ------------------------------------------------------------
rem NOTES: "delete dll" causes dbp to crash and I don't know why
rem yet. I'm pretty sure something's not unloading
rem correctly, still looking for the problem.
rem ------------------------------------------------------------
rem Supported Formats: ogg, wav, flac, aiff, au, raw, paf,
rem svx, nist, voc, ircam, w64, mat4, mat5,
rem pvf, htk, sds, avr, sd2, caf, wve, mpc2k,
rem rf64
rem ------------------------------------------------------------
rem Command list: loadMusic( fileName as string, index as integer )
rem -> loads a music file
rem -> returns -1 if it fails, index if successful
rem playMusic( index as integer )
rem -> plays a loaded music file, or resumes one if it was paused
rem -> returns -1 if it fails, index if successful
rem loopMusic( index as integer )
rem -> loops a loaded music file
rem -> returns -1 if it fails, index if successful
rem pauseMusic( index as integer )
rem -> pauses a playing music file
rem -> returns -1 if it fails, index if successful
rem stopMusic( index as integer )
rem -> stops playing a music file
rem -> returns -1 if it fails, index if successful
rem setMusicVolume( index as integer, volume as float )
rem -> sets the volume of the music (between 0 and 100)
rem -> returns -1 if it fails, index if successful
rem deleteMusic( index as integer )
rem -> deletes a music
rem -> returns -1 if it fails, index if successful
rem cleanUp()
rem -> deletes all music
rem -> returns nothing
rem ------------------------------------------------------------
rem load the simpleMusic dll
load dll "simpleMusic.dll",1
rem make sure dll loaded successfully
if dll exist(1) = 0
print "unable to load dll"
wait key
end
endif
rem load test music
success = call dll( 1, "loadMusic", "test.ogg", 1 )
rem make sure successful
if success = -1
print "unable to load music (probably you didn't place it in the same folder you idiot)"
wait key
end
endif
rem play music
success = call dll( 1, "playMusic", 1 )
rem print crappy messages
print "playing this garbage music ripped from the game " + chr$(34) + "Super Smash Bros. Brawl" + chr$(34)
print "how does that make you feel?" : wait 500
print "..." : wait 500
print "The sitar is an amazing instrument, even here it is audible"
print
print "btw, press any key to stop the music"
wait key
rem stop the music
success = call dll( 1, "stopMusic", 1 )
success = call dll( 1, "deleteMusic", 1 )
rem more messages
print "press any key to load the song again"
wait key
rem load the music 10 times
for n = 1 to 10
success = call dll( 1, "loadMusic", "test.ogg", n )
success = call dll( 1, "playMusic", n )
sleep 100
next n
rem messages
print "whooops, I accidentally the song 10 times"
wait 800
print "you get the idea."
print "press any key to crash (because the dll isn't being unloaded correctly for some reason)"
wait key
rem stop everything
rem NOTE: You can still use the dll after this
success = call dll( 1, "cleanUp" )
rem crash DBP
print "toodles"
wait 100
delete dll 1
Please let me know if it's worth working further on this or not. If you see this as a viable option, I will invest some more time into finding the unloading bug.
Also let me know if you have any requests for more features (such as seeking, retrieving music position, etc.)
TheComet