Ignore:
Timestamp:
05/19/21 09:01:33 (3 years ago)
Author:
davidb
Message:

A set of changes that spans three things: beat detection, time stretching; and a debug class motivated by the need to look at a canvas redraw issue most notable when a waveform widget is playing

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/apollo/gui/SampledTrackGraphView.java

    r1102 r1561  
    7070        private int timescaleFrameLength = 0; // in frames
    7171       
     72        private double timeStretchFactor = 1.0;
     73       
    7274        private final Font RENDER_MESSAGE_FONT = new Font("Arial", Font.BOLD | Font.ITALIC, 14);
    7375       
     
    8082        private Color backColorHighlights = DEFAULT_BACKGROUND_HIGHTLIGHTS_COLOR;
    8183       
    82         public static final Color PLAYBACK_BAR_COLOR = new Color(225, 187, 15);
     84        public static final Color PLAYBACK_BAR_COLOR = new Color(225, 187, 15); // ******
    8385       
    8486        /** The stroke used for drawing graph bars. E.G: The selection Start bar. */
     
    546548        }
    547549       
     550       
     551        public void setTimeStretchFactor(double time_stretch_factor) {
     552                timeStretchFactor = time_stretch_factor;
     553        }
     554       
     555        public double getTimeStretchFactor()
     556        {
     557                return timeStretchFactor;
     558        }
     559
    548560        /**
    549561         * Re-renders the waveform buffers to match the graph size if it needs to.
     
    623635                                trackModel.getAllAudioBytes(),
    624636                                trackModel.getFormat(),
     637                                trackModel.getBeats(),
    625638                                timescaleFrameStart,
    626639                                timescaleFrameLength,
     
    743756                       
    744757                        int x = getPlaybackXPos(currentPlaybackFramePosition);
     758                        //System.out.println("*** playback x = " + x);
     759                       
     760                        x = (int)Math.rint(((double)x) * getTimeStretchFactor()); // ******
    745761                       
    746762                        if (x >= 0 && x <= getWidth()) {
    747                                
     763                                       
    748764                                ((Graphics2D)g).setStroke(GRAPH_BAR_STROKE);
    749765                                g.setColor(PLAYBACK_BAR_COLOR);
Note: See TracChangeset for help on using the changeset viewer.