-
Here is my situation, I have a .wav sound file, which I can read and get all of the bytes, what I need is to feed them to miniaudio and generate a working ma_sound that I can use in my application. I have an implementation kind of working (I'll describe later) but has some problems which I'd like some help with. Why not just use ma_sound_init_from_file ? Because my sound file is embeded into an Android APK and cannot be read wihtout a AAssetManager, which in the end just returns the bytes of the file anyways, so I end up with the same situation. But just igonre this part, my current need is that I need to load the sound by bytes and not by file. The "kind" of working implementation uses ma_audio_buffer which seems the way to go for this kind of situation by the answer of this post. I'm able to load the sound into the ma_audio_buffer and load a ma_sound like this:
Then, on other part of the code I call ma_sound_play . So here is what happens, whit this implementation, no sound is played, at all, but ma_sound_play is fired, that is for sure. My problems:
So, any help would be very appreciated. IMPORTANT: If I use ma_sound_init_from_file (on desktop) it works, so it is not an issue of ma_engine configuration or other configs, it is how the bytes are loaded into the ma_sound |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
For anyone with the same problem, I figured it out after a loooong day, this is how I fixed it. I was calculating wrongly the sizeInFrames and also sending a wrong formated bytes as the data for ma_audio_buffer_config_init . I first needed to do:
Which eventually got me both correct sizeInFrames and the bytes correctly formatted. |
Beta Was this translation helpful? Give feedback.
For anyone with the same problem, I figured it out after a loooong day, this is how I fixed it. I was calculating wrongly the sizeInFrames and also sending a wrong formated bytes as the data for ma_audio_buffer_config_init .
I first needed to do:
Which eventually got me both correct sizeInFrames and the bytes correctly formatted.