[Gambas-user] gb3: gb.sdl.sound disallows more than 8 sounds/channels at once

Kevin Fishburne kevinfishburne at ...1887...
Sun Jul 24 11:50:37 CEST 2011

On 07/24/2011 05:17 AM, Benoît Minisini wrote:
>>> I can play eight sounds simultaneously, adjusting their volumes as
>>> needed, but when I try to set the volume of the channel of the ninth
>>> sound I receive an error saying that the channel is null (even though
>>> the ninth sound actually starts playing at a volume of 1).
>>> ...
>> Sorry, it's my fault. I never noticed that the SDL_mixer used only eight
>> channels by default. I will fix that and tell you.
>> Regards,
> No, it's not my fault. I just forgot how that component works.
> You must define the Channels.Count property to the number of channels you need
> : it is eight by default, and can grow up to 32 (this is an arbitrary limit,
> tell me if more is needed).
> Regards,

Awesome news. I'm glad 32 is arbitrary, also. I have:

' General declarations.
Public Struct Effect  ' Structure containing an individual sound 
effect's data.
   Sample As Sound       ' Waveform data (file).
   Chan As Channel       ' Default channel to play on.
   AmpCurrent As Single  ' Current amplitude.
   AmpTarget As Single   ' Target amplitude.
   AmpScale As Single    ' Target amplitude multiplier.
End Struct
Public Environment[16] As Struct Effect ' Environmental sound effects.

Public Sub Initialize()

   ' Start basic environmental sound effects.

   Channels.Count = 32

   ' Start deep water effect.
   Environment[0].Sample = New Sound(GUI.basepath & "/sound/Ocean.wav")
   Environment[0].AmpScale = 1
   Environment[0].Chan = Environment[0].Sample.Play(-1)
   Environment[0].Chan.Volume = 0

   ' Start medium water effect.
   Environment[1].Sample = New Sound(GUI.basepath & "/sound/River.wav")
   Environment[1].AmpScale = 1
   Environment[1].Chan = Environment[1].Sample.Play(-1)
   Environment[1].Chan.Volume = 0

   ' Etc., etc., etc...

End Sub

It's like it doesn't listen to the Channels property.

Kevin Fishburne
Eight Virtues
www: http://sales.eightvirtues.com
e-mail: sales at ...1887...
phone: (770) 853-6271

More information about the User mailing list