| 663 | } |
| 664 | |
| 665 | void LooperRecorder::ButtonClicked(ClickButton* button, double time) |
| 666 | { |
| 667 | if (button == mResampleButton) |
| 668 | SyncLoopLengths(); |
| 669 | |
| 670 | if (button == mResampAndSetButton) |
| 671 | { |
| 672 | SnapToClosestPitch(); |
| 673 | TheScale->SetRoot(int(AdjustedRootForSpeed() + .5f)); |
| 674 | SyncLoopLengths(); |
| 675 | } |
| 676 | |
| 677 | if (button == mDoubleTempoButton) |
| 678 | { |
| 679 | for (int i = 0; i < mLoopers.size(); ++i) |
| 680 | { |
| 681 | if (mLoopers[i]) |
| 682 | mLoopers[i]->DoubleNumBars(); |
| 683 | } |
| 684 | TheTransport->SetTempo(TheTransport->GetTempo() * 2); |
| 685 | mBaseTempo = TheTransport->GetTempo(); |
| 686 | float pos = TheTransport->GetMeasurePos(time) + (TheTransport->GetMeasure(time) % 8); |
| 687 | int count = TheTransport->GetMeasure(time) - int(pos); |
| 688 | pos *= 2; |
| 689 | count += int(pos); |
| 690 | pos -= int(pos); |
| 691 | TheTransport->SetMeasureTime(count + pos); |
| 692 | for (int i = 0; i < mLoopers.size(); ++i) |
| 693 | { |
| 694 | if (mLoopers[i]) |
| 695 | mLoopers[i]->ResampleForSpeed(1); |
| 696 | } |
| 697 | } |
| 698 | |
| 699 | if (button == mHalfTempoButton) |
| 700 | { |
| 701 | for (int i = 0; i < mLoopers.size(); ++i) |
| 702 | { |
| 703 | if (mLoopers[i]) |
| 704 | mLoopers[i]->HalveNumBars(); |
| 705 | } |
| 706 | TheTransport->SetTempo(TheTransport->GetTempo() / 2); |
| 707 | mBaseTempo = TheTransport->GetTempo(); |
| 708 | float pos = TheTransport->GetMeasurePos(time) + (TheTransport->GetMeasure(time) % 8); |
| 709 | int count = TheTransport->GetMeasure(time) - int(pos); |
| 710 | pos /= 2; |
| 711 | count += int(pos); |
| 712 | pos -= int(pos); |
| 713 | TheTransport->SetMeasureTime(count + pos); |
| 714 | for (int i = 0; i < mLoopers.size(); ++i) |
| 715 | { |
| 716 | if (mLoopers[i]) |
| 717 | mLoopers[i]->ResampleForSpeed(1); |
| 718 | } |
| 719 | } |
| 720 | |
| 721 | if (button == mShiftMeasureButton) |
| 722 | { |
nothing calls this directly
no test coverage detected