Set Playlist Track

You have a question or need an advice about how to do something? Ask it here!
Post Reply
benjavides
Posts: 19
Joined: 15 Sep 2023 20:47
Set Playlist Track

Post by benjavides »

I would like to create an OSC command: /audio/playback/set/fade
which receives a single int number indicating a song index.
It should start playing that song in the currently open playlist. It should behave in this way:
  • If there is music playing:
    1. load the specified track (in the next avaliable player) and start fading to it.
    2. When the fade finishes, unload the track that was playing.
    3. Load the track that is after the specified index as the “next track”
  • If there is no music playing:
    1. load the specified track and start playing it.
    2. Load the track that is after the specified index as the “next track”
This is what I tried first:
Image
It works as expected if there is music playing. But when there is not, it loads the specified index track as the next one and starts playing the track that was set as the “next one” before the command executed.

My current workaround is to unpause the playlist (if it's paused) before executing the instructions. So that it always acts as if music is running.
Image

The problem with this is that the public will be able to listen to the fading transition between the song that was originally paused and the song that the user is setting.

Is there a better way to achieve what I want?
User avatar
radio42
Site Admin
Posts: 8926
Joined: 05 Apr 2012 16:26
Location: Hamburg, Germany
Contact:
Re: Set Playlist Track

Post by radio42 »

It seams almost the same issue as in your other post.
The LOAD_SELECTED command is executed asyc, as such, the SLEEP needs to be large enough.
Try setting it to 3 seconds or more...

Post Reply