Package de.sciss.meloncillo.transmitter

Examples of de.sciss.meloncillo.transmitter.Transmitter


      final double          t_norm;
      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?
View Full Code Here


    Rectangle  cr;
    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 );
 
View Full Code Here

    final AbstractCompoundEdit    edit    = (AbstractCompoundEdit) context.getClientArg( "edit" );
    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 ) {

View Full Code Here

   @synchronization  waitShared on DOOR_TIMETRNSMTE | DOOR_GRP
   */
    private void updateTransmitterPath()
    {
        int            j, reqLen, pathLen, len, lastLen;
        Transmitter        trns;
        Span          span;
        float[][]        frames  = null;
        float[]          x, y;
        GeneralPath        path  = null;
    DecimationInfo      info;
//    AudioTrail        at;
    DecimatedWaveTrail    dwt;     
    float          lx, ly;
    List          collTrns;
       
    try {
      doc.bird.waitShared( Session.DOOR_TIMETRNSMTE | Session.DOOR_GRP );
      span = doc.timeline.getSelectionSpan();
      collTransmitterPath.clear();
      if( span.getLength() < 2 ) return;

      collTrns  = doc.getActiveTransmitters().getAll();
      collTrns.retainAll( doc.getSelectedTransmitters().getAll() );
     
      for( int i = 0; i < collTrns.size(); i++ ) {
        trns  = (Transmitter) collTrns.get( i );
//        at    = trns.getTrackEditor();
        dwt    = trns.getDecimatedWaveTrail();
       
        // performance measures show that this routine is
        // vey fast, like one or two millisecs, while the draw method
        // of the Graphics2D called in redrawImage() becomes hell
        // slow if the GeneralPath contains more than say 250 lines.
        // therefore we start with a fairly big subsample to get a
        // good resolution; however in the path creation loop, points
        // are skipped if they lie very close to each other. therefore,
        // right after the creation of the path we know how many lines
        // it actually contains, and if these exceed 256 we'll restart
        // with a smaller subsample.
        for( reqLen = 1024, pathLen = 257, len = -1; pathLen > 256; reqLen >>= 1 ) {
          info  = dwt.getBestSubsample( span, reqLen );
          lastLen = len;
          len    = (int) info.sublength;
          if( lastLen == len ) continue;

          if( frames == null || frames[0].length < len ) {
            frames = new float[2][len];
          }
//          dwt.readFrame( sub, pos, ch, data );
         
//          dwt.read( info, frames, 0 );
trns.getAudioTrail().readFrames( frames, 0, new Span( info.span.start, info.span.start + len ));
         
          x    = frames[0];
          y    = frames[1];
          path  = new GeneralPath( GeneralPath.WIND_EVEN_ODD, len );
          lx    = x[0];
View Full Code Here

    final long        pos      = Math.min( timelineLen - 1, timelinePos );
    if( pos < 0 ) return;
   
    try {
      for( int trnsIdx = 0; trnsIdx < numTrns; trnsIdx++ ) {
        final Transmitter  trns  = (Transmitter) collTrns.get( trnsIdx );
        final AudioTrail  at    = trns.getAudioTrail();
        at.readFrames( trnsBuf, 0, new Span( pos, pos + 1 ));
        rt_trnsLocX[ trnsIdx = trnsBuf[ 0 ][ 0 ];
        rt_trnsLocY[ trnsIdx = -trnsBuf[ 1 ][ 0 ];
      }
    }
View Full Code Here

      final Span        span;
      final List        collNewTrns    = new ArrayList( num );
      final List        collAllTrns    = doc.getTransmitters().getAll();
      final BasicCompoundEdit  edit;
      Class    c;
      Transmitter  trns;
      String    s;
      Map      map;
     
      edit = new BasicCompoundEdit( getValue( NAME ).toString() );
     
      collMap = new ArrayList( num );
      for( int i = 0; i < num; i++ ) {
        collMap.add( collTypes.get( 0 ));
      }

      span = new Span( 0, doc.timeline.getLength() );
      try {
        for( int i = 0; i < num; i++ ) {
          map    = (Map) collMap.get( i );
          s    = (String) map.get( Main.KEY_CLASSNAME );
          if( s == null ) continue;

          c    = Class.forName( s );
          trns  = (Transmitter) c.newInstance();
          trns.setName( BasicSessionCollection.createUniqueName( Session.SO_NAME_PTRN,
            new Object[] { new Integer( 1 ), Session.TRNS_NAME_PREFIX, Session.TRNS_NAME_SUFFIX },
            collAllTrns ));
          doc.getTransmitters().getMap().copyContexts( this, MapManager.Context.FLAG_DYNAMIC,
                              MapManager.Context.NONE_EXCLUSIVE, trns.getMap() );
          collNewTrns.add( trns );
          collAllTrns.add( trns );
         
//          trns.getAudioTrail().editBegin( edit );
        }
View Full Code Here

    {
      final float[][]      buf      = new float[ 2 ][ 4096 ];
      final BasicCompoundEdit  edit    = (BasicCompoundEdit) context.getClientArg( "edit" );
      final List        collNewTrns  = (List) context.getClientArg( "trns" );
      final int        num      = collNewTrns.size();
      Transmitter        trns;
      AudioTrail        at;
      long          progress  = 0;
      double          d1;
      Span          span    = (Span) context.getClientArg( "span" );
//      TrackSpan        ts;
      float          f1, f2;
      AudioStake        as;
      int            chunkLen;
     
      if( span.isEmpty() ) return DONE;
     
      try {
        for( int i = 0; i < num; i++ ) {
          d1    = ((double) i / (double) num - 0.25) * Math.PI * -2;
//          f1    = (float) (0.25 * (2.0 + Math.cos( d1 )));
//          f2    = (float) (0.25 * (2.0 + Math.sin( d1 )));
          f1    = (float) (0.5 * Math.cos( d1 ));
          f2    = (float) (0.5 * Math.sin( d1 ));
          for( int j = 0; j < 4096; j++ ) {
            buf[0][j] = f1;
            buf[1][j] = f2;
          }
          trns  = (Transmitter) collNewTrns.get( i );
          at    = trns.getAudioTrail();
//          ts    = at.beginInsert( span, edit );
          as    = at.alloc( span );
          for( long framesWritten = 0, frames = span.getLength(); framesWritten < frames; ) {
            chunkLen = (int) Math.min( 4096, frames - framesWritten );
//            at.continueWrite( ts, buf, 0, j );
View Full Code Here

    final Application        app      = AbstractApplication.getApplication();

    float[][]            inTrnsFrames, outTrnsFrames;
    int                minBlockSize, maxBlockSize, prefBlockSize;
    int                i, numTrns, numRcv, trnsIdx, rcvIdx, readLen, writeLen;
    Transmitter            trns;
    AudioTrail            at;
    boolean[]            trnsRequest;
    Object              val;
    long              readOffset, remainingRead, remainingWrite;
    Set                newOptions;
    String              className;
    boolean              success    = false// pessimist bitchâ„¢
   
    // --- resampling related ---
    int            inOff, inTrnsLen, outTrnsLen;
    int            fltLenI    = 0;
    int            overlapLen  = 0;
    int            overlapOff  = 0;
    int            trnsInside  = 0;
    Resampling        rsmp    = null;
    double          rsmpFactor  = 1.0;
    double          inPhase    = 0.0;
    double          newInPhase  = 0.0;
    double          fltLen    = 0.0;
    float[][][]        trnsOverlaps= null;

    // --- init ---

    readOffset    = context.getTimeSpan().getStart();
    numRcv      = context.getReceivers().size();
    numTrns      = context.getTransmitters().size();
    source      = new RenderSource( numTrns, numRcv );

    try {
      if( !invokeProducerBegin( pt, context, source, plugIn )) return FAILED;
      remainingRead    = context.getTimeSpan().getLength();
      newOptions      = context.getModifiedOptions();
      if( newOptions.contains( RenderContext.KEY_MINBLOCKSIZE )) {
        val        = context.getOption( RenderContext.KEY_MINBLOCKSIZE );
        minBlockSize  = ((Integer) val).intValue();
      } else {
        minBlockSize  = 1;
      }
      if( newOptions.contains( RenderContext.KEY_MAXBLOCKSIZE )) {
        val        = context.getOption( RenderContext.KEY_MAXBLOCKSIZE );
        maxBlockSize  = ((Integer) val).intValue();
      } else {
        maxBlockSize  = 0x7FFFFF;
      }
      if( newOptions.contains( RenderContext.KEY_PREFBLOCKSIZE )) {
        val        = context.getOption( RenderContext.KEY_PREFBLOCKSIZE );
        prefBlockSize  = ((Integer) val).intValue();
      } else {
        prefBlockSize   = Math.max( minBlockSize, Math.min( maxBlockSize, 1024 ));
      }
      assert minBlockSize <= maxBlockSize : "minmaxblocksize";
     
      if( newOptions.contains( RenderContext.KEY_TARGETRATE )) {
      // ---- prepare resampling ----
        val        = context.getOption( RenderContext.KEY_TARGETRATE );
        rsmpFactor    = ((Double) val).doubleValue() / (double) context.getSourceRate();
        className    = classPrefs.get( KEY_RESAMPLING, null );
        if( className == null ) {
          className   = NearestNeighbour.class.getName(); // RSMP_ITEMS[ 0 ].getKey();
          showMessage( JOptionPane.WARNING_MESSAGE, app.getResourceString( "errResamplingClass" ) +
                  " : " + val.toString() );
        }
        try {
          rsmp    = (Resampling) Class.forName( className ).newInstance();
        }
        catch( InstantiationException e1 ) {
          pt.setException( e1 );
          return FAILED;
        }
        catch( IllegalAccessException e2 ) {
          pt.setException( e2 );
          return FAILED;
        }
        catch( ClassNotFoundException e3 ) {
          pt.setException( e3 );
          return FAILED;
        }
        finally {
          if( rsmp == null ) {
            showMessage( JOptionPane.ERROR_MESSAGE,
                   app.getResourceString( "errResamplingClass" ) + " : " + className );
          }
        }
       
        fltLen      = rsmp.getWingSize( rsmpFactor );
        fltLenI      = (int) fltLen + 1;
        inOff      = fltLenI;
        overlapLen    = fltLenI << 1;
        if( rsmpFactor > 1.0 ) {
          outTrnsLen  = prefBlockSize;
          i      = (int) (outTrnsLen / rsmpFactor);
          inTrnsLen   = i + overlapLen;
        } else {
          inTrnsLen   = Math.max( prefBlockSize, fltLenI + overlapLen );
          i      = inTrnsLen - overlapLen;
          outTrnsLen  = (int) (i * rsmpFactor) + 1;
        }
        overlapOff    = inTrnsLen - overlapLen;
        trnsInside    = inTrnsLen - fltLenI - fltLenI;
        trnsOverlaps  = new float[ numTrns ][2][ overlapLen ];
        inTrnsFrames  = new float[2][ inTrnsLen ];
        outTrnsFrames   = new float[2][ outTrnsLen ];
        remainingWrite  = (long) (remainingRead * rsmpFactor + 0.5);
//System.err.println( "fltLen "+fltLen+"; inOff "+inOff+"; overlapLen "+overlapLen+"; inTrnsLen "+inTrnsLen+"; outTrnsLen "+outTrnsLen+"; rsmpFactor "+rsmpFactor );
      } else {
        inTrnsLen    = prefBlockSize;
        outTrnsLen    = inTrnsLen;
        inTrnsFrames  = new float[2][ inTrnsLen ];
        outTrnsFrames   = inTrnsFrames;
        inOff      = 0;
        remainingWrite  = remainingRead;
      }

      // --- responding to RenderSource requests ---
      trnsRequest      = new boolean[ numTrns ];   // all false by default
     
      for( trnsIdx = 0; trnsIdx < numTrns; trnsIdx++ ) {
        if( source.trajRequest[ trnsIdx ]) {
          source.trajBlockBuf[ trnsIdx = new float[ 2 ][ outTrnsLen ];
          trnsRequest[ trnsIdx ]      = true;
        }
        for( rcvIdx = 0; rcvIdx < numRcv; rcvIdx++ ) {
          if( source.senseRequest[ trnsIdx ][ rcvIdx ]) {
            source.senseBlockBuf[ trnsIdx ][ rcvIdx ] = new float[ outTrnsLen ];
            trnsRequest[ trnsIdx ]    = true;
          }
        }
      }

      // --- rendering loop ---

      while( isRunning() && remainingWrite > 0 ) {
        readLen        = (int) Math.min( inTrnsLen - inOff, remainingRead );
        source.blockSpan  = new Span( readOffset, readOffset + readLen );
        if( rsmp != null ) {
          inPhase      = newInPhase;
          writeLen    = (int) Math.min( Math.ceil( (trnsInside - inPhase) * rsmpFactor ), remainingWrite );
        } else {
          writeLen    = readLen;
        }
        source.blockBufLen  = writeLen;

        for( trnsIdx = 0; trnsIdx < numTrns; trnsIdx++ ) {
          if( !trnsRequest[ trnsIdx ]) continue;
         
          // --- read transmitter trajectory data ---
          trns    = (Transmitter) context.getTransmitters().get( trnsIdx );
          at      = trns.getAudioTrail();
//          at.read( source.blockSpan, inTrnsFrames, inOff );
          at.readFrames( inTrnsFrames, inOff, source.blockSpan );
          for( i = inOff + readLen; i < inTrnsLen; i++ ) {
            inTrnsFrames[0][i] = 0.0f;    // zero pad in the end
            inTrnsFrames[1][i] = 0.0f;    // XXX actually the last sample should be repeated!
View Full Code Here

  private void reConfigReplacements( Source s )
  {
    if( s == null ) return;
   
    TrajectoryReplacement tr;
    Transmitter trns;

    // reset requests
trnsLp:  for( int trnsIdx = 0; trnsIdx < s.numTrns; trnsIdx++ ) {
      trns = s.transmitters[ trnsIdx ];
      for( int i = 0; i < collReplacements.size(); i++ ) {
View Full Code Here

   */
  public boolean consumerBegin( RenderContext context, RenderSource source )
  throws IOException
  {
    final ConsumerContext  consc;
    Transmitter        trns;
    AudioTrail        at;
   
    consc      = new ConsumerContext();
    consc.edit    = new CompoundSessionObjEdit( this, context.getTransmitters(), Transmitter.OWNER_TRAJ,
                            null, null, "Filter" );
//    consc.bs    = new BlendSpan[ source.numTrns ];
    consc.as    = new AudioStake[ source.numTrns ];
    consc.bc    = root.getBlending()// XXX THREAD XXX
//    if( consc.bc != null ) consc.srcBuf = new float[ 2 ][ 4096 ];
    context.setOption( KEY_CONSC, consc );

    for( int trnsIdx = 0; trnsIdx < source.numTrns; trnsIdx++ ) {
      if( !source.trajRequest[ trnsIdx ]) continue;
     
      trns        = (Transmitter) context.getTransmitters().get( trnsIdx );
      at          = trns.getAudioTrail();
//      consc.bs[ trnsIdx ]  = at.beginOverwrite( context.getTimeSpan(), consc.bc, consc.edit );
      consc.as[ trnsIdx= at.alloc( context.getTimeSpan() );
    }
   
    return true;
View Full Code Here

TOP

Related Classes of de.sciss.meloncillo.transmitter.Transmitter

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.