Start, Stop and Recording

sxPlay() sxStop() sxContinue()
sxRecord() sxPanic() sxGetState()
sxSetInputFilter() sxSetOutputFilter() sxSetLocatorL()
sxSetLocatorR() sxGetLocatorL() sxGetLocatorR()
sxSetLoopState() sxGetLoopState() sxGetSongLength()
sxGetLastEvent() sxGetLastNote()


These commands refer to the playback and recording functions of sequenceXtra. With these You can start and stop playback and recording, as well as setting locator points and controll looping of segments. You can also define which types of data that will be recorded or played back, as well as checking the lenght of Your song.

 
sxPlay(mySong{,start position{,stop postion}})
sxPlay starts playback of the referred song. Start position and stop position are optional arguments. If not used , the song will play from start to end. If only startposition is used, the song will play from that position till the end. If both arguments are used the corresponding part of the song will be played.

NOTE! If sequenceXtras loop function is activated, the song will start looping when it reaches the loop area.

Result code: Standard error code

Examples:
Play whole song Playback from bar 5 Playback from bar 6 to bar 8
on mouseUp
 global mySong 
 sxPlay(mySong)
end mouseUp 
on mouseUp
 global mySong 
 sxPlay(mySong,5) 
end mouseUp 
on mouseUp 
 global mySong
 sxPlay(mySong,6,[8,1,1])
end mouseUp 


 

sxStop(mySong)
sxStop stops playback of the referred song

Result code: Standard error code.

Example:
on mouseUp
 global mySong
 sxStop(mySong)
end mouseUp

 

sxContinue(mySong)
sxContinue will continue playback of the referred song, from the position where the song was last stopped.

Result code: Standard error code.

Example:
on mouseUp
 global mySong
 sxContinue(mySong)
end mouseUp


 

sxRecord(mySong,trackNumber,mode{,startposition{,stopposition}})
sxRecord starts recording on the indicated track of the referred song. Startposition and stopposition are optional arguments. If not used, the recording will take place from start to end. If only startposition is used, the recording will take place from that position until sxStop() is issued. If both arguments are used the corresponding part of the song will be recorded. trackNumber indicates the track to record on. mode indicates which of the following recording modes that shall be used

0: Add - The new recording becomes a new Part, that is added to the Track. Previously recorded information is left untouched.

1: Replace - The new recording replaces all previously recorded data in the recorded region. The recording is placed in existing Parts if any, and new Parts are created on empty regions.

2:
Replace and join - The recording replaces all previously recorded data) and all Parts that are affected of the recording is joined to one Part.

Example 1:
Recording on Track 1 from the beginning of the song until sxStop(mySong) is issued. The recording becomes a new Part and does not affect previous recordings.

on mouseUp
 global mySong
 mySong.sxRecord(1,0)
end mouseUp


Example 2:
Recording on Track1 from bar 5 till sxStop(mySong) is issued. The recording erases all previously recorded data and becomes one Part.

on mouseUp
 global mySong
 mySong.sxRecord(1,2,5)
end mouseUp
Result code:
Positive integer = the new Parts ID number
Negative integer= Standard error code.

 

sxPanic()
sxPanic sends "All Notes Off" and "Reset All Controllers" on all 16 MIDI channels.
Use this function to get rid of hanging notes, stuck pitch bend etc.

Result code: Standard error code.

Example:
on mouseUp
 sxPanic()
end mouseUp

 

sxGetState()
sxGetState returns the current state of sequenceXtra. The state is returned as an integer.


Result code:
Positive integer: 0: Stopped, 1: Playback, 2: Recording
Negative integer: Standard error code

Example:
on exitFrame
 case sxGetState() of
  0 : member ("SequencerState").text = "Stopped"
  1 : member ("SequencerState").text = "Playing"
  2 : member ("SequencerState").text = "Recording"
 end case
end exitFrame


 

 

sxSetInputFilter(filterList)
sxSetOutputFilter(filterList)
sxSetInputFilter and sxSetOutputFilter filters incoming and outgoing MIDI data. The filter blocks data not complying with the conditions indicated in filerList. FilterList is a Lingo propertylist where each property indicates an event type. The following event types can be filtered:

Event types not used in the filter are left untouched.
Result code: Standard error code.

Example:
on mouseUp
 set filterList = [#hiNote:80,#loNote:40,#channel:10]
 sxSetInputFilter(filterList)
end mouseUp
sxSetOutputFilter works in the same manner as sxSetInputFilter(), but acts on the MIDI output. All MIDI events that leave sequenceXtra passes thru this filter.

 
 

sxSetLocatorL(mySong, leftPos)

sxSetLocatorR(mySong, rightPos)
sxSetLocatorL/R sets the left or right locator position. The locator positions indicate the beginning and end of the loop area. Use an integer or a list to set the position of the locators.

Result code: Standard error code.

Example:
on mouseUp
 global mySong
 sxSetLocatorL(mySong, [1,1,1])
 mySong.sxSetLocatorR([3,4,1])
end mouseUp


 
 

sxGetLocatorL(mySong)

sxGetLocatorR(mySong)
sxGetLocatorL/R returns the current left or right locator position.

Result code: Standard error code.

Example:
on mouseUp
 global mySong
 leftLoc = mySong.sxGetLocatorL()
end mouseUp

 

 

sxSetLoopState(mySong, loopCount)
sxSetLoopState turns the loop function on or off. loopCount indicates the number of loops.

loopCount must be one of these integers
0: no loop, -1: infinite loop, 1 or above:finite number of loops


Result code: Standard error code.

Example:
on mouseUp
 global mySong
 sxSetLoopState(mySong, -1)
end mouseUp
         

 

sxGetLoopState(mySong)
sxGetLoopState will return the current loopstate as an integer.

Example:
on mouseUp
 global mySong
 currentLoop = sxGetLoopState(mySong)
end mouseUp


 

sxGetSongLength(mySong)
sxGetSongLength returns the number of bars in the referred song. A bar is counted even if there is only one event in it.

Result code:
Positive integer: The song length in bars.
Negative integer: Standard error code

Example:
global mySong
 on mouseUp
 put sxGetSongLength(mySong)
end mouseUp


 

sxGetLastEvent(song{,format})
sxGetLastEvent returns the time position of the last event in the referred song. format is an optional argument.

Result code:
Negative integer: Standard error code
Other data: If format is not used the function will return a regular position list. If format is used an integer is returned, depending of the format argument:

Example:
on mouseUp
 global mySong
 put sxGetLastEvent(mySong, #bar)
end mouseUp

 

sxGetLastNote(song {,format})
sxGetLastNote returns the time position of the last noteOff in the song
For an explanation of the format argument, see sxGetLastEvent()

Result code: same as sxGetLastEvent

Example:
on mouseUp
 global mySong
 put sxGetLastNote(mySong, #beat)
end mouseUp