public final class SapaService
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
SapaService.Parameters
Sapa Service settings.
|
Modifier and Type | Field and Description |
---|---|
static int |
AUDIO_DEVICE_USB
audio device usb type
|
static int |
START_PARAM_DEFAULT_LATENCY
Start in default latency mode.
|
static int |
START_PARAM_EXCEPT_CAPTURE
Start with no capture device.
|
static int |
START_PARAM_HIGH_LATENCY
Start in high latency mode.
|
static int |
START_PARAM_LOW_LATENCY
Start in low latency mode.
|
static int |
START_PARAM_MID_LATENCY
Start in mid latency mode.
|
static int |
START_PARAM_USE_DUMMY
Start in dummy mode.
|
static int |
STATUS_DEVICE_NOT_FOUND
The status type of not existed device for use with AudioDeviceControlListener
|
static int |
STATUS_DISABLED
The status type of disabled device for use with AudioDeviceControlListener
|
static int |
STATUS_ENABLED
The status type of enabled device for use with AudioDeviceControlListener
|
Constructor and Description |
---|
SapaService()
Creates a SapaService instance.
|
Modifier and Type | Method and Description |
---|---|
void |
connect(SapaPortConnection connection)
Connect a port connection.
|
void |
connect(SapaPort sourcePort,
SapaPort destinationPort)
Connect between a source port and a destination port.
|
void |
disconnect(SapaPortConnection connection)
Disconnect a port connection
|
void |
disconnect(SapaPort sourcePort,
SapaPort destinationPort)
Disconnect between a source port and a destination port if it was connected.
|
void |
disconnectAllConnection()
Disconnect all of port connections.
|
java.util.List<SapaPortConnection> |
getAllConnection()
Get all of port connections
|
java.util.List<SapaPluginInfo> |
getAllPlugin()
Deprecated.
|
java.util.List<SapaPort> |
getAllPort()
Get the list of all ports.
|
SapaPort |
getLoopbackPort(java.lang.String portName)
Get the loopback port
|
java.util.List<SapaPort> |
getLoopbackPorts()
Get the loopback port list
|
SapaService.Parameters |
getParameters()
Get the parameters of SapaService.
|
SapaPort |
getSystemPort(java.lang.String portName)
Get the system ports
|
java.util.List<SapaPort> |
getSystemPorts()
Get the system port list
|
boolean |
isAvailablePort(SapaPort sapaPort)
Check the port is available or not
|
boolean |
isStarted()
Check if the Service is running.
|
void |
register(SapaProcessor processor)
Register the specified SapaProcessor instance with this SapaService instance.
|
void |
register(SapaProcessor processor,
boolean isPowerSavingModeEnabled)
Register the specified SapaProcessor instance with this SapaService instance.
|
boolean |
setPowerSavingEnabled(boolean enable)
Set the Power Saving
|
void |
setTransportFrame(int frameCount)
Set the tranport frame count
|
void |
setTransportPosition(int bar,
int beat,
int tick)
Set the specified transport position.
|
void |
setTransportTimeout(double timeout)
Set the specified transport timeout.
|
void |
start(int startParam)
Start the service in the specified mode.
|
void |
startTransport()
Start the transport.
|
void |
stop(boolean force)
Stop the service.
|
void |
stopTransport()
Stop the transport.
|
void |
unregister(SapaProcessor processor)
Unregister the specified SapaProcessor instance.
|
public static final int START_PARAM_DEFAULT_LATENCY
public static final int START_PARAM_LOW_LATENCY
public static final int START_PARAM_MID_LATENCY
public static final int START_PARAM_HIGH_LATENCY
public static final int START_PARAM_USE_DUMMY
public static final int START_PARAM_EXCEPT_CAPTURE
public static final int AUDIO_DEVICE_USB
public static final int STATUS_ENABLED
public static final int STATUS_DISABLED
public static final int STATUS_DEVICE_NOT_FOUND
public SapaService() throws java.lang.InstantiationException
java.lang.InstantiationException
- if fail to instantiatepublic boolean isStarted()
start(int)
,
stop(boolean)
public SapaService.Parameters getParameters()
public void start(int startParam) throws android.util.AndroidRuntimeException, java.lang.IllegalArgumentException
startParam
- The start mode for the service. android.util.AndroidRuntimeException
- Thrown if an error occurs while starting.java.lang.IllegalArgumentException
- Thrown if the parameter is not allowed.stop(boolean)
public void stop(boolean force)
force
- if false, stop the service when it is possible.
if true, stop the service by force.start(int)
public void register(SapaProcessor processor) throws java.lang.InstantiationException
processor
- The SapaProcessor instance to register.java.lang.InstantiationException
- Thrown if SapaProcessor fails to instantiate.public void register(SapaProcessor processor, boolean isPowerSavingModeEnabled) throws java.lang.InstantiationException
processor
- The SapaProcessor instance to register.isPowerSavingModeEnabled
- true to enable power saving mode, false to disable power saving mode.java.lang.InstantiationException
- Thrown if SapaProcessor fails to instantiate.public void unregister(SapaProcessor processor)
processor
- The SapaProcessor instance to unregister.@Deprecated public java.util.List<SapaPluginInfo> getAllPlugin()
public void connect(SapaPortConnection connection) throws android.util.AndroidRuntimeException
connection
- the connection information for connectingandroid.util.AndroidRuntimeException
- if error while connecting. for example, already connected connection, invalid port name, etc, ...public void connect(SapaPort sourcePort, SapaPort destinationPort) throws android.util.AndroidRuntimeException
sourcePort
- an input port name of a connectiondestinationPort
- an output port name of a connectionandroid.util.AndroidRuntimeException
- if error while connecting. for example, already connected connection, invalid port name, etc, ...public SapaPort getSystemPort(java.lang.String portName) throws android.util.AndroidRuntimeException
portName
- a port name to getandroid.util.AndroidRuntimeException
- Thrown if an error occurs while getting a system portpublic java.util.List<SapaPort> getSystemPorts() throws android.util.AndroidRuntimeException
android.util.AndroidRuntimeException
- Thrown if an error occurs while getting system portspublic SapaPort getLoopbackPort(java.lang.String portName) throws android.util.AndroidRuntimeException
portName
- a port name to getandroid.util.AndroidRuntimeException
- Thrown if an error occurs while getting a loopback portpublic java.util.List<SapaPort> getLoopbackPorts() throws android.util.AndroidRuntimeException
android.util.AndroidRuntimeException
- Thrown if an error occurs while getting loopback portspublic void disconnectAllConnection()
public void disconnect(SapaPortConnection connection) throws android.util.AndroidRuntimeException
connection
- the connection information for disconnectingandroid.util.AndroidRuntimeException
- if error while disconnecting a port connection. for example, already disconnected connection, invalid port name, etc, ...public void disconnect(SapaPort sourcePort, SapaPort destinationPort) throws android.util.AndroidRuntimeException
sourcePort
- an input port of a connectiondestinationPort
- an output port of a connectionandroid.util.AndroidRuntimeException
- if error while disconnecting a port connection. for example, already disconnected connection, invalid port name, etc, ...public java.util.List<SapaPortConnection> getAllConnection()
public java.util.List<SapaPort> getAllPort()
public boolean isAvailablePort(SapaPort sapaPort) throws java.lang.IllegalArgumentException, android.util.AndroidRuntimeException
sapaPort
- a SapaPort instance to checkandroid.util.AndroidRuntimeException
- Thrown if an error occurs while checking a available portjava.lang.IllegalArgumentException
- Thrown if a parameter is nullpublic void setTransportFrame(int frameCount)
frameCount
- the transport frame countpublic void setTransportPosition(int bar, int beat, int tick)
bar
- The bar to move.beat
- The beat to movetick
- The tick to move.public void startTransport()
public void stopTransport()
public void setTransportTimeout(double timeout)
timeout
- true to enable, false to disable
The timeout for the transport in secondspublic boolean setPowerSavingEnabled(boolean enable)
enable
- true to enable, false to disable