Klasse ClientContext

java.lang.Object
server.netsiddev.ClientContext

class ClientContext extends Object
Container for client-specific data.
Autor:
Ken Händel, Antti Lankila, Wilfred Bos
Siehe auch:
  • Felddetails

    • ISO_8859

      private static final Charset ISO_8859
      String encoding
    • SID_NETWORK_PROTOCOL_VERSION

      private static final byte SID_NETWORK_PROTOCOL_VERSION
      See 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_QUEUE
      Maximum time to wait for queue in milliseconds.
      Siehe auch:
    • latency

      private final int latency
      Expected buffer fill rate
    • commands

      private final Command[] commands
      Cached commands because values() returns new array each time.
    • eventConsumerThread

      private final AudioGeneratorThread eventConsumerThread
      Our back-end thread
    • sidRead

      private SIDChip[] sidRead
      Shadow SID clocked with client to read from
    • dataRead

      private final ByteBuffer dataRead
      Allocate read buffer. Maximum command + maximum socket buffer size (assumed to be per request 16K)
    • dataWrite

      private final ByteBuffer dataWrite
      Allocate write buffer. Maximum supported writes are currently 260 bytes long.
    • ssc

      private static ServerSocketChannel ssc
      A selectable channel for stream-oriented listening sockets.
    • selector

      private static Selector selector
      The selector which is registered to the server socket channel.
    • command

      private Command command
      Current command.
    • sidNumber

      private int sidNumber
      Current sid number in command.
    • dataLength

      private int dataLength
      Length of data packet associated to command.
    • inputClock

      private long inputClock
      Current clock value in input.
    • tuneHeader

      private PSidHeader tuneHeader
    • openNewConnection

      private static boolean openNewConnection
      Indicates if a new connection should be opened in case of connection settings changes.
    • clientContextMap

      private static Map<SocketChannel,ClientContext> clientContextMap
      Map which holds all instances of each client connection.
    • whatsSidResult

      private MusicInfoWithConfidenceBean whatsSidResult
    • clientContextNumToCheck

      private static int clientContextNumToCheck
    • whatsSidThread

      private static Thread whatsSidThread
  • Konstruktordetails

    • ClientContext

      private ClientContext(AudioConfig config, int latency)
      Construct a new audio player for connected client
  • Methodendetails

    • getRecognizedTunes

      public static String getRecognizedTunes()
    • toWhatsSidAnswer

      private static String toWhatsSidAnswer(ClientContext cc)
    • setDefaultSidConfiguration

      private void setDefaultSidConfiguration()
    • processReadBuffer

      private void processReadBuffer() throws InvalidCommandException
      Callback to handle protocol after new data has been received.
      Löst aus:
      InvalidCommandException
    • getSidHeaderSize

      private int getSidHeaderSize(int dataLength)
    • handleDelayPacket

      private void handleDelayPacket(int sidNumber, int cycles) throws InvalidCommandException
      Löst aus:
      InvalidCommandException
    • handleWritePacket

      private void handleWritePacket(int dataLength) throws InvalidCommandException
      Löst aus:
      InvalidCommandException
    • dispose

      protected void dispose()
    • disposeWait

      protected void disposeWait()
    • getReadBuffer

      private ByteBuffer getReadBuffer()
    • getWriteBuffer

      private ByteBuffer getWriteBuffer()
    • getTuneHeader

      public PSidHeader getTuneHeader()
    • changeDevice

      public static void changeDevice(Mixer.Info deviceInfo)
      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

      public static void setAudioBufferSize(Integer audioBufferSize)
      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

      public static Collection<PSidHeader> 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

      public static void listenForClients(JSIDDeviceConfig config)
    • startWhatsSidThread

      private static void startWhatsSidThread(SIDDeviceSettings settings)
    • closeClientConnections

      private static void closeClientConnections() throws IOException
      Löst aus:
      IOException