SyrinControl - WIP FoundryVTT module integration

Sound plays through foundry :slight_smile:

Is there a way to have SyrinControl tell Syrinscape to stop all sounds? I have a simple macro that uses fetch to do this using the remote control API link for “stop-all” and that works fine. However, SyrinControl then doesn’t seem to know it happened, so the “stop” button still shows next to the thing that was previously playing instead of a “play” button. I’m hoping there’s a better way to do this with SyrinControl. Or maybe some command I can put in my macro after the stop-all has occured that tells SyrinControl to refresh that? Edit: typo

That’s weird, my “fetch” instruction to stop the sounds works on sounds created by Syrincontrol.

There’s also a macro to stop a playlist and a specific sound in a playlist.

I’m not at my computer now but I can post it here later.

Thanks, looking forward to seeing your macro. It’s probably much better than how I’m doing it!

My goal was to have a macro so I can one-click stop all playing playlists/sounds (aside from ambient sounds on the map). I found a macro online which works great for Foundry-native sounds, but doesn’t work on SyrinControl sounds/playlists. So, I tacked on a simple fetch command at the end to hit stop-all via the API in Syrinscape (see fetch command below). It works great (all sounds, whether from SyrinControl or Foundry-native fade out and stop with a single click) but SyrinControl itself doesn’t seem to get the message, so the Playlists sidebar shows things that think they’re still playing, but aren’t. I’ve tested with a fresh world with only SyrinControl enabled, just in case there was another module getting in the way.

Here’s the fetch instruction I tacked onto the end of that macro (minus my auth token of course!):
fetch("https://syrinscape.com/online/frontend-api/stop-all/?auth_token=redacted");

It’s a very minor problem in the end, but would be nice to solve.

I use that fetch command. But then I don’t use native sounds. I only use Syrinscape through Foundry and YouTube through Kenku FM discord bot.

Here is the Macro to stop a specific sound, it will work on Syrinscape sounds if you are importing your Syrinscape sounds via Syrincontrol and putting them in your playlists.

const pl = game.playlists.getName("name of playlist");
const sound = pl.sounds.getName("name of sound");
await pl.stopSound(sound);

Here is the one to stop an entire playlist.

const pl = game.playlists.getName("name of playlist"); // or use get(id of playlist) instead of getName.
await pl.stopAll()

Thanks, that was helpful. The macro I had found earlier does use that stopAll() function, but for some reason it skips the SyrinControl playlists. It does some stuff to fade the sounds out, and I think that’s where it’s losing the SyrinControl playlists. I could just have it stopAll() on all playlists and that works well, but it cuts off the Foundry native sounds abruptly. I’d prefer it fade the native Foundry sounds out also, so the experience is similar to stopping a Syrinscape mood.

So, what I’m having it do now is run that original function to fade out the Foundry sounds over 3 seconds, wait 3 seconds to let that wrap up, and then do another stopAll() on all playing playlists (which does catch the SyrinControl ones properly). It delays Syrinscape stopping by 3 seconds (configurable) but I can live with that to have a single button to press to cleanly stop all ambience/music without having to remember what’s playing it. There’s probably a more elegant way to do all this, but here’s the full working macro as it is now, in case it would help anyone else:

const wait = async (ms) => new Promise((resolve)=> setTimeout(resolve, ms));

function fadeOutPlaylist(playlist, fadeDuration) {
    if (!playlist.playing) return;
    let playingSound = playlist.sounds.filter(s => s.playing).find(_ => true).sound;
    if (!!!playingSound) return; // should not happen
    let currVol = playingSound.volume;
    let globalVol = game.settings.get("core", "globalPlaylistVolume");
    if (currVol == 0) return;
    playingSound.fade(0, { duration: fadeDuration, from: currVol})
    setTimeout(() => playlist.stopAll(), fadeDuration);
    return;
}

game.playlists.filter(p => p.playing).forEach(p => fadeOutPlaylist(p, 3000));
await wait(3000);
game.playlists.filter(pl => pl.playing).forEach(pl => pl.stopAll());

From this version forward, you can use:

game.syrinscape.stopAll()

to stop all moods at once!

Thanks, that works great!

Hello everyone!
I’m super excited to announce that I just released a stable version 0.4.0 :slight_smile:

I also recorded a short guide through all features:

8 Likes

This is amazing @frondeus!

As always, THANK YOU for your great work on this! :pizza: :beers: :cupcake:

Hello,

I wanted to ask, how do I make syrincontrol work with The Forge - Foundry. I have the module installed but it doesn’t seem that it works (my players cant hear the sound). Any assistance would be appreciated.

Hi there,

I don’t use The Forge so I’m not sure about your problem however I would have thought that made no difference as I use a Molten server to host mine and it works perfectly.

However for a better response either tag @frondeus here or go to the GitHub and add an issue. He’s a busy person so please be patient.
https://github.com/frondeus/fvtt-syrin-control/issues

1 Like

First of all : Thank you for all you’ve made !
I think your work is just oustanding, and hope I would able to make all work together for my next sessions !

But i’m facing a problem : i’m new to foundry as a Gamemaster, and i’ve just installed it … so it’s a V11.
I know SyrinControl is only validated for V10, and V11 seems to be really recent … but i give a try. I manually installed your module, editing the module.cont to set maximum version and validated version to 11.

It seems working well at the first glance : at least, it syncs something, and I get the few voucher collection I have on my account, with list of each mood. The mechanism to launch mood or to import playlist works too, visually.

But there’s no sound.
The only thing i can do, it’s playing short elements when I open the “Syrinscape Elements” from the mood icon (and it finds no element for my voucher).

So … is it because of V11 ? And (next question, of course), when did you think you’ll update the module for V11, if you project to do it ?

EDIT: It’s just working now ! I don’t why ^^
(maybe a restart of foundry ?)

Thanks by advance, and a big thank you for your work !

Goblins with spanners… definitely goblins with spanners! :smiley: :wrench:

Glad it’s working for you. :pizza: :dragon:

Spread the news about this extension (and Syrinscape obviously) in the Foundry community. It does seem that some people still haven’t heard about @frondeus’s amazing work!

2 Likes

I was amazed at how many people at UKGE use Foundry and Syrinscape but still didn’t know about SyrinControl and the amazing work that Frondeus has done with it. So yes, definitely help spread the word! :grin:

1 Like

OK so what did you do exactly? I have just set up a test server to test v11 Foundry and I can’t use Syrincontrol, I am getting a message saying it is unsupported.

I am on 0.4.3 currently. I simply cannot migrate to v11 without Syrinscape and Syrincontrol.

It is ok I figured it out :slight_smile:

Edit the module on the setup page.

Hey everyone here.
@pheldwyn @notrealdan @Orionox @crasherprime @nicolas.tackian

Can anyone help out testing a thing?!

I am very interested to run SyrinScape in Foundry v13, please.
I like when it’s working right now. But it’s not always working w/ v12.
So please sign me up.
Also, I’ve done actual beta testing before. Not the early access stuff that’s a near finished product that is called beta these days, or the alpha software that is being sold to people as beta. But actually beta testing.