Hi! I’m new to fmodex so i will go straight to the problem:I have small player,i play the sound and then i press the button to stop the sound.and the sound is stopped.But if i press again the stop button and no sound is playing my app will crash.The code behind the stop button is this:[code:6n2a8nll] channel->stop [/code:6n2a8nll]
I try to make a test if numebr of channels that are playing is equal to 0 then don’t do any "channel->stop".I do this with this function [code:6n2a8nll]System::getChannelsPlaying(
int * channels);[/code:6n2a8nll]
But this don’t work ,is like nr of channels that this function return isn’t 0.
Anyway could somebody help?
Thanks a lot![/code]
- fioan89 asked 9 years ago
Ok! thanks! But i have a question.Is there a tutorial on the net to get a little deeper with fomd?For now all that i learn was from official api docs and from examples that comes with the libs!In documentation all that is pressent is just the sequence to init the sound and play the sound!The rest is just api refferences.And it’s a little hard for a begginer that have no founds on sound techniques! To be more clear i’ll give an example:In my case if i want to pause a song i could do this via channel->setPaused or just with the system->playSong(…,..,true,…);.Now as a begginer my first question is since these 2 method’s do almost the same job than what is the difference?One pause the channel and one pause the song? but what is the difference or a better question when to use these two?
Oh about the tutorial did some search with google but i didn’t manage to get something god!
Cheers and please excuse my bad english!
- fioan89 answered 9 years ago
There are only the example files provided. they cover most every concept you will need to know.
But I see your confusion…
a sound holds the information about the sound file and data/specs
a channel holds information about a playing sound. it allows to control what is being heard.
The way I see it, a channel is a "playing instance" of a sound.
channel1 = soundPlay(sound1)
channel2 = soundPlay(sound1)
2 seconds later
soundPlay does take a pause argument. it’s usually for when you want to setup some more paramiter for that specific channel before you want to play it… Or when you want to prepare the channel to be played later with no delay, so to say, start a few sounds at the same time…
- icuurd12b42 answered 9 years ago
welcome to the forums fioan89.
It’s hard to diagnose your problem from the information you have provided. A few things to note: it is extremely important to check the FMOD_RESULT returned from every function. so:
Assert(result == FMOD_OK);
You need to do this every time you call [i:2umpeuth]any[/i:2umpeuth] function from the FMOD API.
Also worth noting that calling channel->stop will ‘kill’ that channel. Any further operations on that channel will do nothing and return FMOD_ERR_INVALIDHANDLE result.
A good place to get started is to look at our examples that come with the API. There are quite a lot of examples and the demonstrate all the different features of the API.
- Guest answered 9 years ago
Please login first to submit.