Once I had it writing valid wav files that I could play in VLC. It was just a few tweaks to getting it to play sound in code.
Had to replace the decode() function for ffcc. Because the old one only read files with one frame per packet. But sound formats with a constant bitrate can be multiple frames per packet.
Had to make some variables more flexible. All the movies and ogg music are stereo and 44100 or 48000 so I had hard coded some of those values in.
The way it reads sounds from memory is coping the data into a pointer and it reads from the pointer like it's a file. This took some fiddling to get to work.
I removed the function to read audio right out of the decoded frame. Because for some reason it was causing static when reading the decompressed adpcm audio. So everything goes through the resampler.
Might still be better to use naudio in windows as it works and it's fast. Unsure what the speed difference is. I do know that the sound is slow on my linux vm. Takes a sec to play. Maybe just some optimization would be needed to fix that.
Once I had it writing valid wav files that I could play in VLC. It was just a few tweaks to getting it to play sound in code.
Had to replace the decode() function for ffcc. Because the old one only read files with one frame per packet. But sound formats with a constant bitrate can be multiple frames per packet.
Had to make some variables more flexible. All the movies and ogg music are stereo and 44100 or 48000 so I had hard coded some of those values in.
The way it reads sounds from memory is coping the data into a pointer and it reads from the pointer like it's a file. This took some fiddling to get to work.
I removed the function to read audio right out of the decoded frame. Because for some reason it was causing static when reading the decompressed adpcm audio. So everything goes through the resampler.
Might still be better to use naudio in windows as it works and it's fast. Unsure what the speed difference is. I do know that the sound is slow on my linux vm. Takes a sec to play. Maybe just some optimization would be needed to fix that.