Hi,
I am looking for help with the following problem:
I have two sounds, each resting in one of two MBS players, p1 and p2 (under AVAudioPlayerMBS). How do I make these two sounds alternate with each other? Previously, an eventhandler audioPlayerDidFinishPlaying of a AVFoundationMBS module, with the following code:
If player = App.p1 Then
App.PlayP1
Else
App.PlayP2
End If
performed the job, but this code now does only make p2 alternate with itself. (It stopped working correctly sometime during the spring of 2018).
Am running macOS XHighSierra, Version 10.13.5, Xojo 2018 Release 1.1, and MBS Plugins 181.
I shall be happy to forward the rather small application code, together with two sample sounds.
Any help with the above problem will be greatly appreciated.
Strange
Errata: The code , of course, should read:
If player = App.p1 Then
App.PlayP2
Else
App.PlayP1
End If
Strange
Are you sure both sounds still play? Maybe one got corrupted or is in a format that doesnt play?
What happens is that p2 plays once, and at the same time p1 starts, repeating itself.
Strange
[quote=395156:@Strange Ross]What happens is that p2 plays once, and at the same time p1 starts, repeating itself.
Strange[/quote]
Not strange. Thats exactly what your code asks it to do. Or where is the code to change the player?
It should be more like
If player = App.p1 Then
App.PlayP2
App.p1 = false
Else
App.PlayP1
App.p1 = true
End If
App.p1 and App.p2 are players, not Booleans. If I try:
If player = App.p1 Then
App.PlayP2
App.p1.Stop
Else
App.PlayP1
App.p2.Stop
End If
I still find that p2 plays once, and at the same time p1 starts, repeating itself.
Strange (Denmark)
You might want to ask on the MBS mailing list
Will do. Thanks for your trouble.
Strange