In my XAudio code I have my buffer data, im trying to get my buffer data into the fillbuffer function, but it doesn't work. Here's all the relevant code...
int16* bufferData;
bufferData = new int16[buffer.AudioBytes/2];
buffer.pAudioData = (const byte*)bufferData[0];
...
void DebugFillBufferWithSineWave()
{
...
int16* sampleOut = (int16*)&(buffer.pAudioData);
But this and every other variation crash. One variation i got some of the sound to play, but only if i set the sample count to half the actual sample count. Can a C++ person please help.
Edit: I've changed the code a bit, I'm pretty sure the above is just wrong, it now reads ...
buffer.pAudioData = (const byte*)&bufferData[0];
...
int16* sampleOut = (int16*)&bufferData[0];
And one the problems turned out to be the double *sampleOut++, as i was using mono.