LeapRecorderΒΆ

Defines helper functions for the record/playback mechanism of the HandController.

class LeapRecorder

Maintains a buffer of recorded frames and tracks the state of playback and recording.

Public Functions

LeapRecorder()

Creates a new LeapRecorder object.

This doesn’t make sense outside the context of a HandController object.

void AddFrame(Frame frame)

Serializes a Leap Frame object and adds it to the end of the recording.

Frame GetCurrentFrame()

Returns the current frame without advancing the playhead.

This frame could be invalid.

List< Frame > GetFrames()

Deserializes all the recorded frames and returns them in a new list.

int GetFramesCount()

The number of recorded frames.

int GetIndex()

Returns the playback position.

float GetProgress()

Returns the ratio of the current playback position to the total recording length.

void Load(TextAsset text_asset)

Loads saved frames from a file.

Frame NextFrame()

Advances the playhead, deserializes the frame, and returns it.

void Pause()

Sets the play state to idle.

void Play()

Sets the play state to playing.

void Record()

Sets the play state to recording.

void Reset()

Discards any recorded frames.

string SaveToNewFile()

Saves the recorded frames to a file, overwriting an existing file.

void SetDefault()

Restores the default behaviors.

void SetIndex(int new_index)

Sets the playback position to the specified frame count (or the last frame if the specified index is after the last frame.

void Stop()

Sets the play state to idle.

Public Members

bool loop

Whether to lop back to the beginning when the last recorded frame is played.

float speed

Playback speed.

RecorderState state

The current play state.