Skip to content
Snippets Groups Projects
Commit 7281f6f9 authored by Per Lindgren's avatar Per Lindgren
Browse files

sample accurate, or not so sample accurate

parent 3a44af73
No related branches found
No related tags found
No related merge requests found
......@@ -18,7 +18,14 @@ Test2AudioProcessorEditor::Test2AudioProcessorEditor(Test2AudioProcessor &p)
addAndMakeVisible(positionLabel);
// add a label that will display the current timecode and status..
addAndMakeVisible(timecodeDisplayLabel);
// slider
addAndMakeVisible(posSlider);
posSlider.setRange(50, 5000.0);
posSlider.setValue(500.0);
timecodeDisplayLabel.setFont(juce::Font(juce::Font::getDefaultMonospacedFontName(), 15.0f, juce::Font::plain));
posSlider.addListener(this);
positionLabel.setText("Text input:", juce::dontSendNotification);
positionLabel.setColour(juce::Label::textColourId, juce::Colours::orange);
......@@ -28,8 +35,11 @@ Test2AudioProcessorEditor::Test2AudioProcessorEditor(Test2AudioProcessor &p)
setResizeLimits(400, 300, 1024, 1024);
setSize(400, 300);
if (processor.m_flogger)
{
processor.m_flogger->logMessage("Editor initialized");
}
}
Test2AudioProcessorEditor::~Test2AudioProcessorEditor()
{
......@@ -44,7 +54,7 @@ void Test2AudioProcessorEditor::paint(juce::Graphics &g)
g.setColour(juce::Colours::white);
g.setFont(15.0f);
g.drawFittedText("9) Position : " + std::to_string(processor.position), getLocalBounds(), juce::Justification::centred, 1);
g.drawFittedText("10) Position : " + std::to_string(processor.position), getLocalBounds(), juce::Justification::centred, 1);
// if (processor.m_flogger)
// processor.m_flogger->logMessage("paint called");
}
......@@ -57,6 +67,11 @@ void Test2AudioProcessorEditor::resized()
auto bounds = getLocalBounds();
positionLabel.setBounds(bounds.removeFromBottom(30).withSizeKeepingCentre(50, 24));
timecodeDisplayLabel.setBounds(bounds.removeFromTop(26));
posSlider.setBounds(100, 30, getWidth() - 120, 20);
if (processor.m_flogger)
{
processor.m_flogger->logMessage(bounds.toString());
processor.m_flogger->logMessage(std::to_string(processor.buf_size));
}
}
......@@ -14,7 +14,7 @@
//==============================================================================
/**
*/
class Test2AudioProcessorEditor : public juce::AudioProcessorEditor, private juce::Timer
class Test2AudioProcessorEditor : public juce::AudioProcessorEditor, public juce::Slider::Listener, private juce::Timer
{
public:
Test2AudioProcessorEditor(Test2AudioProcessor &);
......@@ -28,6 +28,17 @@ private:
// This reference is provided as a quick way for your editor to
// access the processor object that created it.
Test2AudioProcessor &processor;
juce::Slider posSlider;
void sliderValueChanged(juce::Slider *slider) override
{
if (slider == &posSlider)
{
if (processor.m_flogger)
processor.m_flogger->logMessage("slider changed");
}
}
// is this the way
juce::Label positionLabel, timecodeDisplayLabel; // = juce::Label("Position", "Position : 0");
// or something like
......
......@@ -129,6 +129,8 @@ void Test2AudioProcessor::processBlock(juce::AudioBuffer<float> &buffer, juce::M
auto totalNumInputChannels = getTotalNumInputChannels();
auto totalNumOutputChannels = getTotalNumOutputChannels();
buf_size = buffer.getNumSamples();
// In case we have more outputs than inputs, this code clears any output
// channels that didn't contain input data, (because these aren't
// guaranteed to be empty - they may contain garbage).
......
......@@ -58,6 +58,7 @@ public:
// this keeps a copy of the last set of time info that was acquired during an audio
// callback - the UI component will read this and display it.
juce::AudioPlayHead::CurrentPositionInfo lastPosInfo;
int buf_size;
private:
//==============================================================================
......@@ -72,8 +73,8 @@ private:
if (ph->getCurrentPosition(newTime))
{
lastPosInfo = newTime; // Successfully got the current time from the host..
if (m_flogger)
m_flogger->logMessage("Got Pos from host");
//if (m_flogger)
// m_flogger->logMessage("Got Pos from host");
return;
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment