Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > irrKlang
Access violation when reading data

bogdan314
Registered User
Quote
2013-09-28 17:44:16

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);
}


niko
Moderator
Quote
2013-09-29 08:48:53

I think getSampleDataSize() is already the length of the stream in bytes, that's your bug.


Create reply:


Posted by: (you are not logged in)


Enter the missing letter in: "Inter?ational" (you are not logged in)


Text:

 

  

Possible Codes


Feature Code
Link [url] www.example.com [/url]
Bold [b]bold text[/b]
Image [img]http://www.example.com/image.jpg[/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]

Emoticons


   






Copyright© Ambiera e.U. all rights reserved.
Privacy Policy | Terms and Conditions | Imprint | Contact