f@0: f@0: #pragma once f@0: f@0: #include "cinder/Color.h" f@0: #include "cinder/gl/Batch.h" f@0: f@0: class DrawInfo; f@0: f@0: class Chunk f@0: { f@0: f@0: public: f@0: f@0: const static float kWidth; f@0: const static float kHalfWidth; f@0: f@0: Chunk( size_t index ); f@0: f@0: void inline setTop(float t) { mAudioTop = t; mAnimate = 0.0f; mResetting = false; /* startes the animation to crate a chunk */ } f@0: void inline setBottom(float b) { mAudioBottom = b; mAnimate = 0.0f; mResetting = false; } f@0: float inline getTop() const { return mAudioTop; } f@0: float inline getBottom() const { return mAudioBottom; } f@0: f@0: void reset(){ f@0: mResetting = true; f@0: } f@0: f@0: void update( const DrawInfo& di ); f@0: f@0: void draw( const DrawInfo& di, ci::gl::BatchRef &batch ); f@0: f@0: void drawBar( const DrawInfo& di, ci::gl::BatchRef &batch ); f@0: f@0: void setAsSelectionStart(bool start){ f@0: isSelectionStart = start; f@0: } f@0: f@0: void setAsSelectionEnd(bool end){ f@0: isSelectionEnd = end; f@0: } f@0: f@0: private: f@0: f@0: float mAudioTop; f@0: float mAudioBottom; f@0: f@0: float mX; f@0: f@0: float mAnimate = 1.0; f@0: int mIndex; f@0: f@0: bool isSelectionStart = false; f@0: bool isSelectionEnd = false; f@0: f@0: bool mResetting = false; f@0: f@0: };