Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Provide number of samples in plugin run method #87

Closed
niclashoyer opened this issue Oct 12, 2020 · 2 comments
Closed

Provide number of samples in plugin run method #87

niclashoyer opened this issue Oct 12, 2020 · 2 comments
Assignees
Labels
🐞 Bug Something isn't working

Comments

@niclashoyer
Copy link
Contributor

The number of samples is not explicitly passed to the rust lv2 run method, while the original method has this information:

unsafe extern "C" fn run(instance: *mut c_void, sample_count: u32)

Is there some way to get the sample count in the plugins run method? I know that if I have an audio port I can get it using the buffer length, but I'm having a somewhat special case. I'm implementing a plugin with just two atom ports (MIDI events) and still need to do frame accurate timing (in this case sequencing). How would I go about that?

@niclashoyer
Copy link
Contributor Author

I experimented a bit. At first I thought it would suffice to just add sample_count as a field to atom ports, but this got complicated. This change is more like the run method in the lv2 reference implementation, just pass the sample_count as last parameter. Then plugin implementations can use it to calculate frame accurate things, or just ignore it.

@JOOpdenhoevel JOOpdenhoevel self-assigned this Oct 23, 2020
@JOOpdenhoevel JOOpdenhoevel added the 🐞 Bug Something isn't working label Oct 23, 2020
@JOOpdenhoevel
Copy link
Contributor

I knew that the sample_count isn't passed as an argument of the run method and knew that there were a reason why we didn't add it, but I don't remember it anymore.

That's an interesting use case you've got there and there really is no way you can get the sample count. I will accept your PR.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
🐞 Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants