Skip to content

Mode Control

SynapseAPI

syn = SynapseAPI()

Returns an instance of SynapseAPI and connects to the Synapse server through port 24414. By default it connects to Synapse running on your local machine (localhost), but can optionally connect to Synapse running on a remote machine.

Example

Open a connection to the Synapse server.

% connect to locally running Synapse
syn = SynapseAPI();

% this is equivalent to SynapseAPI('localhost')
% or you can connect to a remote server on your network
syn = SynapseAPI('10.1.0.55');

% show the current system mode
syn.getModeStr()
# connect to locally running Synapse
syn = SynapseAPI()

# this is equivalent to SynapseAPI('localhost')
# or you can connect to a remote server on your network
syn = SynapseAPI('10.1.0.55')

# show the current system mode
syn.getModeStr()

getMode

iMode = getMode()

Returns the current system mode of Synapse as an integer. This call can be used with setMode to control the operational mode of your entire system. The Synapse modes (Idle, Standby, Preview, and Record) are described in the Synapse Manual.

Returns Type Values
iMode integer 0 (Idle), 1 (Standby), 2 (Preview), 3 (Record)

Example

Open a connection to the Synapse server, and if the mode is Record (3) then the routine runs.

syn = SynapseAPI();

if syn.getMode() == 3
    % Start Routine
end
import tdt
syn = tdt.SynapseAPI()

if syn.getMode() == 3:
    # Start Routine

getModeStr

sMode = getMode()

Returns the current system mode of Synapse as a string. See description of getMode.

Returns Type Values
sMode string 'Idle', 'Standby', 'Preview', 'Record'

Example

Open a connection to the Synapse server, and if the mode is 'Record' then the routine runs.

syn = SynapseAPI();

if strcmp(syn.getModeStr(), 'Record')
    % Start Routine
end
import tdt
syn = tdt.SynapseAPI()

if syn.getModeStr() == 'Record':
    # Start Routine

setMode

bSuccess = setMode(iNewMode)

Sets the system mode of Synapse. The possible modes include: Idle, Standby, Preview, and Record.

Inputs Type Values
iNewMode integer 0 (Idle), 1 (Standby), 2 (Preview), 3 (Record)
Returns Type Values
bSuccess boolean 0 (fail), 1 (success)

Example

This code sample opens a connection to the Synapse server. If the Synapse mode is not Record mode (3), setMode puts Synapse in Record mode.

syn = SynapseAPI();

if syn.getMode() ~= 3
    syn.setMode(3);
end
import tdt
syn = tdt.SynapseAPI()

if syn.getMode() != 3:
    syn.setMode(3)

setModeStr

bSuccess = setModeStr(iNewMode)

Sets the system mode of Synapse. The possible modes include: Idle, Standby, Preview, and Record. See description

Inputs Type Values
sNewMode string 'Idle', 'Standby', 'Preview', 'Record'
Returns Type Values
bSuccess boolean 0 (fail), 1 (success)

Example

This code sample opens a connection to the Synapse server. If the Synapse mode is not in 'Record' mode, setModeStr puts Synapse in 'Record' mode.

syn = SynapseAPI();

if strcmp(syn.setModeStr(), 'Record') ~= 1
    syn.setModeStr('Record');
end
import tdt
syn = tdt.SynapseAPI()

if syn.getModeStr() != 'Record':
    syn.setModeStr('Record')