# Punch in/out

**URL:** <https://forum.juce.com/t/punch-in-out/47718>\
**Category:** Tracktion Engine\
**Created:** [September 8, 2021, 12:09pm UTC](https://forum.juce.com/t/punch-in-out/47718 "2021-09-08T12:09:57Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![splintersilk](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/splintersilk/32/14724_2.png) [@splintersilk](https://forum.juce.com/u/splintersilk)\
**Post date:** [September 9, 2021, 2:38am UTC](https://forum.juce.com/t/punch-in-out/47718/3 "2021-09-09T02:38:35Z")

</div>

@erikronstrom Similar, I was trying to get on the fly PunchInOut recording working. I did bump into something that might be what you want, though.

**My Punch In/Out Problem: - Continuous playback with on demand start/stop recording**  
Using the supplied Recording Demo I found that if it’s already playing, hitting record would trigger the creation of hundreds of tiny (784bytes) wav files whilst grinding everything to a halt.

**What I tried:**  
_1. Rapidly stop playback and start recording_

```cpp
edit.getTransport().stop (false, false); //Sneakily stopping before recording.
edit.getTransport().record (false); //Starts playback and recording again.

```

This kind of works, but clearly isn’t right and also results in a tiny blip in audio playback.

_2. Playing, then hitting record with PunchInOut_  
I also experimented with setting edit.recordingPunchInOut.setValue(true, nullptr), where I set the in and out points slightly later than the start time. By pressing play, then record, it would play fine until it got to the record in-point, then it would all grind to a halt again. So clearly thats not the answer for me either.

_3. Moving punchInOut during record._  
Finally I tried replacing Play with Record+PunchInOut and EditTimeRange(1000.f,1001.f). Then whilst it was playing having a test button suddenly move the EditTimeRange to 2.f and 4.f. I was hoping TE would notice this change and start recording in the newly moved range - kind of like a fake punchInOut recording. That didn’t happen so sadly this idea didn’t work at all.

I don’t know what else to try. I’m pretty sure I must be missing something obvious but I can’t see what.

@erikronstrom I might be misunderstanding but it seems like what you need is:

```cpp
edit.recordingPunchInOut.setValue(true, nullptr);
edit.getTransport().setLoopRange(te::EditTimeRange(double start, double end))
edit.getTransport().record (false);

```

Note the lack of play command. It will still play though, and when it gets to the in point it should start recording.

Cheers,

Jeff

---

_[View the full topic](https://forum.juce.com/t/punch-in-out/47718)._
