| 22 | } |
| 23 | |
| 24 | void TimeQuantizeOptions::processBlock(int inNumSamples) |
| 25 | { |
| 26 | if (mProcessor->getState() == Recording) { |
| 27 | if (!mWasRecording) { |
| 28 | jassert(mNumRecordedSamples == 0); |
| 29 | mWasRecording = true; |
| 30 | |
| 31 | auto playhead_info = mProcessor->getPlayHead()->getPosition(); |
| 32 | _setInfo(playhead_info); |
| 33 | mWasPlaying = isPlayheadPlaying(playhead_info); |
| 34 | mNumPlayingProcessBlock = 0; |
| 35 | |
| 36 | } else if (!mWasPlaying) { |
| 37 | auto playhead_info = mProcessor->getPlayHead()->getPosition(); |
| 38 | |
| 39 | if (isPlayheadPlaying(playhead_info)) { |
| 40 | // Don't use first processBlock after playing to set info. |
| 41 | // Bug in Logic Pro, playhead position incorrect. |
| 42 | if (mNumPlayingProcessBlock < mNumPlayingProcessBlockBeforeSetInfo) { |
| 43 | mNumPlayingProcessBlock += 1; |
| 44 | } else { |
| 45 | _setInfo(playhead_info); |
| 46 | mWasPlaying = true; |
| 47 | } |
| 48 | } |
| 49 | } |
| 50 | |
| 51 | mNumRecordedSamples += inNumSamples; |
| 52 | } else { |
| 53 | // If we were previously recording but not anymore (user clicked record button to stop it). |
| 54 | if (mWasRecording) { |
| 55 | mWasRecording = false; |
| 56 | } |
| 57 | } |
| 58 | } |
| 59 | |
| 60 | void TimeQuantizeOptions::fileLoaded() |
| 61 | { |