Skip to content
Discussion options

You must be logged in to vote

Hi @Scuf-235B5ECE, ExportWaveAsCode() saves raw PCM samples, so its array isn't a complete WAV file. LoadWaveFromMemory(".wav", ...) expects the RIFF/WAV header too.

The 53,260 bytes in your exported array match the WAV's audio data exactly. After InitAudioDevice(), you can build a Wave directly using the names in your attached header:

Wave tempW = { 0 };
tempW.frameCount = _FRAME_COUNT;
tempW.sampleRate = _SAMPLE_RATE;
tempW.sampleSize = _SAMPLE_SIZE;
tempW.channels = _CHANNELS;
tempW.data = RotateSoundData;

Sound testZap = LoadSoundFromWave(tempW);
PlaySound(testZap);

Skip UnloadWave(tempW) here, it would try to free the header's static array. Use UnloadSound(testZap) when you're finis…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by raysan5
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants