Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

playStream seems to ignore anything other than the URL specified in defineAudioSource #1940

Open
dstein766 opened this issue May 26, 2020 · 7 comments
Labels
bug documentation needed Missing, out-of-date or bad documentation

Comments

@dstein766
Copy link

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
@Merudo
Copy link
Member

Merudo commented May 26, 2020

Could you reproduce the example without using bot_globalStream function?

I don't think this is the proper place to debug bot related bugs.

@Azhrei
Copy link
Member

Azhrei commented May 26, 2020

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.

@dstein766
Copy link
Author

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.

@Merudo
Copy link
Member

Merudo commented May 26, 2020

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.

@dstein766
Copy link
Author

dstein766 commented May 26, 2020

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.

@Phergus Phergus added the bug label May 26, 2020
@Merudo
Copy link
Member

Merudo commented May 27, 2020

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")]

@dstein766
Copy link
Author

dstein766 commented May 27, 2020

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 preload can be one of two specific values ("clip" or "stream"), OR any other value which will not preload the item.

preload = "<any_OTHER_value_besides_clip_or_stream_including_empty_string>" 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")]

@Phergus Phergus added the documentation needed Missing, out-of-date or bad documentation label Mar 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug documentation needed Missing, out-of-date or bad documentation
Projects
None yet
Development

No branches or pull requests

4 participants