class MAGES::Recorder::Utilities¶
Overview¶
Recorder utilities. More…
class Utilities { public: // classes class EventDelegator; class EventForwarder; class MicrophoneRequester; templateclass RingBuffer; class UserAvatarDelegator; // properties GameObject Proxy; GameObject ProxyClients; // methods static Packet GetNextPacket(Stream stream); static void WritePacket(Packet packet, Stream stream); static bool ApproximatelyEqual(Vector3 a, Vector3 b); static bool ApproximatelyEqual(Quaternion a, Quaternion b); static string GetPath(this GameObject gameObject); static GameObject CreateRig( string name, GameObject avatar, GameObject leftHand, GameObject rightHand ); static void RequestMicrophone(System.Action onResponse); static string[] GetCodecs(); static T ToStruct< T >(byte[] data); static T ReadStruct< T >(this BinaryReader reader); static T[] ReinterpretArray< T >(byte[] bytes); static byte[] ToBytes< T >(T data); static ICodec CreateCodec(string name); static string FindCodecNameByExtensions(string extension); static void LinearResample(float[] ss, int sh, float[] ts, int th, int nts); static bool LinearResampleAvailable( uint nss, int sh, uint nts, int th, out uint sr, out uint tr ); static uint LinearResampleNumTargetSamplesRequired( uint sourceSamples, uint sourceSampleRate, uint targetSampleRate ); static string DateToRecorderString(this DateTime dateTime); static DateTime RecorderStringToDate(this string dateTime); static string ToRecordingLength(this TimeSpan timeSpan); static async Task<RecorderModule.Recording> GetRecordingFromPathAsync( string path, string appProductName ); static async Task<RecorderModule.Recording[]> GetAllRecordingsAsync( string product, IAuthenticationAPI auth, string baseUrl, string filePath, string appProductName ); static double GetRecordingLength(string path); };
Detailed Documentation¶
Recorder utilities.
Properties¶
GameObject Proxy
Gets the proxy gameobject.
GameObject ProxyClients
Gets the gameobject in which the client avatar instances will be stored.
Methods¶
static Packet GetNextPacket(Stream stream)
Read a packet from a stream.
Parameters:
stream |
The stream to read from. |
InvalidDataException |
Thrown when stream is invalid. |
Returns:
The packet read.
static void WritePacket(Packet packet, Stream stream)
Write a packet to a stream.
Parameters:
packet |
The packet. |
stream |
The output stream. |
static bool ApproximatelyEqual(Vector3 a, Vector3 b)
Compares 2 vectors.
Parameters:
a |
First vector. |
b |
Second vector. |
Returns:
True if they are approximately equal, component wise.
static bool ApproximatelyEqual(Quaternion a, Quaternion b)
Compares 2 quaternions.
Parameters:
a |
First quat. |
b |
Second quat. |
Returns:
True if they are approximately equal.
static string GetPath(this GameObject gameObject)
Gets the path of a GameObject.
Parameters:
gameObject |
The gameobject. |
Returns:
The full path of the gameobject.
static GameObject CreateRig( string name, GameObject avatar, GameObject leftHand, GameObject rightHand )
Builds a rig from an avatar and two hands.
Parameters:
name |
The name of the rig. |
avatar |
The avatar prefab. |
leftHand |
The left hand prefab. |
rightHand |
The right hand prefab. |
Returns:
The parent gameobject.
static void RequestMicrophone(System.ActiononResponse)
Cross platform request microphone function.
Parameters:
onResponse |
Request is async so on completion this callback is invoked. |
static string[] GetCodecs()
Returns an array of all available codecs.
Returns:
An array of all the available codecs.
static T ToStruct< T >(byte[] data)
Converts a byte array to struct.
Parameters:
data |
The data. |
T |
The struct type. |
Returns:
The struct.
static T ReadStruct< T >(this BinaryReader reader)
Reads a struct from a binary reader.
Parameters:
reader |
The reader. |
T |
The struct type. |
Returns:
The struct.
static T[] ReinterpretArray< T >(byte[] bytes)
Reinterprets a byte array as an array of a different type.
Parameters:
bytes |
The byte array. |
T |
The type to reinterpret as. |
Returns:
The reinterpreted array.
static byte[] ToBytes< T >(T data)
Converts a struct to byte array.
Parameters:
data |
The struct. |
T |
The struct type. |
Returns:
The byte array.
static ICodec CreateCodec(string name)
Creates a codec by name.
Parameters:
name |
The name of the codec. |
Returns:
The codec instance.
static string FindCodecNameByExtensions(string extension)
Finds a codec name by extension.
Parameters:
extension |
The extension to search for. |
Returns:
The name of the codec (to be used in Utilities.CreateCodec.
static void LinearResample(float[] ss, int sh, float[] ts, int th, int nts)
Resamples a signal using linear interpolation.
To calculate nts, use LinearResampleAvailable.
Parameters:
ss |
Source samples. |
sh |
Source sample rate (Hz). |
ts |
Target samples. |
th |
Target sample rate (Hz). |
nts |
Number of samples to write to ts. |
static bool LinearResampleAvailable( uint nss, int sh, uint nts, int th, out uint sr, out uint tr )
Calculates the number of samples that can be written to the target buffer.
Parameters:
nss |
Number of samples available in source buffer. |
sh |
Source sample rate (Hz). |
nts |
Number of samples available in target buffer. |
th |
Target sample rate (Hz). |
sr |
Number of samples that can be used from the source buffer. |
tr |
Number of samples that can be written to the target buffer. |
Returns:
True if resampling is possible, false otherwise.
static uint LinearResampleNumTargetSamplesRequired( uint sourceSamples, uint sourceSampleRate, uint targetSampleRate )
Calculates the number of samples that can be written to the target buffer.
Parameters:
sourceSamples |
The source sample count. |
sourceSampleRate |
The source sample rate. |
targetSampleRate |
The target sample rate. |
Returns:
The amount of target samples that will be produced.
static string DateToRecorderString(this DateTime dateTime)
Converts a date time to a string.
Parameters:
dateTime |
The date time instance. |
Returns:
The encoded string.
static DateTime RecorderStringToDate(this string dateTime)
Converts a string to a date time.
Parameters:
dateTime |
The date time. |
Returns:
Date time instance, otherwise null if parse failed.
static string ToRecordingLength(this TimeSpan timeSpan)
Converts a time span to a recording length string.
Parameters:
timeSpan |
The timespan. |
Returns:
The string of the timespan.
static async Task<RecorderModule.Recording> GetRecordingFromPathAsync( string path, string appProductName )
Gathers recording information from a given path.
Parameters:
path |
The path of the XREC file to open. |
Returns:
The recording class.
static async Task<RecorderModule.Recording[]> GetAllRecordingsAsync( string product, IAuthenticationAPI auth, string baseUrl, string filePath, string appProductName )
Gets all recordings.
Parameters:
product |
The product to look for. |
auth |
The authentication api. |
baseUrl |
The baseurl to use. |
filePath |
The file path to look for local recordings. |
Returns:
A list of local and remote recordings.
static double GetRecordingLength(string path)
Gets the recording length in seconds.
Parameters:
path |
The path of the recording. |
Returns:
The duration of the recording (in seconds).