MoAlyousef / soloud-rs

Rust bindings for the soloud audio engine library
MIT License
59 stars 5 forks source link

openmpt source loops even when told not to #35

Open walksanatora opened 11 months ago

walksanatora commented 11 months ago

Expected behavior:

calling openmpt::set_looping(false) should prevent it from looping

Actual behavior: audio still loops

Steps to reproduce the problem:

I was using Wind of Fjords and it looped after the song finished even with loop set to false and loop count set to 0 (confirmed by printing with soloud.looping(handle) and soloud.loop_count(handle)

SoLoud version, operating system, backend used, any other potentially useful information:

SoLoud crate version: 1.0.5 default backend for that version arch linux on kde plasma cargo version: cargo 1.74.1 (ecb9851af 2023-10-18)

Code example

    let mut sl = Soloud::default().unwrap();
    let mut openmpt = audio::Openmpt::default();

    openmpt.load("a-windf.it").unwrap();
    openmpt.set_looping(false);

    let handle = sl.play(&openmpt);

    while sl.voice_count() > 0 {
        println!("duration: {:?}\nvoices: {}\nauto_stop: {}\nlooping: {}\nloopcount: {}",
        Duration::from_secs_f64(sl.stream_position(handle)),
        sl.active_voice_count(),
        sl.auto_stop(handle),
        sl.looping(handle),
        sl.loop_count(handle),
        );
        std::thread::sleep(std::time::Duration::from_millis(100));
    }

which this prints (at the time of writing and letting it run)

duration: 688.277669046s
voices: 1
auto_stop: true
looping: false
loopcount: 0

which that duration is a bit above the 3:36 that Wind of Fjords is

MoAlyousef commented 11 months ago

Thank you for the report. I’ll try to investigate the issue over the weekend.

MoAlyousef commented 11 months ago

I was able to get the same behavior and it seems to be an upstream issue. Check the documentation of Openmpt.setLooping here: https://solhsa.com/soloud/modplug.html