Example #1
0
ControlPanel::ControlPanel(ProcessorGraph* graph_, AudioComponent* audio_)
    : graph(graph_), audio(audio_), initialize(true), open(false)
{

    if (1)
    {

        font = Font("Paragraph", 13, Font::plain);

        // MemoryInputStream mis(BinaryData::misoserialized, BinaryData::misoserializedSize, false);
        // Typeface::Ptr typeface = new CustomTypeface(mis);
        // font = Font(typeface);
        // font.setHeight(15);
    }

    audioEditor = (AudioEditor*) graph->getAudioNode()->createEditor();
    addAndMakeVisible(audioEditor);

    playButton = new PlayButton();
    playButton->addListener(this);
    addAndMakeVisible(playButton);

    recordButton = new RecordButton();
    recordButton->addListener(this);
    addAndMakeVisible(recordButton);

    masterClock = new Clock();
    addAndMakeVisible(masterClock);

    cpuMeter = new CPUMeter();
    addAndMakeVisible(cpuMeter);

    diskMeter = new DiskSpaceMeter();
    addAndMakeVisible(diskMeter);

    cpb = new ControlPanelButton(this);
    addAndMakeVisible(cpb);

    newDirectoryButton = new UtilityButton("+", Font("Small Text", 15, Font::plain));
    newDirectoryButton->setEnabledState(false);
    newDirectoryButton->addListener(this);
    newDirectoryButton->setTooltip("Start a new data directory");
    addChildComponent(newDirectoryButton);


    File executable = File::getSpecialLocation(File::currentExecutableFile);

#if defined(__APPLE__)
    const String executableDirectory =
        executable.getParentDirectory().getParentDirectory().getParentDirectory().getParentDirectory().getFullPathName();
#else
    const String executableDirectory = executable.getParentDirectory().getFullPathName();
#endif

    filenameComponent = new FilenameComponent("folder selector",
                                              executableDirectory,
                                              true,
                                              true,
                                              true,
                                              "*",
                                              "",
                                              "");
    addChildComponent(filenameComponent);

    prependText = new Label("Prepend","");
    prependText->setEditable(true);
    prependText->addListener(this);
    prependText->setColour(Label::backgroundColourId, Colours::lightgrey);
    prependText->setTooltip("Prepend to name of data directory");

    addChildComponent(prependText);

    dateText = new Label("Date","YYYY-MM-DD_HH-MM-SS");
    dateText->setColour(Label::backgroundColourId, Colours::lightgrey);
    dateText->setColour(Label::textColourId, Colours::grey);
    addChildComponent(dateText);

    appendText = new Label("Append","");
    appendText->setEditable(true);
    appendText->addListener(this);
    appendText->setColour(Label::backgroundColourId, Colours::lightgrey);
    addChildComponent(appendText);
    appendText->setTooltip("Append to name of data directory");

    //diskMeter->updateDiskSpace(graph->getRecordNode()->getFreeSpace());
    //diskMeter->repaint();
    //refreshMeters();
    startTimer(10);

    setWantsKeyboardFocus(true);

    backgroundColour = Colour(58,58,58);

}
Example #2
0
 UpdateListComponent()
 {
     addChildComponent (&toggle);
     toggle.setWantsKeyboardFocus (false);
     setInterceptsMouseClicks (false, true);
 }
