createEditForPreviewingClip- How is it used?

#1

I would like to preview a clip from an edit and it seems like createEditForPreviewingClip is what I need. Can I get some pointers on how it’s used?

Thanks!

0 Likes

#2

Just call that method passing the Clip you would like to preview.
It will return a new Edit object which you can play back which contains only a copy of that clip you passed in.

We use it in Waveform for previewing just a clip on a track which effectively gets rid of any other track contents.

0 Likes

#3

I’m obviously still missing something. I’ve tried the following:

auto ped = ed->createEditForPreviewingClip(*this->clip);
auto ptp = &ped->getTransport();
ptp->play(false);

I’m getting no playback :sob:

0 Likes

#4

At what time is your clip located? You may need to set the transport position to inside the clip boundaries.

And what type of Clip is it? (IIRC this can only be used for audio clips, not MID or Step clips).

0 Likes

#5

It’s at the start of the edit on the first AudioTrack. I’ve tried:

if (auto wc = dynamic_cast<te::WaveAudioClip*> (clip.get()))
{
auto ped = ed->createEditForPreviewingClip(*wc);
auto ptp = &ped->getTransport();
ptp->setCurrentPosition(0.0);
ptp->play(false);
}

0 Likes

#6

If you change that to:

if (auto wc = dynamic_cast<te::WaveAudioClip*> (clip.get()))
{
    auto ped = ed->createEditForPreviewingClip (*wc);
    auto& ptp = ped->getTransport();
    ptp.ensureContextAllocated();
    ptp.setCurrentPosition (0.0);
    ptp.play (false);
}

Does that work?
(I don’t think Edits get automatically attached to the DeviceManager).

0 Likes

#7

Still nothing unfortunately.

0 Likes

#8

Have you got an example that I could replicate the problem with?
Maybe as a PIP?

0 Likes

#9

I’ll have to make one…

0 Likes