Add Sound to Sound track

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 12/12/2007 at 23:10, xxxxxxxx wrote:

User Information:
Cinema 4D Version:   R10 
Platform:   Windows  ; Mac  ;  Mac OSX  ; 
Language(s) :     C++  ;

---------
How does one add a sound file to a Sound track in R10+? I see that the type for CID_SOUND_NAME is a String and using SetParameter sets this... but it doesn't load the sound file unless actually selected with the File selector (...) button.

I see that this topic has been raised before without ANY response (except for my own). Has there been a fix, is it 'not possible', should I go make a P&B; sandwhich? 😉

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 13/12/2007 at 14:23, xxxxxxxx wrote:

To add (and poke this topic up a bit before going into obscurity) : With R9, you used a BaseSound attached to a BaseSequence. There is still a BaseSound in R10, but there are no exposed means to attach to CTrack, CCurve, or CKey. I'll check the SDK examples but there is nothing in the SDK docs of assistance.

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 17/12/2007 at 00:10, xxxxxxxx wrote:

I asked the developers about it. Will post again when I get an answer.

cheers,
Matthias

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 17/12/2007 at 23:55, xxxxxxxx wrote:

The plugin API currently does not support loading/accessing sounds of soundtracks.

cheers,
Matthias

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 18/12/2007 at 00:07, xxxxxxxx wrote:

That makes it a bit difficult to support audio from an external source during import. 😞

Any approach that would make it easier for the user to set up the audio? For instance, if it were possible to get the '...' button to get called with the known audio file path that would at least make the process easier than nothing at all. Having the audio file path in the CID_SOUND_NAME string would help the user locate the file manually but is not a great solution.

Thank you very much for your effort and response!

Robert

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 18/12/2007 at 00:59, xxxxxxxx wrote:

There is probably an "unofficial" way to load sounds. I just have to check it first. I will let you know if get it to run.

cheers,
Matthias

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 18/12/2007 at 11:22, xxxxxxxx wrote:

Look forward to any solution, unofficial or hack. :0)

Thanks, Matthias!

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 19/12/2007 at 03:45, xxxxxxxx wrote:

Ok, here is a working example. It loads a sound into an existing soundtrack. As there is no SDK declaration for a soundtrack you have to build your own, see example.

> _
> class SoundTrack : public CTrackData
> {
>      public:
>           BaseSound *sound;
>
> };
>
> class MenuTest : public CommandData
> {
>      public:
>           virtual Bool Execute(BaseDocument *doc);
> };
>
> Bool MenuTest::Execute(BaseDocument *doc)
> {
>      BaseObject *op = doc->GetActiveObject();
>      if(!op) return TRUE;
>
>      CTrack *mytrack = op->FindCTrack(DescLevel(CTsound,CTsound,0));
>      if(!mytrack)
>      {
>           GePrint("no track");
>           return TRUE;
>      }
>
>      Filename fn;
>      if(!fn.FileSelect(FSTYPE_ANYTHING, 0, "Load")) return TRUE;
>      
>      SoundTrack *sdata = (SoundTrack* )mytrack->GetNodeData();
>
>      if (sdata && sdata->sound && sdata->sound->Load(fn))
>      {
>           mytrack->SetParameter(DescLevel(CID_SOUND_NAME),fn.GetFileString(),0);
>           mytrack->SetName(fn.GetFileString());
>           EventAdd();
>      }
>
>      return TRUE;
> }
> _

Hope this helps. As said this is the "unofficial" way so no guarantee and things might change in future Cinema versions.

cheers,
Matthias

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 19/12/2007 at 05:58, xxxxxxxx wrote:

That works perfectly! I'll keep in mind that this is unofficial so that it can be relegated to the proper build only when the next SDK is released.

Thank you very much, Matthias!

Have a great holiday!