Hi. I've done it! You are now able to create fast action games with some awesome sound effects that you have full control over while they play or even before and after they play! This library works now 100% with Basic4ppc for both the desktop and the device! You can mix unlimited MODS with the library and unlimited waves, and unlimited OGG Vorbis all at once or whenever you see fit! The library has a completely new interface and only requires 2 files each for the desktop or the device, not 3 like in the previous version. It also now works with the Optimized Compiler for v6.01 and later, and now supports OGG Vorbis. I also did away with the manual and put an example program that shows how you can use this library in your own Basic4ppc apps. To use OGG Vorbis, simply replace the .wav extension with the .ogg extension when using the load methods from music/sound and that should work. You can download the Basic4ppc library and examples library here: http://www.BrailleSoft.net/Hekkus.zip
The native DLLS with OGG Vorbis support are attached with this message. Just replace the HssDesktop.d and HssDevice.d files with the attached files in the .zip archive for that support.
The hssDevice.d and hssDesktop.d files have been updated. Minor fixes regarding OGG were fixed, and some other important fixes were made.
Enjoy and let me know what you think!
Last edited by Louis : 06-03-2009 at 08:00 PM.
Reason: Native dlls updated!
This looks very interesting, just what my version of Lunar Lander needs some rocket noises!
Im going to try it later, anyone know any good sources for wave files that sound like a rocket engine?
Last edited by colin9876 : 12-02-2007 at 05:51 PM.
Hi. A good place to try first is findsounds.com. Lots of free sounds you can download. Another one is ILoveWAVS.com. Even more waves you can download and use! HTH.
I didn't test your wrapper but I had a quick look at the manual.
Wow! I'm impressed. A lot of work is here. And I should notice that you are new to this!
Hello,
Without doc, I haven't been able to know if it's possible with this lib to launch a sound, stop the program, and continue it just after the sound has finished.
Hi. It sure is, here's an example using only 1 sound, however you can use as many sounds as you like.
'Add a reference to HSSNetDesktop for the Desktop or HSSNetDevice for the PPC and Smartphones. Add a Speaker objet called speaker, a Sound object called sound1, and a Channel1 object called channel1. You must add a sound object and a channel1 object per everysound you want to load and manipulate from Basic4ppc.
Sub Globals
End Sub
Sub App_Start
speaker.new1
sound1.new1
channel1.new1
Speaker.Open(44100, 16, true, 0, 16) 'The parameters of the Open() function are from left to right:
Hurtz as Int32, 8 or 16 as Int32 for 8-bit or 16-bit files, stereo or mono as boolean true=stereo, Number of channels to allocate for MODS as Int32, and Number of channels to allocate for wavs as Int32.
sound1.load("FileToLoad.wav") 'Loads a wav file into sound1.
'Now to manipulate the sound as it plays, you'd code:
channel1.Value = speaker.channel(speaker.PlaySound(sound1.Value))
'And to freeze the program until a sound is done playing, use the channel1 object. The channel1 class also has some nice methods that let you control the sound while it plays and such. The class entitled Channel doesn't work with Basic4ppc, so Channel1 allows this.
'Anyway, simply code while the sound is playing:
do while channel1.Playing
'Code can go here while the sound plays if necessary.
DoEvents
loop
'When the sound is done the code after the loop executes.
'Don't forget to add a close event that closes the speaker when your program aborts via a call to speaker.close
End Sub
If anyone has more questions please let me know. HTH.
You say that I must add a sound object and a channel1 object per everysound you want to load and manipulate from Basic4ppc.
In my app, I have to play 99 different wav files (1.wav 2.wav ... up to 99.wav)
I've done a sub to do that :
Code:
sub tell(num) Sound (".\sons\" & num & ".wav") Sleep (1200) End Sub
How could I do with your lib to do the same without having 99 code parts like :
speaker.new1
sound1.new1
channel1.new1
Another question : is it possible with your lib to play mp3 files ?
Hi Pascal, As of now the lib doesn't support mp3's, only MODS and wavs. And there is a way to load sounds quickly as long as your files are numbered. Check out this code:
'Add a Speaker object named Speaker using Tools - Add Object after making a reference to HSSNETDesktop or HSSNETDevice.dll
Sub Globals
End Sub
Sub App_Start
speaker.New1
speaker.open(44100, 16, true, 0, 16)
'And now let's get the sounds we want.
for i = 1 to 99
AddObject("sound" & i, "Sound")
'Without the optimized compiler:
control("Sound" & i).New1
'With the optimized compiler maybe:
control("Sound" & i,Sound).New1
AddObject("Channel" & i, "Channel1")
'Without the optimized compiler:
control("Channel" & i).New1
'With the optimized compiler maybe:
controll("Channel" & i,Channel1).New1
'Then load the sound.
'Without the optimized compiler:
control("Sound" & i).load("File" & i & ".wav")
'with the optimize compiler maybe:
control("Sound" & i,Sound).load("filename" & i & ".wav")
next
'Now you can play whatever sound you like! Here is code that'll play a random sound for you, and assign the channel to it in case you want to mod it while the sound plays.
a = rnd(1, 100)
'Without the optimized compiler code:
control("Channel" & a).Value = speaker.channel(speaker.playSound(control("Sound" & a).Value))
'With the optimized compiler you might have to code:
control("channel" & a,Channel1).Value = speaker.channel(speaker.playSound(control("Sound" & a,Sound).value))
'If you want to modify the sound, use any of the methods in the Channel1 class to do so.
'Don't forget to add a close event to the form that calls speaker.close before your app ends!
End Sub
Please note: Hekkus loads and compresses sounds into memory so they'll play as soon as you call speaker.PlaySound(). Because you have 99 sounds loading, this may take about 30 seconds or less depending on how big the files are, and how fast your device is. The desktop loads files wihin seconds so there is no delay there because of how fast the processors are. If you have more questions please let me know. HTH.