Share your opinion
WIDGETS GAMBAS
GAMBAS 3 SOFTWARES
TUTORIALS
Library
|
Gambas 2 - gb.sdl.sound
GB.SDL.SOUND
Hye, Today we explain the gb.sdl.sound component who play a sound from Gambas. SOUND To play a sound with this command use this code : mysound = NEW Sound("/home/user/yeah.wav") mysound.play the first line load sound in the mysound variable. The second line play to the soundcard the sound. Well, there is a problem. It is impossible to stop the sound while you play it. And we don't know which channel play. We don't have to code as this. CHANNELS this is the channel which you plaay the sound. There is 32 channels. It is easy to play the sound qith this code : mysound = NEW Sound("/home/user/yeah.wav") Channels[3].Play(mysound, 0) The first line preload the wav sound in the mysound variable and the second line play the sound on the channel 3 and repeat it 1 time(0 number) If you want to repeat in loop, put -1 If you want to repeat 1 time, put 0, 2 time put 1 etc... The advantage to code with this method, you can drive correctly your sound : PAUSE, PLAY STOP, et VOLUME example : Channels[3].Pause Channels[3].Stop Channels[3].Volume = 0.12 volumemust be from 0.1 to 1as from 1 to 100% MUSIC this command play some MP3 from direct to disk without preload in memory : Music.Load("/home/user/essai.mp3") Music.Play CDROM You can drive CDROM unit with this command in the same thing as MUSIC command regards information : Per haps, you have the ERROR 11. this is a ubuntu bug and not a gambas bug. Creation date : 11/01/2011 @ 20:15 Reactions to this article
| QUICK MENU
SEARCH
LANGUAGE
COMPONENTS
Other
LANGUAGE
Where, who?
VISITS
visitors visitors online ARCHIVES GAMBAS 1/2
|