Packageorg.si.sion.sequencer.base
Classpublic class MMLSequencer
InheritanceMMLSequencer Inheritance Object
Subclasses SiMMLSequencer

MMLSequencer is the basic class of a bridges between MMLEvents, sound modules and sound systems. You should follow this in your inherited classes. 1) Register MML event listeners by setMMLEventListener() or newMMLEventListener(). 2) Override on...() functions. 3) Override prepareCompile() and compile() if necessary. 4) Override prepareProcess() and process() to process audio data. And usage is as below. 1) Call initialize() to initialize. 2) Call prepareCompile() and compile() to compile the MML string to MMLData. 3) Call prepareProcess() and process() to process audio in inherited class.



Public Properties
 PropertyDefined By
  sampleRate : int
Audio setting, sampling ratio.
MMLSequencer
  setting : MMLParserSetting
MML parser setting.
MMLSequencer
Public Methods
 MethodDefined By
  
Default constructor initializes event handlers.
MMLSequencer
  
compile(interval:int = 1000):Number
Parse mml string.
MMLSequencer
  
getEventID(mmlCommand:String):int
Get MMLEvent id by mml command letter.
MMLSequencer
  
getEventLetter(eventID:int):String
Get MML command letters by event id.
MMLSequencer
  
prepareCompile(data:MMLData, mml:String):Boolean
Prepare to compile mml string.
MMLSequencer
  
Set global sequence.
MMLSequencer
Protected Methods
 MethodDefined By
  
default operation for MMLEvent.GLOBAL_WAIT.
MMLSequencer
  
default operation for MMLEvent.INTERNAL_CALL.
MMLSequencer
  
default operation for MMLEvent.INTERNAL_WAIT.
MMLSequencer
  
default operation for MMLEvent.NOP.
MMLSequencer
  
default operation for MMLEvent.PROCESS.
MMLSequencer
  
default operation for MMLEvent.REPEAT_ALL.
MMLSequencer
  
default operation for MMLEvent.REPEAT_BEGIN.
MMLSequencer
  
default operation for MMLEvent.REPEAT_BREAK.
MMLSequencer
  
default operation for MMLEvent.REPEAT_END.
MMLSequencer
  
default operation for MMLEvent.SEQUENCE_TAIL.
MMLSequencer
  
default operation for MMLEvent.TEMPO.
MMLSequencer
  
default operation for MMLEvent.TIMER.
MMLSequencer
  
dummy operation for MMLEvent.PROCESS.
MMLSequencer
  
Operates nothing.
MMLSequencer
  
execute global sequence.
MMLSequencer
  
check global sequences pointer acheives to the end.
MMLSequencer
  
newMMLEventListener(letter:String, func:Function, isGlobal:Boolean = false):int
Register new MMLEvent letter.
MMLSequencer
  
Callback after parse.
MMLSequencer
  
onBeat(delaySamples:int, beatCounter:int):void
Callback on every 16th beats.
MMLSequencer
  
onBeforeCompile(mml:String):String
Callback before parse.
MMLSequencer
  
onProcess(length:int, e:MMLEvent):void
Callback on processing.
MMLSequencer
  
onTableParse(prev:MMLEvent, table:String):void
Callback when table event was found.
MMLSequencer
  
onTempoChanged(tempoRatio:Number):void
Callback when the tempo is changed.
MMLSequencer
  
Callback when streaming interrupted by timer .
MMLSequencer
  
processMMLExecutor(exe:MMLExecutor, bufferSampleCount:int):Boolean
Processing audio by one executor.
MMLSequencer
  
setMMLEventListener(id:int, func:Function, isGlobal:Boolean = false):void
Similar with an addEventListener(), but only one listener can be set for one event.
MMLSequencer
  
start global sequence.
MMLSequencer
Public Constants
 ConstantDefined By
  FIXED_BITS : int = 8
[static] bits for fixed decimal
MMLSequencer
  FIXED_FILTER : int
[static] filter for decimal fraction area
MMLSequencer
Property Detail
_eventCommandLetterproperty
_sion_internal var _eventCommandLetter:Array

sampleRateproperty 
public var sampleRate:int

Audio setting, sampling ratio. The value is restricted as 22050 or 44100.

settingproperty 
public var setting:MMLParserSetting

MML parser setting.

Constructor Detail
MMLSequencer()Constructor
public function MMLSequencer()

Default constructor initializes event handlers.

Method Detail
_default_onGlobalWait()method
protected function _default_onGlobalWait(e:MMLEvent):MMLEvent

default operation for MMLEvent.GLOBAL_WAIT.

Parameters

e:MMLEvent

Returns
MMLEvent
_default_onInternalCall()method 
protected function _default_onInternalCall(e:MMLEvent):MMLEvent

default operation for MMLEvent.INTERNAL_CALL.

Parameters

e:MMLEvent

Returns
MMLEvent
_default_onInternalWait()method 
protected function _default_onInternalWait(e:MMLEvent):MMLEvent

default operation for MMLEvent.INTERNAL_WAIT.

Parameters

e:MMLEvent

Returns
MMLEvent
_default_onNoOperation()method 
protected function _default_onNoOperation(e:MMLEvent):MMLEvent

default operation for MMLEvent.NOP.

Parameters

e:MMLEvent

Returns
MMLEvent
_default_onProcess()method 
protected function _default_onProcess(e:MMLEvent):MMLEvent

default operation for MMLEvent.PROCESS.

Parameters

e:MMLEvent

Returns
MMLEvent
_default_onRepeatAll()method 
protected function _default_onRepeatAll(e:MMLEvent):MMLEvent

default operation for MMLEvent.REPEAT_ALL.

Parameters

e:MMLEvent

Returns
MMLEvent
_default_onRepeatBegin()method 
protected function _default_onRepeatBegin(e:MMLEvent):MMLEvent

default operation for MMLEvent.REPEAT_BEGIN.

Parameters

e:MMLEvent

Returns
MMLEvent
_default_onRepeatBreak()method 
protected function _default_onRepeatBreak(e:MMLEvent):MMLEvent

default operation for MMLEvent.REPEAT_BREAK.

Parameters

e:MMLEvent

Returns
MMLEvent
_default_onRepeatEnd()method 
protected function _default_onRepeatEnd(e:MMLEvent):MMLEvent

default operation for MMLEvent.REPEAT_END.

Parameters

e:MMLEvent

Returns
MMLEvent
_default_onSequenceTail()method 
protected function _default_onSequenceTail(e:MMLEvent):MMLEvent

default operation for MMLEvent.SEQUENCE_TAIL.

Parameters

e:MMLEvent

Returns
MMLEvent
_default_onTempo()method 
protected function _default_onTempo(e:MMLEvent):MMLEvent

default operation for MMLEvent.TEMPO.

Parameters

e:MMLEvent

Returns
MMLEvent
_default_onTimer()method 
protected function _default_onTimer(e:MMLEvent):MMLEvent

default operation for MMLEvent.TIMER.

Parameters

e:MMLEvent

Returns
MMLEvent
_dummy_onProcess()method 
protected function _dummy_onProcess(e:MMLEvent):MMLEvent

dummy operation for MMLEvent.PROCESS.

Parameters

e:MMLEvent

Returns
MMLEvent
_nop()method 
protected function _nop(e:MMLEvent):MMLEvent

Operates nothing.

Parameters

e:MMLEvent

Returns
MMLEvent
compile()method 
public function compile(interval:int = 1000):Number

Parse mml string. Calls onAfterCompile() inside.

Parameters

interval:int (default = 1000) — Interval to interrupt parsing [ms]. Set 0 to parse at once.

Returns
Number — Return compile progression. Returns 1 when its finished, or when preparation has not completed.
executeGlobalSequence()method 
protected function executeGlobalSequence():int

execute global sequence. returns executing sample length.

Returns
int
getEventID()method 
public function getEventID(mmlCommand:String):int

Get MMLEvent id by mml command letter.

Parameters

mmlCommand:String — letter of MML command.

Returns
int — Event id. Returns 0 if not found.
getEventLetter()method 
public function getEventLetter(eventID:int):String

Get MML command letters by event id.

Parameters

eventID:int — Event id.

Returns
String — letter of MML command. Returns null if not found.
isEndGlobalSequence()method 
protected function isEndGlobalSequence():Boolean

check global sequences pointer acheives to the end.

Returns
Boolean
newMMLEventListener()method 
protected function newMMLEventListener(letter:String, func:Function, isGlobal:Boolean = false):int

Register new MMLEvent letter.

Parameters

letter:String — The letter of the event on mml.
 
func:Function — The functor of the event called back when its processing.
 
isGlobal:Boolean (default = false)

Returns
int — The ID of the event. This value is greater than or equal to MMLEvent.USER_DEFINE.
onAfterCompile()method 
protected function onAfterCompile(seqGroup:MMLSequenceGroup):void

Callback after parse. This function is called from parse() after parseing.

Parameters

seqGroup:MMLSequenceGroup

onBeat()method 
protected function onBeat(delaySamples:int, beatCounter:int):void

Callback on every 16th beats.

Parameters

delaySamples:int
 
beatCounter:int

onBeforeCompile()method 
protected function onBeforeCompile(mml:String):String

Callback before parse. This function is called from parse() before parseing.

Parameters

mml:String — The mml string to parse.

Returns
String — The mml string you want to parse. Parses with default mml string when you return null.
onProcess()method 
protected function onProcess(length:int, e:MMLEvent):void

Callback on processing. This function is called from process().

Parameters

length:int — Sample length to process calculated from settings.
 
e:MMLEvent — MMLEvent that calls onProcess().

onTableParse()method 
protected function onTableParse(prev:MMLEvent, table:String):void

Callback when table event was found.

Parameters

prev:MMLEvent
 
table:String

onTempoChanged()method 
protected function onTempoChanged(tempoRatio:Number):void

Callback when the tempo is changed.

Parameters

tempoRatio:Number — Ratio of changed tempo and previous tempo.

onTimerInterruption()method 
protected function onTimerInterruption():void

Callback when streaming interrupted by timer .

prepareCompile()method 
public function prepareCompile(data:MMLData, mml:String):Boolean

Prepare to compile mml string. Calls onBeforeCompile() inside.

Parameters

data:MMLData — Data instance.
 
mml:String — MML String.

Returns
Boolean — Returns false when it's not necessary to compile.
processMMLExecutor()method 
protected function processMMLExecutor(exe:MMLExecutor, bufferSampleCount:int):Boolean

Processing audio by one executor. Calls onProcess() inside.

Parameters

exe:MMLExecutor — MMLExecutor to process.
 
bufferSampleCount:int — Buffering length of processing samples at once.

Returns
Boolean — Returns true if the sequence already finished.
setGlobalSequence()method 
public function setGlobalSequence(seq:MMLSequence):void

Set global sequence. This function must be called after prepareProcess() and before process().

Parameters

seq:MMLSequence

setMMLEventListener()method 
protected function setMMLEventListener(id:int, func:Function, isGlobal:Boolean = false):void

Similar with an addEventListener(), but only one listener can be set for one event.

Parameters

id:int — The ID of the event.
 
func:Function — The functor of the event called back when its processing.
 
isGlobal:Boolean (default = false)

startGlobalSequence()method 
protected function startGlobalSequence():void

start global sequence.

Constant Detail
FIXED_BITSConstant
public static const FIXED_BITS:int = 8

bits for fixed decimal

FIXED_FILTERConstant 
public static const FIXED_FILTER:int

filter for decimal fraction area