looping ogg samples in MMF2
I'm just beginning to put in bgm but I want to use ogg files to keep the file sizes low. It seems like ogg's are only called through samples and not music. Unfortunately, this means there is no "Has a Music just finished" condition.
I tried to use the following:
Start of Frame:
-Play sample XXX on Channel#1
Is sample not playing:
-Play sample XXXX on Channel#2
Sadly, this results in a crash when the second event line activates. There isn't much documentation on sound handling, so does anyone know what might be happening? Or are there any articles written on this that I might be missing with basic searches?
Thanks in advance,
Mobichan
Re: looping ogg samples in MMF2
you should be able to use the 'is a specific sample not playing' condition...
you can also choose the 'play and loop a sample' action
0 sets looping forever, otherwise choose a number of repetitions
maybe there is something about he channel switching?
Dave
I tried your code examp,le on my machine and it seems to work
Re: looping ogg samples in MMF2
Do you use the latest MMF2 build? The early ones can cause crashes on some machines when you attempt to play ogg files.
Re: looping ogg samples in MMF2
I just realized that after a recent install, I didn't apply the update patch. But even after upgrading to bR247 it still has the same problem.
Also, if I play the samples "from a file", the sound will play static until I click on the title bar of the game window (and resume static when I stop clicking on the title window.
Another annoying thing is that when I add a file to my samples list, there is no way to remove it (except rolling back to a previous version of my game)
Anyone have any ideas?
Re: looping ogg samples in MMF2
Re: looping ogg samples in MMF2
If you save MMF will remove any unused samples at that time.
I can't reproduce the static problem.
Can you upload a file with an OGG to show this?
Re: looping ogg samples in MMF2
Here is a brand new file I created that still demonstrates the same problem.
File with sample issue
The initial sample is about 12 seconds long. After that, it should go and play the loopable sample. All I hear is static once the second loop begins. (I've tried it on 2 PC's to make sure it wasn't my home PC) Also, if you click on the title bar once you hear static, it will reinitialize the second loop.
I wondered if it might be the sample rate of the ogg. I am using 325, but I can try lower. I also got some wav versions of the files, but they are a bit larger, so I would rather go with ogg if possible.
Hope this helps find the problem,
mobichan
Re: looping ogg samples in MMF2
Try checking the application property play sounds over frames in the Application-runtime properties
Another good option might be to check the do not mute when loses focus.
Then I would also just play and loop under the start of frame.
Once you have checked the play sounds over frames you shouldn't need to test if it is playing.
Re: looping ogg samples in MMF2
Quote:
The initial sample is about 12 seconds long. After that, it should go and play the loopable sample. All I hear is static once the second loop begins. (I've tried it on 2 PC's to make sure it wasn't my home PC) Also, if you click on the title bar once you hear static, it will reinitialize the second loop.
I checked the example. When the intro has finished played, the second event (Bgm_lvl01_intro is not playing) will remain true all the time. Thus, the loop sample will start over on every main loop (usually 50 times per second).
The condition 'Bgm_lvl01_intro is not playing' doesn't trigger one time only when the sound stops playing. On every main loop, that condition will be true and trigger it's actions whenever the specified sound is not playing. By this reason, you have to add an addition condition to restrict it to happen only one time. In this case either 'run this event once' or 'Bgm_lvl01_loop is not playing' would solve your problem.
The reason that the sound starts to play when the application loses focus, or you do something else to to pause the application, is that the main event loop will not run. That finally gives your sound a chance to play without being resetted.
This is basically not an MMF2 problem, it's your application which is incorrectly programmed.