Sound File parameter in sound effector

On 13/04/2016 at 08:39, xxxxxxxx wrote:

Hi there,
I use the soundeffector[MGSOUNDEFFECTOR_FILE]="FileName"
The pat change in the effector pannel but is not updated in the scene.
I test with .Message(MSG_UPDATE) but it does not work!🤢

Any help?⭐


On 14/04/2016 at 08:33, xxxxxxxx wrote:

Hello Davide,

welcome to the Plugin Café forums 🙂

Unfortunately I'm not sure I will make you happy.
First of all, you will need to set the filename as an user interaction, so the effector at least realizes, it has happened.

soundeffector.SetParameter(c4d.MGSOUNDEFFECTOR_FILE, filename, c4d.DESCFLAGS_SET_USERINTERACTION)

Note: Using SetParameter() is usually just another notation for "soundeffector[id] = x", but it is needed here in order to use the mentioned flag.

Unfortunately this is not enough and there are two culprits with this.

a) A message requester will pop up, asking the user, if he or she wants to copy the soundfile into the project directory. There's currently no way to suppress this, sorry.

b) Although the effector now recognizes the new file, it still doesn't start to read the new file and update it's GUI or the effected entities. In Python there currently is no nice way to achieve this currently.
The workaround I came up with, but I need to mention, that this might not be an ideal solution working in every place or context. Plus it is ugly as hell:

c4d.CallButton(op, c4d.MGSOUNDEFFECTOR_PLAY) // turn playback on
c4d.CallButton(op, c4d.MGSOUNDEFFECTOR_PLAY) // and off again


On 14/04/2016 at 12:20, xxxxxxxx wrote:

Thank you Andreas,
I think your solution will work for what I need to do
I try soon