MidiPlayerTK.MPTKInnerLoop

Setting for MIDI inner loop [Pro]. Look at MidiFilePlayer.MPTK_InnerLoop
Example: More...

Public Types

enum  InnerLoopPhase { Start , Resume , Exit }
 

Public Member Functions

void Clear ()
 Disable looping, set start, resume, end, count to 0
 

Public Attributes

int Count
 
bool Enabled
 
long End
 
bool Finished
 
bool Log
 
int Max
 
Func< InnerLoopPhase, long, long, int, bool > OnEventInnerLoop
 
long Resume
 
long Start
 

Detailed Description

Setting for MIDI inner loop [Pro]. Look at MidiFilePlayer.MPTK_InnerLoop
Example:

Member Enumeration Documentation

◆ InnerLoopPhase

Loop phase action sent to OnEventInnerLoop

Enumerator
Start 

Start the loop

Resume 

Resume the loop

Exit 

Exit the loop

Member Data Documentation

◆ Count

int MidiPlayerTK.MPTKInnerLoop.Count

Current loop count. Default is 0.

◆ Enabled

bool MidiPlayerTK.MPTKInnerLoop.Enabled

Enable or disable the loop. Default is false.

◆ End

long MidiPlayerTK.MPTKInnerLoop.End

Tick position to trigger the loop restart to the Resume position (when MidiLoad.MPTK_TickPlayer >= to End). Default is 0.

◆ Finished

bool MidiPlayerTK.MPTKInnerLoop.Finished

Become true when looping is over or OnEventInnerLoop return false. Set to false at start.

◆ Log

bool MidiPlayerTK.MPTKInnerLoop.Log

Enable logging message

◆ Max

int MidiPlayerTK.MPTKInnerLoop.Max

Maximum iteration for the loop including the first. When Count >= Max the MIDI sequencer continue to the next MIDI events AFTER TICK #eND.
Set to 0 for infinite loop. Default is 0.

◆ OnEventInnerLoop

Func<InnerLoopPhase, long, long, int, bool> MidiPlayerTK.MPTKInnerLoop.OnEventInnerLoop

Unity event triggered when a loop occurs. parameters:

  • InnerLoopPhase current loop phase
  • long current tick player (MPTK_TickPlayer)
  • long tick target (End)
  • long loop count (Count). return:
  • boolean true continue looping, false exit loop.
    Note
  • this action is done from the MIDI thread, not from the Unity thread.
  • It's not possible to call Unity API (only Debug.Log).
  • it's a managed thread, so all variables from your script are visible.

◆ Resume

long MidiPlayerTK.MPTKInnerLoop.Resume

Tick position to resume the loop when MidiLoad.MPTK_TickPlayer >= to End. Default is 0. See also MidiFilePlayer.MPTK_RawSeek

◆ Start

long MidiPlayerTK.MPTKInnerLoop.Start

Tick position where the loop begin when the MIDI start. The MIDI sequencer go immediately to this position.
if Start > Resume the loop will begin at Resume position. Default is 0.