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

[Enhancement] Support user created sound #15

Open
EliteMasterEric opened this issue Sep 27, 2021 · 1 comment
Open

[Enhancement] Support user created sound #15

EliteMasterEric opened this issue Sep 27, 2021 · 1 comment

Comments

@EliteMasterEric
Copy link

EliteMasterEric commented Sep 27, 2021

I have a use case where I am being provided with a stream of PCM audio bytes (from video decoding) and I want to play the sound over the user's speakers. OpenFL doesn't provide a means to implement this (I checked, this class is not implemented on most platforms, just Flash). Thankfully, FMod does, but haxe-fmod has not implemented a user-facing interface for it.

Implement the ability to create a sound which, rather than loading from a sound file, continuously executes a callback to retrieve the sound data to be output.

The sound should be created with the FMOD_OPENUSER, and be initialized with an FMOD_CREATESOUNDEXINFO to specify format, defaultfrequency, numchannels, and a read callback. The read callback would probably need to be a wrapper callback, which would call a Haxe function (not a CPP function) provided by the user, which would return an openfl.utils.ByteArray. The wrapper callback would then provide the pointer and length to the sound for playback.

See the api/core/examples/user_created_sound.cpp for an example of this, but in CPP rather than Haxe.

@EliteMasterEric
Copy link
Author

Okay Google, why can't users on GitHub self assign issues if they aren't the maintainer.

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