Skip to content
This repository was archived by the owner on Jun 13, 2025. It is now read-only.

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

Merged
yaxu merged 2 commits intotidalcycles:1.9-devfrom
polymorphicengine:1.9-dev-stremgetnow
Jul 26, 2023
Merged

change streamGetnow to factor in the processAhead and also destroy the sessionstate#1025
yaxu merged 2 commits intotidalcycles:1.9-devfrom
polymorphicengine:1.9-dev-stremgetnow

Conversation

@polymorphicengine
Copy link
Copy Markdown
Collaborator

No description provided.

@Zalastax
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Collaborator

Great idea!

What about processGetAhead?

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

i named it streamGetAhead now :)

Copy link
Copy Markdown
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
Copy Markdown
Member

yaxu commented Jul 26, 2023

Is this ready to merge?

@polymorphicengine
Copy link
Copy Markdown
Collaborator Author

i think so!

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

yaxu commented Jul 26, 2023

Thanks a lot!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants