FBAudioIn Class Reference

FBAudioIn Class Reference

#include <mobu-python-api.h>

Class 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()
# This format is supported, let's set it now
lNewFormat |= FBAudioFmt_ConvertRateMode( FBAudioRateMode.kFBAudioRateMode_22050 )
lNewFormat |= FBAudioFmt_ConvertChannelMode( FBAudioChannelMode.kFBAudioChannelModeStereo )
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"
+ Inheritance diagram for FBAudioIn:

Public Member Functions

 __reduce__ ()
 
FBTime GetDelay (FBAudioIn arg1)
 Returns the delay currently set. More...
 
bool SetOnline (FBAudioIn arg1, object arg2)
 Turns Audio In online or offline. More...
 
 __init__ (object arg1)
 Constructor. More...
 
bool IsOnline (FBAudioIn arg1)
 Is the Audio In online? More...
 
bool PrepareToRecord (FBAudioIn arg1, str arg2, FBExistingClipAction arg3, FBExistingFileAction arg4)
 Prepares the Audio In for recording (similar as checking the "Record" checkbox in the UI). More...
 
bool TurnOffRecording (FBAudioIn arg1)
 Turns off the Audio In recording (similar as un-checking the "Record" checkbox in the UI). More...
 
bool IsReadyToRecord (FBAudioIn arg1)
 Is the Audio In ready to record (has it been prepared properly)? More...
 
