Пример #1
0
void MixerToolBar::UpdateControls()
{
#if USE_PORTMIXER
   float inputVolume;
   float playbackVolume;
   int inputSource;

   // Show or hide the input slider based on whether it works
   mInputSlider->Enable(gAudioIO->InputMixerWorks());

   gAudioIO->GetMixer(&inputSource, &inputVolume, &playbackVolume);

   if (mOutputSlider->Get() != playbackVolume) {
      mOutputSlider->Set(playbackVolume);
      mOutputSliderVolume = playbackVolume;
      SetToolTips();
   }

   if (mInputSlider->Get() != inputVolume) {
      mInputSlider->Set(inputVolume);
      mInputSliderVolume = inputVolume;
      SetToolTips();
   }
#endif // USE_PORTMIXER
}
Пример #2
0
void MixerToolBar::SetMixer(wxCommandEvent & WXUNUSED(event))
{
#if USE_PORTMIXER
   float inputVolume = mInputSlider->Get();
   float outputVolume = mOutputSlider->Get();
   float oldIn, oldOut;
   int inputSource;

   gAudioIO->GetMixer(&inputSource, &oldIn, &oldOut);
   gAudioIO->SetMixer(inputSource, inputVolume, outputVolume);
   mOutputSliderVolume = outputVolume;
   mInputSliderVolume = inputVolume;
   SetToolTips();
#endif // USE_PORTMIXER
}
Пример #3
0
void MixerToolBar::UpdatePrefs()
{
#if USE_PORTMIXER
   float inputVolume;
   float playbackVolume;
   int inputSource;

   wxArrayString inputSources = gAudioIO->GetInputSourceNames();

   // Repopulate the selections
   mInputSourceChoice->Clear();
   mInputSourceChoice->Append(inputSources);

   // Reset the selected source
   gAudioIO->GetMixer(&inputSource, &inputVolume, &playbackVolume);
   mInputSourceChoice->SetSelection(inputSource);

   // Resize the control
   mInputSourceChoice->SetSize(mInputSourceChoice->GetEffectiveMinSize());

   // Show or hide the control based on input sources
   mInputSourceChoice->Show( inputSources.GetCount() != 0 );
   
   // Show or hide the input slider based on whether it works
   mInputSlider->Enable(gAudioIO->InputMixerWorks());
   SetToolTips();

   // Layout the toolbar
   Layout();

   // Resize the toolbar to fit the contents
   Fit();

   // And make that size the minimum
   SetMinSize( wxWindow::GetSizer()->GetMinSize() );
   SetSize( GetMinSize() );

   // Notify someone that we've changed our size
   Updated();
#endif

   // Set label to pull in language change
   SetLabel(_("Mixer"));

   // Give base class a chance
   ToolBar::UpdatePrefs();
}
Пример #4
0
EditPanel::EditPanel(QWidget *parent)
	: QWidget(parent, Qt::Window)
{
	QGridLayout *layout = new QGridLayout(this);
	
	int row = 0;
	m_GridLabel = new QLabel(tr("Grid"), this);
	layout->addWidget(m_GridLabel, row, 0);
	m_Cols = new QSpinBox(this);
	m_Cols->setRange(1, 100);
	connect(m_Cols, SIGNAL(valueChanged(int)), this, SLOT(onGridChanged(int)));
	layout->addWidget(m_Cols, row, 1);
	m_Rows = new QSpinBox(this);
	m_Rows->setRange(1, 100);
	connect(m_Rows, SIGNAL(valueChanged(int)), this, SLOT(onGridChanged(int)));
	layout->addWidget(m_Rows, row, 2);
	
	++row;
	layout->addWidget(new QLabel(tr("Label"),this), row, 0);
	m_Text = new QLineEdit(this);
	connect(m_Text, SIGNAL(editingFinished()), this, SLOT(onEditingFinished()));
	layout->addWidget(m_Text, row, 1, 1, 2);
	
	++row;
	m_PathLabel = new QLabel(tr("OSC Output"), this);
	layout->addWidget(m_PathLabel, row, 0);
	m_Path = new QLineEdit(this);
	connect(m_Path, SIGNAL(editingFinished()), this, SLOT(onEditingFinished()));
	connect(m_Path, SIGNAL(textChanged(const QString&)), this, SLOT(onPathTextChanged(const QString&)));
	layout->addWidget(m_Path, row, 1, 1, 2);
	
	++row;
	m_Path2Label = new QLabel(tr("OSC Output 2"), this);
	layout->addWidget(m_Path2Label, row, 0);
	m_Path2 = new QLineEdit(this);
	connect(m_Path2, SIGNAL(editingFinished()), this, SLOT(onEditingFinished()));
	connect(m_Path2, SIGNAL(textChanged(const QString&)), this, SLOT(onPath2TextChanged(const QString&)));
	layout->addWidget(m_Path2, row, 1, 1, 2);
	
	++row;
	m_Local = new QCheckBox(tr("Local"), this);
	m_Local->setToolTip( tr("send commands to other OSCToy widgets") );
	connect(m_Local, SIGNAL(stateChanged(int)), this, SLOT(onLocalStateChanged(int)));
	layout->addWidget(m_Local, row, 1, 1, 2);
	
	++row;
	m_MinMaxLabel = new QLabel(tr("Min/Max"), this);
	layout->addWidget(m_MinMaxLabel, row, 0);
	m_Min = new QLineEdit(this);
	connect(m_Min, SIGNAL(editingFinished()), this, SLOT(onEditingFinished()));
	layout->addWidget(m_Min, row, 1);
	m_Max = new QLineEdit(this);
	connect(m_Max, SIGNAL(editingFinished()), this, SLOT(onEditingFinished()));
	layout->addWidget(m_Max, row, 2);

	++row;
	m_MinMax2Label = new QLabel(tr("Min/Max 2"), this);
	layout->addWidget(m_MinMax2Label, row, 0);
	m_Min2 = new QLineEdit(this);
	connect(m_Min2, SIGNAL(editingFinished()), this, SLOT(onEditingFinished()));
	layout->addWidget(m_Min2, row, 1);
	m_Max2 = new QLineEdit(this);
	connect(m_Max2, SIGNAL(editingFinished()), this, SLOT(onEditingFinished()));
	layout->addWidget(m_Max2, row, 2);

	++row;
	m_BPMLabel = new QLabel(tr("BPM"), this);
	layout->addWidget(m_BPMLabel, row, 0);
	m_BPM = new QLineEdit(this);
	m_BPM->setToolTip( tr("Beats per Minute") );
	SetToolTips(tr("Beats per Minute"), m_BPMLabel, m_BPM);
	connect(m_BPM, SIGNAL(editingFinished()), this, SLOT(onEditingFinished()));
	layout->addWidget(m_BPM, row, 1);

	++row;
	m_RecvPathLabel = new QLabel(tr("OSC Label"), this);
	layout->addWidget(m_RecvPathLabel, row, 0);
	m_RecvPath = new QLineEdit(this);
	SetToolTips(tr("Designate an incoming OSC command as a text label for this widget"), m_RecvPathLabel, m_RecvPath);
	connect(m_RecvPath, SIGNAL(editingFinished()), this, SLOT(onEditingFinished()));
	layout->addWidget(m_RecvPath, row, 1, 1, 2);

	++row;
	m_FeedbackPathLabel = new QLabel(tr("OSC Trigger"), this);
	layout->addWidget(m_FeedbackPathLabel, row, 0);
	m_FeedbackPath = new QLineEdit(this);
	SetToolTips(tr("Trigger this widget via OSC"), m_FeedbackPathLabel, m_FeedbackPath);
	connect(m_FeedbackPath, SIGNAL(editingFinished()), this, SLOT(onEditingFinished()));
	layout->addWidget(m_FeedbackPath, row, 1, 1, 2);

	++row;
	QLabel *label = new QLabel(tr("Icon"), this);
	layout->addWidget(label, row, 0);
	m_ImagePathButton = new FadeButton(this);
	SetToolTips(tr("Image files are referenced relative to the *.oscwidgets.txt file"), label, m_ImagePathButton);
	m_ImagePathButton->setFixedSize(40, 40);
	connect(m_ImagePathButton, SIGNAL(clicked(bool)), this, SLOT(onImagePathButtonClicked(bool)));
	layout->addWidget(m_ImagePathButton, row, 1, 1, 2);

	++row;
	m_HiddenLabel = new QLabel(tr("Hidden"), this);
	layout->addWidget(m_HiddenLabel, row, 0);
	m_Hidden = new QCheckBox(this);
	SetToolTips(tr("Hide this widget"), label, m_ImagePathButton);
	connect(m_Hidden, SIGNAL(stateChanged(int)), this, SLOT(onHiddenStateChanged(int)));
	layout->addWidget(m_Hidden, row, 1, 1, 2);
	
	++row;
	m_Color = new QPushButton(tr("Color..."), this);
	connect(m_Color, SIGNAL(clicked(bool)), this, SLOT(onColorClicked(bool)));
	layout->addWidget(m_Color, row, 0, 1, 3);
	
	++row;
	m_TextColor = new QPushButton(tr("Text Color..."), this);
	connect(m_TextColor, SIGNAL(clicked(bool)), this, SLOT(onTextColorClicked(bool)));
	layout->addWidget(m_TextColor, row, 0, 1, 3);

	++row;
	QPushButton *button = new QPushButton(tr("Done"), this);
	connect(button, SIGNAL(clicked(bool)), this, SLOT(onDoneClicked(bool)));
	layout->addWidget(button, row, 0, 1, 3);

	++row;
	QGroupBox *group = new QGroupBox(tr("Notes"), this);
	group->setFixedWidth(200);
	QGridLayout *groupLayout = new QGridLayout(group);
	layout->addWidget(group, 0, 4, row, 1);

	m_Help = new QLabel(group);
	m_Help->setWordWrap(true);
	m_Help->setAlignment(Qt::AlignTop|Qt::AlignLeft);
	groupLayout->addWidget(m_Help, 0, 0);
}
Пример #5
0
void MixerToolBar::Populate()
{
   mPlayBitmap = new wxBitmap(theTheme.Bitmap(bmpSpeaker));

   Add(new wxStaticBitmap(this,
                          wxID_ANY, 
                          *mPlayBitmap), 0, wxALIGN_CENTER);

   mOutputSlider = new ASlider(this, wxID_ANY, _("Output Volume"),
                               wxDefaultPosition, wxSize(130, 25));
   mOutputSlider->SetName(_("Slider Output"));
   Add(mOutputSlider, 0, wxALIGN_CENTER);

   mRecordBitmap = new wxBitmap(theTheme.Bitmap(bmpMic));

   Add(new wxStaticBitmap(this,
                          wxID_ANY, 
                          *mRecordBitmap), 0, wxALIGN_CENTER);

   mInputSlider = new ASlider(this, wxID_ANY, _("Input Volume"),
                              wxDefaultPosition, wxSize(130, 25));
   mInputSlider->SetName(_("Slider Input"));
   Add(mInputSlider, 0, wxALIGN_CENTER);

   mInputSourceChoice = NULL;

   // this bit taken from SelectionBar::Populate()
   mOutputSlider->Connect(wxEVT_SET_FOCUS,
                 wxFocusEventHandler(MixerToolBar::OnFocus),
                 NULL,
                 this);
   mOutputSlider->Connect(wxEVT_KILL_FOCUS,
                 wxFocusEventHandler(MixerToolBar::OnFocus),
                 NULL,
                 this);
   mInputSlider->Connect(wxEVT_SET_FOCUS,
                 wxFocusEventHandler(MixerToolBar::OnFocus),
                 NULL,
                 this);
   mInputSlider->Connect(wxEVT_KILL_FOCUS,
                 wxFocusEventHandler(MixerToolBar::OnFocus),
                 NULL,
                 this);

#if USE_PORTMIXER
   wxArrayString inputSources = gAudioIO->GetInputSourceNames();

   mInputSourceChoice = new wxChoice(this,
                                     wxID_ANY,
                                     wxDefaultPosition,
                                     wxDefaultSize,
                                     inputSources);
   mInputSourceChoice->SetName(_("Input Source"));
   Add(mInputSourceChoice, 0, wxALIGN_CENTER | wxLEFT, 2);
   mInputSourceChoice->Connect(wxEVT_SET_FOCUS,
                 wxFocusEventHandler(MixerToolBar::OnFocus),
                 NULL,
                 this);

   // Set choice control to default value
   float inputVolume;
   float playbackVolume;
   int inputSource;
   gAudioIO->GetMixer(&inputSource, &inputVolume, &playbackVolume);
   mInputSourceChoice->SetSelection(inputSource);

   // Show or hide the control based on input sources
   mInputSourceChoice->Show( inputSources.GetCount() != 0 );

   // Show or hide the input slider based on whether it works
   mInputSlider->Enable(gAudioIO->InputMixerWorks());
   SetToolTips();

   UpdateControls();

#endif

   // Add a little space
   Add(2, -1);
}