Closed FM1337 closed 6 years ago
Hi, all of this can be done in Beep, I'll be happy to help! But to avoid wasting time, tell me what you can do and where you're stumbling and I'll explain it from there.
Well I can get background music looping by using beep.loop(-1, source) and then doing a speaker play of that.
but the moment I try to play another sound (such as a sound effect) it plays the sound effect but stops the music.
I tried the mixer but I can't seem to get it working.
I believe the mistake you are making is that you're calling speaker.Init
each time you start playing something. That will reset the speaker. You should only call speaker.Init
once at the beginning of your program.
Hmm okay, I'll try only calling it once; but wouldn't that mean if you tried to play two different kinds of audio files, one is a .wav and the other is .mp3 wouldn't the sound be messed up because both of them would have a different sample rate?
Yes, they would, but that's what you should use beep.Resample
for.
Alright I appear to have it working, now I just need to find a way to lower the volume of the background music so I can hear some of the sound effects.
Thanks!
You can use the volume effect for that ;)
@FM1337 please, show example how did you do that :)
I got it mostly working but it would segment on itself after the music was finished playing. I haven't touched the code in a few months but I'll look into it when I get time.
Your game was for mobile devices?
Okay, so I know mixers are a thing in this library but what I need to do doesn't appear to be covered by that.
So let's say I have a game with background music playing, but I want to do sound effects when something happens, but I don't want the music to be interrupted/restarted and I want it to continue playing but also play the sound effect when it's needed
how would I go about accomplishing this?