[Gambas-user] sdl2 application

Charles Bukowski charlesbukowski.italy at gmail.com
Tue May 3 14:28:11 CEST 2022

Hello, I am writing a simple application that plays a self made .wav file
using sdl2.
It is a main form with a button that opens another form with three buttons
: one to choose the file to play, one to close form and go back to main and
the other to close the application.It works, but the sample is played for
eight (???) times only; clicking on the button for the ninth time and
further, sound channel is muted.Furthermore, Is it possible to declare
event handlers of the second form private? When doing it instead of public,
compiler raises "unused function" warning.

Here my code :

Private Sub PlayAudio()
' sound object creation, channel object creation
 Dim sample As Sound
 Dim audio As New Channel
'end creation

 Dim Filename As String

 Dialog.Filter = ["*.wav;*.mp3", "audio files"]
 Dialog.Path = Application.Path
 Filename = Dialog.Path

 ' if no selection back to calling form
 ' otherwise loads audio and play

  If Filename = Application.Path Then
  sample = Sound.load(Filename)
  'destoying audio objects
  audio = Null
  sample = Null

Public Sub QuitProgram_Click()  --------> ok public
Public Sub CloseWindow_Click()-----> is it possible to declare as private?
(if not public it raises a compilation warning)
Public Sub PlayWavFile_Click() -----> is it possible to declare as private?
(if not public it raises a compilation warning)

Many Thx
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20220503/ffcff53c/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gambas conf
Type: application/octet-stream
Size: 2067 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20220503/ffcff53c/attachment.obj>

More information about the User mailing list