audio question

cmartins

Member
Licensed User
Longtime User
Hi All


How can I run 2 different audios at the same time.

I tried it but all the time when I load the last file or a beep the first file loaded stop.
 
Last edited:
What exactly have you tried, can you post some code so we don't have to start from scratch and know which libraries you are looking at.
 
Upvote 0
My application use around 100 litte wave file to inform the speed that vehicle should run (1 km/h to 85km/h) and other advises.

can I load all WAV files in soundspool and play when the application ask or load and play the WAV file and after use unload?
 
Upvote 0
I've succesfully loaded 250 ogg files (3 MB total) into memory, and play several of them at the same time using soundpool, unloading them, playing another bunch, etc.
 
Upvote 0
This is an example. If you have 100 sounds under ./Files/snd/ named sound1.wav, sound2,wav ... sound99.wav, then:

Code: Copy
Dim soundsLoaded(100) As Int ' IDs of loaded sounds
Dim SP As SoundPool ' SoundPool Object
SP.Initialize(16)   ' Max number of sounds in soundpool playing sametime
soundsPlaying(16) As Int ' Here are stored the IDs of the sounds playing, so we can stop them

Do While (i < 100)
   filename = "sound" & i & ".wav"
   soundsLoaded(i) = SP.Load(File.DirAssets, "subfolder/" & soundname )
   i = i + 1
Loop

And:
Code: Copy
' To play a sound
soundsPlaying(0) = SP.Play(soundsLoaded(x), 1, 1, 1, 0, 1)

' To stop a sound
SP.Stop(soundsPlaying(X)) ' X should be a number from 0 to 15, in this case

' To stop all sounds
For n = 0 To 16
   SP.Stop(soundsPlaying(X))
Next
 
Upvote 0
I've succesfully loaded 250 ogg files (3 MB total) into memory, and play several of them at the same time using soundpool, unloading them, playing another bunch, etc.

Joseluis

what kind of files can we use with soundpool? I tried open ogg files but it doesnt work
 
Upvote 0
Back
Top