예제 #1
0
 @Override
 protected void starting() {
   if (outputClient == null) {
     try {
       setIdle();
     } catch (IllegalRootStateException ex) {
     }
     return;
   }
   bus =
       new BusClient(
           blockSize.value,
           inputClient == null ? 0 : inputClient.getInputCount(),
           outputClient.getOutputCount());
   busListener = new BusListener();
   bus.addBufferRateListener(busListener);
   bus.addConfigurationListener(busListener);
   if (inputClient != null) {
     makeInputConnections();
   }
   makeOutputConnections();
   try {
     server = createServer(bus);
   } catch (Exception ex) {
     Logger.getLogger(DefaultAudioRoot.class.getName()).log(Level.SEVERE, null, ex);
     try {
       setIdle();
     } catch (IllegalRootStateException ex1) {
     }
     return;
   }
   setDelegate(
       new Runnable() {
         public void run() {
           try {
             server.run();
           } catch (Exception ex) {
             Logger.getLogger(DefaultAudioRoot.class.getName()).log(Level.SEVERE, null, ex);
           }
           try {
             setIdle();
           } catch (IllegalRootStateException ex) {
             // ignore - state already changed
           }
         }
       });
   interrupt();
 }
예제 #2
0
 private void makeInputConnections() {
   int count = Math.min(inputClient.getInputCount(), bus.getSourceCount());
   for (int i = 0; i < count; i++) {
     inputClient.getInputSink(i).addSource(bus.getSource(i));
   }
 }