Skip to content

Conversation

emuell
Copy link
Member

@emuell emuell commented Jul 14, 2025

  • added c++ bindings/FFI layer and a relay, as used by Renoise
  • added descriptions on how to use your own version of patterns in Renoise
  • updated global README to explain monorepo structure

@unlessgames could you have a quick look at this, if that makes sense - and reads okay?
It's yet another sub-project, but I like mono repos, so I've at least added an overview of the sub projects in the README.

Also, note 'Using a Custom pattrns Library in Renoise', which I wanted to document anyway, as well as in relation to #73.

Copy link

Benchmark for 1690f37

Click to view benchmark
Test Base PR %
Cycle/Generate 48.7±0.63µs 48.2±0.65µs -1.03%
Cycle/Parse 373.0±7.46µs 376.0±11.13µs +0.80%
Rust Phrase/Clone 434.1±5.82ns 431.7±6.14ns -0.55%
Rust Phrase/Create 74.4±1.31µs 75.3±0.95µs +1.21%
Rust Phrase/Run 628.7±6.45µs 644.3±4.05µs +2.48%
Rust Phrase/Seek 141.5±262.36µs 137.7±255.89µs -2.69%
Scripted Phrase/Clone 658.7±6.06ns 650.9±6.21ns -1.18%
Scripted Phrase/Create 943.3±21.55µs 960.4±9.96µs +1.81%
Scripted Phrase/Run 1683.6±15.36µs 1687.9±16.65µs +0.26%
Scripted Phrase/Seek 222.2±449.11µs 219.6±445.83µs -1.17%

@unlessgames
Copy link
Collaborator

I have tried building and copying the libpattrns.so on linux but Renoise crashes with

Renoise LOG> Player: Loading pattrns rhythm library from: '/home/user/.config/Renoise/V3.5.1/libpattrns.so'
Renoise LOG> Exception: failed to resolve pattrns function: 'new_phrase'.
Renoise LOG> Error Message: failed to resolve pattrns function: 'new_phrase'.
>> XMessage: failed to resolve pattrns function: 'new_phrase'.

@emuell emuell force-pushed the feature/cpp-bindings branch from 5cf7112 to 08c4d50 Compare July 15, 2025 07:30
@emuell
Copy link
Member Author

emuell commented Jul 15, 2025

Wanted to get rid of a few unused functions (the phrase API). Those functions never have been used.

Added stubs for them and will get rid of them properly with the next Renoise update.

Copy link

Benchmark for 45dfdfe

Click to view benchmark
Test Base PR %
Cycle/Generate 48.9±0.90µs 48.7±0.32µs -0.41%
Cycle/Parse 379.4±5.50µs 376.6±4.78µs -0.74%
Rust Phrase/Clone 440.6±6.97ns 433.6±7.80ns -1.59%
Rust Phrase/Create 76.4±0.96µs 75.8±0.86µs -0.79%
Rust Phrase/Run 632.2±4.30µs 638.9±3.35µs +1.06%
Rust Phrase/Seek 134.6±249.73µs 135.3±250.26µs +0.52%
Scripted Phrase/Clone 649.6±6.03ns 656.4±24.59ns +1.05%
Scripted Phrase/Create 959.2±17.15µs 943.8±9.88µs -1.61%
Scripted Phrase/Run 1679.6±6.48µs 1676.9±44.97µs -0.16%
Scripted Phrase/Seek 220.2±446.43µs 218.5±443.39µs -0.77%

@emuell
Copy link
Member Author

emuell commented Jul 15, 2025

Probably ffi or bindings would be a better folder sub project name here? cbindgen currently is generating a c++ header, but it could also generate a plain C header instead or additionally...

@unlessgames
Copy link
Collaborator

unlessgames commented Jul 16, 2025

Can't really comment on the implementation aspect as this is unfamiliar territory for me, but the instructions are easy to follow and the build now works fine on Linux.

I agree that ffi might be a better name, especially if this will be extended beyond c++ later.

emuell added 3 commits July 16, 2025 14:55
    - fixed typos & cleaned up some wording
    - add new "Repository Structure" chapter
@emuell emuell force-pushed the feature/cpp-bindings branch from 08c4d50 to 3b66269 Compare July 16, 2025 13:04
@emuell
Copy link
Member Author

emuell commented Jul 16, 2025

Had renamed that to bindings already. I think that's fine too.

Copy link

Benchmark for 8dc155f

Click to view benchmark
Test Base PR %
Cycle/Generate 49.0±0.33µs 48.2±0.40µs -1.63%
Cycle/Parse 371.7±27.12µs 381.3±7.56µs +2.58%
Rust Phrase/Clone 434.7±6.13ns 432.7±4.07ns -0.46%
Rust Phrase/Create 74.6±1.16µs 76.2±1.20µs +2.14%
Rust Phrase/Run 626.7±5.65µs 633.7±5.95µs +1.12%
Rust Phrase/Seek 137.5±257.34µs 135.7±251.57µs -1.31%
Scripted Phrase/Clone 669.3±5.04ns 652.7±5.89ns -2.48%
Scripted Phrase/Create 957.9±9.49µs 952.8±30.01µs -0.53%
Scripted Phrase/Run 1676.8±10.97µs 1659.5±9.82µs -1.03%
Scripted Phrase/Seek 220.3±445.67µs 218.1±441.08µs -1.00%

@emuell emuell merged commit 7bd6f81 into master Jul 16, 2025
2 checks passed
@emuell emuell deleted the feature/cpp-bindings branch July 16, 2025 13:11
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.

2 participants