Replies: 1 comment
-
|
There's nothing in dr_mp3 specifically to do that, but dr_wav has an encoder that you could use to create the WAV file (though you could also easily just do the WAV encoding yourself - it's very simple). The process is simply decode from dr_mp3, then encode those samples with dr_wav. Once the encoding to WAV is done just load your temporary file like normal. Example usage for the WAV encoder: https://github.com/mackron/dr_libs/blob/master/tests/wav/wav_encoding.c I have no interest in supporting anything WAV related in dr_mp3. That's what dr_wav is for. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
If you wonder what could be the usage of this functionality, here is why:
I am the developer of the DxWnd program (see on SourceForge) that struggle to revive old programs and add functionalities when possible.
Some user asked for a space-saving feature where all game .wav files are replaced by .mp3 files and converted on the fly. Since the legacy game uses winmm mmio system library calls, it would expect a well-formed .wav file anyway, so the idea is to put a quick conversion from .mp3 to .wav in the mmioOpen wrappers.
I would need a function call like this: Mp3toWav(char *mp3path, HANDLE wavHandle) where wavHandle should be a file handle of a temporary file with FILE_FLAG_DELETE_ON_CLOSE file option to remove it as soon as it is closed.
It seems that what I need could be a modification of the drmp3_open_file_and_read_pcm_frames_f32() function, maybe taking care to add a .wav file header at the end of the operation and using the opportune callbacks to read from and write to the files, but I would prefer to ask your wise advice and, if possible, a code sample.
In case you are interested, here is the DxWnd discussion about it: https://sourceforge.net/p/dxwnd/discussion/general/thread/ba69562df1/#74d3
Beta Was this translation helpful? Give feedback.
All reactions