play 2 sounds successively?!

sound1.Play
sound2.PlayLooping

plays sound1 and sound2 simultaneously but how can i play it successively in ONE event?

thanks :slight_smile:

Sound1.play
While sound1.Isplaying
Wend
Sound2.play
But the app hangs while sound1 is playing.

So if that’s a problem for him, then he should perhaps make a thread.

[quote=50963:@Thomas ROBISSON]Sound1.play
While sound1.Isplaying
Wend
Sound2.play
But the app hangs while sound1 is playing.[/quote]

Another way would be to concatenate the two sounds using an AIFF editor such as Audacity, and create a new sound containing both. Then it becomes Sound.play :slight_smile:

Another idea: Open the sound as a movie file (rather than dragging it into the project) and play it using an invisible MoviePlayer. Then in the Stop event handler of the MoviePlayer, play the next sound.

I am looking to play up to 3 asynchronously triggered sounds simultaneously with master volume control. I’m sure I need one thread, but will I need 3 threads? Is killing a sound possible from another thread? Thanks…

Dim t, c as Integer
// 4000000 is a faster2 beep, 6000000 is a slower 2 beep rate
c = 6000000
Beep // 1st Beep

For t = c downto 0
// do nothing till count down
Next t
Beep // 2nd Beep

// for n beeps
Dim n, t, c as Integer
// 4000000 is a faster2 beep, 6000000 is a slower 2 beep rate
c = 6000000
Beep // 1st Beep

n = 3
for i as integer = n downto 1
For t = c downto 0
// do nothing till count down
Next t
Beep // 2nd and subsequent Beep
next i

Trying to to simultaneous .wav sounds not sequential beeps…

I am currently using ALSA and Pulse Audio and C++

John, open a new thread with a new title. Different subjects needs distinct calls for better results.

It’s not exactly the same problem, but …
The sounds are not played the same way when build in Carbon than in Cocoa.
I have a game which play a sound , and then do something and then play again the Sound, etc. I don’t do a loop to wait the end of previous sound, but I have animation between each sound (then time process).
In Carbon, I ear all the sound, in Cocoa I don’t ear all the sounds.

[code]Dim iNbre, Fin_iNbre as UInt32

ProgressWheel1.Visible = True
Fin_iNbre = Val(TextField1.text)

Beep
’ Whit.Play
For iNbre = 0 to Fin_iNbre ’ Anything in the loop to take some time
TextField2.Text = TextField2.Text + “a”
If (iNbre mod 10) = 0 Then App.DoEvents
Next iNbre
TextField2.Text = “”
App.DoEvents

Beep
’ Whit.Play
For iNbre = 0 to Fin_iNbre ’ Anything in the loop to take some time
TextField2.Text = TextField2.Text + “a”
If (iNbre mod 10) = 0 Then App.DoEvents
Next iNbre
TextField2.Text = “”
App.DoEvents

Beep
’ Whit.Play
For iNbre = 0 to Fin_iNbre ’ Anything in the loop to take some time
TextField2.Text = TextField2.Text + “a”
If (iNbre mod 10) = 0 Then App.DoEvents
Next iNbre
TextField2.Text = “”
App.DoEvents

ProgressWheel1.Visible = False
[/code]

This code in the action event of a push button. In TextField1 I have “50”. TextField2 is only here to take time process.
When run in Cocoa I ear one Beep, I ear the 3 Beep in Carbon.