e3 Rental Property Website

Welcome Guest (Register -  Login)  Active Topics Active Topics Display List of Forum Members Memberlist Search The Forum Search Help Help
 Navigation
 Skin Chooser

Choose Skin:


There are 2 skins total.
The newest skin is Classis Default

 Latest Forum Posts

Sound and Music
 C++ GamesSound and Music
Subject Topic: play wav file while moving Post ReplyPost New Topic
 play wav file while moving
<< Prev Topic | Next Topic >>
stranomavero
Posted: 17-October-2007 at 1:11pm | IP Logged Quote stranomavero

Newbie
Newbie


Group: Newbie
Joined: 17-October-2007
Location: Ireland
Posts: 2
Hello everyone!
first of all,i have to say i'm using OpenAL  for playing my sounds.

I'm creating a 3D environment to display urban developments.
I want to play a wav file (steps) while the user is moving inside the environment and don't play it while is standing still.

that's the bit of code i wrote to achieve this outcome

int j=0;
float x[j],y[j];
float xmov,ymov;

for(;;j++){
xmov=x[j+1]-x[j];
ymov=y[j+1]-y[j];
if(xmov!=0 || ymov!=0)
alSourcei(g_sources[2],AL_LOOPING,AL_TRUE),alSourcePlay(g_sources[2]);
else alSourcei(g_sources[2],AL_LOOPING,AL_FALSE);
Sleep(250);
}
it doesn't give me any error...but it doesn't work too.
I didn't set any limit to j as i want it to loop endlessly. is this the problem?
 
Online Status: Offline
View stranomavero's Profile Search for other posts by stranomavero Back to Top
 
DutchDude
Posted: 19-October-2007 at 2:44am | IP Logged Quote DutchDude
Avatar
Super Dedicated Groupie
Super Dedicated Groupie


Group: Super Dedicated Groupie
Joined: 02-April-2007
Location: Netherlands
Posts: 71
First I would like to say, I don't use OpenAL, and I'm just trying to help.
Also I use Irrklang should anyone care, I like it, because I also use Irrlicht and they go together nicely.

Maybe it plays the .wav file, but your soundcard doesn't support it or other music has more volume and is thus making it unhearable.
I think you know what you are doing and so these may just be useless, but if the engine updated, you may need to update your soundcard drivers.
As fo the music having too much volume, just put the other music as a comment
(  /* CODE */ ) and see if thats it.

Now for a different suggestion.
I would try using a while loop, instead of an if for playing sounds that are supposed to happen while something is happening (e.g. walking).
Maybe it's just my personal style but it does help in making it more understandable and maybe OpenAL doesn't play sounds looped using an if, in a situation like this.

I hope this helped you, or anyone else reading this.
Again, I don't use OpenAL, I'm just trying to help by giving a fast reply so you have some things to try out, don't be mad at me for being wrong.
 
Online Status: Offline
View DutchDude's Profile Search for other posts by DutchDude Visit DutchDude's CppGames Back to Top
 
stranomavero
Posted: 19-October-2007 at 6:00am | IP Logged Quote stranomavero

Newbie
Newbie


Group: Newbie
Joined: 17-October-2007
Location: Ireland
Posts: 2
thank u very much,i'll try with the while loop as u suggested! 

i can play other sounds,so i think my sound card is fine with openAL...i only think there is something wrong with the loop i wrote,so i'll give it a shot with the while one!

thanks againg for your help
 
Online Status: Offline
View stranomavero's Profile Search for other posts by stranomavero Back to Top
 
1 User(s) are browsing this topic, 1 Guest(s) and 0 Member(s)
0 Members:
<< Prev Topic Sound and Music Next Topic >>

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.2031 seconds.

[ Users browsing page: none ]



Terms and Conditions | Privacy | Contact Us

Copyright © 2010 Cpp Games. All rights reserved.

This site is best viewed at 1024x768 screen resolution.
Back to Top

Designed by Micronet Technologies