Package server.netsiddev
Klasse ClientContext
java.lang.Object
server.netsiddev.ClientContext
Container for client-specific data.
- Autor:
- Ken Händel, Antti Lankila, Wilfred Bos
- Siehe auch:
-
Feldübersicht
FelderModifizierer und TypFeldBeschreibungprivate static Map<SocketChannel, ClientContext> Map which holds all instances of each client connection.private static intprivate CommandCurrent command.private final Command[]Cached commands because values() returns new array each time.private intLength of data packet associated to command.private final ByteBufferAllocate read buffer.private final ByteBufferAllocate write buffer.private final AudioGeneratorThreadOur back-end threadprivate longCurrent clock value in input.private static final CharsetString encodingprivate final intExpected buffer fill rateprivate static final longMaximum time to wait for queue in milliseconds.private static booleanIndicates if a new connection should be opened in case of connection settings changes.private static SelectorThe selector which is registered to the server socket channel.private static final byteSee netsiddev.ad for version info of the protocol.private intCurrent sid number in command.private SIDChip[]Shadow SID clocked with client to read fromprivate static ServerSocketChannelA selectable channel for stream-oriented listening sockets.private PSidHeaderprivate MusicInfoWithConfidenceBeanprivate static Thread -
Konstruktorübersicht
KonstruktorenModifiziererKonstruktorBeschreibungprivateClientContext(AudioConfig config, int latency) Construct a new audio player for connected client -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungstatic voidapplyConnectionConfigChanges will close all current connections and apply the new configuration which is stored in the SIDDeviceSettings.static voidchangeDevice(Mixer.Info deviceInfo) changeDevice will change the device to the specified device for all connected client contextsprivate static voidprotected voiddispose()protected voidstatic intprivate ByteBufferstatic Stringprivate intgetSidHeaderSize(int dataLength) static Collection<PSidHeader> private ByteBufferprivate voidhandleDelayPacket(int sidNumber, int cycles) private voidhandleWritePacket(int dataLength) static voidlistenForClients(JSIDDeviceConfig config) private voidCallback to handle protocol after new data has been received.static voidsetAudioBufferSize(Integer audioBufferSize) setAudioBufferSize will change the size of the audio buffer for all connected client contextsprivate voidstatic voidsetDigiBoost(boolean enabled) setDigiBoost will change the digiboost setting for each 8580 device for all connected client contextsprivate static voidstartWhatsSidThread(SIDDeviceSettings settings) private static String
-
Felddetails
-
ISO_8859
String encoding -
SID_NETWORK_PROTOCOL_VERSION
private static final byte SID_NETWORK_PROTOCOL_VERSIONSee netsiddev.ad for version info of the protocol.- Siehe auch:
-
MAX_TIME_TO_WAIT_FOR_QUEUE
private static final long MAX_TIME_TO_WAIT_FOR_QUEUEMaximum time to wait for queue in milliseconds.- Siehe auch:
-
latency
private final int latencyExpected buffer fill rate -
commands
Cached commands because values() returns new array each time. -
eventConsumerThread
Our back-end thread -
sidRead
Shadow SID clocked with client to read from -
dataRead
Allocate read buffer. Maximum command + maximum socket buffer size (assumed to be per request 16K) -
dataWrite
Allocate write buffer. Maximum supported writes are currently 260 bytes long. -
ssc
A selectable channel for stream-oriented listening sockets. -
selector
The selector which is registered to the server socket channel. -
command
Current command. -
sidNumber
private int sidNumberCurrent sid number in command. -
dataLength
private int dataLengthLength of data packet associated to command. -
inputClock
private long inputClockCurrent clock value in input. -
tuneHeader
-
openNewConnection
private static boolean openNewConnectionIndicates if a new connection should be opened in case of connection settings changes. -
clientContextMap
Map which holds all instances of each client connection. -
whatsSidResult
-
clientContextNumToCheck
private static int clientContextNumToCheck -
whatsSidThread
-
-
Konstruktordetails
-
ClientContext
Construct a new audio player for connected client
-
-
Methodendetails
-
getRecognizedTunes
-
toWhatsSidAnswer
-
setDefaultSidConfiguration
private void setDefaultSidConfiguration() -
processReadBuffer
Callback to handle protocol after new data has been received.- Löst aus:
InvalidCommandException
-
getSidHeaderSize
private int getSidHeaderSize(int dataLength) -
handleDelayPacket
- Löst aus:
InvalidCommandException
-
handleWritePacket
- Löst aus:
InvalidCommandException
-
dispose
protected void dispose() -
disposeWait
protected void disposeWait() -
getReadBuffer
-
getWriteBuffer
-
getTuneHeader
-
changeDevice
changeDevice will change the device to the specified device for all connected client contexts- Parameter:
deviceInfo- the device that should be used
-
setDigiBoost
public static void setDigiBoost(boolean enabled) setDigiBoost will change the digiboost setting for each 8580 device for all connected client contexts- Parameter:
enabled- specifies if the digiboost feature is turned on
-
setAudioBufferSize
setAudioBufferSize will change the size of the audio buffer for all connected client contexts- Parameter:
audioBufferSize- specifies the size of the audio buffer (1024-16384 as a power of two)
-
getTuneHeaders
-
getClientsConnectedCount
public static int getClientsConnectedCount() -
applyConnectionConfigChanges
public static void applyConnectionConfigChanges()applyConnectionConfigChanges will close all current connections and apply the new configuration which is stored in the SIDDeviceSettings. -
listenForClients
-
startWhatsSidThread
-
closeClientConnections
- Löst aus:
IOException
-