| 1047 | } |
| 1048 | |
| 1049 | void Looper::ButtonClicked(ClickButton* button, double time) |
| 1050 | { |
| 1051 | if (button == mClearButton) |
| 1052 | { |
| 1053 | mUndoBuffer->CopyFrom(mBuffer, mLoopLength); |
| 1054 | Clear(); |
| 1055 | } |
| 1056 | if (button == mMergeButton && mRecorder) |
| 1057 | mRecorder->RequestMerge(this); |
| 1058 | if (button == mSwapButton && mRecorder) |
| 1059 | mRecorder->RequestSwap(this); |
| 1060 | if (button == mCopyButton && mRecorder) |
| 1061 | mRecorder->RequestCopy(this); |
| 1062 | if (button == mVolumeBakeButton) |
| 1063 | mWantBakeVolume = true; |
| 1064 | if (button == mSaveButton) |
| 1065 | { |
| 1066 | Sample::WriteDataToFile(ofGetTimestampString("loops/loop_%Y-%m-%d_%H-%M-%S.wav").c_str(), mBuffer, mLoopLength); |
| 1067 | } |
| 1068 | if (button == mCommitButton && mRecorder) |
| 1069 | mRecorder->Commit(this); |
| 1070 | if (button == mDoubleSpeedButton) |
| 1071 | { |
| 1072 | if (mSpeed == 1) |
| 1073 | { |
| 1074 | HalveNumBars(); |
| 1075 | mSpeed = 2; |
| 1076 | ResampleForSpeed(GetPlaybackSpeed()); |
| 1077 | } |
| 1078 | } |
| 1079 | if (button == mHalveSpeedButton) |
| 1080 | { |
| 1081 | if (mSpeed == 1 && mLoopLength < MAX_BUFFER_SIZE / 2) |
| 1082 | { |
| 1083 | DoubleNumBars(); |
| 1084 | mSpeed = .5f; |
| 1085 | ResampleForSpeed(GetPlaybackSpeed()); |
| 1086 | } |
| 1087 | } |
| 1088 | if (button == mExtendButton) |
| 1089 | { |
| 1090 | int newLength = mNumBars * 2; |
| 1091 | if (newLength <= 16) |
| 1092 | SetNumBars(newLength); |
| 1093 | } |
| 1094 | if (button == mUndoButton) |
| 1095 | mWantUndo = true; |
| 1096 | if (button == mWriteOffsetButton) |
| 1097 | mWantShiftOffset = true; |
| 1098 | if (button == mQueueCaptureButton) |
| 1099 | { |
| 1100 | mCaptureQueued = true; |
| 1101 | mLastCommitTime = time; |
| 1102 | } |
| 1103 | if (button == mResampleButton) |
| 1104 | ResampleForSpeed(GetPlaybackSpeed()); |
| 1105 | } |
| 1106 |
nothing calls this directly
no test coverage detected