Open IngoHenkel opened 3 years ago
Hi @IngoHenkel, well spotted thanks! I think it makes sense that Project.bpm
would return the base project tempo while another method would return the tempo at cursor position. So as you said it's both a documentation error and a missing feature.
Pull requests are very welcome, but I have to warn you that there currently is a substantial backlog of unmerged PR that I have to process, so it may take time before I review yours. In the meantime, feel free to ask any question you may have regarding contributing.
I guess the implementation itself is gonna be straightforward so the question that remains is where to place this feature in the API. My first idea would be a Project.bpm_at_cursor
property. Anything better coming to your mind?
HI @RomeoDespres , that was actually exactly what I was thinking. This way you ensure legacy support and also the new function basically makes clear what its returning by its name.
https://github.com/RomeoDespres/reapy/blob/14c8d88538d5a8dac03c99f268c0812e63959ec2/docs/api.json#L1945
In the documentation it is stated that project.bpm is mapped to the Reascript-function Master_GetTempo(). But they only return the same result if you have no tempo changes within the project. While Master_GetTempo() returns the current tempo at the cursor position within the reaper-project (I verified this with a project containing a tempo change), project.bpm aquires its result via the method GetProjectTimeSignature2, which seemingly returns only the tempo at the beginning of the project. So if you want to display the current BPM at the given time, the project.bpm method will not help you. This can either be a bug (method is not working as documented) or a new feature request (request tempo at cursor position). I am looking forward to discussing this and/or contributing a pull request with the changes