-
-
Notifications
You must be signed in to change notification settings - Fork 26
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
Allow audio generation #37
Comments
Hi! It would be nice to have, but, realistically - its a bit out of a scope of quad-snd. quad-snd is quite a minimum thing that used just for macroquad and advanced audio tricks are not really close in the roadmap. I would recommend doing a fork, especially if you interested in just one platform, quad-snd is designed to be very fork-friendly |
Yeah I will try forking it - I was actually hoping for cross platform (linux, web, android) but maybe I can get that working. I've read that But thanks for your reply |
It does on all the platforms except web. On the web it is easier to use higher-level webaudio abstractions instead of dealing with the buffers - it allows to skip threading and web workers and significantly win in performance. Not the best decision for a general-purpose library for sure, but so far works quite well for macroquad. |
I've finished the Android, Linux and Windows buffer based code in my fork (I've only tested my example on Linux so far). As I do not expect it to be merged at any point (one won't ever need both features at the same time), I've removed/plan on removing the Mixer and file loading part completely. Unfortunately I'm currently stuck with the coreaudio version, because I honestly do not understand why the EDIT: I've just noticed that I misread the code and was looking for a wrong function name in the docs, |
Nice, glad it worked! quad-snd was designed to be very copy-paste friendly - take some code out of quad-snd, there is not much of it, actually, and build something that suits you better :) coreaudio.rs was auto-generated, yes. You might want to use https://github.com/RustAudio/coreaudio-rs if you want to use way more functions, but I would just keep hand-adding binding to the required functions to coreaudio.rs, it doesn't take too much time while keeping things simple |
Thanks I will certainly have a look at that. I just finished porting my old rust-sdl2 based app to miniquad, Again thank you for your support, I don't know if you want to keep this issue open - if you keep it open, I will probably do an update when I get the macOS and web stuff working, but I don't mind if you close the issue EDIT: Midi will obviously be disabled on android, as I was unable to get that working in a miniquad fork - I got lost in the JNI crate, more can be found on my seperate miniquad issue |
I have a question related to your version of the library: Have you tested the android version? And if you did, does the audio play without skipping beats or production clicking sounds? Trying to find out if my software is broken or if I may have introduced a bug into my fork |
I believe it worked well, at least here https://play.google.com/store/apps/details?id=rust.zemeroth&hl=en&gl=US I can't hear any sound artifacts |
Ok, so I don't really understand why it wasn't working - I noticed that you were filling two channels and I had apparently deleted those calls in my fork. |
Not every game neccessarilly wants to play prerecorded audio files, rather they might want to generate the audio in real time.
To do this the
Mixer
would have to be exposed publically or rather theAudioContext
would have to have an option to specify if the sample should be loaded from a file or the buffer should be filled using a callback or a second thread.I'm thinking of a sgstem similar to how rust-sdl2 handles it: example can be found in their docs
I'm not completely sure if and how this could be implemented for all the supported platforms, but looking at the alsa module for linux, the mixer already had a function to fill a given buffer
The text was updated successfully, but these errors were encountered: