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

change streamGetnow to factor in the processAhead and also destroy the sessionstate #1025

Merged
merged 2 commits into from
Jul 26, 2023

Conversation

polymorphicengine
Copy link
Collaborator

No description provided.

@Zalastax
Copy link
Collaborator

What is the expected behavior here? To get the cycle that would right now be hitting the speakers or roughly get the cycle that we would be processing at this moment? Reading the old code it seems like the latter is what was used, which would correspond to the change you are proposing. But I want us to reflect on what is most useful. Do we have some clear use cases for this function? If it is most used for the once function, then adding processAhead seems somewhat wrong.

The old code:

streamGetnow :: Stream -> IO Double
streamGetnow s = do tempo <- readMVar $ sTempoMV s
now <- O.time
return $ fromRational $ T.timeToCycles tempo now

@polymorphicengine
Copy link
Collaborator Author

Do we have some clear use cases for this function?

The intended use is when someone wants to use the time of the stream to query a pattern for something (for example to highlight the pattern in the editor). When using this i encountered that with fast speeds there was a misalignment with the event that was playing and the one that was being highlighted. Adding the processAhead fixed the issue for me.

so maybe we should rename this function to something else and keep the old one as streamGetnow?

@Zalastax
Copy link
Collaborator

Great idea!

What about processGetAhead?

rename to streamGetAhead and bring streamGetnow back in original version
@polymorphicengine
Copy link
Collaborator Author

i named it streamGetAhead now :)

Copy link
Collaborator

@Zalastax Zalastax left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, that's better and probably what I actually meant 😸 Great job!

@yaxu
Copy link
Member

yaxu commented Jul 26, 2023

Is this ready to merge?

@polymorphicengine
Copy link
Collaborator Author

i think so!

@yaxu yaxu merged commit 3b44c5f into tidalcycles:1.9-dev Jul 26, 2023
@yaxu
Copy link
Member

yaxu commented Jul 26, 2023

Thanks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants