Basic4ppc - Windows Mobile Development  

Go Back   Basic4ppc - Windows Mobile Development > Main Category > Code Samples & Tips > Additional Libraries
Home Register FAQ Members List Search Today's Posts Mark Forums Read

Additional Libraries Users contributed libraries.
This sub-forum is only available to licensed users.


New Hekkus Sound Library Wrapper!


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 11-23-2007, 10:23 PM
Knows the basics
 
Join Date: May 2007
Posts: 86
Default

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 up to 64 MODS with the library and 128 waves 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. 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. You can download the library here:
http://www.BrailleSoft.net/Hekkus.zip

Enjoy and let me know what you think!

Last edited by Louis : 12-28-2007 at 11:56 PM.
Reply With Quote
Old 11-24-2007, 02:07 AM
Louis
This message has been deleted by Louis.
  #2 (permalink)  
Old 12-02-2007, 05:14 PM
Basic4ppc Veteran
 
Join Date: Nov 2007
Posts: 316
Default 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 by colin9876 : 12-02-2007 at 05:51 PM.
Reply With Quote
  #3 (permalink)  
Old 12-02-2007, 10:24 PM
Knows the basics
 
Join Date: May 2007
Posts: 86
Default

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.
Reply With Quote
  #4 (permalink)  
Old 12-03-2007, 05:13 PM
dzt's Avatar
dzt dzt is offline
Basic4ppc Veteran
 
Join Date: May 2007
Location: Greece
Posts: 353
Awards Showcase
Forum Contributer 
Total Awards: 1
Default

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!
__________________
Dimitris Zacharakis
http://www.terracom.gr
Reply With Quote
  #5 (permalink)  
Old 12-28-2007, 05:19 AM
Knows the basics
 
Join Date: May 2007
Posts: 86
Default

See first message for info on the easier Hekkus Sound System Wrapper.
Reply With Quote
  #6 (permalink)  
Old 12-28-2007, 11:58 PM
Knows the basics
 
Join Date: May 2007
Posts: 86
Default

The Hekkus wrapper has been updated see post number 1 in this thread for the changes and new download.
Reply With Quote
  #7 (permalink)  
Old 05-09-2008, 10:15 PM
pmu5757's Avatar
Knows the basics
 
Join Date: Sep 2007
Location: Metz (France)
Posts: 51
Default 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.
__________________
Pascal
Reply With Quote
  #8 (permalink)  
Old 05-09-2008, 10:53 PM
Knows the basics
 
Join Date: May 2007
Posts: 86
Default

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.
Reply With Quote
  #9 (permalink)  
Old 05-10-2008, 04:49 PM
pmu5757's Avatar
Knows the basics
 
Join Date: Sep 2007
Location: Metz (France)
Posts: 51
Default 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 :

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 ?

Thank you.
__________________
Pascal
Reply With Quote
  #10 (permalink)  
Old 05-11-2008, 01:09 AM
Knows the basics
 
Join Date: May 2007
Posts: 86
Default

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.
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
The Hekkus Library doesn't work when used with the Optimized Compiler Louis Questions & Help Needed 5 12-28-2007 08:06 PM
SOund Input? PKinz Basic4ppc Wishlist 1 12-12-2007 02:51 PM
Controlling Sound derez Questions & Help Needed 0 10-28-2007 08:14 PM
Hekkus Sound System wrapper Louis Additional Libraries 18 09-27-2007 12:35 PM
Sound/Mic input Bill Todd Questions & Help Needed 2 06-22-2007 11:29 AM


All times are GMT. The time now is 12:59 PM.


Powered by vBulletin® Version 3.6.10
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.1.0