crumblingstatue / rust-openmpt-sys

Rust sys bindings for libopenmpt
https://lib.openmpt.org/doc/libopenmpt_c_overview.html
3 stars 3 forks source link

Some guidance in order to have a POC running #2

Open jllodra opened 10 months ago

jllodra commented 10 months ago

Hi, first of all I am a newbie in Rust.

If I understand correctly, these are bindings for calling the libopenmpt dll straight away from Rust. Meaning that a module song can be played from Rust.

If my assumptions are correct, could you give me some hints to have a minimal example in Rust for playing a module file?

I guess an audio lib would be still needed to play the audio generated by libopenmpt?

Thank you in advance!

PD: Can I ask why you did this project? are you using it on another piece of opensource software?

crumblingstatue commented 10 months ago

If I understand correctly, these are bindings for calling the libopenmpt dll straight away from Rust.

I never tested this library on windows, so I'm not sure if it works there. But yeah, these bindings are for directly calling into openmpt from Rust.

Meaning that a module song can be played from Rust. Correct.

If my assumptions are correct, could you give me some hints to have a minimal example in Rust for playing a module file?

I'll try adding an example to the repo.

I guess an audio lib would be still needed to play the audio generated by libopenmpt?

Yes, you also need an audio lib. A popular audio playback library for rust is cpal.

PD: Can I ask why you did this project? are you using it on another piece of opensource software?

I used it for a few of my games, none of which were ever finished/released unfortunately.

jllodra commented 10 months ago

I used it for a few of my games, none of which were ever finished/released unfortunately.

I am sorry to hear that, I hope you can finish them some day.

I'll try adding an example to the repo.

Thank you for that!!! I also want to think that nothing stops the code from being compatible with Windows (I am a Windows user currently), so I will try to make your example work in case you don't have a Windows box around

crumblingstatue commented 10 months ago

I added an example Feel free to try it out and let me know if you run into any trouble!

crumblingstatue commented 10 months ago

By the way, you should take a look at the documentation for the libopenmpt C API. This crate is just direct Rust bindings to that API.

jllodra commented 10 months ago

Example works like a charm (on win), thank you ❤️