/[svn]/jlscp/trunk/src/org/linuxsampler/lscp/Client.java
ViewVC logotype

Diff of /jlscp/trunk/src/org/linuxsampler/lscp/Client.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1541 by iliev, Mon Dec 3 22:59:39 2007 UTC revision 1542 by iliev, Tue Dec 4 18:14:31 2007 UTC
# Line 344  public class Client { Line 344  public class Client {
344                  if(!llFSI.isEmpty()) subscribe("FX_SEND_INFO");                  if(!llFSI.isEmpty()) subscribe("FX_SEND_INFO");
345                  if(!llSC.isEmpty()) subscribe("STREAM_COUNT");                  if(!llSC.isEmpty()) subscribe("STREAM_COUNT");
346                  if(!llVC.isEmpty()) subscribe("VOICE_COUNT");                  if(!llVC.isEmpty()) subscribe("VOICE_COUNT");
347                    if(!llTSC.isEmpty()) subscribe("TOTAL_STREAM_COUNT");
348                  if(!llTVC.isEmpty()) subscribe("TOTAL_VOICE_COUNT");                  if(!llTVC.isEmpty()) subscribe("TOTAL_VOICE_COUNT");
349                  if(!llMIMC.isEmpty()) subscribe("MIDI_INSTRUMENT_MAP_COUNT");                  if(!llMIMC.isEmpty()) subscribe("MIDI_INSTRUMENT_MAP_COUNT");
350                  if(!llMIMI.isEmpty()) subscribe("MIDI_INSTRUMENT_MAP_INFO");                  if(!llMIMI.isEmpty()) subscribe("MIDI_INSTRUMENT_MAP_INFO");
# Line 485  public class Client { Line 486  public class Client {
486          private final Vector<ItemInfoListener> llMIDI = new Vector<ItemInfoListener>();          private final Vector<ItemInfoListener> llMIDI = new Vector<ItemInfoListener>();
487          private final Vector<StreamCountListener> llSC = new Vector<StreamCountListener>();          private final Vector<StreamCountListener> llSC = new Vector<StreamCountListener>();
488          private final Vector<VoiceCountListener> llVC = new Vector<VoiceCountListener>();          private final Vector<VoiceCountListener> llVC = new Vector<VoiceCountListener>();
489            private final Vector<TotalStreamCountListener> llTSC = new Vector<TotalStreamCountListener>();
490          private final Vector<TotalVoiceCountListener> llTVC = new Vector<TotalVoiceCountListener>();          private final Vector<TotalVoiceCountListener> llTVC = new Vector<TotalVoiceCountListener>();
491                    
492          /** MIDI instrument map count listeners */          /** MIDI instrument map count listeners */
# Line 522  public class Client { Line 524  public class Client {
524                          !llMIDI.isEmpty() ||                          !llMIDI.isEmpty() ||
525                          !llSC.isEmpty()   ||                          !llSC.isEmpty()   ||
526                          !llVC.isEmpty()   ||                          !llVC.isEmpty()   ||
527                            !llTSC.isEmpty()  ||
528                          !llTVC.isEmpty()  ||                          !llTVC.isEmpty()  ||
529                          !llMIMC.isEmpty() ||                          !llMIMC.isEmpty() ||
530                          !llMIMI.isEmpty() ||                          !llMIMI.isEmpty() ||
# Line 662  public class Client { Line 665  public class Client {
665                          } catch(NumberFormatException x) {                          } catch(NumberFormatException x) {
666                                  getLogger().log(Level.WARNING, "Unknown CHANNEL_INFO format", x);                                  getLogger().log(Level.WARNING, "Unknown CHANNEL_INFO format", x);
667                          }                          }
668                    } else if(s.startsWith("TOTAL_STREAM_COUNT:")) {
669                            try {
670                                    s = s.substring("TOTAL_STREAM_COUNT:".length());
671                                    int i = Integer.parseInt(s);
672                                    TotalStreamCountEvent e = new TotalStreamCountEvent(this, i);
673                                    for(TotalStreamCountListener l : llTSC) l.totalStreamCountChanged(e);
674                            } catch(NumberFormatException x) {
675                                    getLogger().log (
676                                            Level.WARNING, "Unknown TOTAL_STREAM_COUNT format", x
677                                    );
678                            }
679                  } else if(s.startsWith("TOTAL_VOICE_COUNT:")) {                  } else if(s.startsWith("TOTAL_VOICE_COUNT:")) {
680                          try {                          try {
681                                  s = s.substring("TOTAL_VOICE_COUNT:".length());                                  s = s.substring("TOTAL_VOICE_COUNT:".length());
# Line 1134  public class Client { Line 1148  public class Client {
1148          /**          /**
1149           * Registers the specified listener for receiving event messages.           * Registers the specified listener for receiving event messages.
1150           * Listeners can be registered regardless of the connection state.           * Listeners can be registered regardless of the connection state.
1151             * @param l The <code>TotalStreamCountListener</code> to register.
1152             */
1153            public synchronized void
1154            addTotalStreamCountListener(TotalStreamCountListener l) {
1155                    if(llTSC.isEmpty()) subscribe("TOTAL_STREAM_COUNT");
1156                    llTSC.add(l);
1157            }
1158            
1159            /**
1160             * Removes the specified listener.
1161             * Listeners can be removed regardless of the connection state.
1162             * @param l The <code>TotalStreamCountListener</code> to remove.
1163             */
1164            public synchronized void
1165            removeTotalStreamCountListener(TotalStreamCountListener l) {
1166                    boolean b = llTSC.remove(l);
1167                    if(b && llTSC.isEmpty()) unsubscribe("TOTAL_STREAM_COUNT");
1168            }
1169            
1170            /**
1171             * Registers the specified listener for receiving event messages.
1172             * Listeners can be registered regardless of the connection state.
1173           * @param l The <code>TotalVoiceCountListener</code> to register.           * @param l The <code>TotalVoiceCountListener</code> to register.
1174           */           */
1175          public synchronized void          public synchronized void
# Line 4871  public class Client { Line 4907  public class Client {
4907          }          }
4908                    
4909          /**          /**
4910             * Gets the current number of all active streams.
4911             * @return The current number of all active streams.
4912             * @throws IOException If some I/O error occurs.
4913             * @throws LscpException If LSCP protocol corruption occurs.
4914             * @throws LSException If some other error occurs.
4915             */
4916            public synchronized int
4917            getTotalStreamCount() throws IOException, LscpException, LSException {
4918                    verifyConnection();
4919                    out.writeLine("GET TOTAL_STREAM_COUNT");
4920                    if(getPrintOnlyMode()) return -1;
4921                    
4922                    String s = getSingleLineResultSet().getResult();
4923                    return parseInt(s);
4924            }
4925            
4926            /**
4927           * Gets the current number of all active voices.           * Gets the current number of all active voices.
4928           * @return The current number of all active voices.           * @return The current number of all active voices.
4929           * @throws IOException If some I/O error occurs.           * @throws IOException If some I/O error occurs.

Legend:
Removed from v.1541  
changed lines
  Added in v.1542

  ViewVC Help
Powered by ViewVC