Ejemplo n.º 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();
 }
Ejemplo n.º 2
0
 private void makeOutputConnections() {
   int count = Math.min(outputClient.getOutputCount(), bus.getSinkCount());
   for (int i = 0; i < count; i++) {
     bus.getSink(i).addSource(outputClient.getOutputSource(i));
   }
 }