New Hekkus Sound Library Wrapper!

Louis

Active Member
Licensed User
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!
 

Attachments

Last edited:

colin9876

Active Member
Licensed User
Great

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:

Louis

Active Member
Licensed User
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.
 

dzt

Active Member
Licensed User
Hi Louis,

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!

Well done!
:)
 

Louis

Active Member
Licensed User
The Hekkus wrapper has been updated see post number 1 in this thread for the changes and new download.
 

pmu5757

Member
Licensed User
Hekkus lib

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.

Can anybody help me ?

Thank you.
 

Louis

Active Member
Licensed User
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.
 

pmu5757

Member
Licensed User
Hekkus lib

Hello Louis,
Thank you for your answer.

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 :

B4X:
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 ?

Thank you.
 

Louis

Active Member
Licensed User
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.
 

ikaplan

Member
Licensed User
Hi Louis

I have downloaded your library from
http://www.BrailleSoft.net/Hekkus.zip
Not sure, however this zip file does not contain the manual. It has just one "release" directory with demo programs, library dll and sample wav files.
Am I missing something?
Would greatly appreciate your reply

Thanks a lot.

Igor.
 

Louis

Active Member
Licensed User
Hi there, there is no manual. See post 9 or 10 (where I am responding to Pascal's question) for an explanation about how to use this library. HTH.Though if you want more examples I will be more than happy to share them here. Also in the Release directory there is a simple Basic4ppc example that demonstrates basically how to play 2 files at once, though it doesn't modify the sounds panning or volume while the sound plays, but using the Channel1 object you can do so after playing the sound and assigning it to a Channel1.value property with the speaker.Channel() method in the speaker object. HTH.
 
Last edited:

ikaplan

Member
Licensed User
Hi Louis,

Thanks a lot for your reply. Actually I would greatly appreciate more examples how to work with this library. Working with panning and other sound properties example would be very interesting. Can I change panning while sound is playing?
All the best.

Igor.
 

Louis

Active Member
Licensed User
Hi. Located at http://www.BrailleSoft.net/SoundExample.zip is quite an example of how to use most of the features in the sound library. It first shows you how to pan a sound, how to play more than one file at a time and pan their positions, and how to stop sounds and fade-out, or adjust the volume of sounds. In order to test out programs written with this library, you need to compile your B4ppc app to an executable, either legacy or as optimized and run the executable. Also, unzip this file to the location of the DLLS. Now, because this was a demo to show how this library works, I didn't perfect the movements of the sounds, speed wise or how they are to fade out, ETC. You'll have to experiment and see what you can come up with. You'll see what I mean once you compile and run the example, but I think it is good enough for you to get my drift. If you have anymore questions please post them. HTH.
 

ikaplan

Member
Licensed User
Hi Louis,

It is just wanderful! Many, many thanks. The wanderful example. Appreciate it very much..
 

linum

Active Member
Licensed User
Can somebody please upload the file so that we can download it (the links no longer work).

Thank you so much...
 

Louis

Active Member
Licensed User
The native dlls were updated to fix some minor bugs with OGG and various others. See post 1 for more details!
 

pano

Member
Licensed User
any mp3-ogg converter runing on the pda ?

I'm tired of the fmod hangs and seriously think of converting mp3 to ogg on the pda for playing them with the hekkus dll.

Do you know of a command line app that can do that under Windows Mobile ? (there are plenty under windows but I cannot find one under wm) Thanks !
 
Top