Page 1 of 1

AmigaOS3: selected audio channel is out of range

Posted: Tue May 05, 2020 11:28 am
by amyren
I have this game, where my previous version just played its samples without specifying an audio channel.
Then I ran into issues with the android version, so I did change this so they all had audio channel specified.
like this:

Code: Select all

PlaySample(2, {Channel = 2})
This worked well for android and windows versions.
But now when compiling the OS3 version, it will exit with an error: "selected audio channel is out of range"
For debugging, I did use the GetChannels() and etxtout, so I see that there are 8 channels available before the error happens.

Re: AmigaOS3: selected audio channel is out of range

Posted: Sat May 09, 2020 12:32 pm
by airsoftsoftwair
This is because of the legacy audio driver that is still the default one on AmigaOS 3. The legacy audio driver reserves the first 4 channels for Protracker playback because of the limited CPU power on 68k, Protracker modules aren't mixed down to one channel (as it is done on all other platforms) but they're played through 4 channels as it is usually done on original, Paula-based hardware. This has the advantage that not many CPU cycles are wasted on Protracker playback.

The disadvantage is that you can only use channels 5 to 8 for sample playback on OS3. Alternatively, you can also disable the legacy audio driver by using the "-nolegacyaudio" argument in which case Hollywood on OS3 will behave like on all other platforms (but sound playback might be slower then).

Re: AmigaOS3: selected audio channel is out of range

Posted: Sat May 09, 2020 10:37 pm
by amyren
That explains the error. But why does getchannels report that there are 8 available channels?

Re: AmigaOS3: selected audio channel is out of range

Posted: Sun May 10, 2020 11:41 am
by airsoftsoftwair
amyren wrote: Sat May 09, 2020 10:37 pm That explains the error. But why does getchannels report that there are 8 available channels?
Because there are 8 channels :) It's just that the first 4 are reserved for the legacy Protracker player...

Re: AmigaOS3: selected audio channel is out of range

Posted: Mon May 11, 2020 8:46 pm
by amyren
Ah. I see now. I should use HaveFreeChannel to check if the channel can be used.
Perhaps it could be mentioned in the docs that those channels are reserved?

Re: AmigaOS3: selected audio channel is out of range

Posted: Tue May 12, 2020 9:49 pm
by airsoftsoftwair
amyren wrote: Mon May 11, 2020 8:46 pm Ah. I see now. I should use HaveFreeChannel to check if the channel can be used.
Perhaps it could be mentioned in the docs that those channels are reserved?
Yes, that's a good idea. Actually, I thought it was in the doc already but apparently that's not the case. Will add it.