Forums | developer.brewmp.com Forums | developer.brewmp.com

Developer

Forums

Forums:

I've been try to loop a MIDI file but for some reason it won't work. I have registered a notification when the MIDI file is done, and it comes through perfectly.

I then call

ISOUNDPLAYER_Stop( curApp->Sound );
ISOUNDPLAYER_Play( curApp->Sound );

to restart the MIDI track, with curApp->Sound being a pointer to my ISound object, evidently.

I included the ISOUNDPLAYER_Stop because I read somewhere in the docs that it always has to be called before you make another call to ISOUNDPLAYER_Play.

However, my track is playing only once. I tried rewinding the track but it didn't help either. Am I missing something?

Thanks

I get a loop by calling SetInfo (again) and then Play in
AEE_SOUNDPLAYER_DONE. I don't call Stop. This at least
works to get looping for qcp files. YMMV
Cheers, Scott

I get a loop by calling SetInfo (again) and then Play in
AEE_SOUNDPLAYER_DONE. I don't call Stop. This at least
works to get looping for qcp files. YMMV
Cheers, Scott

Well, you may try to stop and then setting a callback with 0 delay just to play,
that may work, it seems to have some problems stopping and playing right away, I don´t remember for sure but I think the api says that when you hit play and something´s already playing, it stops the current playing and then start, but that seems not to work.
I tried all this in cdm9500, not sure for other devices.
abd for looping a midi I think it has a param, when you play or a setinfo, or something like, that you set wich the delay is between each play, I think that you can set how many times you want to play either,
not sure if that is for the soundplayer interface or ringermgr interface, but that worth taking a look, iringermgr interface is a lot simplier

Well, you may try to stop and then setting a callback with 0 delay just to play,
that may work, it seems to have some problems stopping and playing right away, I don´t remember for sure but I think the api says that when you hit play and something´s already playing, it stops the current playing and then start, but that seems not to work.
I tried all this in cdm9500, not sure for other devices.
abd for looping a midi I think it has a param, when you play or a setinfo, or something like, that you set wich the delay is between each play, I think that you can set how many times you want to play either,
not sure if that is for the soundplayer interface or ringermgr interface, but that worth taking a look, iringermgr interface is a lot simplier

The Setinfo suggestions you made with regards to delay and looping only exist in the IRINGERMGR not in the ISOUNDPLAYER, unfortunately.
But even there, they are not what I need as a delay of 0 is illegal, which would be imperative to create a seamlessly looping track.
Also the Ringer Manager hardly seems suitable to play in-game music, so I still believe SoundPlayer would be the way to go.
Today I noticed that my tracks are indeed looping wit hthe technique I described above. They only have a minute-long pause between the loops or so.
Any more ideas or suggestions anyone? I'm still having trouble getting this to work properly.

The Setinfo suggestions you made with regards to delay and looping only exist in the IRINGERMGR not in the ISOUNDPLAYER, unfortunately.
But even there, they are not what I need as a delay of 0 is illegal, which would be imperative to create a seamlessly looping track.
Also the Ringer Manager hardly seems suitable to play in-game music, so I still believe SoundPlayer would be the way to go.
Today I noticed that my tracks are indeed looping wit hthe technique I described above. They only have a minute-long pause between the loops or so.
Any more ideas or suggestions anyone? I'm still having trouble getting this to work properly.

I have finally been able to solve the problem and just wanted to close this thread with the information that ultimately solved the problem.
As Marcel correctly assumed, you cannot STOP one track and immediately PLAY another one. There needs to be a delay in between that allows the system to terminate the original track.
So, I now make a call to stop my track and then in the next event-loop timer callback I start the new track. That solves the problem.
Thanks to everyone for their suggestions and input.

I have finally been able to solve the problem and just wanted to close this thread with the information that ultimately solved the problem.
As Marcel correctly assumed, you cannot STOP one track and immediately PLAY another one. There needs to be a delay in between that allows the system to terminate the original track.
So, I now make a call to stop my track and then in the next event-loop timer callback I start the new track. That solves the problem.
Thanks to everyone for their suggestions and input.

Hi Dragon
How do you introduce the delay in between sounds?
I am facing a problem wherein the I have a looping midi and immediately after this midi is stopped I need to play another sound. And this 2 nd sound does not play at all. ANy sound after that plays.
Actually I use ISHELL_PostEvent to call Stop Sound for the looping sound, and that gets called after Soundplayer has been initialised with the second sound.
Let me know how I can introduce a delay between the sounds.

Hi Dragon
How do you introduce the delay in between sounds?
I am facing a problem wherein the I have a looping midi and immediately after this midi is stopped I need to play another sound. And this 2 nd sound does not play at all. ANy sound after that plays.
Actually I use ISHELL_PostEvent to call Stop Sound for the looping sound, and that gets called after Soundplayer has been initialised with the second sound.
Let me know how I can introduce a delay between the sounds.

You will have to queue your sound effects. After you stop the current effect you write a request for the next one into a queue. The next time your EventHandler is called it checks if there is a request in the queue and then plays that sound. That way there is always at least one timer interval between the Stop() and the Play() call.

You will have to queue your sound effects. After you stop the current effect you write a request for the next one into a queue. The next time your EventHandler is called it checks if there is a request in the queue and then plays that sound. That way there is always at least one timer interval between the Stop() and the Play() call.