IC Python API:RLPy RAudioRecorder

From Reallusion Wiki!
Revision as of 02:21, 23 April 2020 by Chuck (RL) (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Main article: Modules.
Last modified: 04/23/2020

Description

This class is used for the recording of audio. In addition, this class provides functionality for selecting the audio input.

See Also: RIAudioObject, RAudioRecorderCallback

Member Functions

GetAudio ( self )

Get the recorded audio object. If no recording exists then return None.

Returns

Audio object - RIAudioObject
1 audio_recorder = RLPy.RAudioRecorder()
2 recorded_audio = audio_recorder.GetAudio()      # RIAudioObject

GetAvailableDevices ( self )

Get all the available devices on this audio recorder.

Returns

All available recording devices - string list
1 audio_recorder = RLPy.RAudioRecorder()
2 all_device = audio_recorder.GetAvailableDevices()

GetInputDevice ( self )

Get the name of the device on this audio recorder.

Returns

Current recording device name - string
1 audio_recorder = RLPy.RAudioRecorder()
2 all_device = audio_recorder.GetInputDevice()

GetTimeLimit ( self )

Get this audio recorder's time limit.

Returns

Time limit (default: 9,000,000 milliseconds or 15 minutes) - integer
1 audio_recorder = RLPy.RAudioRecorder()
2 all_device = audio_recorder.GetTimeLimit()

RegisterCallback ( self )

Register an audio recorder callback.

Parameters

pCallback [IN] Audio recorder callback - RAudioRecorderCallback
 1 class RLAudioRecorderCallback(RLPy.RAudioRecorderCallback):
 2     def __init__(self):
 3         RLPy.RAudioRecorderCallback.__init__(self)
 4         self.time_reached = None
 5     def OnTimeLimitReached(self):
 6         if self.time_reached != None:
 7             self.time_reached()
 8     def register_time_reached(self, func):
 9         self.time_reached = func
10 audio_callback = RLAudioRecorderCallback()
11 audio_recorder = RLPy.RAudioRecorder()
12 audio_recorder.RegisterCallback(audio_callback)

SetInputDevice ( self, strInuptAudioDeviceName )

Set the audio recording device name designated for usage.

Parameters

strInputAudioDeviceName [IN] Name of the recording device - string

Return

Success - RLPy.RStatus.Success
Failure - RLPy.RStatus.Failure
1 audio_recorder = RLPy.RAudioRecorder()
2 all_device = audio_recorder.GetAvailableDevices()
3 if len(all_device) > 0:
4     audio_recorder.SetInputDevice(all_device[0]))

SetTimeLimit ( self, nMillisecond )

Set the audio length limitation. When the recording time exceeds this limitation, then the recording will automatically stop.

Parameters

nMillisecond [IN] The time limit in milliseconds - integer
1 audio_recorder = RLPy.RAudioRecorder()
2 audio_recorder.SetTimeLimit(5000)

Start ( self )

Start recording audio. If the current recording device no longer exists, then return RLPy.RStatus.Failure.

Return

Success - RLPy.RStatus.Success
Failure - RLPy.RStatus.Failure
1 audio_recorder = RLPy.RAudioRecorder()
2 audio_recorder.Start()

Stop ( self )

Stop recording audio.

Return

Success - RLPy.RStatus.Success
Failure - RLPy.RStatus.Failure
1 audio_recorder = RLPy.RAudioRecorder()
2 audio_recorder.Stop()