Ambiera ForumDiscussions, Help and Support. |
|
|
|||||
|
Hi everybody, I'm having troubles copying data from a .OGG sound file. I'm getting access violation reading memory 0x...., and here is my code: ISoundEngine* engine = createIrrKlangDevice(); ISoundSource* fan = engine->addSoundSourceFromFile(filename,ESM_NO_STREAMING,false); void* fanData = fan->getSampleData(); SAudioStreamFormat format = fan->getAudioFormat(); int data_sample_number = format.getSampleDataSize(); int data_sample_size = format.getSampleSize(); int data_size = data_sample_number * data_sample_size; unsigned char* newData = new unsigned char[data_size]; printf("Trying to copy data..."); for (int i=0; i<data_size; i++) { newData[i] = *((unsigned char*)fanData+i); } |
||||
|
I think getSampleDataSize() is already the length of the stream in bytes, that's your bug. |
|