THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 13/08/2011 at 09:40, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 12
Platform: Windows ;
Language(s) : C++ ;
---------
Hi,
I can't get a sound file to load into a sound track properly using Python. So I'm giving it a try with C++. But I'm running having problems creating a sound track.
C4D is crashing on me. And I don't know what I'm doing wrong:
Bool SimplePlugin::Execute(BaseDocument *doc)
{
BaseObject *sphere = BaseObject::Alloc(Osphere);
doc->InsertObject(sphere, NULL, NULL); // Add it to the OM
CTrack *soundtrack = CTrack::Alloc(sphere,DescLevel(CTsound,DTYPE_LONG,0)); //SDK says this: CTrack::Alloc(op,DescLevel(ID,ID,0))
sphere->InsertTrackSorted(soundtrack); //This crashes C4D!!!
//Then I need to load a sound file from my desktop into the sound field
EventAdd();
return true;
}
I think I might be using the wrong code in the second Alloc ID parameter.
Can anyone offer any help on creating a sound track and loading a sound file into it?
-ScottA