fungus

Open full view…

URGENT: Can't play two Audio loops, or audio loop + music

Marcos Venturelli
Mon, 24 Aug 2015 06:18:27 GMT

I'm finishing my Ludum Dare game but just realised I can't seem to play two audio files in loop at the same time. If I'm playing music and I started playing an Ambient it stops the music. I'm using "Control Audio" for the loops and music, but even if I use Play Music + Control Audio it still stops the previous looping sound Can anyone offer some light on the matter? I have just a few hours :O

Marcos Venturelli
Mon, 24 Aug 2015 06:48:07 GMT

Accidentally bumped myself on the other post :O

Soloflare Interactive
Mon, 24 Aug 2015 11:23:00 GMT

Hmm coming from the Ren'py visual novel engine, the way to play two audio loops at the same time is to make a 2 channel declaration (basically assign each audio file to a different channel and instantiate them at the same time, or whenever desired). This is a most definite solution. I do not know the specific on how to accomplish this in Fungus, but once I work out a solution I will let you know.

chrisgregan
Mon, 24 Aug 2015 19:50:00 GMT

You're on the right track with Control Audio, but it sounds like you're only using one AudioSource? You need to have two separate AudioSource objects to play two music tracks at the same time. Play Music gives you very simple, but very basic control over playing music. For anything more sophisticated you should use the Control Audio command.

Marcos Venturelli
Tue, 25 Aug 2015 13:44:55 GMT

I use two different audio sources, of course :) The Control Audio is indeed broken, at least for me. Just try playing two looping audio files and you will see. They also make the "Play Music" command stop. Haven't tried creating a new project to test it, so it may be something I did with my project, not sure. I have "fixed" it by creating my own audio methods and calling them, but there's definitely a problem there

chrisgregan
Tue, 25 Aug 2015 15:34:06 GMT

Ok thanks for letting me know, I've added a [github issue](https://github.com/FungusGames/Fungus/issues/132) for it.

chrisgregan
Tue, 25 Aug 2015 16:13:57 GMT

Found the problem (had to do with gameobject tags). Just committed the fix to github.

Marcos Venturelli
Tue, 25 Aug 2015 17:03:16 GMT

Thanks! I created a version of "Play Music", "Play Audio" and "Set Audio Volume" scripts that had support for multiple channels. I'd send it as a Pull Request, but I take it that fixing the original method is better haha

chrisgregan
Tue, 25 Aug 2015 22:42:53 GMT

Yeah Play Music, etc. are designed to be as simple as possible, but not very powerful. Control Audio is there for when you need something more powerful. Thanks again for the bug report!