Skip to content

Commit

Permalink
Update SeqTrackContentViewer
Browse files Browse the repository at this point in the history
  • Loading branch information
FangCunWuChang committed May 19, 2024
1 parent 92efb27 commit da61a0a
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/ui/component/sequencer/SeqTrackContentViewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ void SeqTrackContentViewer::updateBlock(int blockIndex) {

void SeqTrackContentViewer::updateHPos(double pos, double itemSize) {
bool shouldRepaintDataImage = !juce::approximatelyEqual(this->itemSize, itemSize);
bool shouldRepaintAudioImageTemp = !juce::approximatelyEqual(this->pos, pos);

this->pos = pos;
this->itemSize = itemSize;
Expand All @@ -119,6 +120,9 @@ void SeqTrackContentViewer::updateHPos(double pos, double itemSize) {
if (shouldRepaintDataImage) {
this->updateDataImage();
}
else if (shouldRepaintAudioImageTemp) {
this->updateAudioImage();
}

this->repaint();
}
Expand Down Expand Up @@ -203,6 +207,26 @@ void SeqTrackContentViewer::updateAudioImage() {
return;
}

/** Get Clips */
double hotSecStart = this->secStart - (this->secEnd - this->secStart);
double hotSecEnd = this->secEnd + (this->secEnd - this->secStart);
juce::Array<std::pair<int, int>> clips;
for (auto block : this->blockTemp) {
if ((block->startTime <= hotSecEnd)
&& (block->endTime >= hotSecStart)) {
double hotBlockSecStart = block->startTime - (block->endTime - block->startTime);
double hotBlockSecEnd = block->endTime + (block->endTime - block->startTime);

double hotClipSecStart = std::max(hotSecStart, hotBlockSecStart);
double hotClipSecEnd = std::min(hotSecEnd, hotBlockSecEnd);

clips.add({ (int)std::floor(hotClipSecStart * this->itemSize),
(int)std::floor(hotClipSecEnd * this->itemSize) });
}
}

/** TODO Join Into Union */

/** Get Size */
auto screenSize = utils::getScreenSize(this);
float blockPaddingHeight = screenSize.getHeight() * 0.01;
Expand Down

0 comments on commit da61a0a

Please sign in to comment.