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

Sync code execution to host transport #5

Open
hellocatfood opened this issue Dec 26, 2024 · 5 comments
Open

Sync code execution to host transport #5

hellocatfood opened this issue Dec 26, 2024 · 5 comments

Comments

@hellocatfood
Copy link

Is there a way to have the code execute only once transport is started in the host?

Using Ardour and the code example you provided, the code is executed when I press Run in Kotoist and then can be heard when I press play in Ardour. Playback stops when I stop transport, but it appears that the code is still being executed in the background.

@ales-tsurko
Copy link
Owner

Hi @hellocatfood! Thanks for opening this issue.

There is some background processing even when the transport is not playing, but the patterns aren’t executed and don’t produce any values during this time. It just first returns note off to cutoff playing notes and then returns an empty buffer. The gui and gpu stuff is ongoing forever, but it shouldn’t affect the audio thread.

There is still a kind of an issue, that you have to execute your code any time you reopen the project. I’m going to make it execute all tabs from the rightmost to the leftmost when plugin is loaded from the state.

@hellocatfood
Copy link
Author

The gui and gpu stuff is ongoing forever, but it shouldn’t affect the audio thread.

I think the main reason I ask for this is so that it kept in syn with whatever else is happening in the host.

For example I have a drum pattern created with kotoist that I want to be played back in sync with the melody I have created in midi in Ardour

@ales-tsurko
Copy link
Owner

Ah, I see. This happens because there is no reset mechanism in the pattern itself. Also, patterns know nothing about position. They just produce next values when it's time for them. One after another. If you need to reset them or start from a particular position, take a look at on_play and on_pause callbacks. Oh, and I think I should make these callbacks receive the position.

@ales-tsurko
Copy link
Owner

Ah, I see. This happens because there is no reset mechanism in the pattern itself. Also, patterns know nothing about position. They just produce next values when it's time for them. One after another. If you need to reset them or start from a particular position, take a look at on_play and on_pause callbacks. Oh, and I think I should make these callbacks receive the position.

I've updated these callbacks to receive cursor position and tempo.

@hellocatfood
Copy link
Author

Thank you! I'll let you know how it goes trying it out.

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

No branches or pull requests

2 participants