Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to link properly to SDL2_mixer on aarch64 Android #1384

Open
ionarevamp opened this issue Apr 7, 2024 · 2 comments
Open

Unable to link properly to SDL2_mixer on aarch64 Android #1384

ionarevamp opened this issue Apr 7, 2024 · 2 comments

Comments

@ionarevamp
Copy link

The dependency is defined as such in Cargo.toml:

[target.'cfg(all(target_os = "android"))'.dependencies.sdl2]
git = "https://github.com/rust-sdl2/rust-sdl2"
default-features = false
features = ["ttf","image","gfx","mixer"]

However, I get this error when calling sdl2::mixer::init(...)

= note: ld.lld: error: undefined symbol: Mix_Init
          >>> referenced by ....rcgu.o:([project]::main::hf704b2d9cfbfac9d)

          ld.lld: error: undefined symbol: Mix_Quit
          >>> referenced by ....rcgu.o:([project]::main::hf704b2d9cfbfac9d)
          cc: error: linker command failed with exit code 1 (use -v to see invocation)

Linking statically without the NDK doesn't work (and I don't want to use it as it doesn't seem to work correctly anyways and takes up too much space on this device), and specifying -L or -l flags doesn't fix the problem either.

I would really like to use the mixer library for volume control when playing music, as the next best thing for high-quality gapless playback is to use the queuing methods which don't have direct volume control. If anyone knows a good workaround in the meantime that would be great.

@ionarevamp
Copy link
Author

By the way, I had the idea to do my own form of audio queueing by effectively concatenating the data buffers of different loaded files, one after another. I'll do that when I have some free time and make another comment about its effectiveness. In theory, it should work though.

@ionarevamp
Copy link
Author

ionarevamp commented Apr 9, 2024

Using a Sound struct and implementing the callback function for it (based on the wav file example), I was able to then call the .lock() method on a generated AudioDevice<Sound> instance and append the contained data vector with that of another wav file.
It works perfectly.
Now just to make some changes to the Vec structure and the callback function, along with writing a couple new audio-pairing functions, and I should be able to mix audio ""manually"" without the need to link to the mixer library.

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

No branches or pull requests

1 participant