THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 11/12/2012 at 11:05, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 13
Platform: Mac OSX ;
Language(s) : C++ ;
---------
Hello all,
I've got a button that's loading a sound and playing it. I want to get the volume of sound at each update which I think SDataEx will give me. So I have a loop that runs when the sound is playing and I'm printing out the data for SDataEx, but it always prints out 0.
Here's my code.
if (ID==BTNCREATESOUND)
{
Filename fn;
if (!fn.FileSelect(FILESELECTTYPE_ANYTHING, FILESELECT_LOAD, "Load Sound")) return FALSE;
AutoAlloc<BaseSound> sound;
if (!sound) return FALSE;
sound->Init(5,5,5);
if (!sound->Load(fn)) return FALSE;
GeSndInfo sndinfo(sound);
AutoAlloc<GePlaySnd> playsound;
if (!playsound) return FALSE;
playsound->Open(sound);
playsound->Scrub(0, sndinfo.GetLength().Get());
SDataEx sounddata;
while(playsound->IsPlaying())
{
GePrint("pos: " + RealToString(playsound->GetPositionEstimate()));
sound->GetSampleEx(playsound->GetPositionEstimate(),&sounddata);
GePrint("L:"+RealToString(sounddata.l));
GePrint("R:"+RealToString(sounddata.r));
}
}
I'm almost positive that I'm making a simple mistake, but I can't figure what it is.
Thanks,
Dan