//==============================================================================
PanelEngine::PanelEngine ()
{
    addAndMakeVisible (operatorGroup = new GroupComponent ("operator group",
                                                           TRANS("Operators")));
    operatorGroup->setTextLabelPosition (Justification::centredLeft);
    operatorGroup->setColour (GroupComponent::outlineColourId, Colour (0x60808080));
    operatorGroup->setColour (GroupComponent::textColourId, Colour (0xff4f4f4f));

    addAndMakeVisible (mixerGroup = new GroupComponent ("mixer group",
                                                        TRANS("Mixer")));
    mixerGroup->setTextLabelPosition (Justification::centredLeft);
    mixerGroup->setColour (GroupComponent::outlineColourId, Colour (0x60808080));
    mixerGroup->setColour (GroupComponent::textColourId, Colour (0xff4f4f4f));

    addAndMakeVisible (imGroup = new GroupComponent ("IM group",
                                                     TRANS("Modulation indexes")));
    imGroup->setTextLabelPosition (Justification::centredLeft);
    imGroup->setColour (GroupComponent::outlineColourId, Colour (0x60808080));
    imGroup->setColour (GroupComponent::textColourId, Colour (0xff4f4f4f));


    //[UserPreSize]
    for (int k=0; k<NUMBER_OF_MIX; k++) {
        addAndMakeVisible(volumeKnob[k] = new SliderPfm2("Volume " + String(k+1)));
        volumeKnob[k]->setRange (0, 1, .01f);
        volumeKnob[k]->setSliderStyle (Slider::RotaryVerticalDrag);
        volumeKnob[k]->setTextBoxStyle (Slider::NoTextBox, false, 20, 20);
        volumeKnob[k]->setDoubleClickReturnValue(true, 1.0f);
        volumeKnob[k]->setValue(1.0f, dontSendNotification);
        volumeKnob[k]->addListener (this);

        addAndMakeVisible(panKnob[k] = new SliderPfm2("Pan " + String(k+1)));
        panKnob[k]->setRange (-1, 1, .01f);
        panKnob[k]->setSliderStyle (Slider::LinearHorizontal);
        panKnob[k]->setTextBoxStyle (Slider::NoTextBox, false, 40, 20);
        panKnob[k]->setColour(Slider::thumbColourId, Colours::blue);
        panKnob[k]->setDoubleClickReturnValue(true, 0.0f);
        panKnob[k]->addListener (this);

        addAndMakeVisible(mixLabel[k] = new Label(String("mix label ")+ String(k+1), String("Mix ")+ String(k+1)));
    }

    for (int k=0; k<NUMBER_OF_IM; k++) {
    	addAndMakeVisible(IMNumber[k] = new Label("IM Label" + String(k+1), String("IM") + String(k+1)));


        addAndMakeVisible(IMKnob[k] = new SliderPfm2("IM " + String(k+1)));
        IMKnob[k]->setRange (0, 16, .01f);
        IMKnob[k]->setSliderStyle (Slider::RotaryVerticalDrag);
        IMKnob[k]->setTextBoxStyle (Slider::TextBoxLeft, false, 30, 16);
        IMKnob[k]->setDoubleClickReturnValue(true, 1.0f);
        IMKnob[k]->setValue(1.0f, dontSendNotification);
        IMKnob[k]->addListener (this);

        addAndMakeVisible(IMVelocityKnob[k] = new SliderPfm2("IM Velocity " + String(k+1)));
        IMVelocityKnob[k]->setRange (0, 16, .01f);
        IMVelocityKnob[k]->setSliderStyle (Slider::RotaryVerticalDrag);
        IMVelocityKnob[k]->setTextBoxStyle (Slider::TextBoxLeft, false, 30, 16);
        IMVelocityKnob[k]->setDoubleClickReturnValue(true, 0.0f);
        IMVelocityKnob[k]->setValue(0.0f, dontSendNotification);
        IMVelocityKnob[k]->addListener (this);
    }
	addAndMakeVisible(IMLabel = new Label("IM Label", "Main"));
	IMLabel->setJustificationType(Justification::centredTop);
	addAndMakeVisible(IMVelocityLabel = new Label("IM Velocity Label", "Velocity"));
	IMVelocityLabel->setJustificationType(Justification::centredTop);

    for (int k=0; k<NUMBER_OF_OPERATORS; k++) {
        enveloppe[k] = new Enveloppe ();
        enveloppe[k]->setName ("Op"+String(k+1)+" Env");

        enveloppeButton[k] = new TextButton ("enveloppe button");
        enveloppeButton[k]->setButtonText ("Op" + String(k+1));

        enveloppeButton[k]->setColour (TextButton::buttonColourId, Colour (0xffa4c9e9));
        enveloppeButton[k]->setColour (TextButton::buttonOnColourId, Colours::aliceblue);

        enveloppeButton[k]->setClickingTogglesState(true);
        enveloppeButton[k]->setRadioGroupId(4242);
        enveloppeButton[k]->setConnectedEdges((k!=0 ? Button::ConnectedOnLeft : 0) | (k!= NUMBER_OF_OPERATORS-1 ? Button::ConnectedOnRight : 0 ));
        enveloppeButton[k]->addListener (this);
        addAndMakeVisible(enveloppeButton[k]);

        opShape[k] = new ComboBox("Op"+String(k+1)+" Shape");
        opShape[k]->setJustificationType (Justification::centred);
        opShape[k]->setColour (ComboBox::buttonColourId, Colours::blue);
        opShape[k]->addItem("Sin", 1);
        opShape[k]->addItem("Saw", 2);
        opShape[k]->addItem("Square", 3);
        opShape[k]->addItem("Sin^2", 4);
        opShape[k]->addItem("SinZero", 5);
        opShape[k]->addItem("SinPos", 6);
        opShape[k]->addItem("Noise", 7);
        opShape[k]->addItem("Off", 8);
        opShape[k]->setSelectedId(1);
        opShape[k]->setEditableText (false);
        opShape[k]->addListener (this);

        opFrequencyType[k] = new ComboBox("Op"+ String(k+1) + " Freq Type");
        opFrequencyType[k]->setEditableText (false);
        opFrequencyType[k]->setJustificationType (Justification::centred);
        opFrequencyType[k]->setColour (ComboBox::buttonColourId, Colours::blue);
        opFrequencyType[k]->addItem("Keyboard", 1);
        opFrequencyType[k]->addItem("Fixed", 2);
        opFrequencyType[k]->setSelectedId(1);
        opFrequencyType[k]->addListener (this);

		opFrequency[k] = new SliderPfm2Always2Decimals("Op" + String(k+1) + " Frequency");
        opFrequency[k]->setRange (0, 16, 1.0f / 12.0f);
        opFrequency[k]->setSliderStyle (Slider::RotaryVerticalDrag);
        opFrequency[k]->setTextBoxStyle (Slider::TextBoxBelow, false, 60, 16);
        opFrequency[k]->setDoubleClickReturnValue(true, 1.0f);
        opFrequency[k]->addListener (this);

        opFrequencyFineTune[k] = new SliderPfm2("Op"+ String(k+1)+ " Fine Tune");
        opFrequencyFineTune[k]->setRange (-1.0f, 1.0f, .01f);
        opFrequencyFineTune[k]->setSliderStyle (Slider::RotaryVerticalDrag);
        opFrequencyFineTune[k]->setTextBoxStyle (Slider::TextBoxBelow, false, 40, 16);
        opFrequencyFineTune[k]->setDoubleClickReturnValue(true, 0.0f);
        opFrequencyFineTune[k]->addListener (this);

        if (k == 0) {
            addAndMakeVisible(enveloppe[k]);
            addAndMakeVisible(opShape[k]);
            addAndMakeVisible(opFrequencyType[k]);
            addAndMakeVisible(opFrequency[k]);
            addAndMakeVisible(opFrequencyFineTune[k]);
        } else {
            addChildComponent(enveloppe[k]);
            addChildComponent(opShape[k]);
            addChildComponent(opFrequencyType[k]);
            addChildComponent(opFrequency[k]);
            addChildComponent(opFrequencyFineTune[k]);
        }
    }
    enveloppeButton[0]->setToggleState(true, sendNotification);

    addAndMakeVisible(opShapeLabel = new Label("op shapelabel", "Shape"));
	opShapeLabel->setJustificationType(Justification::centredTop);

    addAndMakeVisible(opFrequencyTypeLabel = new Label("op frequency type", "Follows"));
    opFrequencyTypeLabel->setJustificationType(Justification::centredTop);

    addAndMakeVisible(opFrequencyLabel = new Label("op frequency label", "Frequency"));
    opFrequencyLabel->setJustificationType(Justification::centredTop);

    addAndMakeVisible(opFrequencyFineTuneLabel = new Label("op frequency FT label", "Fine Tune"));
    opFrequencyFineTuneLabel->setJustificationType(Justification::centredTop);

    addAndMakeVisible(algoChooser = new SliderPfm2("Algo"));
    algoChooser->setRange (1, NUMBER_OF_ALGO, 1);
    algoChooser->setTextBoxIsEditable(true);
    algoChooser->setSliderStyle (Slider::IncDecButtons);
    algoChooser->setTextBoxStyle (Slider::TextBoxAbove, false, 30, 16);
    algoChooser->setDoubleClickReturnValue(true, 1.0f);
    algoChooser->addListener (this);

    for (int a=0; a<NUMBER_OF_ALGO; a++) {
    	algoImages[a] = ImageFileFormat::loadFrom(algo4_pngs[a], algo4_png_sizes[a]);
    }
    addAndMakeVisible(algoDrawableImage = new DrawableImage());
    algoDrawableImage->setImage(algoImages[0]);

	addAndMakeVisible(algoChooserLabel = new Label("algo label", "Algo"));
	algoChooserLabel->setJustificationType(Justification::centredTop);

	addAndMakeVisible(velocityLabel = new Label("velocity label", "Velocity"));
	velocityLabel->setJustificationType(Justification::centredTop);

    addAndMakeVisible(velocity = new SliderPfm2("Velocity"));
    velocity->setRange (0, 16, 1);
    velocity->setSliderStyle (Slider::RotaryVerticalDrag);
    velocity->setTextBoxStyle (Slider::TextBoxAbove, false, 30, 16);
    velocity->setDoubleClickReturnValue(true, 1.0f);
    velocity->addListener (this);

	addAndMakeVisible(velocityLabel = new Label("velocity label", "Velocity"));
	velocityLabel->setJustificationType(Justification::centredTop);

    addAndMakeVisible(velocity = new SliderPfm2("Velocity"));
    velocity->setRange (0, 16, 1);
    velocity->setValue(12, dontSendNotification);
    velocity->setSliderStyle (Slider::RotaryVerticalDrag);
    velocity->setTextBoxStyle (Slider::TextBoxAbove, false, 30, 16);
    velocity->setDoubleClickReturnValue(true, 1.0f);
    velocity->addListener (this);

	addAndMakeVisible(voicesLabel = new Label("voices label", "Voices"));
	voicesLabel->setJustificationType(Justification::centredTop);

    addAndMakeVisible(voices = new SliderPfm2("Voices"));
    voices->setRange (0, 8, 1);
    voices->setSliderStyle (Slider::RotaryVerticalDrag);
    voices->setTextBoxStyle (Slider::TextBoxAbove, false, 30, 16);
    voices->setDoubleClickReturnValue(true, 3.0f);
    voices->addListener (this);

	addAndMakeVisible(glideLabel = new Label("glide label", "Glide"));
	glideLabel->setJustificationType(Justification::centredTop);

    addAndMakeVisible(glide = new SliderPfm2("Glide"));
    glide->setRange (0, 10, 1);
    glide->setSliderStyle (Slider::RotaryVerticalDrag);
    glide->setTextBoxStyle (Slider::TextBoxAbove, false, 30, 16);
    glide->setDoubleClickReturnValue(true, 3.0f);
    glide->addListener (this);


//    addAndMakeVisible (comboBox);
//    comboBox.setBounds (10, 85, 200, 24);
//    comboBox.setEditableText (true);
//    comboBox.setJustificationType (Justification::centred);
//
//    for (int i = 1; i < 100; ++i)
//        comboBox.addItem ("combo box item " + String (i), i);
//	}
//    comboBox.setSelectedId (1);

    //[/UserPreSize]

    setSize (900, 700);


    //[Constructor] You can add your own custom stuff here..
    eventsToAdd = nullptr;
    voices->setValue(4.0f, sendNotification);
	sliderValueChanged(voices);
	sliderValueChanged(algoChooser);
	initialized = false;
    //[/Constructor]
}
VexEditorComponent::VexEditorComponent (VexFilter* const ownerFilter)
    : AudioProcessorEditor(ownerFilter)
{
	//Comboboxes, wave selection
	addAndMakeVisible (comboBox = new ComboBox (String::empty));
    comboBox->setEditableText (false);
    comboBox->setJustificationType (Justification::centredLeft);
    comboBox->setTextWhenNothingSelected (String(T("silent")));
    comboBox->setTextWhenNoChoicesAvailable (String(T("silent")));
    comboBox->addListener (this);
	comboBox->setColour(ComboBox::backgroundColourId, Colours::black);
	comboBox->setColour(ComboBox::textColourId, Colours::lightgrey);
	comboBox->setColour(ComboBox::outlineColourId, Colours::grey);
	comboBox->setColour(ComboBox::buttonColourId, Colours::grey);
	comboBox->setWantsKeyboardFocus(false); 
	comboBox->setLookAndFeel(&mlaf);

    addAndMakeVisible (comboBox2 = new ComboBox (String::empty));
    comboBox2->setEditableText (false);
    comboBox2->setJustificationType (Justification::centredLeft);
    comboBox2->setTextWhenNothingSelected (String(T("silent")));
    comboBox2->setTextWhenNoChoicesAvailable (String(T("silent")));
    comboBox2->addListener (this);
	comboBox2->setColour(ComboBox::backgroundColourId, Colours::black);
	comboBox2->setColour(ComboBox::textColourId, Colours::lightgrey);
	comboBox2->setColour(ComboBox::outlineColourId, Colours::grey);
	comboBox2->setColour(ComboBox::buttonColourId, Colours::grey);
	comboBox2->setWantsKeyboardFocus(false);
	comboBox2->setLookAndFeel(&mlaf);

    addAndMakeVisible (comboBox3 = new ComboBox (String::empty));
    comboBox3->setEditableText (false);
    comboBox3->setJustificationType (Justification::centredLeft);
    comboBox3->setTextWhenNothingSelected (String(T("silent")));
    comboBox3->setTextWhenNoChoicesAvailable (String(T("silent")));
    comboBox3->addListener (this);
	comboBox3->setColour(ComboBox::backgroundColourId, Colours::black);
	comboBox3->setColour(ComboBox::textColourId, Colours::lightgrey);
	comboBox3->setColour(ComboBox::outlineColourId, Colours::grey);
	comboBox3->setColour(ComboBox::buttonColourId, Colours::grey);
	comboBox3->setWantsKeyboardFocus(false);
	comboBox3->setLookAndFeel(&mlaf);
	
#if 0
	File location = (File::getSpecialLocation(File::userHomeDirectory)).getChildFile(".vex");
	if (! location.exists ())
	    location.createDirectory ();

    DBG (location.getFullPathName());

	String filePath = location.getFullPathName();

    DirectoryIterator iter (File(filePath), true, "*.raw");

	int i = 1;
	while (iter.next())
	{
		File theFile(iter.getFile());
		if (theFile.hasFileExtension (T("raw")))
		{
			i++;
			comboBox->addItem (theFile.getFileNameWithoutExtension(), i);
			comboBox2->addItem (theFile.getFileNameWithoutExtension(), i);
			comboBox3->addItem (theFile.getFileNameWithoutExtension(), i);
		}
	}
#endif

    int tableSize = waveRenderer::getWaveTableSize ();
	for (int i = 0; i < tableSize; i++)
	{
	    String tableName (waveRenderer::getWaveTableName (i));

		comboBox->addItem (tableName, i + 1);
		comboBox2->addItem (tableName, i + 1);
		comboBox3->addItem (tableName, i + 1);
	}

	//Make sliders
	for (int i = 0; i < 89; i++)
	{
		addAndMakeVisible (sliders[i] = new SnappingSlider (T("s")));
		sliders[i]->setSliderStyle(Slider::RotaryVerticalDrag);
		sliders[i]->setRange (0, 1, 0);
		sliders[i]->setSnap(0.0f, 0.0f);
		sliders[i]->setLookAndFeel(&mlaf);
		sliders[i]->addListener (this);
	}

	//Adjust the center of some
    sliders[1]->setRange (0, 1, 0.25f);		
	sliders[1]->setSnap(0.5f, 0.05f);
    sliders[2]->setSnap(0.5f, 0.05f);
    sliders[3]->setSnap(0.5f, 0.05f);
    sliders[4]->setSnap(0.5f, 0.05f);
    sliders[8]->setSnap(0.5f, 0.05f);
    sliders[13]->setSnap(0.5f, 0.05f);
    sliders[18]->setSnap(0.5f, 0.05f);

	int tmp = 24;
    sliders[1 + tmp]->setRange (0, 1, 0.25f);
	sliders[1 + tmp]->setSnap(0.5f, 0.05f);
    sliders[2 + tmp]->setSnap(0.5f, 0.05f);
    sliders[3 + tmp]->setSnap(0.5f, 0.05f);
    sliders[4 + tmp]->setSnap(0.5f, 0.05f);
    sliders[8 + tmp]->setSnap(0.5f, 0.05f);
    sliders[13 + tmp]->setSnap(0.5f, 0.05f);
    sliders[18 + tmp]->setSnap(0.5f, 0.05f);

	tmp = 48;
    sliders[1 + tmp]->setRange (0, 1, 0.25f);
	sliders[1 + tmp]->setSnap(0.5f, 0.05f);
    sliders[2 + tmp]->setSnap(0.5f, 0.05f);
    sliders[3 + tmp]->setSnap(0.5f, 0.05f);
    sliders[4 + tmp]->setSnap(0.5f, 0.05f);
    sliders[8 + tmp]->setSnap(0.5f, 0.05f);
    sliders[13 + tmp]->setSnap(0.5f, 0.05f);
    sliders[18 + tmp]->setSnap(0.5f, 0.05f);

    sliders[83]->setSnap(0.5f, 0.05f);
    sliders[84]->setSnap(0.5f, 0.05f);
    sliders[85]->setSnap(0.5f, 0.05f);

	sliders[75]->setSnap(0.0f, 0.05f);
	sliders[78]->setSnap(0.0f, 0.05f);
	sliders[82]->setSnap(0.0f, 0.05f);

	//PART ON/OFF
    addAndMakeVisible (TB = new TextButton (T("new button")));
    TB->setButtonText (String::empty);
    TB->addButtonListener (this);
    TB->setColour (TextButton::buttonColourId, Colours::darkred.withAlpha(0.5f));
	TB->setColour(TextButton::buttonOnColourId, Colours::red);
	TB->setClickingTogglesState(true);
	TB->setToggleState(false,false);

    addAndMakeVisible (TB2 = new TextButton (T("new button")));
    TB2->setButtonText (String::empty);
    TB2->addButtonListener (this);
    TB2->setColour (TextButton::buttonColourId, Colours::darkred.withAlpha(0.5f));
	TB2->setColour(TextButton::buttonOnColourId, Colours::red);
	TB2->setClickingTogglesState(true);
	TB2->setToggleState(false,false);

    addAndMakeVisible (TB3 = new TextButton (T("new button")));
    TB3->setButtonText (String::empty);
    TB3->addButtonListener (this);
    TB3->setColour (TextButton::buttonColourId, Colours::darkred.withAlpha(0.5f));
	TB3->setColour(TextButton::buttonOnColourId, Colours::red);
	TB3->setClickingTogglesState(true);
	TB3->setToggleState(false,false);

	//Peggy ON/OFF
    addAndMakeVisible (TB4 = new TextButton (T("new button")));
    TB4->setButtonText (String::empty);
    TB4->addButtonListener (this);
    TB4->setColour (TextButton::buttonColourId, Colours::darkblue.withAlpha(0.5f));
	TB4->setColour(TextButton::buttonOnColourId, Colours::blue);
	TB4->setClickingTogglesState(true);
	TB4->setToggleState(false,false);

    addAndMakeVisible (TB5 = new TextButton (T("new button")));
    TB5->setButtonText (String::empty);
    TB5->addButtonListener (this);
    TB5->setColour (TextButton::buttonColourId, Colours::darkblue.withAlpha(0.5f));
	TB5->setColour(TextButton::buttonOnColourId, Colours::blue);
	TB5->setClickingTogglesState(true);
	TB5->setToggleState(false,false);

    addAndMakeVisible (TB6 = new TextButton (T("new button")));
    TB6->setButtonText (String::empty);
    TB6->addButtonListener (this);
    TB6->setColour (TextButton::buttonColourId, Colours::darkblue.withAlpha(0.5f));
	TB6->setColour(TextButton::buttonOnColourId, Colours::blue);
	TB6->setClickingTogglesState(true);
	TB6->setToggleState(false,false);

	addChildComponent(p1 = new PeggyViewComponent(ownerFilter, 1));
	p1->setLookAndFeel(&mlaf);
	addChildComponent(p2 = new PeggyViewComponent(ownerFilter, 2));
	p2->setLookAndFeel(&mlaf);
	addChildComponent(p3 = new PeggyViewComponent(ownerFilter, 3));
	p3->setLookAndFeel(&mlaf);

	internalCachedImage1 = ImageCache::getFromMemory (Resources::vex3_png, Resources::vex3_pngSize);

	ownerFilter->addChangeListener (this);
	setSize(800,500);

	updateParametersFromFilter(true);
//==============================================================================
ZenAutoTrimAudioProcessorEditor::ZenAutoTrimAudioProcessorEditor (ZenAutoTrimAudioProcessor& p)
    : AudioProcessorEditor (&p), processor (p), textColour(Colours::lightgrey)
{	
	// #TODO: ADD JUCE DETECT LEAKS TO MY ZEN_UTILS CLASSES

	zenLookAndFeel = new ZenLookAndFeel();
	LookAndFeel::setDefaultLookAndFeel(zenLookAndFeel);
	setSize(222, 250);
		
	backgroundImg = ImageFileFormat::loadFrom(
		BinaryData::backgroundImg_png, (size_t)BinaryData::backgroundImg_pngSize);
	
	addAndMakeVisible(titleBar = new ZenTitleBar("Zen Title Bar", this));
	titleBar->setBounds(0, 0, getWidth(), 30);
	titleBar->addBypassListener(this);

	//https://www.reddit.com/r/cpp_questions/comments/4kisug/lambdastdfunction_this_access_confusion/
	auto MakeGetTextParserLambda = [] (ZenLabelDisplay* labelRef)
	{
		float val = labelRef->getTextValue().getValue();
		if (val < -96.0f)
			return String("-Inf");
		else
			return String(val);
	};
	

	addAndMakeVisible(gainLabel = new Label("Gain Text", "Applied Gain:"));
	gainLabel->setColour(Label::textColourId, textColour);
	gainLabel->setBounds(12, 40, 130, 48);

	addAndMakeVisible(calcGainDisplay = new ZenLabelDisplay("Calculated Gain Label", "0.00"));
	calcGainDisplay->setGetTextFunction(MakeGetTextParserLambda);
	calcGainDisplay->setShouldScaleText(true);
	calcGainDisplay->setFontMarginSize(35);
	calcGainDisplay->setTooltip("The calculated amount of gain to be applied to the incoming signal.");
	calcGainDisplay->setBounds(120, 40, 75, 48);

	addAndMakeVisible(leftAvgRMSLabel = new ZenLabelDisplay("Left Avg RMS Out", "00"));
	leftAvgRMSLabel->setColour(Label::textColourId, textColour);
	leftAvgRMSLabel->setGetTextFunction(MakeGetTextParserLambda);
	leftAvgRMSLabel->setBounds(8, 98, 72, 24);
	
	addAndMakeVisible(leftMaxRMSLabel = new ZenLabelDisplay("Left Max RMS Out", "0.00"));
	leftMaxRMSLabel->setColour(Label::textColourId, textColour);
	leftMaxRMSLabel->setGetTextFunction(MakeGetTextParserLambda);
	leftMaxRMSLabel->setBounds(8, 126, 72, 24);
	
	addAndMakeVisible(leftPeakLabel = new ZenLabelDisplay("Left Peak Out", "0.00"));
	leftPeakLabel->setColour(Label::textColourId, textColour);
	leftPeakLabel->setGetTextFunction(MakeGetTextParserLambda);
	leftPeakLabel->setBounds(8, 154, 72, 24);

	addAndMakeVisible(avgBox = new Label("Avg Label", "AVG"));
	avgBox->setColour(Label::textColourId, textColour);
	avgBox->setBounds(90, 98, 40, 24);

	addAndMakeVisible(maxBox = new Label("Max Label", "MAX"));
	maxBox->setColour(Label::textColourId, textColour);
	maxBox->setBounds(90, 126, 40, 24);

	addAndMakeVisible(peakBox = new Label("Peak Label", "PEAK"));
	peakBox->setColour(Label::textColourId, textColour);
	peakBox->setBounds(90, 154, 40, 24);
	
	addAndMakeVisible(rightAvgRMSLabel = new ZenLabelDisplay("Right Avg RMS Out", "0.00"));
	rightAvgRMSLabel->setColour(Label::textColourId, Colours::white);
	rightAvgRMSLabel->setGetTextFunction(MakeGetTextParserLambda);
	rightAvgRMSLabel->setBounds(140, 98, 72, 24);
	
	addAndMakeVisible(rightMaxRMSLabel = new ZenLabelDisplay("Right Max RMS Out", "0.00"));
	rightMaxRMSLabel->setColour(Label::textColourId, Colours::white);
	rightMaxRMSLabel->setGetTextFunction(MakeGetTextParserLambda);
	rightMaxRMSLabel->setBounds(140, 126, 72, 24);
	
	addAndMakeVisible(rightPeakLabel = new ZenLabelDisplay("Right Peak Out", "0.00"));
	rightPeakLabel->setColour(Label::textColourId, textColour);
	rightPeakLabel->setGetTextFunction(MakeGetTextParserLambda);
	rightPeakLabel->setBounds(140, 154, 72, 24);

	addAndMakeVisible(targetComboBox = new ZenComboBox("Target Combo Box"));
	targetComboBox->addItem("Avg RMS", CalibrationTarget::AverageRMS);
	targetComboBox->addItem("Max RMS", CalibrationTarget::MaxRMS);
	targetComboBox->addItem("Peak", CalibrationTarget::Peak);
	targetComboBox->setTextWhenNothingSelected("Target");
	targetComboBox->setBounds(9, 186, 90, 24);
	targetComboBox->setSelectedId(processor.getTargetTypeParam()->getValueAsInt(), dontSendNotification);
	targetComboBox->setTooltip("Target to automatically gain stage toward.");
	targetComboBox->addListener(this);

	addAndMakeVisible(rmsWindowComboBox = new ZenComboBox("RMS Window Combo Box"));
	rmsWindowComboBox->addItem("10ms", CalibrationTimeInMS::time10ms);
	rmsWindowComboBox->addItem("300ms", CalibrationTimeInMS::time300ms);
	rmsWindowComboBox->addItem("1000ms", CalibrationTimeInMS::time1000ms);
	rmsWindowComboBox->addItem("5000ms", CalibrationTimeInMS::time5000ms);
	rmsWindowComboBox->setTextWhenNothingSelected("Window");
	rmsWindowComboBox->setBounds(122, 186, 90, 24);
	rmsWindowComboBox->setSelectedId(getCalibrationTimeFromMS(
		processor.getRMSWindowTimeParam()->getValueAsInt()), dontSendNotification);
	if (targetComboBox->getSelectedId() == CalibrationTarget::Peak) 
		rmsWindowComboBox->setEnabled(false);
	rmsWindowComboBox->setTooltip("Window time (in milliseconds) to use when calculating RMS");
	rmsWindowComboBox->addListener(this);
	
	addAndMakeVisible(resetBtn = new ZenImageButton("Reset Button", "Reset"));
	resetBtn->setTooltip("Reset all calculation.");
	resetBtn->setBounds(16, 218, 51, 24);
	resetBtn->addListener(this);	
	
	addAndMakeVisible(autoGainBtn = new ZenImageButton("Auto Gain Button", "AutoGain"));
	autoGainBtn->setClickingTogglesState(true);
	autoGainBtn->setTooltip("Enable automatic gain staging of incoming signals.");
	autoGainBtn->setBounds(154, 218, 60, 24);
	autoGainBtn->setToggleState(processor.getAutoGainEnableParam()->getValueAsBool(), dontSendNotification);
	autoGainBtn->addListener(this);

	addAndMakeVisible(targetEditor = new ZenDecibelTextEditor("Target Editor", processor.getTargetParam()));
	targetEditor->setMultiLine(false);
	targetEditor->setReturnKeyStartsNewLine(false);
	targetEditor->setReadOnly(false);
	targetEditor->setScrollbarsShown(false);
	targetEditor->setCaretVisible(true);
	targetEditor->setSelectAllWhenFocused(true);
	targetEditor->setText(processor.getTargetParam()->getTextInDB(), dontSendNotification);
	targetEditor->setBounds(75, 218, 71, 24);
	targetEditor->setTooltip("Decibel value to gain stage the incoming signal toward.");
	targetEditor->addListener(this);
		
	addChildComponent(bypassOverlay = new Label("Bypass Overlay", String()));
	bypassOverlay->setEditable(false, false, false);
	bypassOverlay->setColour(Label::backgroundColourId, Colour(0xCC202020));
	bypassOverlay->setBounds(0, 31, 222, 220);
	bypassOverlay->setVisible(!processor.isEnabled());

	tooltipWindow.setMillisecondsBeforeTipAppears(2000);

	startTimer(100);
	//ZEN_COMPONENT_DEBUG_ATTACH(this);

	//openGLContext = new OpenGLContext();
	//openGLContext->attachTo(*this);
}
Example #6
0
//==============================================================================
mlrVSTGUI::mlrVSTGUI (mlrVSTAudioProcessor* owner, const int &newNumChannels, const int &newNumStrips)
    : AudioProcessorEditor (owner),

    // Communication ////////////////////////
    parent(owner),
    // Style / positioning objects //////////
    myLookAndFeel(), overrideLF(),

    // Fonts ///////////////////////////////////////////////////////
    fontSize(12.f), defaultFont("ProggyCleanTT", 18.f, Font::plain),

    // Volume controls //////////////////////////////////////////////////
    masterGainSlider("master gain"), masterSliderLabel("master", "mstr"),
    slidersArray(), slidersMuteBtnArray(),

    // Tempo controls ///////////////////////////////////////
    bpmSlider("bpm slider"), bpmLabel(),
    quantiseSettingsCbox("quantise settings"),
    quantiseLabel("quantise label", "quant."),

    // Buttons //////////////////////////////////
    loadFilesBtn("load samples", "load samples"),
    sampleStripToggle("sample strip toggle", DrawableButton::ImageRaw),
    patternStripToggle("pattern strip toggle", DrawableButton::ImageRaw),
    sampleImg(), patternImg(),

    // Record / Resample / Pattern UI ////////////////////////////////////////
    precountLbl("precount", "precount"), recordLengthLbl("length", "length"), bankLbl("bank", "bank"),
    recordPrecountSldr(), recordLengthSldr(), recordBankSldr(),
    resamplePrecountSldr(), resampleLengthSldr(), resampleBankSldr(),
    patternPrecountSldr(), patternLengthSldr(), patternBankSldr(),
    recordBtn("record", Colours::black, Colours::white),
    resampleBtn("resample", Colours::black, Colours::white),
    patternBtn("pattern", Colours::black, Colours::white),

    // branding
    vstNameLbl("vst label", "mlrVST"),

    // Misc ///////////////////////////////////////////
    lastDisplayedPosition(),
    debugButton("loadfile", DrawableButton::ImageRaw),    // temporary button

    // Presets //////////////////////////////////////////////////
    presetLabel("presets", "presets"), presetCbox(),
    presetPrevBtn("prev", 0.25, Colours::black, Colours::white),
    presetNextBtn("next", 0.75, Colours::black, Colours::white),
    addPresetBtn("add", "add preset"),
    toggleSetlistBtn("setlist"),
    presetPanelBounds(294, PAD_AMOUNT, THUMBNAIL_WIDTH, 725),
    presetPanel(presetPanelBounds, owner),


    // Settings ///////////////////////////////////////
    numChannels(newNumChannels), useExternalTempo(true),
    toggleSettingsBtn("settings"),
    settingsPanelBounds(294, PAD_AMOUNT, THUMBNAIL_WIDTH, 725),
    settingsPanel(settingsPanelBounds, owner, this),

    // Mappings //////////////////////////////////////
    mappingPanelBounds(294, PAD_AMOUNT, THUMBNAIL_WIDTH, 725),
    toggleMappingBtn("mappings"),
    mappingPanel(mappingPanelBounds, owner),

    // SampleStrip controls ///////////////////////////
    sampleStripControlArray(), numStrips(newNumStrips),
    waveformControlHeight( (GUI_HEIGHT - numStrips * PAD_AMOUNT) / numStrips),
    waveformControlWidth(THUMBNAIL_WIDTH),

    // Overlays //////////////////////////////
    patternStripArray(), hintOverlay(owner)
{
    DBG("GUI loaded " << " strips of height " << waveformControlHeight);

    parent->addChangeListener(this);

    // these are compile time constants
    setSize(GUI_WIDTH, GUI_HEIGHT);
    setWantsKeyboardFocus(true);

    int xPosition = PAD_AMOUNT;
    int yPosition = PAD_AMOUNT;

    // set up volume sliders
    buildSliders(xPosition, yPosition);

    // add the bpm slider and quantise settings
    setupTempoUI(xPosition, yPosition);

    // set up the various panels (settings, mapping, etc)
    // and the buttons that control them
    setupPanels(xPosition, yPosition);

    // preset associated UI elements
    setupPresetUI(xPosition, yPosition);


    // useful UI debugging components
    addAndMakeVisible(&debugButton);
    debugButton.addListener(this);
    debugButton.setColour(DrawableButton::backgroundColourId, Colours::blue);
    debugButton.setBounds(50, 300, 50, 25);

    sampleImg.setImage(ImageCache::getFromMemory(BinaryData::waveform_png, BinaryData::waveform_pngSize));
    patternImg.setImage(ImageCache::getFromMemory(BinaryData::pattern_png, BinaryData::pattern_pngSize));

    addAndMakeVisible(&sampleStripToggle);
    sampleStripToggle.addListener(this);
    sampleStripToggle.setImages(&sampleImg);
    sampleStripToggle.setBounds(100, 300, 70, 25);
    displayMode = modeSampleStrips;

    addAndMakeVisible(&loadFilesBtn);
    loadFilesBtn.addListener(this);
    loadFilesBtn.setBounds(50, 350, 100, 25);

    setUpRecordResampleUI();
    buildSampleStripControls(numStrips);
    setupPatternOverlays();

    masterGainSlider.addListener(this);



    // start timer to update play positions, slider values etc.
    startTimer(50);

    addAndMakeVisible(&vstNameLbl);
    vstNameLbl.setBounds(PAD_AMOUNT, 600, 250, 50);
    vstNameLbl.setFont(Font("ProggyCleanTT", 40.f, Font::plain));
    vstNameLbl.setColour(Label::textColourId, Colours::white);

    addChildComponent(&hintOverlay);
    const int overlayHeight = 150;
    hintOverlay.setBounds(0, GUI_HEIGHT/2 - overlayHeight/2, GUI_WIDTH, overlayHeight);

    // This tells the GUI to use a custom "theme"
    LookAndFeel::setDefaultLookAndFeel(&myLookAndFeel);
}
Example #7
0
UIComponent::UIComponent(MainWindow* mainWindow_, ProcessorGraph* pgraph, AudioComponent* audio_)
    : mainWindow(mainWindow_), processorGraph(pgraph), audio(audio_)

{

    processorGraph->setUIComponent(this);

    infoLabel = new InfoLabel();

    dataViewport = new DataViewport();
    addChildComponent(dataViewport);
    dataViewport->addTabToDataViewport("Info", infoLabel,0);

    std::cout << "Created data viewport." << std::endl;

    editorViewport = new EditorViewport();

    addAndMakeVisible(editorViewport);

    std::cout << "Created filter viewport." << std::endl;

    editorViewportButton = new EditorViewportButton(this);
    addAndMakeVisible(editorViewportButton);

    controlPanel = new ControlPanel(processorGraph, audio);
    addAndMakeVisible(controlPanel);

    std::cout << "Created control panel." << std::endl;

    processorList = new ProcessorList();
    addAndMakeVisible(processorList);

    std::cout << "Created filter list." << std::endl;

    messageCenter = new MessageCenter();
    addActionListener(messageCenter);
    addAndMakeVisible(messageCenter);

    std::cout << "Created message center." << std::endl;

    setBounds(0,0,500,400);

    std::cout << "Component width = " << getWidth() << std::endl;
    std::cout << "Component height = " << getHeight() << std::endl;

    std::cout << "UI component data viewport: " << dataViewport << std::endl;

    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->sendActionMessage("Test.");

    //processorGraph->loadState();

#if JUCE_MAC
    MenuBarModel::setMacMainMenu(this);
    mainWindow->setMenuBar(0);
#else
    mainWindow->setMenuBar(this);
#endif

    //getEditorViewport()->loadState(File("/home/jsiegle/Programming/GUI/Builds/Linux/build/test.xml"));
    
    //Check and see where file is being executed
    //File executable = File::getSpecialLocation(File::currentExecutableFile);
    //const String executableDirectory = executable.getParentDirectory().getFullPathName();
    //sendActionMessage(executableDirectory);

}
Example #8
0
UIComponent::UIComponent(MainWindow* mainWindow_, ProcessorGraph* pgraph, AudioComponent* audio_)
    : mainWindow(mainWindow_), processorGraph(pgraph), audio(audio_)

{

    processorGraph->setUIComponent(this);

    infoLabel = new InfoLabel();
    std::cout << "Created info label." << std::endl;

    graphViewer = new GraphViewer();
    std::cout << "Created graph viewer." << std::endl;

    dataViewport = new DataViewport();
    addChildComponent(dataViewport);
    dataViewport->addTabToDataViewport("Info", infoLabel,0);
    dataViewport->addTabToDataViewport("Graph", graphViewer,0);

    std::cout << "Created data viewport." << std::endl;

    editorViewport = new EditorViewport();

    addAndMakeVisible(editorViewport);

    std::cout << "Created filter viewport." << std::endl;

    editorViewportButton = new EditorViewportButton(this);
    addAndMakeVisible(editorViewportButton);

    controlPanel = new ControlPanel(processorGraph, audio);
    addAndMakeVisible(controlPanel);

    std::cout << "Created control panel." << std::endl;

    processorList = new ProcessorList();
    processorListViewport.setViewedComponent(processorList,false);
    processorListViewport.setScrollBarsShown(true,false);
    addAndMakeVisible(&processorListViewport);
    processorList->setVisible(true);
    processorList->setBounds(0,0,195,processorList->getTotalHeight());
    std::cout << "Created filter list." << std::endl;

    messageCenter = new MessageCenter();
    addActionListener(messageCenter);
    addAndMakeVisible(messageCenter);

    std::cout << "Created message center." << std::endl;

    setBounds(0,0,500,400);

    processorGraph->setUIComponent(this);
    
    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

#if JUCE_MAC
    MenuBarModel::setMacMainMenu(this);
    mainWindow->setMenuBar(0);
#else
    mainWindow->setMenuBar(this);
#endif

}
void ComponentLayoutEditor::mouseDown (const MouseEvent& e)
{
    selectedComponents.deselectAll();
    Array<File> customPlants;
    resetAllInterest();

    if (e.mods.isPopupMenu())
    {
        PopupMenu menu;
        menu.setLookAndFeel (&lookAndFeel);
        CabbagePopupWidgets widgets;

        PopupMenu subM;
        subM.addItem (1, "Button");
        subM.addItem (2, "Button - File");
        subM.addItem (3, "Button - Info");
        menu.addSubMenu ("Buttons", subM);
        subM.clear();


        menu.addItem (4, "Checkbox");
        menu.addItem (5, "ComboBox");
        menu.addItem (6, "Csound Output");
        menu.addItem (7, "Endless Encoder");
        menu.addItem (8, "Gentable");
        menu.addItem (9, "Groupbox");

        menu.addItem (11, "Image");
        menu.addItem (12, "Keyboard");
        menu.addItem (13, "Label");
        menu.addItem (27, "Listbox");
        subM.addItem (10, "Horizontal Meter");
        subM.addItem (25, "Vertical Meter");
        menu.addSubMenu( "Meters", subM);

        subM.clear();
        
        menu.addItem (14, "Signal Display");

        subM.addItem (15, "Slider - Horizontal");
        subM.addItem (16, "Slider - Rotary");
        subM.addItem (17, "Slider - Vertical");
        subM.addItem (18, "Slider - Range - Vertical");
        subM.addItem (19, "Slider - Range - Horizontal");
        subM.addItem (20, "Slider - Number Box");
        menu.addSubMenu("Sliders", subM);
        subM.clear();

        menu.addItem (21, "Soundfiler");
        menu.addItem (22, "Event Sequencer");
        menu.addItem (23, "Text Box");
        menu.addItem (24, "Text Editor");
        menu.addItem (26, "XY Pad");



        CabbageSettings settings;
        settings.setStorageParameters(CabbageUtilities::getStorageProps());
        settings.setDefaultSettings();
        const String plantDir = settings.getUserSettings()->getValue("CabbagePlantDir");
        CabbageUtilities::debug(plantDir);

        PopupMenu subMenu;
        CabbageUtilities::addCustomPlantsToMenu(subMenu, customPlants, plantDir);
        menu.addSubMenu("Custom Plants", subMenu);
        const int result = menu.show();

        if (result > 0 && result < 100)
            getPluginEditor()->addNewWidget (widgets.getAllValues()[result - 1], e.getPosition());
        else
            getPluginEditor()->addNewWidget (customPlants[result-100].getFullPathName(), e.getPosition(), true);
        currentMouseCoors = e.getPosition();
    }
    else
    {
        addChildComponent (&lassoComp);
        lassoComp.beginLasso (e, this);
    }
}
Example #10
0
WizardFinish::WizardFinish() :
    _finish("Finish"),
    _peerSucceed(false)
{
	
    _logger = &Poco::Logger::get("subutai");
    _logger->trace("Creating Wizard Finish UI Component");
    auto font = juce::Font("Encode Sans", 17, 0);

    _thanks.setText("Thank you for using Subutai", juce::dontSendNotification);
    _thanks.setColour(juce::Label::textColourId, juce::Colour(105, 116, 144));
    _thanks.setBounds(15, 15, 400, 40);
    _thanks.setFont(font);
    _thanks.setJustificationType(juce::Justification::top);
    addAndMakeVisible(_thanks);

	_ptp.setText("P2P Installation", juce::dontSendNotification);
	_ptp.setColour(juce::Label::textColourId, juce::Colour(105, 116, 144));
	_ptp.setBounds(15, 35, 150, 40);
	_ptp.setFont(font);
	_ptp.setJustificationType(juce::Justification::top);
	addAndMakeVisible(_ptp);

	_ptpResult.setText("Undefined", juce::dontSendNotification);
	_ptpResult.setColour(juce::Label::textColourId, juce::Colour(105, 116, 144));
	_ptpResult.setBounds(150, 35, 500, 40);
	_ptpResult.setFont(font);
	_ptpResult.setJustificationType(juce::Justification::top);
	addAndMakeVisible(_ptpResult);

	_tray.setText("Tray Installation", juce::dontSendNotification);
	_tray.setColour(juce::Label::textColourId, juce::Colour(105, 116, 144));
	_tray.setBounds(15, 55, 150, 40);
	_tray.setFont(font);
	_tray.setJustificationType(juce::Justification::top);
	addAndMakeVisible(_tray);

	_trayResult.setText("Undefined", juce::dontSendNotification);
	_trayResult.setColour(juce::Label::textColourId, juce::Colour(105, 116, 144));
	_trayResult.setBounds(150, 55, 500, 40);
	_trayResult.setFont(font);
	_trayResult.setJustificationType(juce::Justification::top);
	addAndMakeVisible(_trayResult);

	_ete.setText("E2E Installation", juce::dontSendNotification);
	_ete.setColour(juce::Label::textColourId, juce::Colour(105, 116, 144));
	_ete.setBounds(15, 75, 150, 40);
	_ete.setFont(font);
	_ete.setJustificationType(juce::Justification::top);
	addAndMakeVisible(_ete);

	_eteResult.setText("Undefined", juce::dontSendNotification);
	_eteResult.setColour(juce::Label::textColourId, juce::Colour(105, 116, 144));
	_eteResult.setBounds(150, 75, 500, 40);
	_eteResult.setFont(font);
	_eteResult.setJustificationType(juce::Justification::top);
	addAndMakeVisible(_eteResult);

	_peer.setText("Peer Installation", juce::dontSendNotification);
	_peer.setColour(juce::Label::textColourId, juce::Colour(105, 116, 144));
	_peer.setBounds(15, 95, 150, 40);
	_peer.setFont(font);
	_peer.setJustificationType(juce::Justification::top);
	addAndMakeVisible(_peer);

	_peerResult.setText("Undefined", juce::dontSendNotification);
	_peerResult.setColour(juce::Label::textColourId, juce::Colour(105, 116, 144));
	_peerResult.setBounds(150, 95, 500, 40);
	_peerResult.setFont(font);
	_peerResult.setJustificationType(juce::Justification::top);
	addAndMakeVisible(_peerResult);

    _finish.setBounds(400, 560, 86, 25);
    _finish.setColour(juce::TextButton::buttonColourId, juce::Colour(7,141,208));
    _finish.addListener(this);
    addAndMakeVisible(_finish);

    _peerLink.setBounds(-1, -1, 1, 1);
    _peerLink.setURL(URL("https://localhost:9999"));
    addAndMakeVisible(_peerLink);
    
    std::string pCrashBot(SubutaiLauncher::Session::instance()->getSettings()->getTmpPath() + "crashbot.png");
    Poco::File pLogo(pCrashBot);
    if (pLogo.exists())
    {
        _crashBot.setImage(juce::ImageCache::getFromFile(juce::File(pCrashBot)));
    }
    else
    {
        _logger->error("crashbot.png doesn't exists");
    }
    addChildComponent(_crashBot);
    _crashBot.setBounds(122, 200, 256, 167);

    auto font2 = juce::Font("Encode Sans", 21, 1);
	_crashWarning.setText("Something went wrong!", juce::dontSendNotification);
	_crashWarning.setColour(juce::Label::textColourId, juce::Colour(105, 116, 144));
	_crashWarning.setBounds(0, 380, 500, 40);
	_crashWarning.setFont(font2);
	_crashWarning.setJustificationType(juce::Justification::centred);
    addChildComponent(_crashWarning);
    
	_crashText.setText("Use the code below if you're going to contact us about these problems", juce::dontSendNotification);
	_crashText.setColour(juce::Label::textColourId, juce::Colour(105, 116, 144));
	_crashText.setBounds(0, 420, 500, 40);
	_crashText.setFont(font);
	_crashText.setJustificationType(juce::Justification::centred);
    addChildComponent(_crashText);

    auto font3 = juce::Font("Encode Sans", 24, 1);
	_installId.setText("", juce::dontSendNotification);
	_installId.setColour(juce::Label::textColourId, juce::Colours::black);
	_installId.setBounds(0, 460, 500, 40);
	_installId.setFont(font3);
	_installId.setJustificationType(juce::Justification::centred);
    addChildComponent(_installId);

}
Example #11
0
SpikeDetectorEditor::SpikeDetectorEditor(GenericProcessor* parentNode, bool useDefaultParameterEditors=true)
    : GenericEditor(parentNode, useDefaultParameterEditors), isPlural(true)

{

    MemoryInputStream mis(BinaryData::silkscreenserialized, BinaryData::silkscreenserializedSize, false);
    Typeface::Ptr typeface = new CustomTypeface(mis);
    font = Font(typeface);

    desiredWidth = 300;

    electrodeTypes = new ComboBox("Electrode Types");

    SpikeDetector* processor = (SpikeDetector*) getProcessor();

    for (int i = 0; i < processor->electrodeTypes.size(); i++)
    {
        String type = processor->electrodeTypes[i];
        electrodeTypes->addItem(type += "s", i+1);
    }

    electrodeTypes->setEditableText(false);
    electrodeTypes->setJustificationType(Justification::centredLeft);
    electrodeTypes->addListener(this);
    electrodeTypes->setBounds(65,40,110,20);
    electrodeTypes->setSelectedId(2);
    addAndMakeVisible(electrodeTypes);

    electrodeList = new ComboBox("Electrode List");
    electrodeList->setEditableText(false);
    electrodeList->setJustificationType(Justification::centredLeft);
    electrodeList->addListener(this);
    electrodeList->setBounds(15,75,115,20);
    addAndMakeVisible(electrodeList);

    numElectrodes = new Label("Number of Electrodes","1");
    numElectrodes->setEditable(true);
    numElectrodes->addListener(this);
    numElectrodes->setBounds(30,40,25,20);
    //labelTextChanged(numElectrodes);
    addAndMakeVisible(numElectrodes);

    upButton = new TriangleButton(1);
    upButton->addListener(this);
    upButton->setBounds(50,40,10,8);
    addAndMakeVisible(upButton);

    downButton = new TriangleButton(2);
    downButton->addListener(this);
    downButton->setBounds(50,50,10,8);
    addAndMakeVisible(downButton);

    plusButton = new UtilityButton("+", titleFont);
    plusButton->addListener(this);
    plusButton->setRadius(3.0f);
    plusButton->setBounds(15,42,14,14);
    addAndMakeVisible(plusButton);

    ElectrodeEditorButton* e1 = new ElectrodeEditorButton("EDIT",font);
    e1->addListener(this);
    addAndMakeVisible(e1);
    e1->setBounds(15,110,40,10);
    electrodeEditorButtons.add(e1);

    ElectrodeEditorButton* e2 = new ElectrodeEditorButton("MONITOR",font);
    e2->addListener(this);
    addAndMakeVisible(e2);
    e2->setBounds(55,110,70,10);
    electrodeEditorButtons.add(e2);

    ElectrodeEditorButton* e3 = new ElectrodeEditorButton("DELETE",font);
    e3->addListener(this);
    addAndMakeVisible(e3);
    e3->setBounds(130,110,70,10);
    electrodeEditorButtons.add(e3);

    thresholdSlider = new ThresholdSlider(font);
    thresholdSlider->setBounds(200,35,75,75);
    addAndMakeVisible(thresholdSlider);
    thresholdSlider->addListener(this);
    thresholdSlider->setActive(false);
    Array<double> v;
    thresholdSlider->setValues(v);

    thresholdLabel = new Label("Name","Threshold");
    font.setHeight(10);
    thresholdLabel->setFont(font);
    thresholdLabel->setBounds(202, 105, 95, 15);
    thresholdLabel->setColour(Label::textColourId, Colours::grey);
    addAndMakeVisible(thresholdLabel);

    // create a custom channel selector
    deleteAndZero(channelSelector);

    channelSelector = new ChannelSelector(false, font);
    addChildComponent(channelSelector);
    channelSelector->setVisible(false);

    //  Array<int> a;

    channelSelector->inactivateButtons();
    channelSelector->paramButtonsToggledByDefault(false);
    //  channelSelector->paramButtonsActiveByDefault(false);

}
Example #12
0
    //==============================================================================
    InterprocessCommsDemo()
        : sendButton ("send", "Fires off the message"),
          modeLabel (String::empty, "Mode:"),
          pipeLabel (String::empty, "Pipe Name:"),
          numberLabel (String::empty, "Socket Port:"),
          hostLabel (String::empty, "Socket Host:")
    {
        setName ("Interprocess Communication");

        server = new DemoInterprocessConnectionServer (*this);

        // create all our UI bits and pieces..
        addAndMakeVisible (&modeSelector);
        modeSelector.setBounds (100, 25, 200, 24);
        modeLabel.attachToComponent (&modeSelector, true);

        modeSelector.addItem ("(Disconnected)", 8);
        modeSelector.addSeparator();
        modeSelector.addItem ("Named pipe (listening)", 1);
        modeSelector.addItem ("Named pipe (connect to existing pipe)", 5);
        modeSelector.addSeparator();
        modeSelector.addItem ("Socket (listening)", 2);
        modeSelector.addItem ("Socket (connect to existing socket)", 6);

        modeSelector.setSelectedId (8);
        modeSelector.addListener (this);

        addAndMakeVisible (&pipeName);
        pipeName.setBounds (100, 60, 130, 24);
        pipeName.setMultiLine (false);
        pipeName.setText ("juce demo pipe");
        pipeLabel.attachToComponent (&pipeName, true);

        addAndMakeVisible (&socketNumber);
        socketNumber.setBounds (350, 60, 80, 24);
        socketNumber.setMultiLine (false);
        socketNumber.setText ("12345");
        socketNumber.setInputRestrictions (5, "0123456789");
        numberLabel.attachToComponent (&socketNumber, true);

        addAndMakeVisible (&socketHost);
        socketHost.setBounds (530, 60, 130, 24);
        socketHost.setMultiLine (false);
        socketHost.setText ("localhost");
        socketNumber.setInputRestrictions (512);
        hostLabel.attachToComponent (&socketHost, true);

        addChildComponent (&sendText);
        sendText.setBounds (30, 120, 200, 24);
        sendText.setMultiLine (false);
        sendText.setReadOnly (false);
        sendText.setText ("testing 1234");

        addChildComponent (&sendButton);
        sendButton.setBounds (240, 120, 200, 24);
        sendButton.changeWidthToFitText();
        sendButton.addListener (this);

        addChildComponent (&incomingMessages);
        incomingMessages.setReadOnly (true);
        incomingMessages.setMultiLine (true);
        incomingMessages.setBounds (30, 150, 500, 250);

        // call this to set up everything's state correctly.
        comboBoxChanged (0);
    }
PowerPageComponent::PowerPageComponent() {
  bgColor = Colours::black;
  bgImage = createImageFromFile(assetFile("powerMenuBackground.png"));
  mainPage = new Component();
  addAndMakeVisible(mainPage);
  mainPage->toBack();
  ChildProcess child{};
  
  felPage = new PowerFelPageComponent();
  
  // create back button
  backButton = createImageButton(
      "Back", createImageFromFile(assetFile("nextIcon.png")));
  backButton->addListener(this);
  backButton->setAlwaysOnTop(true);
  addAndMakeVisible(backButton);
    
  powerOffButton = new TextButton("Power OFF");
  powerOffButton->setButtonText("Shutdown");
  powerOffButton->addListener(this);
  addAndMakeVisible(powerOffButton);
    
  rebootButton = new TextButton("Reboot");
  rebootButton->setButtonText("Reboot");
  rebootButton->addListener(this);
  addAndMakeVisible(rebootButton);
    
   sleepButton = new TextButton("Sleep");
   sleepButton->setButtonText("Sleep");
   sleepButton->addListener(this);
   addAndMakeVisible(sleepButton);
    
    felButton = new TextButton("Fel");
    felButton->setButtonText("Flash Software");
    felButton->addListener(this);
    addAndMakeVisible(felButton);
  
    powerSpinnerTimer.powerComponent = this;
    Array<String> spinnerImgPaths{"wait0.png","wait1.png","wait2.png","wait3.png","wait4.png","wait5.png","wait6.png","wait7.png"};
    for(auto& path : spinnerImgPaths) {
        auto image = createImageFromFile(assetFile(path));
        launchSpinnerImages.add(image);
    }
    powerSpinner = new ImageComponent();
    powerSpinner->setImage(launchSpinnerImages[0]);
    addChildComponent(powerSpinner);
  
  buildName = "Build: ";
  auto releaseFileName = absoluteFileFromPath( "/etc/os-release" );
  File releaseFile( releaseFileName );
  if (releaseFile.exists()) {
    auto fileStr = releaseFile.loadFileAsString();
    auto lines = split(fileStr, "\n");
    if (lines.size() < 9)
      DBG(__func__ << ": No release information in /etc/os-release");
    else {
      auto releaseKv = split(lines[8],"=");
      std::vector<String> releaseV(releaseKv.begin()+1,releaseKv.end());
      for (const auto& val : releaseV) {
        // WIP: misses the removed equals
        buildName += val;
      }
      DBG(buildName);
    }
  }
  
#if JUCE_MAC
  buildName = "Build: MacOsX Dev Build";
#endif
  
  buildNameLabel = new Label("Build Name");
  buildNameLabel->setText(buildName, NotificationType::dontSendNotification);
  buildNameLabel->      setFont(16);
  buildNameLabel->setJustificationType(Justification::centred);
  addAndMakeVisible(buildNameLabel);
  
  //Create rev Text
  String rev_string = std::to_string(rev_number);
  rev = new Label("rev", ("v0.0."+rev_string));
  addAndMakeVisible(rev);
  rev->setAlwaysOnTop(true);
  rev->setFont(Font(20.f));
    
  //Update button
  updateButton = new TextButton("Update");
  updateButton->setButtonText("Check for updates");
  updateButton->setAlwaysOnTop(true);
  updateButton->addListener(this);
  addAndMakeVisible(updateButton);
  
  updateButton->setVisible(false);
  
  //Update window
  updateWindow = new AlertWindow("Checking for updates",
                   "Downloading informations, please wait...", 
                   AlertWindow::AlertIconType::NoIcon);
  addAndMakeVisible(updateWindow, 10);
  updateWindow->setAlwaysOnTop(true);
  updateWindow->setVisible(false);
}
Example #14
0
//==============================================================================
MumuAudioGranularAudioProcessorEditor::MumuAudioGranularAudioProcessorEditor (MumuAudioGranularAudioProcessor& p)
: AudioProcessorEditor (&p), processor (p), Tab(TabbedButtonBar::TabsAtLeft), Tab1_stretchButton("Grain")
{
    // Make sure that before the constructor has finished, you've set the
    // editor's size to whatever you need it to be.
    setSize (600, 280);
    LookAndFeel::setDefaultLookAndFeel(&myLookAndFeel);
    
    //======== Tab Bar =========
    addAndMakeVisible(Tab);
    Tab.setBounds(0, 20, 20, 180);
    Tab.addTab("Pitch / Stretch", Colour(Colours::darkgrey), 1);
    Tab.addTab("Rhythmic Chop", Colour(Colours::darkgrey), 2);
    Tab.addTab("Patches", Colour(Colours::darkgrey), 3);
    Tab.setAlpha(0.8);
    Tab.addChangeListener(this);
    
    //======== Tab 1 ===========
    PitchStretch.setBounds(20, 0, 580, 280);
    PitchStretch.addAndMakeVisible(Tab1_pitchKnob);
    PitchStretch.addAndMakeVisible(Tab1_densityKnob);
    PitchStretch.addAndMakeVisible(Tab1_grainSizeKnob);
    PitchStretch.addAndMakeVisible(Tab1_dryWayKnob);
    PitchStretch.addAndMakeVisible(Tab1_stretchSpeedKnob);
    PitchStretch.addAndMakeVisible(Tab1_stretchButton);
    
    addChildComponent(PitchStretch);
    
    Tab1_pitchKnob.setTextBoxStyle(Slider::NoTextBox, false, 0, 0);
    Tab1_pitchKnob.setName("Slider 1");
    Tab1_pitchKnob.setSliderStyle(Slider::RotaryVerticalDrag);
    Tab1_pitchKnob.setRange(0.0, 1.0);
    Tab1_pitchKnob.addListener(this);
    Tab1_pitchKnob.setBounds(60, 28, 75, 75);
    
    Tab1_pitchLabel.setText("Pitch", dontSendNotification);
    Tab1_pitchLabel.setColour(juce::Label::textColourId, juce::Colour(255.0f, 255.0f, 255.0f));
    Tab1_pitchLabel.attachToComponent(&Tab1_pitchKnob, true);
    
    Tab1_densityKnob.setTextBoxStyle(Slider::NoTextBox, false, 0, 0);
    Tab1_densityKnob.setName("Slider 2");
    Tab1_densityKnob.setSliderStyle(Slider::RotaryVerticalDrag);
    Tab1_densityKnob.setRange(0.0, 1.0);
    Tab1_densityKnob.addListener(this);
    Tab1_densityKnob.setBounds(160, 88, 75, 75);
    
    Tab1_densityLabel.setText("Density", dontSendNotification);
    Tab1_densityLabel.setColour(juce::Label::textColourId, juce::Colour(255.0f, 255.0f, 255.0f));
    Tab1_densityLabel.attachToComponent(&Tab1_densityKnob, true);
    
    Tab1_grainSizeKnob.setTextBoxStyle(Slider::NoTextBox, false, 0, 0);
    Tab1_grainSizeKnob.setName("Slider 3");
    Tab1_grainSizeKnob.setSliderStyle(Slider::RotaryVerticalDrag);
    Tab1_grainSizeKnob.setRange(0.0, 1.0);
    Tab1_grainSizeKnob.addListener(this);
    Tab1_grainSizeKnob.setBounds(260, 28, 75, 75);
    
    Tab1_grainSizeLabel.setText("GrainSize", dontSendNotification);
    Tab1_grainSizeLabel.setColour(juce::Label::textColourId, juce::Colour(255.0f, 255.0f, 255.0f));
    Tab1_grainSizeLabel.attachToComponent(&Tab1_grainSizeKnob, true);
    addAndMakeVisible(Tab1_grainSizeLabel);
    
    Tab1_dryWayKnob.setTextBoxStyle(Slider::NoTextBox, false, 0, 0);
    Tab1_dryWayKnob.setName("Slider 4");
    Tab1_dryWayKnob.setSliderStyle(Slider::RotaryVerticalDrag);
    Tab1_dryWayKnob.setRange(0.0, 1.0);
    Tab1_dryWayKnob.addListener(this);
    Tab1_dryWayKnob.setBounds(360, 88, 75, 75);
    
    Tab1_dryWetLabel.setText("Dry/Wet", dontSendNotification);
    Tab1_dryWetLabel.setColour(juce::Label::textColourId, juce::Colour(255.0f, 255.0f, 255.0f));
    Tab1_dryWetLabel.attachToComponent(&Tab1_dryWayKnob, true);
    addAndMakeVisible(Tab1_dryWetLabel);
    
    Tab1_stretchSpeedKnob.setTextBoxStyle(Slider::NoTextBox, false, 0, 0);
    Tab1_stretchSpeedKnob.setName("Slider 5");
    Tab1_stretchSpeedKnob.setSliderStyle(Slider::RotaryVerticalDrag);
    Tab1_stretchSpeedKnob.setRange(0.0, 1.0);
    Tab1_stretchSpeedKnob.addListener(this);
    Tab1_stretchSpeedKnob.setBounds(500, 88, 45, 45);
    
    Tab1_stretchSpeedLabel.setText("Speed", dontSendNotification);
    Tab1_stretchSpeedLabel.setColour(juce::Label::textColourId, juce::Colour(255.0f, 255.0f, 255.0f));
    Tab1_stretchSpeedLabel.attachToComponent(&Tab1_stretchSpeedKnob, false);
    addAndMakeVisible(Tab1_stretchSpeedLabel);
    
    Tab1_stretchButton.setBounds(480,28,80,20);
    Tab1_stretchButton.setColour(juce::ToggleButton::textColourId , Colours::white);
    Tab1_stretchButton.addListener(this);
    
    addMouseListener(this, true);
    
    timerCallback();
    checkTabs();
    startTimer(50);
}
Example #15
0
UIComponent::UIComponent (MainWindow* mainWindow_, ProcessorGraph* pgraph, AudioComponent* audio_) 
	: processorGraph(pgraph), audio(audio_), mainWindow(mainWindow_)

{	

	processorGraph->setUIComponent(this);

	infoLabel = new InfoLabel();

	dataViewport = new DataViewport ();
	addChildComponent(dataViewport);
	dataViewport->addTabToDataViewport("Info",infoLabel,0);

	std::cout << "Created data viewport." << std::endl;

	editorViewport = new EditorViewport();

	addAndMakeVisible(editorViewport);

	std::cout << "Created filter viewport." << std::endl;

	editorViewportButton = new EditorViewportButton(this);
	addAndMakeVisible(editorViewportButton);

	controlPanel = new ControlPanel(processorGraph, audio);
	addAndMakeVisible(controlPanel);

	std::cout << "Created control panel." << std::endl;

	processorList = new ProcessorList();
	addAndMakeVisible(processorList);

	std::cout << "Created filter list." << std::endl;

	messageCenter = new MessageCenter();
	addActionListener(messageCenter);
	addAndMakeVisible(messageCenter);

	std::cout << "Created message center." << std::endl;

	setBounds(0,0,500,400);

	std::cout << "Component width = " << getWidth() << std::endl;
	std::cout << "Component height = " << getHeight() << std::endl;

	std::cout << "UI component data viewport: " << dataViewport << std::endl;

	std::cout << "Finished UI stuff." << std::endl << std::endl << std::endl;

	processorGraph->setUIComponent(this);
	processorList->setUIComponent(this);
	editorViewport->setUIComponent(this);
	dataViewport->setUIComponent(this);
	controlPanel->getAudioEditor()->setUIComponent(this);
	controlPanel->setUIComponent(this);
    
    //processorGraph->sendActionMessage("Test.");

	//processorGraph->loadState();

#if JUCE_MAC
    MenuBarModel::setMacMainMenu(this);
    mainWindow->setMenuBar(0);
#else
    mainWindow->setMenuBar(this);
#endif
	
}