0 Replies Latest reply: Nov 20, 2010 6:46 AM by 814592 RSS

    How to resume audio recording after commit() was called?

    814592
      I have the same problem. After first commit(), calling setRecordStream() throws IllegalStateException: "startRecord() has been called and commit has not been called". Scheme looks like this:
      Player p= Manager.createPlayer("capture://audio?encoding=pcm");
      p.realize();
      RecordControl rc= (RecordControl)p.getControl("RecordControl");
      ByteArrayOutputStream nbos= new ByteArrayOutputStream();
      rc.setRecordStream(nbos);
      p.start();
      rc.startRecord();
       
      Thread.sleep(6000);
      rc.stopRecord();
       
      rc.commit();
      nbos.flush();
       byte[] barr= nbos.toByteArray();   // up to here everything is ok and i get my recorded bytes
       
      Thread.sleep(5000);       // let's wait a moment before starting next recording
      rc.setRecordStream(nbos);    //this line throws IllegalStateException
                                //I also tried rc.setRecordStream(new ByteArrayOutputStream()); but no effect
      ...
      It's obvious that commit() is called befere second setRecordStream() but exception states otherwise
      Has anyone handled this?

      Maybe author of this thread solved this?

      Any help appreciated :)

      Problem similar to this [url http://forums.oracle.com/forums/thread.jspa?threadID=1700471&tstart=0]one