Skip to content
Snippets Groups Projects
Commit 1843dfc8 authored by Josh Siegle's avatar Josh Siegle
Browse files

Have the AudioEditor display the buffer size in samples

parent 46511f33
Branches
Tags
No related merge requests found
......@@ -55,6 +55,8 @@ AudioProcessorEditor* AudioNode::createEditor()
{
audioEditor = new AudioEditor(this);
//audioEditor->setUIComponent(getUIComponent());
//audioEditor->updateBufferSizeText();
//setEditor(editor);
......@@ -72,6 +74,13 @@ void AudioNode::resetConnections()
}
void AudioNode::updateBufferSize()
{
AudioEditor* editor = (AudioEditor*) getEditor();
editor->updateBufferSizeText();
}
void AudioNode::setChannel(Channel* ch)
{
......
......@@ -93,6 +93,8 @@ public:
/** A pointer to the AudioNode's editor. */
ScopedPointer<AudioEditor> audioEditor;
void updateBufferSize();
private:
......
......@@ -50,10 +50,12 @@ AudioWindowButton::AudioWindowButton()
{
setClickingTogglesState(true);
MemoryInputStream mis(BinaryData::silkscreenserialized, BinaryData::silkscreenserializedSize, false);
Typeface::Ptr typeface = new CustomTypeface(mis);
font = Font(typeface);
font.setHeight(12);
//MemoryInputStream mis(BinaryData::silkscreenserialized, BinaryData::silkscreenserializedSize, false);
//Typeface::Ptr typeface = new CustomTypeface(mis);
font = Font("Small Text", 12, Font::plain); //Font(typeface);
//font.setHeight(12);
textString = "AUDIO";
setTooltip("Change the buffer size");
}
AudioWindowButton::~AudioWindowButton()
......@@ -69,7 +71,12 @@ void AudioWindowButton::paintButton(Graphics& g, bool isMouseOver, bool isButton
g.setFont(font);
//g.drawSingleLineText(" AUDIO",0,0);
g.drawSingleLineText("AUDIO",0,15);
g.drawSingleLineText(textString,0,15);
}
void AudioWindowButton::setText(String text)
{
textString = text;
}
AudioEditor::AudioEditor(AudioNode* owner)
......@@ -85,6 +92,9 @@ AudioEditor::AudioEditor(AudioNode* owner)
audioWindowButton = new AudioWindowButton();
audioWindowButton->addListener(this);
audioWindowButton->setToggleState(false,false);
//AccessClass* audioNode = (AccessClass*) getAudioProcessor();
//
addAndMakeVisible(audioWindowButton);
volumeSlider = new Slider("High-Cut Slider");
......@@ -107,8 +117,8 @@ AudioEditor::~AudioEditor()
void AudioEditor::resized()
{
muteButton->setBounds(0,0,30,25);
volumeSlider->setBounds(35,0,100,getHeight());
audioWindowButton->setBounds(140,0,200,getHeight());
volumeSlider->setBounds(35,0,50,getHeight());
audioWindowButton->setBounds(90,0,200,getHeight());
}
bool AudioEditor::keyPressed(const KeyPress& key)
......@@ -118,6 +128,12 @@ bool AudioEditor::keyPressed(const KeyPress& key)
}
void AudioEditor::updateBufferSizeText()
{
// currently crashing
// audioWindowButton->setText(String(getAudioComponent()->getBufferSize()));
}
void AudioEditor::buttonClicked(Button* button)
{
if (button == muteButton)
......@@ -146,7 +162,7 @@ void AudioEditor::buttonClicked(Button* button)
// audioComponent->restartDevice();
// if (audioComponent != 0) {
acw = new AudioConfigurationWindow(getAudioComponent()->deviceManager, (Button*) audioWindowButton);
acw = new AudioConfigurationWindow(getAudioComponent()->deviceManager, audioWindowButton);
acw->setUIComponent(getUIComponent());
//}
}
......@@ -157,7 +173,7 @@ void AudioEditor::buttonClicked(Button* button)
}
else
{
audioWindowButton->setText(String(getAudioComponent()->getBufferSize()));
acw->setVisible(false);
//deleteAndZero(acw);
getAudioComponent()->stopDevice();
......@@ -179,7 +195,7 @@ void AudioEditor::paint(Graphics& g)
AudioConfigurationWindow::AudioConfigurationWindow(AudioDeviceManager& adm, Button* cButton)
AudioConfigurationWindow::AudioConfigurationWindow(AudioDeviceManager& adm, AudioWindowButton* cButton)
: DocumentWindow("Audio Settings",
Colours::red,
DocumentWindow::closeButton),
......@@ -220,6 +236,7 @@ AudioConfigurationWindow::~AudioConfigurationWindow()
void AudioConfigurationWindow::closeButtonPressed()
{
controlButton->setToggleState(false,false);
controlButton->setText(String(getAudioComponent()->getBufferSize()));
getAudioComponent()->stopDevice();
setVisible(false);
}
......
......@@ -58,8 +58,10 @@ public:
AudioWindowButton();
~AudioWindowButton();
void paintButton(Graphics& g, bool isMouseOver, bool isButtonDown);
void setText(String);
private:
Font font;
String textString;
};
/**
......@@ -73,7 +75,7 @@ class AudioConfigurationWindow : public DocumentWindow,
public AccessClass
{
public:
AudioConfigurationWindow(AudioDeviceManager& adm, Button* b);
AudioConfigurationWindow(AudioDeviceManager& adm, AudioWindowButton* b);
~AudioConfigurationWindow();
void paint(Graphics& g);
......@@ -83,7 +85,7 @@ private:
void closeButtonPressed();
Button* controlButton;
AudioWindowButton* controlButton;
};
......@@ -109,6 +111,8 @@ public:
bool keyPressed(const KeyPress& key);
void resized();
void updateBufferSizeText();
private:
......
......@@ -118,6 +118,7 @@ void ProcessorGraph::createDefaultNodes()
void ProcessorGraph::updatePointers()
{
getAudioNode()->setUIComponent(getUIComponent());
getAudioNode()->updateBufferSize();
getRecordNode()->setUIComponent(getUIComponent());
}
......
......@@ -74,12 +74,14 @@ UIComponent::UIComponent(MainWindow* mainWindow_, ProcessorGraph* pgraph, AudioC
std::cout << "Finished UI stuff." << std::endl << std::endl << std::endl;
processorGraph->setUIComponent(this);
processorGraph->updatePointers(); // needs to happen after processorGraph gets the right pointers
processorList->setUIComponent(this);
editorViewport->setUIComponent(this);
dataViewport->setUIComponent(this);
controlPanel->getAudioEditor()->setUIComponent(this);
controlPanel->setUIComponent(this);
processorGraph->updatePointers(); // needs to happen after processorGraph gets the right pointers
//processorGraph->sendActionMessage("Test.");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment