Examples of AudioTrail


Examples of de.sciss.eisenkraut.io.AudioTrail

      final boolean          cutTimeline      = ((Boolean) context.getClientArg( "cut" )).booleanValue();
      final Span            cutTimelineSpan    = (Span) context.getClientArg( "cutSpan" );
      final long            delta        = insertPos - tl.getSpan().start;
      Track.Info            ti;
      Trail              srcTrail;
      AudioTrail            audioTrail;
      boolean[]            trackMap;
      boolean              isAudio, pasteAudio;

      for( int i = 0; i < tis.size(); i++ ) {
        ti    = (Track.Info) tis.get( i );
        if( ti.selected ) {  // ----------------- selected tracks -----------------
          try {
            ti.trail.editBegin( edit );
            isAudio  = ti.trail instanceof AudioTrail;
            srcTrail = tl.getSubTrail( ti.trail.getClass() );
         
            if( isAudio ) {
              pasteAudio = (srcTrail != null) && (((AudioTrail) srcTrail).getChannelNum() > 0);
            } else {
              pasteAudio = false;
            }
           
            if( mode == EDIT_INSERT ) {
              ti.trail.editInsert( this, insertSpan, edit );
              if( cutTimeline ) ti.trail.editRemove( this, cutTimelineSpan, edit );
//              } else if( (mode == EDIT_OVERWRITE) && (pasteAudio || !isAudio) ) { // Audio needs to be cleared even in Mix mode!
            } else if( pasteAudio || ((mode == EDIT_OVERWRITE) && !isAudio) ) { // Audio needs to be cleared even in Mix mode!
              ti.trail.editClear( this, insertSpan, edit );
            }
           
            if( pasteAudio ) {
              audioTrail      = (AudioTrail) ti.trail;
              trackMap  = tl.getTrackMap( ti.trail.getClass() );
             
//System.err.println( "clipboard tm : " );
//for( int x = 0; x < trackMap.length; x++ ) { System.err.println( "  " + trackMap[ x ]); }
              int[] trackMap2 = new int[ audioTrail.getChannelNum() ];
              for( int j = 0, k = 0; j < trackMap2.length; j++ ) {
                if( ti.trackMap[ j ]) {  // target track selected
                  for( ; (k < trackMap.length) && !trackMap[ k ] ; k++ ) ;
                  if( k < trackMap.length ) {  // source track exiting
                    trackMap2[ j ] = k++;
                  } else if( tl.getTrackNum( ti.trail.getClass() ) > 0 ) {    // ran out of source tracks, fold over (simple mono -> stereo par exemple)
                    for( k = 0; !trackMap[ k ] ; k++ ) ;
                    trackMap2[ j ] = k++;
                  } else {
                    trackMap2[ j ] = -1;    // there aren't any clipboard tracks ....
                  }
                } else {              // target track not selected
                  trackMap2[ j ] = -1;
                }
              }
              if( !audioTrail.copyRangeFrom( (AudioTrail) srcTrail, copySpan, insertPos, mode, this, edit, trackMap2, bcPre, bcPost )) return CANCELLED;

            } else if( (ti.numTracks == 1) && (tl.getTrackNum( ti.trail.getClass() ) == 1) ) {
              ti.trail.editAddAll( this, srcTrail.getCuttedRange(
                copySpan, true, srcTrail.getDefaultTouchMode(), delta ), edit );
            }
View Full Code Here

Examples of de.sciss.eisenkraut.io.AudioTrail

    {
      final List          tis      = (List) context.getClientArg( "tis" );
      final AbstractCompoundEdit  edit    = (AbstractCompoundEdit) context.getClientArg( "edit" );
      final Span          insertSpan  = (Span) context.getClientArg( "span" );
      Track.Info          ti;
      AudioTrail          audioTrail;

      for( int i = 0; i < tis.size(); i++ ) {
        ti = (Track.Info) tis.get( i );
        ti.trail.editBegin( edit );
        try {
          ti.trail.editInsert( this, insertSpan, edit );
          if( ti.trail instanceof AudioTrail ) {
            audioTrail      = (AudioTrail) ti.trail;             
            audioTrail.editAdd( this, audioTrail.allocSilent( insertSpan ), edit );
          }
        }
        finally {
          ti.trail.editEnd( edit );
        }
View Full Code Here

Examples of de.sciss.eisenkraut.io.AudioTrail

      final BlendContext        bc          = (BlendContext) context.getClientArg( "bc" );
      final long            left        = bc == null ? 0L : bc.getLeftLen();
      final long            right        = bc == null ? 0L : bc.getRightLen();
      final boolean          cutTimeline      = ((Boolean) context.getClientArg( "cut" )).booleanValue();
      final Span            cutTimelineSpan    = (Span) context.getClientArg( "cutSpan" );
      AudioTrail            audioTrail;
      Track.Info            ti;
      boolean              isAudio;

      for( int i = 0; i < tis.size(); i++ ) {
        ti    = (Track.Info) tis.get( i );
        try {
          ti.trail.editBegin( edit );
          isAudio = ti.trail instanceof AudioTrail;
          if( ti.selected ) {
            if( mode == EDIT_INSERT ) {
              if( isAudio ) {
                if( bc == null ) {
                  ti.trail.editRemove( this, span, edit );
                } else {
                  ti.trail.editRemove( this, new Span( span.start - left, span.stop + right ), edit );
                  ti.trail.editInsert( this, new Span( span.start - left, span.start + right ), edit );
                }
                audioTrail = (AudioTrail) ti.trail;
                audioTrail.clearRange( span, EDIT_INSERT, this, edit, ti.trackMap, bc );
              } else {
                ti.trail.editRemove( this, span, edit );
              }
            } else {
              ti.trail.editClear( this, span, edit );
              if( isAudio ) {
                audioTrail = (AudioTrail) ti.trail;
                audioTrail.clearRange( span, EDIT_OVERWRITE, this, edit, ti.trackMap, bc );
              }
            }
          } else if( cutTimeline ) {
            ti.trail.editRemove( this, cutTimelineSpan, edit );
          }
View Full Code Here

Examples of de.sciss.eisenkraut.io.AudioTrail

  {
    super();
   
    this.host      = host;
       
    final AudioTrail at  = doc.getAudioTrail();
    fullChannels    = at.getChannelNum();
    channelMap      = new int[ fullChannels ];
    for( int i = 0; i < fullChannels; i++ ) {
      channelMap[ i = i;
    }
   
View Full Code Here

Examples of de.sciss.eisenkraut.io.AudioTrail

                     timelineVis.getLength());
      if( (pos < 0) || (pos >= timelineLen) ) return;
   
      final String      chName  = doc.audioTracks.get( ch ).getName();
      final double      seconds  = pos / timelineRate;
      final AudioTrail     at;
      final DecimatedWaveTrail  dt;
      final float[][]      data;
      final float[]      frame;
      float          f1;
     
      argsCsr[3]    = chName;
      argsCsr[0]    = new Long( pos );
      argsCsr[1]    = new Integer( (int) (seconds / 60) );
      argsCsr[2]    = new Float( seconds % 60 );
     
      csrInfo[0]    = msgCsr1.format( argsCsr );
     
      switch( info.model ) {
      case DecimatedTrail.MODEL_PCM:
        at      = doc.getAudioTrail();
        data    = new float[ at.getChannelNum() ][];
        data[ ch = new float[ 1 ];
        try {
          at.readFrames( data, 0, new Span( pos, pos + 1 ));
        }
        catch( IOException e1 ) { return; }
        f1      = data[ ch ][ 0 ];
        argsCsr[4= new Float( f1 );
        argsCsr[5= new Float( Math.log( Math.abs( f1 )) * TWENTYDIVLOG10 );
View Full Code Here

Examples of de.sciss.meloncillo.io.AudioTrail

      final BlendContext        bc          = (BlendContext) context.getClientArg( "bc" );
      final long            left        = bc == null ? 0L : bc.getLeftLen();
      final long            right        = bc == null ? 0L : bc.getRightLen();
      final boolean          cutTimeline      = ((Boolean) context.getClientArg( "cut" )).booleanValue();
      final Span            cutTimelineSpan    = (Span) context.getClientArg( "cutSpan" );
      AudioTrail            audioTrail;
      Track.Info            ti;
      boolean              isAudio;

      for( int i = 0; i < tis.size(); i++ ) {
        ti    = (Track.Info) tis.get( i );
        try {
          ti.trail.editBegin( edit );
          isAudio = ti.trail instanceof AudioTrail;
          if( ti.selected ) {
            if( mode == EDIT_INSERT ) {
              if( isAudio ) {
                if( bc == null ) {
                  ti.trail.editRemove( this, span, edit );
                } else {
                  ti.trail.editRemove( this, new Span( span.start - left, span.stop + right ), edit );
                  ti.trail.editInsert( this, new Span( span.start - left, span.start + right ), edit );
                }
                audioTrail = (AudioTrail) ti.trail;
                audioTrail.clearRange( span, EDIT_INSERT, this, edit, ti.channelMap, bc );
              } else {
                ti.trail.editRemove( this, span, edit );
              }
            } else {
              ti.trail.editClear( this, span, edit );
              if( isAudio ) {
                audioTrail = (AudioTrail) ti.trail;
                audioTrail.clearRange( span, EDIT_OVERWRITE, this, edit, ti.channelMap, bc );
              }
            }
          } else if( cutTimeline ) {
            ti.trail.editRemove( this, cutTimelineSpan, edit );
          }
View Full Code Here

Examples of de.sciss.meloncillo.io.AudioTrail

      final float[][]          interpBuf;
      final float[]          warpedTime;
      final float            v_start_norm, dv_norm;
      final long            interpLen, progressLen;
      Transmitter            trns;
      AudioTrail            at;
      int                len;
      long              t, tt;
//      BlendSpan            bs;
      // interpLen entspricht 'T' in der Formel (Gesamtzeit), interpOff entspricht 't' (aktueller Zeitpunkt)
      long              start, interpOff;
      long              progress  = 0;
      AudioStake            as;
       
      interpLen   = span.getLength();
      warpedTime  = new float[(int) Math.min( interpLen, 4096 )];
      interpBuf   = new float[2][ warpedTime.length ];

      t_norm      = 1.0 / (interpLen - 1);
      v_start_norm  = (float) (vStart * t_norm);
      dv_norm      = (float) ((vStop - vStart) / 2 * t_norm * t_norm);

//      initFunctionEvaluation();
     
      progressLen      = interpLen*collTrns.size();
     
      try {
        for( int i = 0; i < collTrns.size(); i++ ) {
          trns  = (Transmitter) collTrns.get( i );
          at    = trns.getAudioTrail();

//          bs = at.beginOverwrite( span, bc, edit );
          as = at.alloc( span );

          // XXX has to be called for each trns?
          initFunctionEvaluation();

          for( start = span.getStart(), interpOff = 0; start < span.getStop();
             start += len, interpOff += len ) {
            
            len  = (int) Math.min( 4096, span.getStop() - start );
            t  = interpOff;
            for( int j = 0; j < len; j++, t++ ) {
              tt        = t*t;
              warpedTime[j]   = v_start_norm * t + dv_norm * tt;
//              warpedTime[j]   = (v_start_norm * t + dv_norm * tt) * 1.5f - 0.25f;  // extrap.
            }
            evaluateFunction( warpedTime, interpBuf, len );
            if( bc != null ) {
              at.readFrames( srcBuf, 0, new Span( start, start + len ));
              if( interpOff < bc.getLen() ) {  // EEE getLen?
                bc.blend( interpOff, srcBuf, 0, interpBuf, 0, interpBuf, 0, len );
              }
              if( interpLen - (interpOff + len) < bc.getLen() ) {  // EEE getLen?
                bc.blend( interpOff - (interpLen - bc.getLen()), interpBuf, 0, srcBuf, 0, interpBuf, 0, len );
              }
            }
            as.writeFrames( interpBuf, 0, new Span( start, start + len ));
//            at.continueWrite( bs, interpBuf, 0, len );
            progress += len;
            context.setProgression( (float) progress / (float) progressLen );
          }
          at.editBegin( edit );
          at.editClear( this, span, edit );
          at.editAdd( this, as, edit );
          at.editEnd( edit );
//          at.finishWrite( bs, edit );
        } // for( i = 0; i < collTransmitters.size(); i++ )
       
//        edit.perform();
//        edit.end(); // fires doc.tc.modified()
View Full Code Here

Examples of de.sciss.meloncillo.io.AudioTrail

    {
      final List          tis      = (List) context.getClientArg( "tis" );
      final AbstractCompoundEdit  edit    = (AbstractCompoundEdit) context.getClientArg( "edit" );
      final Span          insertSpan  = (Span) context.getClientArg( "span" );
      Track.Info          ti;
      AudioTrail          audioTrail;

      for( int i = 0; i < tis.size(); i++ ) {
        ti = (Track.Info) tis.get( i );
        ti.trail.editBegin( edit );
        try {
          ti.trail.editInsert( this, insertSpan, edit );
          if( ti.trail instanceof AudioTrail ) {
            audioTrail      = (AudioTrail) ti.trail;             
            audioTrail.editAdd( this, audioTrail.allocSilent( insertSpan ), edit );
          }
        }
        finally {
          ti.trail.editEnd( edit );
        }
View Full Code Here

Examples of de.sciss.meloncillo.io.AudioTrail

    int      y;
   
    fullChannels = 0;
    for( int i = 0; i < doc.getActiveTransmitters().size(); i++ ) {
      final Transmitter t = (Transmitter) doc.getActiveTransmitters().get( i );
      final AudioTrail at = t.getAudioTrail();
      fullChannels += at.getChannelNum();
    }
   
    channelOffset = 0;
    for( int i = 0; i < doc.getActiveTransmitters().size(); i++ ) {
      final Transmitter t = (Transmitter) doc.getActiveTransmitters().get( i );
      final AudioTrail at = t.getAudioTrail();
      final DecimatedWaveTrail dt = t.getDecimatedWaveTrail();
      if( dt == null ) continue;
      info = dt.getBestSubsample( new Span( viewSpan.start, viewSpan.stop + 1 ), w );
//      fullChannels = at.getChannelNum(); // XXX dirty shit
      dt.drawWaveform( info, this, g2 );
 
      if( nullLinie ) {
        g2.setPaint( pntNull );
        g2.setStroke( strkNull );
        for( int ch = 0; ch < fullChannels; ch++ ) {
          cr = rectForChannel( ch );
          y = cr.y + (cr.height >> 1);
          g2.drawLine( cr.x, y, cr.x + cr.width, y );
        }
      }
      channelOffset += at.getChannelNum();
    }
  }
View Full Code Here

Examples of de.sciss.meloncillo.io.AudioTrail

    final List            collTrns  = (List) context.getClientArg( "trns" );
    final BlendContext        bc      = (BlendContext) context.getClientArg( "blend" );
    final float[][]          srcBuf    = bc == null ? null : new float[ 2 ][ 4096 ];
    final float[][]          interpBuf;
    Transmitter            trns;
    AudioTrail            at;
    float[]              warpedTime;
    int                i, len;
    double              t_norm;
//    BlendSpan            bs;
    // interpLen entspricht 'T' in der Formel (Gesamtzeit), interpOff entspricht 't' (aktueller Zeitpunkt)
    long              start, interpOff, interpLen, progressLen;
    long              progress  = 0;
//    boolean              success    = false;
    AudioStake            as;

//    if( span.getLength() < 2 ) return DONE;
    if( !initFunctionEvaluation( (Point2D[]) context.getClientArg( "points" ))) return FAILED;

    interpLen    = span.getLength();
    warpedTime    = new float[(int) Math.min( interpLen, 4096 )];
    interpBuf    = new float[2][ warpedTime.length ];
    // '-1' because the last sample shall really equal the end point of the shape
    t_norm      = 1.0 / (interpLen - 1);

    progressLen    = interpLen*collTrns.size();

    try {
      for( i = 0; i < collTrns.size(); i++ ) {
        trns  = (Transmitter) collTrns.get( i );
        at    = trns.getAudioTrail();
        as    = at.alloc( span );
//        bs = at.beginOverwrite( span, bc, edit );
        for( start = span.getStart(), interpOff = 0; start < span.getStop();
           start += len, interpOff += len ) {

          len = (int) Math.min( 4096, span.getStop() - start );
          calcWarpedTime( warpedTime, interpOff * t_norm, t_norm, len );
          evaluateFunction( warpedTime, interpBuf, len );
//          at.continueWrite( bs, interpBuf, 0, len );
          if( bc != null ) {
            at.readFrames( srcBuf, 0, new Span( start, start + len ));
            if( interpOff < bc.getLen() ) {  // EEE getLen?
              bc.blend( interpOff, srcBuf, 0, interpBuf, 0, interpBuf, 0, len );
            }
            if( interpLen - (interpOff + len) < bc.getLen() ) {  // EEE getLen?
              bc.blend( interpOff - (interpLen - bc.getLen()), interpBuf, 0, srcBuf, 0, interpBuf, 0, len );
            }
          }
          as.writeFrames( interpBuf, 0, new Span( start, start + len ));
          progress += len;
          context.setProgression( (float) progress / (float) progressLen );
        }
//        at.finishWrite( bs, edit );
        at.editBegin( edit );
        at.editClear( this, span, edit );
        at.editAdd( this, as, edit );
        at.editEnd( edit );
      } // for( i = 0; i < collTransmitters.size(); i++ )
     
//      edit.perform();
//      edit.end(); // fires doc.tc.modified()
//      doc.getUndoManager().addEdit( edit );
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.