From bcd03d923e43cbee11446a2484298a3a79dc5bb7 Mon Sep 17 00:00:00 2001 From: xenakios Date: Tue, 19 Dec 2017 23:00:42 +0200 Subject: [PATCH] Some initial work on using AudioPlayHead --- Source/PluginEditor.cpp | 3 +++ Source/PluginProcessor.cpp | 5 +++++ Source/PluginProcessor.h | 2 +- paulstretchplugin.jucer | 2 +- 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Source/PluginEditor.cpp b/Source/PluginEditor.cpp index 1c972eb..076f159 100644 --- a/Source/PluginEditor.cpp +++ b/Source/PluginEditor.cpp @@ -136,6 +136,9 @@ void PaulstretchpluginAudioProcessorEditor::timerCallback(int id) infotext += " " + String(processor.m_abnormal_output_samples) + " invalid sample values"; if (processor.isNonRealtime()) infotext += " (offline rendering)"; + if (processor.m_playposinfo.isPlaying) + infotext += " "+String(processor.m_playposinfo.timeInSeconds,1); + m_info_label.setText(infotext, dontSendNotification); } if (id == 2) diff --git a/Source/PluginProcessor.cpp b/Source/PluginProcessor.cpp index b3f9066..c014fca 100644 --- a/Source/PluginProcessor.cpp +++ b/Source/PluginProcessor.cpp @@ -351,6 +351,11 @@ void copyAudioBufferWrappingPosition(const AudioBuffer& src, AudioBuffer< void PaulstretchpluginAudioProcessor::processBlock (AudioSampleBuffer& buffer, MidiBuffer& midiMessages) { ScopedLock locker(m_cs); + AudioPlayHead* phead = getPlayHead(); + if (phead != nullptr) + { + phead->getCurrentPosition(m_playposinfo); + } ScopedNoDenormals noDenormals; double srtemp = getSampleRate(); if (srtemp != m_cur_sr) diff --git a/Source/PluginProcessor.h b/Source/PluginProcessor.h index 74c9a5f..6801ddd 100644 --- a/Source/PluginProcessor.h +++ b/Source/PluginProcessor.h @@ -135,7 +135,7 @@ public: void timerCallback(int id) override; double getSampleRateChecked(); int m_abnormal_output_samples = 0; - + AudioPlayHead::CurrentPositionInfo m_playposinfo; private: diff --git a/paulstretchplugin.jucer b/paulstretchplugin.jucer index 37a2dda..5898e72 100644 --- a/paulstretchplugin.jucer +++ b/paulstretchplugin.jucer @@ -85,7 +85,7 @@ headerPath="Source/PS_Source Source/WDL " vstBinaryLocation="C:\VSTPlugins_64bit"/>