MotionBuilder Forum
Welcome to Autodesk’s MotionBuilder Forums. Share your knowledge, ask questions, and explore popular MotionBuilder topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

FBAudioOut

4 REPLIES 4
Reply
Message 1 of 5
Anonymous
186 Views, 4 Replies

FBAudioOut

Hi guys,

has anyone of you ever tried to change the destination of an audioclip by script?
The python docs are not listing the properties of an newly created object of the class FBAudioOut.

We have multiple sound clips in our scenes which's destination are set to "none" when you open the fbx. I just want to set this destination to the next possible, e.g. Speaker(VIA High Definition Audio). Doing this by hand takes too much time. 😉

Does anyone have a solution for this or ever tried the same?

Script so far:


from pyfbsdk import *

mySystem = FBSystem()

for myAudio in mySystem.Scene.AudioClips:
# What is the current Destination
print myAudio.Destination

#Here should be the declaration of the destination
print myAudio.Destination = FBAudioOut()



Cheers,

Chris
4 REPLIES 4
Message 2 of 5
Anonymous
in reply to: Anonymous

Hi guys,

has anyone of you ever tried to change the destination of an audioclip by script?
The python docs are not listing the properties of an newly created object of the class FBAudioOut.

We have multiple sound clips in our scenes which's destination are set to "none" when you open the fbx. I just want to set this destination to the next possible, e.g. Speaker(VIA High Definition Audio). Doing this by hand takes too much time. 😉

Does anyone have a solution for this or ever tried the same?

Script so far:


from pyfbsdk import *

mySystem = FBSystem()

for myAudio in mySystem.Scene.AudioClips:
# What is the current Destination
print myAudio.Destination

#Here should be the declaration of the destination
print myAudio.Destination = FBAudioOut()



Cheers,

Chris


I got the same issue here, is there anyone from Mobu team who can answer this question?
Cheers,
Message 3 of 5
Anonymous
in reply to: Anonymous

Hi,

One turn arround the problem that work,
if someone know a better way, please add to this trhead 🙂

from pyfbsdk import *

for ac in FBSystem().Scene.AudioClips:
# Destination return the actual object set as active ( pyfbsdk.FBAudioOut object or None )
print ac.Destination
# PropertyList.Find("Destination") It is an FBPropertyEnum
print ac.PropertyList.Find("Destination")
# ok we instantiate that
lprop = ac.PropertyList.Find("Destination")
# this property have the .EnumList attribute who return None if the index it is wrong
# exemple:
print ac.PropertyList.Find("Destination").EnumList(0)
print ac.PropertyList.Find("Destination").EnumList(1)
print ac.PropertyList.Find("Destination").EnumList(2)
# actual EnumList index
print lprop.Data
#
# i do not find a way to iterate the EnumList
# this obligate to made a while loop
# usualy i do not like use a while loop
#
# anyway, this it is an possible solution for you guy's
lprop = ac.PropertyList.Find("Destination")
i = 0
while i is not None:
if "Speakers" in lprop.EnumList(i):
lprop.Data = i
i = None
else:
i += 1
Message 4 of 5
Anonymous
in reply to: Anonymous

sorry guy's,
i dooble post because the indent in the texte still not keeped in the first post 😞


from pyfbsdk import *

for ac in FBSystem().Scene.AudioClips:
# Destination return the actual object set as active ( pyfbsdk.FBAudioOut object or None )
print ac.Destination
# PropertyList.Find("Destination") It is an FBPropertyEnum
print ac.PropertyList.Find("Destination")
# this property have the .EnumList attribute who return None if the index it is wrong
# exemple:
print ac.PropertyList.Find("Destination").EnumList(0)
print ac.PropertyList.Find("Destination").EnumList(1)
print ac.PropertyList.Find("Destination").EnumList(2)
# actual EnumList index
print lprop.Data
#
# i do not find a way to iterate the EnumList
# this obligate to made a while loop
# usualy i do not like use a while loop
#
# anyway, this it is an possible solution for you guy's
lprop = ac.PropertyList.Find("Destination")
i = 0
while i is not None:
if "Speakers" in lprop.EnumList(i):
lprop.Data = i
i = None
else:
i += 1


ps: sorry for my english
Message 5 of 5
Anonymous
in reply to: Anonymous

Again, sorry for the multiple post,

I do not know if it is possible to have more than one speakers listed in the FBPropertyEnum "Destination", and if we can have other type of FBAudioOut (external device and so on).
That make possibly unsecure any way to simply set the .Data directly to an index whithout try to iterate the EnumList

On my computer the speaker it is on the index 1 on each motionbuilder i have in this computer.
fast way it is simply this:

from pyfbsdk import *

for ac in FBSystem().Scene.AudioClips:
lprop = ac.PropertyList.Find("Destination")
if lprop.Data == 0:
lprop.Data = 1


ok, that all for this subject, i will let other pserson give a better solution 🙂

ps: sorry for my english

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report