int GetSupportedFormats (FBAudioIn arg1)
 Returns all the Audio In supported formats (i.e. More...
 
bool SetRecordingFormat (FBAudioIn arg1, object arg2)
 Sets the recording format (i.e. More...
 
int GetRecordingFormat (FBAudioIn arg1)
 Returns the recording format (i.e. More...
 
bool SetDelay (FBAudioIn arg1, FBTime arg2)
 Sets the delay to use. More...
 
bool SetDestination (FBAudioIn arg1, object arg2)
 Sets the Audio Out object to be used as the destination. More...
 
object GetDestination (FBAudioIn arg1)
 Returns the Audio Out object currently used as the destination. More...
 
- Public Member Functions inherited from FBComponent
 __reduce__ ()
 
FBPropertyList PropertyGetModifiedList (FBComponent arg1, FBPlugModificationFlag arg2)
 Get list of properties which have been modified since last loading. More...
 
str ClassName (FBComponent arg1)
 Get the class name. More...
 
 DisableObjectFlags (FBComponent arg1, FBObjectFlag arg2)
 Disable a specific Object Flags. More...
 
 EnableObjectFlags (FBComponent arg1, FBObjectFlag arg2)
 Enable a specific Object Flags. More...
 
bool FBCreate (FBComponent arg1)
 Open Reality Creation function. More...
 
 FBDelete (FBComponent arg1)
 Open Reality deletion function. More...
 
 FBDestroy (FBComponent arg1)
 Open Reality destruction function. More...
 
FBObjectFlag GetObjectFlags (FBComponent arg1)
 Get all Object Flags (concatenated). More...
 
bool GetObjectStatus (FBComponent arg1, FBObjectStatus arg2)
 Check to see if an object status is enabled. More...
 
bool HasObjectFlags (FBComponent arg1, FBObjectFlag arg2)
 Check whether a specific object flag is enabled. More...
 
bool Is (FBComponent arg1, object arg2)
 Returns true if object is of type TypeId. More...
 
bool ProcessNamespaceHierarchy (FBComponent arg1, FBNamespaceAction arg2, str arg3, str arg4, object arg5)
 ProcessNamespaceHierarchy. More...
 
bool ProcessObjectNamespace (FBComponent arg1, FBNamespaceAction arg2, str arg3, str arg4, object arg5)
 ProcessObjectNamespace. More...
 
int PropertyAdd (FBComponent arg1, FBProperty arg2)
 Add a property to the component's property manager. More...
 
bool PropertyAddReferenceProperty (FBComponent arg1, FBProperty arg2)
 Add a reference property to the component's property manager. More...
 
object PropertyCreate (FBComponent arg1, str arg2, FBPropertyType arg3, str arg4, object arg5, object arg6, FBProperty arg7)
 Create user or dynamic property. More...
 
 PropertyRemove (FBComponent arg1, FBProperty arg2)
 Remove a Property from the component's Property manager. More...
 
 SetObjectFlags (FBComponent arg1, FBObjectFlag arg2)
 SetObjectFlags. More...
 
 SetObjectStatus (FBComponent arg1, FBObjectStatus arg2, object arg3)
 Enable/Disable a specific Object Status. More...
 
 HardSelect (FBComponent arg1)
 HardSelect. More...
 
object GetOwnerFileReference (FBComponent arg1)
 Get the owner FileReference object. More...
 
 __init__ (...)
 Constructor. More...
 
- Public Member Functions inherited from FBPlug
 __reduce__ ()
 
bool BeginChange (FBPlug arg1)
 Begins a change on multiple plugs. More...
 
str ClassName (FBPlug arg1)
 internal System vars. More...
 
bool ConnectDst (FBPlug arg1, FBPlug arg2, FBConnectionType arg3)
 Add a destination connection. More...
 
bool ConnectDstAt (FBPlug arg1, object arg2, FBPlug arg3, FBConnectionType arg4)
 Add a destination connection. More...
 
bool ConnectSrc (FBPlug arg1, FBPlug arg2, FBConnectionType arg3)
 Add a source connection. More...
 
bool ConnectSrcAt (FBPlug arg1, object arg2, FBPlug arg3, FBConnectionType arg4)
 Add a source connection. More...
 
 DisconnectAllDst (FBPlug arg1)
 Remove all destination connections. More...
 
 DisconnectAllSrc (FBPlug arg1)
 Remove all source connections. More...
 
bool DisconnectDst (FBPlug arg1, FBPlug arg2)
 Remove a destination connection. More...
 
bool DisconnectDstAt (FBPlug arg1, object arg2)
 Remove a destination connection at a specified index. More...
 
bool DisconnectSrc (FBPlug arg1, FBPlug arg2)
 Remove a source connection. More...
 
bool DisconnectSrcAt (FBPlug arg1, object arg2)
 Remove a source connection at a specified index. More...
 
 EndChange (FBPlug arg1)
 Ends a change on multiple plugs. More...
 
object GetDst (FBPlug arg1, object arg2)
 Get a destination connection's plug at specified index. More...
 
int GetDstCount (FBPlug arg1)
 Get destination connection count. More...
 
FBConnectionType GetDstType (FBPlug arg1, object arg2)
 Get a destination connection's type at specified index. More...
 
object GetOwned (FBPlug arg1, object arg2)
 Get the owned plug at specified index. More...
 
int GetOwnedCount (FBPlug arg1)
 Get the owned plug count. More...
 
object GetOwner (FBPlug arg1)
 Get the owner of this plug. More...
 
object GetSrc (FBPlug arg1, object arg2)
 Get a source connection's plug at specified index. More...
 
int GetSrcCount (FBPlug arg1)
 Get source connection count. More...
 
FBConnectionType GetSrcType (FBPlug arg1, object arg2)
 Get a source connection's type at specified index. More...
 
bool Is (FBPlug arg1, object arg2)
 Is( int pTypeId ) More...
 
bool IsSDKComponent (FBPlug arg1)
 Return whether or not item is an SDK component. More...
 
 MoveSrcAt (...)
 
bool ReplaceDstAt (FBPlug arg1, object arg2, FBPlug arg3)
 Replace a destination connection at a specified index. More...
 
bool ReplaceSrcAt (FBPlug arg1, object arg2, FBPlug arg3)
 Replace a source connection at a specified index. More...
 
bool SwapSrc (FBPlug arg1, object arg2, object arg3)
 Swap source connection at index A with source connection at index B. More...
 
 SetSelfModified (FBPlug arg1, FBPlugModificationFlag arg2, object arg3)
 Set the plug's self modification flag. More...
 
bool GetSelfModified (FBPlug arg1, FBPlugModificationFlag arg2)
 Tell if the plug's self has changed. More...
 
 SetContentModified (FBPlug arg1, FBPlugModificationFlag arg2, object arg3)
 Set the plug's owned property/object's modification flag. More...
 
bool GetContentModified (FBPlug arg1, FBPlugModificationFlag arg2)
 Tell if the plug's content has changed. More...
 
int GetPlugConnectionModifiedList (FBPlug arg1, FBPlugList arg2, FBPlugModificationFlag arg3, object arg4)
 Get plug's modified src/dst property/object connection added/removed List. More...
 
bool RevertModification (FBPlug arg1, FBPlugModificationFlag arg2)
 Revert the plug's modification to original status. More...
 
 __init__ (...)
 
method staticmethod (function)
 
- Public Member Functions inherited from FBPythonWrapper
 __reduce__ ()
 
 __init__ (...)
 

Additional Inherited Members

- Public Attributes inherited from FBComponent
object OwnerNamespace
 
ORSDK2018::FBPropertyListComponent Components
 List: List of components. More...
 
ORSDK2018::FBPropertyString Name
 Read Write Property: Unique name of object. More...
 
ORSDK2018::FBPropertyString LongName
 Read Write Property: Name and namespace for object. More...
 
object FullName
 
ORSDK2018::FBPropertyListComponent Parents
 List: Parents. More...
 
ORSDK2018::FBPropertyManager PropertyList
 Read Only Property: Manages all of the properties for the component. More...
 
FBPropertyBool Selected
 Read Write Property: Selected property. More...
 
- Public Attributes inherited from FBPythonWrapper
object OnUnbind
 

Member Function Documentation

__init__ ( object  arg1)

Constructor.

Python Docstring:

__init__( (object)arg1) -> None 

C++ Signature:

 FBAudioIn(HIObject pObject = ((void *) 0)) 
Parameters
pObjectFor internal use only.
__reduce__ ( )
FBTime GetDelay ( FBAudioIn  arg1)

Returns the delay currently set.

Python Docstring:

GetDelay( (FBAudioIn)arg1) -> FBTime 

C++ Signature:

ORSDK2018::FBTime GetDelay() 

(Windows only).

Returns
The delay currently set.
object GetDestination ( FBAudioIn  arg1)

Returns the Audio Out object currently used as the destination.

Python Docstring:

GetDestination( (FBAudioIn)arg1) -> object 

C++ Signature:

ORSDK2018::FBAudioOut * GetDestination() 

(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.
int GetRecordingFormat ( FBAudioIn  arg1)

Returns the recording format (i.e.

Python Docstring:

GetRecordingFormat( (FBAudioIn)arg1) -> int 

C++ Signature:

FBAudioFmt GetRecordingFormat() 

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

Returns
The audio format currently set for recording.
int GetSupportedFormats ( FBAudioIn  arg1)

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

Python Docstring:

GetSupportedFormats( (FBAudioIn)arg1) -> int 

C++ Signature:

FBAudioFmt GetSupportedFormats() 

Bit Depths, Rates and Channels).

Returns
The Audio In supported formats.
bool IsOnline ( FBAudioIn  arg1)

Is the Audio In online?

Python Docstring:

IsOnline( (FBAudioIn)arg1) -> bool 

C++ Signature:

bool IsOnline() 
Returns
True if the Audio In is online, false if it is offline.
bool IsReadyToRecord ( FBAudioIn  arg1)

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

Python Docstring:

IsReadyToRecord( (FBAudioIn)arg1) -> bool 

C++ Signature:

bool IsReadyToRecord() 
Returns
True if the audio is ready to record, false otherwise.
bool PrepareToRecord ( FBAudioIn  arg1,
str  arg2,
FBExistingClipAction  arg3,
FBExistingFileAction  arg4 
)

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

Python Docstring:

PrepareToRecord( (FBAudioIn)arg1, (str)arg2 [, (FBExistingClipAction)arg3 [, (FBExistingFileAction)arg4]]) -> bool 

C++ Signature:

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

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.).
bool SetDelay ( FBAudioIn  arg1,
FBTime  arg2 
)

Sets the delay to use.

Python Docstring:

SetDelay( (FBAudioIn)arg1, (FBTime)arg2) -> bool 

C++ Signature:

bool SetDelay(ORSDK2018::FBTime & pDelay) 

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.
bool SetDestination ( FBAudioIn  arg1,
object  arg2 
)

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

Python Docstring:

SetDestination( (FBAudioIn)arg1, (object)arg2) -> bool 

C++ Signature:

bool SetDestination(ORSDK2018::FBAudioOut * pAudioOut) 

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.
bool SetOnline ( FBAudioIn  arg1,
object  arg2 
)

Turns Audio In online or offline.

Python Docstring:

SetOnline( (FBAudioIn)arg1, (object)arg2) -> bool 

C++ Signature:

bool SetOnline(bool pOnline) 
Parameters
pOnlineTrue to turn the Audio In online, false to turn it offline.
Returns
True if operation is successful, false otherwise.
bool SetRecordingFormat ( FBAudioIn  arg1,
object  arg2 
)

Sets the recording format (i.e.

Python Docstring:

SetRecordingFormat( (FBAudioIn)arg1, (object)arg2) -> bool 

C++ Signature:

bool SetRecordingFormat(FBAudioFmt pAudioFormat) 

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.).
bool TurnOffRecording ( FBAudioIn  arg1)

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

Python Docstring:

TurnOffRecording( (FBAudioIn)arg1) -> bool 

C++ Signature:

bool TurnOffRecording() 
Returns
True if operation is successful, false otherwise.