VSTPluginInstance - Moar Rates


#1

Hey Jules,

I’ve decided to extend the frame-rate functionality a little bit:

This method is for the sake of DRYing:

void configureHostTimePerFrameRate (int frameRateIndex, double frameRateTime, double currentTime)
{
    vstHostTime.smpteFrameRate  = frameRateIndex;
    vstHostTime.smpteOffset     = (long) (currentTime * 80.0 * frameRateTime + 0.5);
    vstHostTime.flags           |= kVstSmpteValid;
}

Somewhere in processBlock…

switch (position.frameRate)
{
    case AudioPlayHead::fps24:
        configureHostTimePerFrameRate (0, 24.0, position.timeInSeconds);
    break;

    case AudioPlayHead::fps25:
        configureHostTimePerFrameRate (1, 25.0, position.timeInSeconds);
    break;

    case AudioPlayHead::fps2997:
        configureHostTimePerFrameRate (2, 29.97, position.timeInSeconds);
    break;

    case AudioPlayHead::fps30:
        configureHostTimePerFrameRate (3, 30.0, position.timeInSeconds);
    break;

    default: break;
}

I’m not sure if the following is correct (never dealt with 29.97 drop… doesn’t make sense to me. I thought 29.97 = 30 dropped frame?) - so here it is, but separated:

    case AudioPlayHead::fps2997drop:
        configureHostTimePerFrameRate (4, 29.97, position.timeInSeconds);
    break;

    case AudioPlayHead::fps30drop:
        configureHostTimePerFrameRate (5, 29.97, position.timeInSeconds);
    break;

#2

Thanks, I’ll tidy that up. TBH I don’t know about 29.97 drop-frame either, but that seems like a reasonable way to handle it.


#3

Hey Jules,

Noticed that you put 30 fps for 30 Dropped Frame; that would be incorrect. It’s supposed to be 29.97 fps (non-dropped fps ÷ 1.001 = dropped fps).

I’m still sketch on the correct fps for 29.97 Dropped though: there’s literally no information on it, and wouldn’t know if it follows the same formula. I swear it was suddenly made-up out of confusion… Maybe some more experienced studio guys are around that can clarify that one.


#4

[quote=“jrlanglois”]Hey Jules,

Noticed that you put 30 fps for 30 Dropped Frame; that would be incorrect. It’s supposed to be 29.97 fps (non-dropped fps ÷ 1.001 = dropped fps).

I’m still sketch on the correct fps for 29.97 Dropped though: there’s literally no information on it, and wouldn’t know if it follows the same formula. I swear it was suddenly made-up out of confusion… Maybe some more experienced studio guys are around that can clarify that one.[/quote]

Rail


#5

Oh sweet - thanks for the link!

In short, if I understood correctly; “29.97 DF” is still 29.97 fps… so the code in my first post contains the right fps params.


#6

Ok, gotcha. Will update that.