mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Added AudioPlayHead::CurrentPositionInfo::timeInSamples member.
This commit is contained in:
parent
ffbf1cd5c4
commit
33dbaa2d30
5 changed files with 16 additions and 8 deletions
|
|
@ -468,6 +468,7 @@ public:
|
|||
{
|
||||
info.timeSigNumerator = 0;
|
||||
info.timeSigDenominator = 0;
|
||||
info.timeInSamples = 0;
|
||||
info.timeInSeconds = 0;
|
||||
info.editOriginTime = 0;
|
||||
info.ppqPositionOfLastBarStart = 0;
|
||||
|
|
@ -520,6 +521,7 @@ public:
|
|||
&outCycleEndBeat) == noErr)
|
||||
{
|
||||
info.isPlaying = playing;
|
||||
info.timeInSamples = (int64) outCurrentSampleInTimeLine;
|
||||
info.timeInSeconds = outCurrentSampleInTimeLine / GetSampleRate();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -518,8 +518,7 @@ protected:
|
|||
juceFilter->setPlayConfigDetails (fNumInputs, fNumOutputs,
|
||||
sampleRate, mRTGlobals->mHWBufferSizeInSamples);
|
||||
|
||||
juceFilter->prepareToPlay (sampleRate,
|
||||
mRTGlobals->mHWBufferSizeInSamples);
|
||||
juceFilter->prepareToPlay (sampleRate, mRTGlobals->mHWBufferSizeInSamples);
|
||||
|
||||
prepared = true;
|
||||
}
|
||||
|
|
@ -702,7 +701,7 @@ protected:
|
|||
Cmn_Int64 ticks = 0;
|
||||
Cmn_Bool isPlaying = false;
|
||||
|
||||
if (midiTransport != 0)
|
||||
if (midiTransport != nullptr)
|
||||
{
|
||||
midiTransport->GetCurrentTempo (&bpm);
|
||||
midiTransport->IsTransportPlaying (&isPlaying);
|
||||
|
|
@ -717,6 +716,14 @@ protected:
|
|||
midiTransport->GetCurrentTDMSampleLocation (&sampleLocation);
|
||||
|
||||
midiTransport->GetCustomTickPosition (&ticks, sampleLocation);
|
||||
|
||||
info.timeInSamples = (int64) sampleLocation;
|
||||
info.timeInSeconds = sampleLocation / sampleRate;
|
||||
}
|
||||
else
|
||||
{
|
||||
info.timeInSamples = 0;
|
||||
info.timeInSeconds = 0;
|
||||
}
|
||||
|
||||
info.bpm = bpm;
|
||||
|
|
@ -730,10 +737,6 @@ protected:
|
|||
info.ppqLoopStart = 0;
|
||||
info.ppqLoopEnd = 0;
|
||||
|
||||
// xxx incorrect if there are tempo changes, but there's no
|
||||
// other way of getting this info..
|
||||
info.timeInSeconds = ticks * (60.0 / 960000.0) / bpm;
|
||||
|
||||
double framesPerSec = 24.0;
|
||||
|
||||
switch (fTimeCodeInfo.mFrameRate)
|
||||
|
|
|
|||
|
|
@ -682,6 +682,7 @@ public:
|
|||
info.timeSigDenominator = 4;
|
||||
}
|
||||
|
||||
info.timeInSamples = (int64) ti->samplePos;
|
||||
info.timeInSeconds = ti->samplePos / ti->sampleRate;
|
||||
info.ppqPosition = (ti->flags & kVstPpqPosValid) != 0 ? ti->ppqPos : 0.0;
|
||||
info.ppqPositionOfLastBarStart = (ti->flags & kVstBarsValid) != 0 ? ti->barStartPos : 0.0;
|
||||
|
|
|
|||
|
|
@ -72,6 +72,8 @@ public:
|
|||
/** Time signature denominator, e.g. the 4 of a 3/4 time sig */
|
||||
int timeSigDenominator;
|
||||
|
||||
/** The current play position, in samples from the start of the edit. */
|
||||
int64 timeInSamples;
|
||||
/** The current play position, in seconds from the start of the edit. */
|
||||
double timeInSeconds;
|
||||
|
||||
|
|
|
|||
|
|
@ -291,7 +291,7 @@ void AudioProcessorListener::audioProcessorParameterChangeGestureEnd (AudioProce
|
|||
//==============================================================================
|
||||
bool AudioPlayHead::CurrentPositionInfo::operator== (const CurrentPositionInfo& other) const noexcept
|
||||
{
|
||||
return timeInSeconds == other.timeInSeconds
|
||||
return timeInSamples == other.timeInSamples
|
||||
&& ppqPosition == other.ppqPosition
|
||||
&& editOriginTime == other.editOriginTime
|
||||
&& ppqPositionOfLastBarStart == other.ppqPositionOfLastBarStart
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue