Page 1 of 2
Failed To Allocate Audio Channel
Posted: Thu Dec 12, 2024 6:26 pm
by oceanarts
I don't think I've had this error before. (I've had to reinstall my Linux system because of some Nvidia issue, and this problem just manifested)
I have a single ambient music track playing continuously and a sample which triggers on MouseOver at various locations.
It's set up like this:
Code: Select all
@SAMPLE 1, "trm_select.wav"
@MUSIC 1, "trm_hum.wav"
PlayMusic(1, {Times = 0, Volume = Mst_Vol - Mus_Vol})
PlaySample(1, {Volume = Mst_Vol - Sfx_Vol})
Any ideas what could be wrong? I thought Hollywood handled this appropriately in the background.
Re: Failed To Allocate Audio Channel
Posted: Fri Dec 13, 2024 8:20 am
by Bugala
Have you tried this on other platforms too, that does this only happen on Linux, or on others too?
I think error message should be different, but one possibility that comes to my mind is that if the sample is, are they called 32-bit samples or what? For Hollywood doesn't handle the most modern samples, but they need to be converted to lower version first. Lately getting sound libraries often require to convert the sounds first to lower versions for them to work in hollywood.
Re: Failed To Allocate Audio Channel
Posted: Fri Dec 13, 2024 7:03 pm
by oceanarts
Seems I didn't include StopSample(x) later in the code.
But I honestly didn't think it would be needed as the sample in question was about half a second long (but I guess it's good practice in any case).
Does that mean that a channel isn't automatically freed when the sample has finished playing?
Re: Failed To Allocate Audio Channel
Posted: Fri Dec 13, 2024 7:52 pm
by oceanarts
Well, actually StopSample doesn't solve anything.
The user might trigger that sample with their mouse multiple times, StopSample just abruptly stops it, as I guess it should.
I don't understand. I didn't have this problem before.
Re: Failed To Allocate Audio Channel
Posted: Fri Dec 13, 2024 11:05 pm
by Bugala
My guess, without seeing your code, is that you are triggering that PlaySample or PlayMusic so many times you run out of channels. Hollywood automatically chooses vacant channel for your newest "PlaySample", as long as one is available.
put "Debugprint("Playing Sample") right before that PlaySample and PlayMusic lines, and see how many times it prints that out.
Re: Failed To Allocate Audio Channel
Posted: Sat Dec 14, 2024 1:47 pm
by Flinx
Re: Failed To Allocate Audio Channel
Posted: Sat Dec 14, 2024 5:58 pm
by oceanarts
Well, The ResourceMonitor didn't tell me much, but Hollywood crashes when the ninth instance of the sample is triggered which fits with the default eight channel limit. But that's still never happened before, and it's not counting the music sample playing continuously. Maybe there's something wrong with the sound system on this new Linux install? Is that possible?
Re: Failed To Allocate Audio Channel
Posted: Sun Dec 15, 2024 6:42 pm
by oceanarts
So, I reinstalled Fedora which I used before I attempted Pop! OS (Ubuntu based) and the problem is no longer there.
Hollywood no longer crashes and the sample plays fine no matter how many times it is triggered.
I don't know what it was... A Pipewire issue, maybe?
Re: Failed To Allocate Audio Channel
Posted: Mon Dec 16, 2024 10:23 pm
by airsoftsoftwair
oceanarts wrote: ↑Sun Dec 15, 2024 6:42 pm
So, I reinstalled Fedora which I used before I attempted Pop! OS (Ubuntu based) and the problem is no longer there.
Hollywood no longer crashes and the sample plays fine no matter how many times it is triggered.
I don't know what it was... A Pipewire issue, maybe?
Maybe, audio on Linux is a difficult thing and I've also seen buggy audio drivers. That being said, you must make sure there is a free channel before you start audio playback using
PlaySample() or
PlayMusic(). By default, Hollywood allocates 8 channels so if you call
PlaySample() 9 times you'll get an error. If you don't want that, you could hard-code the channel for each audio playback by using the "Channel" tag of
PlaySample() or
PlayMusic(). From the manual:
"Channel": Channel to use for playback of this sample. By default,
PlaySample() will automatically choose a vacant channel and will fail if there is no vacant channel. To override this behaviour, you can use this field. When specified, it will always enforce playback on the very channel specified here. If the channel is already playing, it will be stopped first.
If you hard-code the channel to use, there'll never be an error complaining about not enough free channels. But of course it means that if there's already something playing on the channel you specify, that previous playback will be stopped.
Re: Failed To Allocate Audio Channel
Posted: Sat Dec 21, 2024 8:53 pm
by oceanarts
Thanks! I'll add that tag.
