Package de.sciss.util

Examples of de.sciss.util.MutableInt


  {
    int          idx      = editIndexOf( readSpan.start, true, ce );
    if( idx < 0 ) idx = -(idx + 2);
    final long      startR    = decimHelps[sub].roundAdd - readSpan.start;
    final List      coll    = editGetCollByStart( ce );
    final MutableInt  readyLen  = new MutableInt( 0 );
    final MutableInt  busyLen    = new MutableInt( 0 );
    DecimatedStake  stake;
    int          chunkLen, discrepancy;
    Span        subSpan;
    int          readOffset, nextOffset = dataOffset;
    int          len      = (int) (readSpan.getLength() >> decimHelps[ sub ].shift);

    while( (len > 0) && (idx < coll.size()) ) {
      stake    = (DecimatedStake) coll.get( idx );
      subSpan    = new Span( Math.max( stake.getSpan().start, readSpan.start ),
                  Math.min( stake.getSpan().stop, readSpan.stop ));
      stake.readFrames( sub, data, nextOffset, subSpan, readyLen, busyLen );
      chunkLen  = readyLen.value() + busyLen.value();
      readOffset  = nextOffset + readyLen.value(); // chunkLen;
      nextOffset  = (int) ((subSpan.stop + startR) >> decimHelps[ sub ].shift) + dataOffset;
      discrepancy  = nextOffset - readOffset;
      len      -= readyLen.value() + discrepancy;
      if( busyLen.value() == 0 ) {
        if( discrepancy > 0 ) {
          if( readOffset > 0 ) {
            for( int i = readOffset, k = readOffset - 1; i < nextOffset; i++ ) {
              for( int j = 0; j < data.length; j++ ) {
                data[ j ][ i ] = data[ j ][ k ];
              }
            }
          }
        }
      } else {
        busyList.add( new Span( subSpan.stop - (subSpan.getLength() * busyLen.value() / chunkLen),
                    subSpan.stop ));
        for( int i = Math.max( 0, readOffset ); i < nextOffset; i++ ) {
          for( int j = 0; j < data.length; j++ ) {
            data[ j ][ i ] = 0f;
          }
View Full Code Here


  {
    int          idx      = editIndexOf( readSpan.start, true, ce );
    if( idx < 0 ) idx = -(idx + 2);
    final long      startR    = decimHelps[ sub ].roundAdd - readSpan.start;
    final List      coll    = editGetCollByStart( ce );
    final MutableInt  readyLen  = new MutableInt( 0 );
    final MutableInt  busyLen    = new MutableInt( 0 );
    // someReady is a transient trick to keep a newly opened documented
    // responsive (since it's zoomed out completely and due to the missing
    // decimation drawWaveform would take ages)
    boolean        someReady  = false;
    DecimatedStake    stake;
    int          chunkLen, discrepancy;
    Span        subSpan;
    int          readOffset, nextOffset = dataOffset;
    int          len      = (int) (readSpan.getLength() >> decimHelps[ sub ].shift );
   
    while( (len > 0) && (idx < coll.size()) ) {
      stake    = (DecimatedStake) coll.get( idx );
      subSpan    = new Span( Math.max( stake.getSpan().start, readSpan.start ),
                  Math.min( stake.getSpan().stop, readSpan.stop ));
      stake.readFrames( sub, data, nextOffset, subSpan, readyLen, busyLen );
      chunkLen  = readyLen.value() + busyLen.value();
      readOffset  = nextOffset + readyLen.value(); // chunkLen;
      nextOffset  = (int) ((subSpan.stop + startR) >> decimHelps[ sub ].shift) + dataOffset;
      discrepancy  = nextOffset - readOffset;
      len      -= readyLen.value() + discrepancy;
      if( readyLen.value() > 0 ) someReady = true;
      if( busyLen.value() == 0 ) {
        if( discrepancy > 0 ) {
          if( readOffset > 0 ) {
            for( int i = readOffset, k = readOffset - 1; i < nextOffset; i++ ) {
              for( int j = 0; j < data.length; j++ ) {
                data[ j ][ i ] = data[ j ][ k ];
              }
            }
          }
        }
      } else {
        final Span busySpan = new Span( subSpan.stop - (subSpan.getLength() * busyLen.value() / chunkLen),
                                        subSpan.stop );
        final int busyLastIdx = busyList.size() - 1;
        if( busyLastIdx >= 0 ) {
          final Span busySpan2 = (Span) busyList.get( busyLastIdx );
          if( busySpan.touches( busySpan2 )) {
View Full Code Here

  {
    int          idx      = editIndexOf( readSpan.start, true, ce );
    if( idx < 0 ) idx = -(idx + 2);
    final long      startR    = decimHelps[sub].roundAdd - readSpan.start;
    final List      coll    = editGetCollByStart( ce );
    final MutableInt  readyLen  = new MutableInt( 0 );
    final MutableInt  busyLen    = new MutableInt( 0 );
    DecimatedStake  stake;
    int          chunkLen, discrepancy;
    Span        subSpan;
    int          readOffset, nextOffset = dataOffset;
    int          len      = (int) (readSpan.getLength() >> decimHelps[ sub ].shift);

//if( idx < 0 ) {
//  System.out.println( "Doh! readSpan = " + readSpan + " ; this.span " + getSpan() );
//}
   
    while( (len > 0) && (idx < coll.size()) ) {
      stake    = (DecimatedStake) coll.get( idx );
      subSpan    = new Span( Math.max( stake.getSpan().start, readSpan.start ),
                  Math.min( stake.getSpan().stop, readSpan.stop ));
      stake.readFrames( sub, data, nextOffset, subSpan, readyLen, busyLen );
      chunkLen  = readyLen.value() + busyLen.value();
      readOffset  = nextOffset + readyLen.value(); // chunkLen;
      nextOffset  = (int) ((subSpan.stop + startR) >> decimHelps[ sub ].shift) + dataOffset;
      discrepancy  = nextOffset - readOffset;
      len      -= readyLen.value() + discrepancy;
      if( busyLen.value() == 0 ) {
        if( discrepancy > 0 ) {
          if( readOffset > 0 ) {
            for( int i = readOffset, k = readOffset - 1; i < nextOffset; i++ ) {
              for( int j = 0; j < data.length; j++ ) {
                data[ j ][ i ] = data[ j ][ k ];
              }
            }
          }
        }
      } else {
        busyList.add( new Span( subSpan.stop - (subSpan.getLength() * busyLen.value() / chunkLen),
                    subSpan.stop ));
        for( int i = Math.max( 0, readOffset ); i < nextOffset; i++ ) {
          for( int j = 0; j < data.length; j++ ) {
            data[ j ][ i ] = 0f;
          }
View Full Code Here

  {
    Track          track;
    Trail          trail;
    Track.Info        ti;
    int            chan;
    MutableInt        count;
    final Map        mapInfos  = new HashMap();
    final List        collInfos  = new ArrayList();
    final Map        mapCounts  = new HashMap();
   
    for( int i = 0; i < allTracks.size(); i++ ) {
      track  = (Track) allTracks.get( i );
      trail  = track.getTrail();
      ti    = (Track.Info) mapInfos.get( trail );
      count  = (MutableInt) mapCounts.get( trail.getClass() );
      if( count == null ) {
        count = new MutableInt( 0 );
        mapCounts.put( trail.getClass(), count );
      }
      if( ti == null ) {
        ti  = new Info( trail, count.value() );
        mapInfos.put( trail, ti );
        collInfos.add( ti );
      }
      if( selectedTracks.contains( track )) {
        count.add( 1 );
        ti.selected  = true;
        ti.tracks.add( track );
        if( track instanceof Transmitter ) {
          ti.channelMap[ 0 ] = true;
          ti.channelMap[ 1 ] = true// not possible to select x/y separately
View Full Code Here

    private void readFrames( int sub, float[][] data, int dataOffset, List busyList, Span readSpan )
    throws IOException
    {
      final DecimatedStake   stake    = decimatedStake;
    final long        startR    = decimHelps[ sub ].roundAdd - readSpan.start;
    final MutableInt    readyLen  = new MutableInt( 0 );
    final MutableInt    busyLen    = new MutableInt( 0 );
    int            chunkLen, discrepancy;
    Span          subSpan;
    int            readOffset, nextOffset = dataOffset;
    int            len      = (int) (readSpan.getLength() >> decimHelps[ sub ].shift);
   
    subSpan    = new Span( Math.max( stake.getSpan().start, readSpan.start ),
                Math.min( stake.getSpan().stop, readSpan.stop ));
    stake.readFrames( sub, data, nextOffset, subSpan, readyLen, busyLen );
    chunkLen  = readyLen.value() + busyLen.value();
    readOffset  = nextOffset + readyLen.value(); // chunkLen;
    nextOffset  = (int) ((subSpan.stop + startR) >> decimHelps[ sub ].shift) + dataOffset;
    discrepancy  = nextOffset - readOffset;
    len       -= readyLen.value() + discrepancy;
    if( busyLen.value() == 0 ) {
      if( discrepancy > 0 ) {
        if( readOffset > 0 ) {
          for( int i = readOffset, k = readOffset - 1; i < nextOffset; i++ ) {
            for( int j = 0; j < data.length; j++ ) {
              data[ j ][ i ] = data[ j ][ k ];
            }
          }
        }
      }
    } else {
      busyList.add( new Span( subSpan.stop - (subSpan.getLength() * busyLen.value() / chunkLen), subSpan.stop ));
      for( int i = Math.max( 0, readOffset ); i < nextOffset; i++ ) {
        for( int j = 0; j < data.length; j++ ) {
          data[ j ][ i ] = 0f;
        }
      }
View Full Code Here

TOP

Related Classes of de.sciss.util.MutableInt

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.