Maptool: playStream seems to ignore anything other than the URL specified in defineAudioSource

Created on 26 May 2020  路  7Comments  路  Source: RPTools/maptool

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

  • Version: 1.7
  • Install: Upgrade from 1.6.1

Desktop (please complete the following information):

  • OS: Windows 10
  • Version Build 1909
bug

All 7 comments

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 ), but further study indicates that there's still at least a documentation bug, in that https://lmwcs.com/rptools/wiki/defineAudioSource specifies that preloadcan be one of two specific values ("clip" or "stream"), OR any other value which will not preload the item.

preload = "" leads to the same unexpected behavior (i.e. single playthrough and volume setting not honored) as initially reported. This means that it is impossible to rely on defineAudioSource for a stream that you don't wish to preload, since anything you spec after the 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")]
Was this page helpful?
0 / 5 - 0 ratings

Related issues

nmeier picture nmeier  路  9Comments

cwisniew picture cwisniew  路  6Comments

Azhrei picture Azhrei  路  9Comments

Phergus picture Phergus  路  9Comments

Lovewyrm picture Lovewyrm  路  4Comments