Package de.sciss.io

Examples of de.sciss.io.AudioFileDescr


      }
    }
   
    private AudioFileDescr query()
    {
      final AudioFileDescr    afd      = new AudioFileDescr();
//      final JOptionPane      dlg;
      final String[]        queryOptions = { getResourceString( "buttonCreate" ),
                             getResourceString( "buttonCancel" )};
      final int          result;
//      final Object        result;
View Full Code Here


//              getValue( NAME ).toString(), JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE,
//              null, queryOptions, queryOptions[1] );
            result = BasicWindowHandler.showDialog( op2, getWindow(), getValue( NAME ).toString() );
            if( result != 0 ) return null;
          }
          afds[ k ]    = new AudioFileDescr( protoType[ j ]);
          affp.toDescr( afds[ k ]);
          afds[ k ].file  = f;
          afds[ k ].channels = channelsUsed[ j ];
          k++;
        }
View Full Code Here

      final File          recFile;
      final Session        tmpDoc;
      final ClipboardTrackList  tl;
      final ProcessingThread    pt;
      final Session        targetDoc;
      final AudioFileDescr    afd, afd2;
   
      try {
        recDlg  = new RecorderDialog( doc );
      }
      catch( IOException e1 ) {
        BasicWindowHandler.showErrorDialog( getWindow(), e1, getValue( NAME ).toString() );
        return;
      }
      recFile  = recDlg.getResult();
     
      if( recFile != null ) {
        try {
//          if( true ) throw new IOException( "test" );
          tmpDoc  = Session.newFrom( recFile, false, false );
        }
        catch( IOException e1 ) {
          GUIUtil.displayError( getWindow(), e1, getValue( NAME ).toString() );
          confirmDelete( recFile );
          return;
        }
        tl    = new ClipboardTrackList( tmpDoc, new Span( 0, tmpDoc.timeline.getLength() ), tmpDoc.tracks.getAll() );
        if( doc.checkProcess()) {
          targetDoc      = doc;
        } else // doc busy, save the recording by creating a separate document
          afd          = doc.getDisplayDescr();
          afd2        = new AudioFileDescr();
          afd2.bitsPerSample  = afd.bitsPerSample;
          afd2.channels    = afd.channels;
          afd2.rate      = afd.rate;
          afd2.sampleFormat  = afd.sampleFormat;
          targetDoc      = ((MenuFactory) app.getMenuFactory()).newDocument( afd2 );
View Full Code Here

 

  public static AudioTrail newFrom( AudioFile af )
  throws IOException
  {
    final AudioFileDescr  afd      = af.getDescr();
    final int[][]      channelMaps = new int[ 1 ][ afd.channels ];
    final AudioTrail    at;
    final Span        span    = new Span( 0, afd.length );

    for( int i = 0; i < afd.channels; i++ ) {
View Full Code Here

    if( afs.length == 1 ) return newFrom( afs[ 0 ]);
    if( afs.length == 0 ) throw new IllegalArgumentException( "Need at least one audio file" );
   
    final long      length;
    final double    rate;
    AudioFileDescr    afd;
    final int[][]    channelMaps;
    final Span      span;
    final AudioTrail  at;
    final Span[]    fileSpans  = new Span[ afs.length ];
   
View Full Code Here

  public void exchange( AudioFile af )
  throws IOException
  {
    if( audioFiles.length != 1 ) throw new IllegalStateException();
 
    final AudioFileDescr  afd      = af.getDescr();
    final Span        span    = new Span( 0, afd.length );

    if( afd.channels != channelMaps[ 0 ].length ) throw new IllegalStateException();

//    clear( null );
View Full Code Here

    if( audioFiles.length != afs.length ) throw new IllegalStateException();
   
    final long      length;
    final double    rate;
    AudioFileDescr    afd;
    final Span      span;
    final Span[]    fileSpans  = new Span[ afs.length ];
   
    afd      = afs[ 0 ].getDescr();
    length    = afd.length;
View Full Code Here

//    }
   
   private void createTempFiles()
    throws IOException
  {
    final AudioFileDescr afd  = new AudioFileDescr();
    afd.type          = AudioFileDescr.TYPE_AIFF;
    afd.rate          = getRate();
    afd.bitsPerSample      = 32;
    afd.sampleFormat      = AudioFileDescr.FORMAT_FLOAT;

    if( singleFile ) {
      afd.channels      = getChannelNum();
      afd.file        = IOUtil.createTempFile();
      tempF          = new AudioFile[] { AudioFile.openAsWrite( afd )};
    } else {
      AudioFileDescr afd2;
      final AudioFile[] tempF2 = new AudioFile[ channelMaps.length ];
      for( int i = 0; i < channelMaps.length; i++ ) {
        afd2        = new AudioFileDescr( afd );
        afd2.channels    = channelMaps[ i ].length;
        afd2.file      = IOUtil.createTempFile();
        tempF2[ i ]      = AudioFile.openAsWrite( afd2 );
      }
      // real assignment here coz tempF will remain null if error occurs in the loop
View Full Code Here

    final Span[]    fileSpans  = new Span[ audioFiles.length ];
    final AudioFile[]  cacheAFs  = new AudioFile[ audioFiles.length ];
    final String    ourCode    = AbstractApplication.getApplication().getMacOSCreator();
    final int[][]    channelMaps  = createCacheChannelMaps();
    AudioStake      result    = null;
    AudioFileDescr    afd;
    byte[]        appCode;
    AudioFileCacheInfo  infoA, infoB;

    try {
      for( int i = 0; i < cacheAFs.length; i++ ) {
// System.out.println( "openCacheForRead checking '" + f[ i ].getAbsolutePath() + "'" );
       
        if( !f[ i ].isFile() ) return null;
        cacheAFs[ i ] = AudioFile.openAsRead( f[ i ]);
        cacheAFs[ i ].readAppCode();
        afd = cacheAFs[ i ].getDescr();
        final long expected = ((audioFiles[ i ].getFrameNum() + MAXCEILADD) & MAXMASK) >> decimHelps[ 0 ].shift;
        // System.out.println( "expected " + expected+ "; cacheF " +
        // cacheAFs[ i ].getFile().getAbsolutePath() );
        if( expected != afd.length ) {
          // System.err.println( "expected numFrames = "+ expected +
          // ", but got " + afd.length );
          return null;
        }
        appCode = (byte[]) afd.getProperty( AudioFileDescr.KEY_APPCODE );
        // System.err.println( "ourCode = '" + ourCode + "'; afd.appCode
        // = '" + afd.appCode + "'; appCode = '" + appCode + "'" );
        if( ourCode.equals( afd.appCode ) && (appCode != null) ) {
          infoA = AudioFileCacheInfo.decode( appCode );
          if( infoA != null ) {
View Full Code Here

  {
    final File[]      f      = createCacheFileNames();
    if( f == null ) return null;

    final AudioFile[]    audioFiles  = fullScale.getAudioFiles();
    final AudioFileDescr  afdProto  = new AudioFileDescr();
    final CacheManager    cm      = PrefCacheManager.getInstance();
    final Span[]      fileSpans  = new Span[ audioFiles.length ];
    final AudioFile[]    cacheAFs  = new AudioFile[ audioFiles.length ];
    final String      ourCode    = AbstractApplication.getApplication().getMacOSCreator();
    final int[][]      channelMaps  = createCacheChannelMaps();
    AudioStake        result    = null;
    AudioFileDescr      afd;
    AudioFileCacheInfo    info;

    afdProto.type      = AudioFileDescr.TYPE_AIFF;
    afdProto.bitsPerSample  = 32;
    afdProto.sampleFormat  = AudioFileDescr.FORMAT_FLOAT;
    afdProto.rate      = decimHelps[ 0 ].rate; // getRate();
    afdProto.appCode    = ourCode;

    try {
      for( int i = 0; i < f.length; i++ ) {
        cm.removeFile( f[ i ]); // in case it existed
// System.out.println( "openCacheForWrite doing '" + f[ i ].getAbsolutePath() + "'" );
        afd        = new AudioFileDescr( afdProto );
        afd.channels  = channelMaps[ i ].length;
        // System.out.println( "channels = " + afd.channels );
        afd.file    = f[ i ];
        info      = new AudioFileCacheInfo( audioFiles[ i ], decimModel, audioFiles[ i ].getFrameNum() );
        afd.setProperty( AudioFileDescr.KEY_APPCODE, info.encode() );
        cacheAFs[ i = AudioFile.openAsWrite( afd );
        fileSpans[ i = new Span( 0, decimFrameNum );
      }
      // XXX WE NEED A WAY TO CLOSE THE FILES UPON STAKE DISPOSAL XXX
      if( channelMaps.length == 1 ) {
View Full Code Here

TOP

Related Classes of de.sciss.io.AudioFileDescr

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.