Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3368: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3370: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3371: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3372: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
OrbWorks Community Forum • View topic - Exit Head SoundManager
Page 1 of 1

PostPosted: Fri Aug 26, 2005 1:17 am
by exit_head
ive been having troble latley with playing sounds in async using, so i made a manager.

<code>

//EHsoundmanager
//version 1.0
//using SoundLib V1

library "SoundLib"
int EHsndptr[10],EHsndtime[10],sndSLOT,EHx,EHmode;

EHplaysnd(int EHsndID,string EHsndDB,int EHsndVOL,int EHsndLength){
EHsndptr[sndSLOT]=PlaySound(EHsndDB,EHsndID,EHsndVOL,1);
EHsndtime[sndSLOT]=EHsndLength+ticks();
if(sndSLOT==9)sndSLOT=0;
else(sndSLOT++);
}

EHsoundmanagerFREE(){
if(EHsndtime[EHx]>ticks() && EHsndptr[EHx]!=0){StopSound(EHsndptr[EHx]); EHsndptr[EHx]=0;}
EHx++;
}

EHsoundmanagerCLEAR(){
if(EHsndptr[EHx]!=0)StopSound(EHsndptr[EHx]);
EHx++;
}

EHsoundmanager(int EHmode){
if(EHmode==0){
EHx=0;
do(EHsoundmanagerFREE());
while(EHx<9);
}
if(EHmode==1){
EHx=0;
do(EHsoundmanagerCLEAR());
while(EHx<9);
}
}

</code>

its simple but it gets the job done. You can play up to 10 sounds before you have to release some.

EHplaysnd(int EHsndID,string EHsndDB,int EHsndVOL,int EHsndLength);

int EHsndID is the resource number
string EHsndDB is the database the sound is located in.
int EHsndVOL is the volume you want to play the sound. (i use 512)
int EHsndLength is the lenght of the .wav file in mil seconds.

EHsoundmanager(int EHmode);

int EHmode is:
0 is normal
1 is clear all, this will release all sound regardless of how much has played.

EXAMPLE:

<code>
@cid "test";
@name "test";
@dbname "test";
@category "Games";
@ver "1.0";

include "EHsoundmanager.pc"

int e,end;
pointer exitfunc;
@res "WAVE,1300,sound.wav";

mainloop(){
//blah blah
EHsoundmanager(0);
e=event(1);
if(e==12)end=1;
//pen input or what ever you want to do here.
}

clearsound(){
//clears ALL sound pointers
EHsoundmanager(1);
}

main(){
graph_on();
title("TEST");
exitfunc=clearsound;
atexit(exitfunc);
//blah blah
//other start up code here
//the following asumes the name of this app database is "test" and
//you have a .wav rsrc with the rsrc # 1300 and is .15 seconds long
EHplaysnd(1300,"test",512,15);
sleep(50);
EHplaysnd(1300,"test",512,15);
do(mainloop());
while(end!=1);
}
</code>


just be sure you have EHsoundmanager(0); in your loops and it will release the sounds when they are done playing automaticaly.

PostPosted: Sun Sep 04, 2005 12:35 am
by exit_head
dont know if anyone is interested but ive now gotten background music to play(lower quality wav) if anyone is interested post here and ill make a releaseable version (zip)


my latest test version of dzeeet uses the EHsoundmanager to play background music.

http://www.theexithead.com/DZEEETtest13.zip

Nate Edwards

PostPosted: Sun Sep 04, 2005 12:15 pm
by SyPDA
Interested! :D

PostPosted: Tue Sep 06, 2005 2:14 am
by exit_head
ok, ive assembled a little "demo" that shows you how to use EHSoundManager.pc

it shows a happy little animation and plays the music.

http://www.theexithead.com/EHsoundmanager110.zip

Questions Comments?

PostPosted: Tue Sep 06, 2005 8:03 am
by Mikael
Hi,

Any idea what the maximum allowable length of a particular sound file is?
I've been playing around with a background music clip on the Simulator and can't seem to get the demo to work with anything longer than about 6 seconds. Any longer and I get an alert telling me that the Simulator has skipped the sound resource. I'm using 8 bit at 8.00 Khz.

Thanks in advance,

Mikael

PostPosted: Tue Sep 06, 2005 8:26 am
by exit_head
ahh its not the length but the SIZE, palm os cant handle resources larger then 64k
im working on being able to, string together longer soungs out of broken up bits and loop that. dont worry :) but even then the size of the DB will be HUGE!

Nate "i need some sleep" Edwards