Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > irrKlang
getSampleData() returning NULL

ders
Registered User
Quote
2015-03-12 13:53:59

I'm getting the ISoundSource of some audio sources in my application like this:
irrklang::ISoundSource* soundSource = irrKlangEngine->getSoundSource(fullsoundName.c_str(), true);

After that is done (and I checked if soundSource isn't NULL) I try to get the sample data like this, together with some other information:
short* data = (short*)soundSource->getSampleData();
int channels = soundSource->getAudioFormat().ChannelCount;
int frames = soundSource->getAudioFormat().FrameCount;

Now, sometimes data seems to be NULL for some reason. I'm sure that the source I get this from are not streamed and that seemed to be the only exception when getSampleData() would return NULL.

Am I forgetting something? Or is there something I should check?

EDIT: I've did some more tests and I found that if the data wasn't preloaded it seems to be a problem.


niko
Moderator
Quote
2015-03-12 15:08:12

Also note this from the documentation:

This function will only return a pointer to the data if the audio file is not streamed, namely ESM_NO_STREAMING



ders
Registered User
Quote
2015-03-12 15:11:19

I'm pretty sure that the audio isn't in streaming mode. When I output the getStreamMode() value it returns ESM_AUTO_DETECT.

Do you still think I might be doing something wrong when I register the sound so that it is in streaming mode?

EDIT:

Oh shit. I got it.
I had to explicitly tell the ISoundSource object how to manage the file

I added this and now it works:
soundSource->setStreamMode(irrklang::ESM_NO_STREAMING);



niko
Moderator
Quote
2015-03-13 13:43:04

Ah, nice that it's working now. :)


Create reply:


Posted by: (you are not logged in)


Enter the missing letter in: "Int?rnational" (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