Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > irrKlang
Access violation when reading data

Registered User
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);

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)




Possible Codes

Feature Code
Link [url] [/url]
Bold [b]bold text[/b]
Image [img][/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]



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