Multiple Audio File Playing

Started by Vincent, Thu 28/08/2025 09:30:37

Previous topic - Next topic

Vincent

Hello Agsers, yesterday I run into an issue while playing some audio playback (using AGS 4 alpha22).

My Problem:
I have three audio elements:

A footstep sound effect that plays when the player character moves.

A looping flame sound effect that plays continuously in the room.

A background music track for the room.

The issue is that the background music stops as soon as the footstep sound plays. The flame SFX continues to loop without a problem. It seems like the footstep sound is "stealing" the channel from the music. I've made sure the music is set to play on the Music audio channel and the footstep/flame is set to play on the Sounds channel. I've also made sure that both of the channels are set to MaxChannels to 0. I also tried to add the music track into the Ambient Sound channel but it acted the same, what should I do?


:FIXED:
My mistake, the error was that I was manually managing channels 1 and 2 via code for the footstep sounds (trying to alternate between channels 1 and 2 to prevent cutting off sounds) and the problem was that if other sounds in the game like the music track are using these same channels, they'll cut each other off, so to prevent it I only had to define my Channels and then use PlayOnChannel to avoid the problem.

Snarky

Try setting MaxChannels for the Music AudioType to 1. This guarantees that there is always a channel dedicated to Music.

Vincent

Quote from: Snarky on Thu 28/08/2025 10:19:56Try setting MaxChannels for the Music AudioType to 1. This guarantees that there is always a channel dedicated to Music.

Thanks Snarky, yeah it's actually what I did right now but it was a mistake of mine, I edited the first post.

SMF spam blocked by CleanTalk