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

Track start event? #29

Closed
peppizza opened this issue Dec 7, 2020 · 4 comments
Closed

Track start event? #29

peppizza opened this issue Dec 7, 2020 · 4 comments
Labels
events Relates to driver event handling/generation. feature-request Request for addition of a new feature or improvement.

Comments

@peppizza
Copy link
Contributor

peppizza commented Dec 7, 2020

Is there an event i can register to get fired on a track starting, similar to that of a track ending

@FelixMcFelix FelixMcFelix added events Relates to driver event handling/generation. feature-request Request for addition of a new feature or improvement. labels Dec 7, 2020
@FelixMcFelix
Copy link
Member

Not at present, no. Play/Pause (i.e., changes to PlayMode) would be useful additions to TrackEvent.

For now, I think you can work around this by adding a timed event to a track which fires in the first 20ms (i.e., set it to 5ms or similar). These fire based on the playback time for a track, so a track which transitions from paused to playing will fire this event in the same "tick" as the track starts (assuming this relates to queued tracks).

@peppizza
Copy link
Contributor Author

peppizza commented Dec 7, 2020

I assume you mean using the delayed event?

@saanuregh
Copy link
Contributor

@peppizza depending upon ur requirement this might not be useful, but to display an embed on track start, I implemented a track end event like this:
https://github.com/saanuregh/bowot-rs/blob/553ce71047c8f8a0c9c8f5ebfb1abaa4de095d03/src/commands/music.rs#L35
But, this method will not display the embed for the first track enqueued.

@peppizza
Copy link
Contributor Author

peppizza commented Dec 9, 2020

@saanuregh I achieved something very similar to that except checking for the empty queue when the event is created, and not creating it if its the first song

FelixMcFelix added a commit to FelixMcFelix/songbird that referenced this issue Jan 26, 2021
Uses much of the existing machinery to add some more PlayMode state change events—all in all, a pretty simple change.

Closes serenity-rs#29.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
events Relates to driver event handling/generation. feature-request Request for addition of a new feature or improvement.
Projects
None yet
Development

No branches or pull requests

3 participants