Open Reality Reference Guide
FBAudioIn Class Reference

Audio In class. More...

#include <fbaudio.h>

Inheritance diagram for FBAudioIn:

Public Member Functions

 FBAudioIn (HIObject pObject=NULL)
 Constructor. More...
 
bool SetOnline (bool pOnline)
 Turns Audio In online or offline. More...
 
bool IsOnline () const
 Is the Audio In online? More...
 
bool PrepareToRecord (const char *pRecordingPath, FBExistingClipAction pExistingClipAction=kFBExistingClipAskUser, FBExistingFileAction pExistingFileAction=kFBExistingFileAskUser)
 Prepares the Audio In for recording (similar as checking the "Record" checkbox in the UI). More...
 
bool TurnOffRecording ()
 Turns off the Audio In recording (similar as un-checking the "Record" checkbox in the UI). More...
 
bool IsReadyToRecord () const
 Is the Audio In ready to record (has it been prepared properly)? More...
 
FBAudioFmt GetSupportedFormats () const
 Returns all the Audio In supported formats (i.e. More...
 
bool SetRecordingFormat (FBAudioFmt pAudioFormat)
 Sets the recording format (i.e. More...
 
FBAudioFmt GetRecordingFormat () const
 Returns the recording format (i.e. More...
 
bool SetDelay (FBTime &pDelay)
 Sets the delay to use. More...
 
FBTime GetDelay () const
 Returns the delay currently set. More...
 
bool SetDestination (FBAudioOut *pAudioOut)
 Sets the Audio Out object to be used as the destination. More...
 
FBAudioOutGetDestination () const
 Returns the Audio Out object currently used as the destination. More...
 
- Public Member Functions inherited from FBComponent
 FBComponent (HIObject pObject)
 Constructor. More...
 
virtual ~FBComponent ()
 Destructor. More...
 
virtual bool FBCreate ()
 Open Reality Creation function. More...
 
virtual void FBDestroy ()
 Open Reality destruction function. More...
 
virtual void FBDelete () override
 Open Reality deletion function. More...
 
virtual bool SetHIObject (HIObject pObject, bool pSDKComponent) override
 Assign component to an internal pointer. More...
 
virtual int PropertyAdd (FBProperty *pProperty)
 Add a property to the component's property manager. More...
 
bool PropertyAddReferenceProperty (FBProperty *pReferenceProperty)
 Add a reference property to the component's property manager. More...
 
void PropertyRemove (FBProperty *pProperty)
 Remove a Property from the component's Property manager. More...
 
void PropertyGetModifiedList (FBArrayTemplate< FBProperty * > &pPropList, FBPlugModificationFlag pModificationFlags)
 Get list of properties which have been modified since last loading. More...
 
FBPropertyPropertyCreate (const char *pName, FBPropertyType pType, const char *pDataType, bool pAnimatable, bool pIsUser=false, FBProperty *pReferenceSource=NULL)
 Create user or dynamic property. More...
 
FBObjectFlag GetObjectFlags ()
 Get all Object Flags (concatenated). More...
 
void SetObjectFlags (FBObjectFlag pFlags)
 SetObjectFlags. More...
 
bool HasObjectFlags (FBObjectFlag pFlags)
 Check whether a specific object flag is enabled. More...
 
void EnableObjectFlags (FBObjectFlag pFlags)
 Enable a specific Object Flags. More...
 
void DisableObjectFlags (FBObjectFlag pFlags)
 Disable a specific Object Flags. More...
 
void SetObjectStatus (FBObjectStatus pStatus, bool pValue)
 Enable/Disable a specific Object Status. More...
 
bool GetObjectStatus (FBObjectStatus pStatus)
 Check to see if an object status is enabled. More...
 
bool ProcessNamespaceHierarchy (FBNamespaceAction pNamespaceAction, const char *pNamespaceName, const char *pReplaceTo=NULL, bool pAddRight=true)
 ProcessNamespaceHierarchy. More...
 
bool ProcessObjectNamespace (FBNamespaceAction pNamespaceAction, const char *pNamespaceName, const char *pReplaceTo=NULL, bool pAddRight=true)
 ProcessObjectNamespace. More...
 
virtual const char * ClassName () override
 Get the class name. More...
 
virtual bool UseCustomPropertyViewSet () const
 Use the custom property viewSet or not. More...
 
const char * GetFullName (void)
 Get the full name. More...
 
void SetOwnerNamespace (FBNamespace *pOwnerNSObj)
 Set the owner Namespace object. More...
 
FBNamespaceGetOwnerNamespace (void)
 Get the owner Namespace object. More...
 
FBFileReferenceGetOwnerFileReference (void)
 Get the owner FileReference object. More...
 
void HardSelect ()
 HardSelect. More...
 
virtual bool Is (int pTypeId) override
 Returns true if object is of type TypeId. More...
 
virtual int GetTypeId () override
 GetTypeId( int pTypeId ) More...
 
- Public Member Functions inherited from FBWrapperHolder
FBScriptWrapperGetWrapper ()
 Return the wrapper interface of this FBObject. More...
 
void AddWrapper (FBScriptWrapper *)
 
void RemoveWrapper (FBScriptWrapper *)
 

Additional Inherited Members

- Static Public Member Functions inherited from FBComponent
static int GetInternalClassId ()
 
static void FBComponentSetName (FBComponent *pObject, const char *pName)
 
static const char * FBComponentGetName (FBComponent *pObject)
 
static void FBComponentSetLongName (FBComponent *pObject, const char *pName)
 
static const char * FBComponentGetLongName (FBComponent *pObject)
 
- Public Attributes inherited from FBComponent
FBPropertyManager PropertyList
 Read Only Property: Manages all of the properties for the component. More...
 
FBPropertyListComponent Components
 List: List of components. More...
 
FBPropertyListComponent Parents
 List: Parents. More...
 
FBPropertyBool Selected
 Read Write Property: Selected property. More...
 
FBPropertyString Name
 Read Write Property: Unique name of object. More...
 
FBPropertyString LongName
 Read Write Property: Name and namespace for object.
More...
 
FBPropertyFolder Folder
 Read Write Property: The folder that contain this component. More...
 
- Static Public Attributes inherited from FBComponent
static int TypeInfo
 Contains the Type information of the object. More...
 
- Protected Member Functions inherited from FBPlug
bool IsSDKComponent ()
 Return whether or not item is an SDK component. More...
 
bool ConnectSrc (FBPlug *pSrc, FBConnectionType pConnectionType=kFBConnectionTypeNone)
 Add a source connection. More...
 
bool ConnectDst (FBPlug *pDst, FBConnectionType pConnectionType=kFBConnectionTypeNone)
 Add a destination connection. More...
 
bool ConnectSrcAt (int pDst_SrcIndex, FBPlug *pSrc, FBConnectionType pConnectionType=kFBConnectionTypeNone)
 Add a source connection. More...
 
bool ConnectDstAt (int pSrc_DstIndex, FBPlug *pDst, FBConnectionType pConnectionType=kFBConnectionTypeNone)
 Add a destination connection. More...
 
bool DisconnectDst (FBPlug *pDst)
 Remove a destination connection. More...
 
bool DisconnectSrc (FBPlug *pSrc)
 Remove a source connection. More...
 
void DisconnectAllSrc ()
 Remove all source connections. More...
 
void DisconnectAllDst ()
 Remove all destination connections. More...
 
bool DisconnectDstAt (int pIndex)
 Remove a destination connection at a specified index. More...
 
bool DisconnectSrcAt (int pIndex)
 Remove a source connection at a specified index. More...
 
bool ReplaceDstAt (int pIndex, FBPlug *pDst)
 Replace a destination connection at a specified index. More...
 
bool ReplaceSrcAt (int pIndex, FBPlug *pSrc)
 Replace a source connection at a specified index. More...
 
bool SwapSrc (int pIndexA, int pIndexB)
 Swap source connection at index A with source connection at index B. More...
 
bool MoveSrcAt (int pIndex, int pAtIndex)
 Move source connection at pIndex to pAtIndex. More...
 
bool MoveSrcAt (FBPlug *pSrc, FBPlug *pAtSrc)
 Move source connection pSrc to the position of pAtSrc. More...
 
int GetSrcCount ()
 Get source connection count. More...
 
FBPlugGetSrc (int pIndex)
 Get a source connection's plug at specified index. More...
 
FBConnectionType GetSrcType (int pIndex)
 Get a source connection's type at specified index. More...
 
int GetDstCount ()
 Get destination connection count. More...
 
FBPlugGetDst (int pIndex)
 Get a destination connection's plug at specified index. More...
 
FBConnectionType GetDstType (int pIndex)
 Get a destination connection's type at specified index. More...
 
bool BeginChange ()
 Begins a change on multiple plugs. More...
 
void EndChange ()
 Ends a change on multiple plugs. More...
 
void SetSelfModified (FBPlugModificationFlag pFlag, bool pBool)
 Set the plug's self modification flag. More...
 
bool GetSelfModified (FBPlugModificationFlag pFlag)
 Tell if the plug's self has changed. More...
 
void SetContentModified (FBPlugModificationFlag pFlag, bool pBool)
 Set the plug's owned property/object's modification flag. More...
 
bool GetContentModified (FBPlugModificationFlag pFlag)
 Tell if the plug's content has changed. More...
 
int GetPlugConnectionModifiedList (FBPlugList &pPlugList, FBPlugModificationFlag pConnectionModificatonFlag, bool pAddRemove)
 Get plug's modified src/dst property/object connection added/removed List. More...
 
bool RevertModification (FBPlugModificationFlag pFlag=kFBAllModifiedMask)
 Revert the plug's modification to original status. More...
 
void SetStatusFlag (FBPlugStatusFlag pStatus, bool pValue)
 Set the plug's status flag. More...
 
bool GetStatusFlag (FBPlugStatusFlag pStatus) const
 Tell if the plug's status has changed. More...
 
FBPlugGetOwner ()
 Get the owner of this plug. More...
 
FBPlugGetOwned (int pIndex)
 Get the owned plug at specified index. More...
 
int GetOwnedCount ()
 Get the owned plug count. More...
 
virtual bool PlugDataNotify (FBConnectionAction pAction, FBPlug *pThis, void *pData=NULL, void *pDataOld=NULL, int pDataSize=0)
 PlugDataNotify when overloaded is equivalent of FBSystem.OnConnectionDataNotify but in the context of the derived object only. More...
 
virtual bool PlugStateNotify (FBConnectionAction pAction, FBPlug *pThis, void *pData=NULL, void *pDataOld=NULL, int pDataSize=0)
 PlugStateNotify when overloaded is equivalent of FBSystem.OnConnectionStateNotify but in the context of the derived object only. More...
 
virtual bool PlugNotify (FBConnectionAction pAction, FBPlug *pThis, int pIndex, FBPlug *pPlug=NULL, FBConnectionType pConnectionType=kFBConnectionTypeNone, FBPlug *pNewPlug=NULL)
 PlugNotify when overloaded is equivalent of FBSystem.OnConnectionNotify but in the context of the derived object only. More...
 
- Static Protected Member Functions inherited from FBPlug
static int GetInternalClassId ()
 Internal class Id. More...
 
- Protected Attributes inherited from FBPlug
bool mAllocated
 Contain the Allocation State of the Component. More...
 
HIObject mObject
 Handle on the Plug. More...
 
bool mSDKComponent
 bool Plug is an SDK component.
More...
 
- Static Protected Attributes inherited from FBPlug
static const char * ClassGroupName
 ClassGroupName of the object. More...
 
static int TypeInfo
 TypeInfo. More...
 
static int mGlobalTypeInfo
 Represente the Type Index. More...
 

Detailed Description

Audio In class.

Used to control Audio In objects (like a Microphone Audio Device).

# This example shows how to prepare an FBAudioIn object for recording
# by redirecting the audio to an FBAudioOut object and
# by specifying a desired audio format and target audio file
from pyfbsdk import *
# Let's see how many FBAudioIn objects are available
lAudioIns = FBSystem().AudioInputs
print "The number of Audio Inputs:", len( lAudioIns )
if len( lAudioIns ) > 0:
# Work with the first Audio In object available
lAudioIn = lAudioIns[0]
print "Audio Input Name:", lAudioIn.Name
# Let's turn it offline, if not already
if lAudioIn.IsOnline():
print "Turned offline successful?", lAudioIn.SetOnline( False )
# Let's set the first AudioOut available as the Audio In destination
# if any destination is set yet
# (Windows Only)
if lAudioIn.GetDestination() == None:
lAudioOuts = FBSystem().AudioOutputs
print "The number of Audio Outputs:", len( lAudioOuts )
if len( lAudioOuts ) > 0:
# Work with the first Audio Out object available
lAudioOut = lAudioOuts[0]
print "Audio Output Name:", lAudioOut.Name
print "Setting destination successful?", lAudioIn.SetDestination( lAudioOut )
else:
print "No available Audio Out object available for destination"
else:
print "Audio Output <", lAudioIn.GetDestination().Name, "> already set for destination"
# Let's try to record an audio file in 8-bit, 22060 hz and in stereo
# Make sure this Audio In object supports this format
lSupportedFormats = lAudioIn.GetSupportedFormats()
if lSupportedFormats & FBAudioFmt_ConvertBitDepthMode( FBAudioBitDepthMode.kFBAudioBitDepthMode_8 ) != 0 and \
lSupportedFormats & FBAudioFmt_ConvertRateMode( FBAudioRateMode.kFBAudioRateMode_22050 ) != 0 and \
lSupportedFormats & FBAudioFmt_ConvertChannelMode( FBAudioChannelMode.kFBAudioChannelModeStereo ) != 0:
# This format is supported, let's set it now
lNewFormat = FBAudioFmt_ConvertBitDepthMode( FBAudioBitDepthMode.kFBAudioBitDepthMode_8 )
print "Setting recording format successful?", lAudioIn.SetRecordingFormat( lNewFormat )
# Let's add a delay of 3 frames
# (Windows only)
print "Setting delay successful?", lAudioIn.SetDelay( FBTime( 0, 0, 0, 3 ) )
# Let's turn it online now
print "Turned online successful?", lAudioIn.SetOnline( True )
# Now, prepare the Audio In object for recording
# To turn it off first, if already in "Record" state
if lAudioIn.IsReadyToRecord():
print "Turned Off Recording?", lAudioIn.TurnOffRecording()
lAudioFilePath = "C:\\temp\\myRecordedAudioFile.wav"
# Note: To remove pop-ups that may occurs, if required,
# look at the optional parameters of the PrepareToRecord method
print "Preparing to record successful?", lAudioIn.PrepareToRecord( lAudioFilePath )
if lAudioIn.IsReadyToRecord():
print "You are now ready to start recording and playback!"
else:
print "Something failed while preparing to record! Tip: Do you have a C:\temp folder?"
else:
print "This format (8-bit, 22060 hz, stereo) is not supported!"
else:
print "No available Audio In object available"
bool SetRecordingFormat(FBAudioFmt pAudioFormat)
Sets the recording format (i.e.
Provides access to the underlying system, and the MotionBuilder scene.
Definition: fbsystem.h:157
FBPropertyListAudioIn AudioInputs
List: Available audio inputs.
Definition: fbsystem.h:207
FBPropertyListAudioOut AudioOutputs
List: Available audio outputs.
Definition: fbsystem.h:208
Time data structure.
Definition: fbtime.h:88
K_DLLIMPORT FBAudioFmt FBAudioFmt_ConvertRateMode(FBAudioRateMode pRateMode)
Converts an FBAudioRateMode enum value to its FBAudioFmt object equivalent.
FBAudioBitDepthMode
Enum FBAudioBitDepthMode.
Definition: fbaudiofmt.h:70
FBAudioChannelMode
Enum FBAudioChannelMode.
Definition: fbaudiofmt.h:63
@ kFBAudioChannelModeStereo
2 channels, Wave file render support.
Definition: fbaudiofmt.h:65
K_DLLIMPORT FBAudioFmt FBAudioFmt_ConvertChannelMode(FBAudioChannelMode pChannelMode)
Converts an FBAudioChannelMode enum value to its FBAudioFmt object equivalent.
FBAudioRateMode
Enum FBAudioRateMode.
Definition: fbaudiofmt.h:77
@ kFBAudioRateMode_22050
22050 hz, Wave file render support.
Definition: fbaudiofmt.h:83
K_DLLIMPORT FBAudioFmt FBAudioFmt_ConvertBitDepthMode(FBAudioBitDepthMode pBitDepthMode)
Converts an FBAudioBitDepthMode enum value to its FBAudioFmt object equivalent.

Definition at line 189 of file fbaudio.h.

Constructor & Destructor Documentation

◆ FBAudioIn()

FBAudioIn ( HIObject  pObject = NULL)

Constructor.

Parameters
pObjectFor internal use only.

Member Function Documentation

◆ GetDelay()

FBTime GetDelay ( ) const

Returns the delay currently set.

(Windows only).

Returns
The delay currently set.

◆ GetDestination()

FBAudioOut* GetDestination ( ) const

Returns the Audio Out object currently used as the destination.

(Windows only).

Returns
The Audio Out object currently used as the destination. Returns a NULL pointer (None in Python) if any Audio Out object is currently set.

◆ GetRecordingFormat()

FBAudioFmt GetRecordingFormat ( ) const

Returns the recording format (i.e.

Bit Depth, Rate and Channel(s)) currently set.

Returns
The audio format currently set for recording.

◆ GetSupportedFormats()

FBAudioFmt GetSupportedFormats ( ) const

Returns all the Audio In supported formats (i.e.

Bit Depths, Rates and Channels).

Returns
The Audio In supported formats.

◆ IsOnline()

bool IsOnline ( ) const

Is the Audio In online?

Returns
True if the Audio In is online, false if it is offline.

◆ IsReadyToRecord()

bool IsReadyToRecord ( ) const

Is the Audio In ready to record (has it been prepared properly)?

Returns
True if the audio is ready to record, false otherwise.

◆ PrepareToRecord()

bool PrepareToRecord ( const char *  pRecordingPath,
FBExistingClipAction  pExistingClipAction = kFBExistingClipAskUser,
FBExistingFileAction  pExistingFileAction = kFBExistingFileAskUser 
)

Prepares the Audio In for recording (similar as checking the "Record" checkbox in the UI).

If the Audio In is not already online, it will turn it online automatically. If the Audio In is already ready to record, it will turn it off first automatically.

Parameters
pRecordingPathThe file path for the desired output wav file. The file must have the .wav extension.
pExistingClipActionThe action to perform when the action clip associated to the recording path is already in the scene.
pExistingFileActionThe action to perform when the file associated to the recording path already exists on disk and it not empty.
Returns
True if operation is successful, false otherwise. It could fail for different reasons (e.g. the specified file is not a WAV file or is invalid, the operation is abort by the user, etc.).

◆ SetDelay()

bool SetDelay ( FBTime pDelay)

Sets the delay to use.

The Audio In must be offline when this method is called. (Windows only).

Parameters
pDelayThe delay to use. To mimic the UI, the FBTime should refer to a frame number.
Returns
True if operation is successful, false otherwise.

◆ SetDestination()

bool SetDestination ( FBAudioOut pAudioOut)

Sets the Audio Out object to be used as the destination.

The Audio In must be offline when this method is called. (Windows only).

Parameters
pAudioOutThe Audio Out object to be used as the destination. Use a NULL pointer (None in Python) to unset the destination.
Returns
True if operation is successful, false otherwise.

◆ SetOnline()

bool SetOnline ( bool  pOnline)

Turns Audio In online or offline.

Parameters
pOnlineTrue to turn the Audio In online, false to turn it offline.
Returns
True if operation is successful, false otherwise.

◆ SetRecordingFormat()

bool SetRecordingFormat ( FBAudioFmt  pAudioFormat)

Sets the recording format (i.e.

Bit Depth, Rate and Channel(s)) to use. The Audio In must be offline when this method is called.

Parameters
pAudioFormatThe audio format to use for recording. It must specify a unique Bit Depth, Rate and Channels.
Returns
True if operation is successful, false otherwise. It could fail for different reasons (e.g. the specified audio format is not supported, more than one Bit Depth is specified, etc.).

◆ TurnOffRecording()

bool TurnOffRecording ( )

Turns off the Audio In recording (similar as un-checking the "Record" checkbox in the UI).

Returns
True if operation is successful, false otherwise.

The documentation for this class was generated from the following file: