To Reproduce
Using the code in Wolph42's mtplayer beta 27-02-20, setup the following:
In SETUP_SOUND:
[H: LINK = "https://jumpyip.com/Audio/Soundtracks/Critical%20Role/Boss%20Battle/Justin%20Bell%20-%20The%20Dragon%20Thrashed%20and%20Wailed.mp3"]
[h:defineAudioSource("Music_The_Dragon_Thrashed_and_Wailed", LINK, PRELOAD_MUSIC, CYCLES_MUSIC, VOLUME_MUSIC, START_MUSIC, STOP_MUSIC)]
The uppercase constants are as defaulted in SETUP_SOUND, but are "", -1, 0.5, 0, 0
Macro button 1 (plays music using the defineAudioSource entry)
[r:bot_globalStream("Music_The_Dragon_Thrashed_and_Wailed")]
Macro button 2 (plays music using explicit calling string)
[r:bot_globalStream("https://jumpyip.com/Audio/Soundtracks/Critical%20Role/Boss%20Battle/Justin%20Bell%20-%20The%20Dragon%20Thrashed%20and%20Wailed.mp3", -1, 0.5, 0, -1)]
Expected behavior
Both buttons SHOULD result in the same behavior: the music should play IN A LOOP and at HALF VOLUME.
Result #1: Song plays ONCE at FULL VOLUME and stops. (Should have played in a loop at half volume.)
Result #2: Song plays in LOOP at HALF VOLUME. (Expected behavior)
The flow of the globalStream macro is that it passes all args through to the localStream macro, which ultimately passes them to playStream. In test #1 playStream reaceives only the single arg (i.e. the tag name specified in defineAudioSource) whereas in test #2 it receives all the explicitly specified args.
MapTool Info
Desktop (please complete the following information):
Could you reproduce the example without using bot_globalStream function?
I don't think this is the proper place to debug bot related bugs.
Hah - ninja'd! :)
This looks like a bug report (the Description field at the beginning is missing) against Wolph42's bag-of-tricks library token. This GitHub server is for bugs filed against MapTool, not user-created and user-supported library tokens.
I can try to set that up, but note that (AFAI can tell), this is all native code other than the fact that Wolph programatically turns everything into a UDF during onCampaignLoad by prefixing stuff with "bot". Further, when I reported it to Wolph yesterday in the macro chat he tagged you Guillaume/Merudo with a request to take a look, as he felt I had a valid report.
Hah - ninja'd! :)
By no more than 10 seconds, too!
I can try to set that up, but note that (AFAI can tell), this is all native code other than the fact that Wolph programatically turns everything into a UDF during onCampaignLoad by prefixing stuff with "bot".
In this case, it should be very easy for you to change your replication steps to not depend on the bot.
Here you go. Here are the revised tests. I simplified the calls to playSource to spec only URL, cycleCount and volume. Problems still exist.
Test 1: playSource using explicit args:
[r:playstream("https://jumpyip.com/Audio/Soundtracks/Critical%20Role/Boss%20Battle/Justin%20Bell%20-%20The%20Dragon%20Thrashed%20and%20Wailed.mp3", -1, 0.25)]
Expected: Looping audio and 1/4 volume
Result: Looping audio and 1/4 volume
Test 2: playSource using defineAudioSource
[h:defineAudioSource("Music_The_Dragon_Thrashed_and_Wailed", "https://jumpyip.com/Audio/Soundtracks/Critical%20Role/Boss%20Battle/Justin%20Bell%20-%20The%20Dragon%20Thrashed%20and%20Wailed.mp3", "", -1, 0.25)]
[r:playstream("Music_The_Dragon_Thrashed_and_Wailed")]
Expected: LOOP and 1/4 volume
Result: Single playthrough at FULL volume.
It's caused by not defining the preload parameter. This works:
[h:defineAudioSource("Music_The_Dragon_Thrashed_and_Wailed", "https://jumpyip.com/Audio/Soundtracks/Critical%20Role/Boss%20Battle/Justin%20Bell%20-%20The%20Dragon%20Thrashed%20and%20Wailed.mp3", "stream", -1, 0.25)]
[r:playstream("Music_The_Dragon_Thrashed_and_Wailed")]
Concur. Not sure how I overlooked that in my test case (other than PEBKAC preloadcan be one of two specific values ("clip" or "stream"), OR any other value which will not preload the item.
preload = "preload field is seemingly ignored [when preload isn't one of the 2 specifically named values].
If this is a designed/expected outcome (which, at least to me, was NOT expected) then the docs for defineAudioSource would benefit from an update to indicate this behavior will result if using any other value.
Code to recreate the case where preload of "arbitraryvalue" still doesn't work as expected based upon the current docs:
[h:stopSound("*",1)]
[h:defineAudioSource("Music_The_Dragon_Thrashed_and_Wailed", "https://jumpyip.com/Audio/Soundtracks/Critical%20Role/Boss%20Battle/Justin%20Bell%20-%20The%20Dragon%20Thrashed%20and%20Wailed.mp3", "donotpreloadstream", -1, 0.25)]
[r:playstream("Music_The_Dragon_Thrashed_and_Wailed")]