THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 17/01/2006 at 22:26, xxxxxxxx wrote:
Like most C4D 'Base' classes, there are no direct constructor/destructor methods. You must use 'Alloc' and 'Free' to allocated and free the class:
BaseSound* sound = BaseSound::Alloc();
BaseSound::Free(sound);
Note that Load() only works with WAV sound files. It is possible that certain codecs are not supported (unless they are installed).
Here is working source that I use (in conjunction with animation tracks) :
if (type == Ssound)
{
// <Bool:On|Off>
if (!tokenReader.ParseBool(&fileReader;, &boolVal;, "on", "off")) return FALSE;
data->SetBool(ID_SOUND_ONOFF, boolVal);
// "<String:Sound_Filename>"
SoundSequence *sseq = static_cast<SoundSequence*>(seq);
BaseSound* bsound;
if (!(bsound = sseq->GetSound()))
{
ErrorException::Throw(GeLoadString(ERROR_MEMORY_TEXT), "AnimatLOAD.ReadSequence.bsound");
return FALSE;
}
if (!tokenReader.ParseQuotedString(&fileReader;, &name;))
{
BaseSound::Free(bsound);
return FALSE;
}
Filename soundFile = Filename(filename);
soundFile.SetFile(Filename(name));
if (bsound->Load(soundFile))
{
sseq->SetSound(bsound);
sseq->SetParameter(DescID(ID_SOUND_NAME), name, DESCFLAGS_DONTCHECKMINMAX);
}
else ErrorException::Throw(GeLoadString(ERROR_OPENFILE_TEXT), "Sound file:", name);
BaseSound::Free(bsound);
}
HTH,