ExPixel / miniaudio-rs

Rust bindings for miniaudio C library.
https://crates.io/crates/miniaudio
MIT License
49 stars 20 forks source link

Cannot get Vorbis decoding to work #53

Open jpochyla opened 3 years ago

jpochyla commented 3 years ago

Hi! I've modified the simple-playback-decoder example to reach for an OGG vorbis file and always get the following output (failed to initialize decoder from file: generic). Is there anything I'm missing? It looks like stb_vorbis is getting compiled in. Thank you!

$ cargo run --example simple-playback-decoder --features=ma-enable-vorbis
   Compiling ep-miniaudio-sys v2.4.0 (/Users/jpochyla/Projects/jpochyla/miniaudio-rs/miniaudio-sys)
warning: ./miniaudio/extras/stb_vorbis.c:3055:95: warning: unused parameter 'step2_flag' [-Wunused-parameter]
warning: static int do_floor(vorb *f, Mapping *map, int i, int n, float *target, YTYPE *finalY, uint8 *step2_flag)
warning:                                                                                               ^
warning: ./miniaudio/extras/stb_vorbis.c:3162:86: warning: unused parameter 'left_end' [-Wunused-parameter]
warning: static int vorbis_decode_packet_rest(vorb *f, int *len, Mode *m, int left_start, int left_end, int right_start, int right_end, int *p_left)
warning:                                                                                      ^
warning: 2 warnings generated.
   Compiling miniaudio v0.10.0 (/Users/jpochyla/Projects/jpochyla/miniaudio-rs/miniaudio)
    Finished dev [unoptimized + debuginfo] target(s) in 19.28s
     Running `/Users/jpochyla/Projects/jpochyla/miniaudio-rs/target/debug/examples/simple-playback-decoder`
thread 'main' panicked at 'failed to initialize decoder from file: generic', miniaudio/examples/simple-playback-decoder.rs:5:10
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
jpochyla commented 3 years ago

If I initialize explicitly via ma_decoder_init_file_vorbis, "failed to initialize decoder from file: no backend" is raised.

ExPixel commented 3 years ago

Odd, I thought I had this working at one point. Maybe I broke it without realizing. I'll try and reproduce on my end. Although I am working on refactoring the library and the bindings a bit so maybe I'll end up fixing it through that.

jpochyla commented 3 years ago

Ok, thanks! I've seen that miniaudio is working on a high-level API for the 1.0 version, are you planning on adding those to miniausio-rs?

ExPixel commented 3 years ago

Yeah, version 1.0 is what I've been waiting for before doing too much work on the library so that I wasn't trying to support a moving target.