mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-16 16:10:06 +02:00
Remove MixerToolbar
The mixer toolbar is redundant when PortMixer isn't supported Signed-off-by: akleja <storspov@gmail.com>
This commit is contained in:
parent
a39ee7f83c
commit
056de91cf7
@ -755,8 +755,6 @@ list( APPEND SOURCES
|
|||||||
toolbars/EditToolBar.h
|
toolbars/EditToolBar.h
|
||||||
toolbars/MeterToolBar.cpp
|
toolbars/MeterToolBar.cpp
|
||||||
toolbars/MeterToolBar.h
|
toolbars/MeterToolBar.h
|
||||||
toolbars/MixerToolBar.cpp
|
|
||||||
toolbars/MixerToolBar.h
|
|
||||||
toolbars/ScrubbingToolBar.cpp
|
toolbars/ScrubbingToolBar.cpp
|
||||||
toolbars/ScrubbingToolBar.h
|
toolbars/ScrubbingToolBar.h
|
||||||
toolbars/SelectionBar.cpp
|
toolbars/SelectionBar.cpp
|
||||||
|
@ -406,7 +406,6 @@ void MenuCreator::CreateMenusAndCommands(AudacityProject &project)
|
|||||||
{wxT("/View/Other/Toolbars/Toolbars/Other"), wxT(
|
{wxT("/View/Other/Toolbars/Toolbars/Other"), wxT(
|
||||||
"ShowTransportTB,ShowToolsTB,ShowRecordMeterTB,ShowPlayMeterTB,"
|
"ShowTransportTB,ShowToolsTB,ShowRecordMeterTB,ShowPlayMeterTB,"
|
||||||
//"ShowMeterTB,"
|
//"ShowMeterTB,"
|
||||||
"ShowMixerTB,"
|
|
||||||
"ShowEditTB,ShowTranscriptionTB,ShowScrubbingTB,ShowDeviceTB,ShowSelectionTB,"
|
"ShowEditTB,ShowTranscriptionTB,ShowScrubbingTB,ShowDeviceTB,ShowSelectionTB,"
|
||||||
"ShowSpectralSelectionTB") }
|
"ShowSpectralSelectionTB") }
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,6 @@ Paul Licameli split from AudacityProject.cpp
|
|||||||
#include "import/Import.h"
|
#include "import/Import.h"
|
||||||
#include "import/ImportMIDI.h"
|
#include "import/ImportMIDI.h"
|
||||||
#include "prefs/QualitySettings.h"
|
#include "prefs/QualitySettings.h"
|
||||||
#include "toolbars/MixerToolBar.h"
|
|
||||||
#include "toolbars/SelectionBar.h"
|
#include "toolbars/SelectionBar.h"
|
||||||
#include "toolbars/SpectralSelectionBar.h"
|
#include "toolbars/SpectralSelectionBar.h"
|
||||||
#include "toolbars/TimeToolBar.h"
|
#include "toolbars/TimeToolBar.h"
|
||||||
@ -991,9 +990,7 @@ void ProjectManager::OnTimer(wxTimerEvent& WXUNUSED(event))
|
|||||||
{
|
{
|
||||||
auto &project = mProject;
|
auto &project = mProject;
|
||||||
auto &projectAudioIO = ProjectAudioIO::Get( project );
|
auto &projectAudioIO = ProjectAudioIO::Get( project );
|
||||||
auto mixerToolBar = &MixerToolBar::Get( project );
|
|
||||||
mixerToolBar->UpdateControls();
|
|
||||||
|
|
||||||
auto gAudioIO = AudioIO::Get();
|
auto gAudioIO = AudioIO::Get();
|
||||||
// gAudioIO->GetNumCaptureChannels() should only be positive
|
// gAudioIO->GetNumCaptureChannels() should only be positive
|
||||||
// when we are recording.
|
// when we are recording.
|
||||||
|
@ -724,7 +724,6 @@ void ScreenshotBigDialog::OnCaptureSomething(wxCommandEvent & event)
|
|||||||
ScreenshotCommand::ktimer,
|
ScreenshotCommand::ktimer,
|
||||||
ScreenshotCommand::ktools,
|
ScreenshotCommand::ktools,
|
||||||
ScreenshotCommand::ktransport,
|
ScreenshotCommand::ktransport,
|
||||||
ScreenshotCommand::kmixer,
|
|
||||||
ScreenshotCommand::kmeter,
|
ScreenshotCommand::kmeter,
|
||||||
ScreenshotCommand::kplaymeter,
|
ScreenshotCommand::kplaymeter,
|
||||||
ScreenshotCommand::krecordmeter,
|
ScreenshotCommand::krecordmeter,
|
||||||
|
@ -66,7 +66,6 @@ kCaptureWhatStrings[ ScreenshotCommand::nCaptureWhats ] =
|
|||||||
{ XO("Timer") },
|
{ XO("Timer") },
|
||||||
{ XO("Tools") },
|
{ XO("Tools") },
|
||||||
{ XO("Transport") },
|
{ XO("Transport") },
|
||||||
{ XO("Mixer") },
|
|
||||||
{ XO("Meter") },
|
{ XO("Meter") },
|
||||||
{ wxT("PlayMeter"), XO("Play Meter") },
|
{ wxT("PlayMeter"), XO("Play Meter") },
|
||||||
{ wxT("RecordMeter"), XO("Record Meter") },
|
{ wxT("RecordMeter"), XO("Record Meter") },
|
||||||
@ -814,8 +813,6 @@ bool ScreenshotCommand::Apply(const CommandContext & context)
|
|||||||
return CaptureToolbar(context, &toolManager, ToolsBarID, mFileName);
|
return CaptureToolbar(context, &toolManager, ToolsBarID, mFileName);
|
||||||
case ktransport:
|
case ktransport:
|
||||||
return CaptureToolbar(context, &toolManager, TransportBarID, mFileName);
|
return CaptureToolbar(context, &toolManager, TransportBarID, mFileName);
|
||||||
case kmixer:
|
|
||||||
return CaptureToolbar(context, &toolManager, MixerBarID, mFileName);
|
|
||||||
case kmeter:
|
case kmeter:
|
||||||
return CaptureToolbar(context, &toolManager, MeterBarID, mFileName);
|
return CaptureToolbar(context, &toolManager, MeterBarID, mFileName);
|
||||||
case krecordmeter:
|
case krecordmeter:
|
||||||
|
@ -54,7 +54,6 @@ public:
|
|||||||
ktimer,
|
ktimer,
|
||||||
ktools,
|
ktools,
|
||||||
ktransport,
|
ktransport,
|
||||||
kmixer,
|
|
||||||
kmeter,
|
kmeter,
|
||||||
kplaymeter,
|
kplaymeter,
|
||||||
krecordmeter,
|
krecordmeter,
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
#include "../Project.h"
|
#include "../Project.h"
|
||||||
#include "../commands/CommandContext.h"
|
#include "../commands/CommandContext.h"
|
||||||
#include "../commands/CommandManager.h"
|
#include "../commands/CommandManager.h"
|
||||||
#include "../toolbars/MixerToolBar.h"
|
|
||||||
#include "../toolbars/DeviceToolBar.h"
|
#include "../toolbars/DeviceToolBar.h"
|
||||||
|
|
||||||
#include <wx/frame.h>
|
#include <wx/frame.h>
|
||||||
@ -23,66 +22,6 @@ namespace ExtraActions {
|
|||||||
|
|
||||||
struct Handler : CommandHandlerObject {
|
struct Handler : CommandHandlerObject {
|
||||||
|
|
||||||
void OnOutputGain(const CommandContext &context)
|
|
||||||
{
|
|
||||||
auto &project = context.project;
|
|
||||||
auto tb = &MixerToolBar::Get( project );
|
|
||||||
|
|
||||||
if (tb) {
|
|
||||||
tb->ShowOutputGainDialog();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void OnOutputGainInc(const CommandContext &context)
|
|
||||||
{
|
|
||||||
auto &project = context.project;
|
|
||||||
auto tb = &MixerToolBar::Get( project );
|
|
||||||
|
|
||||||
if (tb) {
|
|
||||||
tb->AdjustOutputGain(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void OnOutputGainDec(const CommandContext &context)
|
|
||||||
{
|
|
||||||
auto &project = context.project;
|
|
||||||
auto tb = &MixerToolBar::Get( project );
|
|
||||||
|
|
||||||
if (tb) {
|
|
||||||
tb->AdjustOutputGain(-1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void OnInputGain(const CommandContext &context)
|
|
||||||
{
|
|
||||||
auto &project = context.project;
|
|
||||||
auto tb = &MixerToolBar::Get( project );
|
|
||||||
|
|
||||||
if (tb) {
|
|
||||||
tb->ShowInputGainDialog();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void OnInputGainInc(const CommandContext &context)
|
|
||||||
{
|
|
||||||
auto &project = context.project;
|
|
||||||
auto tb = &MixerToolBar::Get( project );
|
|
||||||
|
|
||||||
if (tb) {
|
|
||||||
tb->AdjustInputGain(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void OnInputGainDec(const CommandContext &context)
|
|
||||||
{
|
|
||||||
auto &project = context.project;
|
|
||||||
auto tb = &MixerToolBar::Get( project );
|
|
||||||
|
|
||||||
if (tb) {
|
|
||||||
tb->AdjustInputGain(-1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void OnInputDevice(const CommandContext &context)
|
void OnInputDevice(const CommandContext &context)
|
||||||
{
|
{
|
||||||
auto &project = context.project;
|
auto &project = context.project;
|
||||||
@ -140,7 +79,6 @@ static CommandHandlerObject &findCommandHandler(AudacityProject &) {
|
|||||||
namespace {
|
namespace {
|
||||||
using namespace MenuTable;
|
using namespace MenuTable;
|
||||||
|
|
||||||
BaseItemSharedPtr ExtraMixerMenu();
|
|
||||||
BaseItemSharedPtr ExtraDeviceMenu();
|
BaseItemSharedPtr ExtraDeviceMenu();
|
||||||
|
|
||||||
BaseItemSharedPtr ExtraMenu()
|
BaseItemSharedPtr ExtraMenu()
|
||||||
@ -149,8 +87,7 @@ BaseItemSharedPtr ExtraMenu()
|
|||||||
// TODO: devise a registration system instead.
|
// TODO: devise a registration system instead.
|
||||||
static BaseItemSharedPtr extraItems{ Items( wxEmptyString,
|
static BaseItemSharedPtr extraItems{ Items( wxEmptyString,
|
||||||
Section( "Part1",
|
Section( "Part1",
|
||||||
ExtraMixerMenu()
|
ExtraDeviceMenu()
|
||||||
, ExtraDeviceMenu()
|
|
||||||
),
|
),
|
||||||
|
|
||||||
Section( "Part2" )
|
Section( "Part2" )
|
||||||
@ -170,28 +107,6 @@ AttachedItem sAttachment1{
|
|||||||
Shared( ExtraMenu() )
|
Shared( ExtraMenu() )
|
||||||
};
|
};
|
||||||
|
|
||||||
// Under /MenuBar/Optional/Extra/Part1
|
|
||||||
BaseItemSharedPtr ExtraMixerMenu()
|
|
||||||
{
|
|
||||||
static BaseItemSharedPtr menu{
|
|
||||||
( FinderScope{ findCommandHandler },
|
|
||||||
Menu( wxT("Mixer"), XXO("Mi&xer"),
|
|
||||||
Command( wxT("OutputGain"), XXO("Ad&just Playback Volume..."),
|
|
||||||
FN(OnOutputGain), AlwaysEnabledFlag ),
|
|
||||||
Command( wxT("OutputGainInc"), XXO("&Increase Playback Volume"),
|
|
||||||
FN(OnOutputGainInc), AlwaysEnabledFlag ),
|
|
||||||
Command( wxT("OutputGainDec"), XXO("&Decrease Playback Volume"),
|
|
||||||
FN(OnOutputGainDec), AlwaysEnabledFlag ),
|
|
||||||
Command( wxT("InputGain"), XXO("Adj&ust Recording Volume..."),
|
|
||||||
FN(OnInputGain), AlwaysEnabledFlag ),
|
|
||||||
Command( wxT("InputGainInc"), XXO("I&ncrease Recording Volume"),
|
|
||||||
FN(OnInputGainInc), AlwaysEnabledFlag ),
|
|
||||||
Command( wxT("InputGainDec"), XXO("D&ecrease Recording Volume"),
|
|
||||||
FN(OnInputGainDec), AlwaysEnabledFlag )
|
|
||||||
) ) };
|
|
||||||
return menu;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Under /MenuBar/Optional/Extra/Part1
|
// Under /MenuBar/Optional/Extra/Part1
|
||||||
BaseItemSharedPtr ExtraDeviceMenu()
|
BaseItemSharedPtr ExtraDeviceMenu()
|
||||||
{
|
{
|
||||||
|
@ -1,345 +0,0 @@
|
|||||||
/**********************************************************************
|
|
||||||
|
|
||||||
Audacity: A Digital Audio Editor
|
|
||||||
|
|
||||||
MixerToolBar.cpp
|
|
||||||
|
|
||||||
Dominic Mazzoni
|
|
||||||
|
|
||||||
*******************************************************************//*!
|
|
||||||
|
|
||||||
\class MixerToolBar
|
|
||||||
\brief A ToolBar that provides the record and playback volume settings.
|
|
||||||
|
|
||||||
*//*******************************************************************/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include "MixerToolBar.h"
|
|
||||||
|
|
||||||
#include "ToolManager.h"
|
|
||||||
|
|
||||||
// For compilers that support precompilation, includes "wx/wx.h".
|
|
||||||
#include <wx/wxprec.h>
|
|
||||||
|
|
||||||
#ifndef WX_PRECOMP
|
|
||||||
#include <wx/choice.h>
|
|
||||||
#include <wx/event.h>
|
|
||||||
#include <wx/intl.h>
|
|
||||||
#include <wx/settings.h>
|
|
||||||
#include <wx/sizer.h>
|
|
||||||
#include <wx/statbmp.h>
|
|
||||||
#include <wx/tooltip.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "../AColor.h"
|
|
||||||
#include "../AllThemeResources.h"
|
|
||||||
#include "../AudioIO.h"
|
|
||||||
#include "../ImageManipulation.h"
|
|
||||||
#include "../KeyboardCapture.h"
|
|
||||||
#include "../Prefs.h"
|
|
||||||
#include "../widgets/ASlider.h"
|
|
||||||
#include "../widgets/Grabber.h"
|
|
||||||
|
|
||||||
IMPLEMENT_CLASS(MixerToolBar, ToolBar);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
/// Methods for MixerToolBar
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(MixerToolBar, ToolBar)
|
|
||||||
EVT_PAINT(MixerToolBar::OnPaint)
|
|
||||||
EVT_SLIDER(wxID_ANY, MixerToolBar::SetMixer)
|
|
||||||
EVT_CHOICE(wxID_ANY, MixerToolBar::SetMixer)
|
|
||||||
EVT_COMMAND(wxID_ANY, EVT_CAPTURE_KEY, MixerToolBar::OnCaptureKey)
|
|
||||||
END_EVENT_TABLE()
|
|
||||||
|
|
||||||
//Standard constructor
|
|
||||||
MixerToolBar::MixerToolBar( AudacityProject &project )
|
|
||||||
: ToolBar(project, MixerBarID, XO("Mixer"), wxT("Mixer"), true)
|
|
||||||
{
|
|
||||||
mInputSliderVolume = 0.0;
|
|
||||||
mOutputSliderVolume = 0.0;
|
|
||||||
mEnabled = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
MixerToolBar::~MixerToolBar()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
MixerToolBar &MixerToolBar::Get( AudacityProject &project )
|
|
||||||
{
|
|
||||||
auto &toolManager = ToolManager::Get( project );
|
|
||||||
return *static_cast<MixerToolBar*>( toolManager.GetToolBar(MixerBarID) );
|
|
||||||
}
|
|
||||||
|
|
||||||
const MixerToolBar &MixerToolBar::Get( const AudacityProject &project )
|
|
||||||
{
|
|
||||||
return Get( const_cast<AudacityProject&>( project )) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
void MixerToolBar::Create(wxWindow *parent)
|
|
||||||
{
|
|
||||||
ToolBar::Create(parent);
|
|
||||||
UpdatePrefs();
|
|
||||||
}
|
|
||||||
|
|
||||||
void MixerToolBar::Populate()
|
|
||||||
{
|
|
||||||
SetBackgroundColour( theTheme.Colour( clrMedium ) );
|
|
||||||
// Recording icon and slider
|
|
||||||
Add(safenew AStaticBitmap(this,
|
|
||||||
wxID_ANY,
|
|
||||||
theTheme.Bitmap(bmpMic)), 0, wxALIGN_CENTER);
|
|
||||||
mInputSlider = safenew ASlider(this, wxID_ANY, XO("Recording Volume"),
|
|
||||||
wxDefaultPosition, wxSize(130, 25),
|
|
||||||
ASlider::Options{}.Line( 0.1f ).Page( 2.0f ));
|
|
||||||
Add(mInputSlider, 1, wxALIGN_CENTER);
|
|
||||||
mInputSlider->SetSizeHints(wxSize(75, 25), wxSize(1000, 25));
|
|
||||||
|
|
||||||
// Playback icon and slider
|
|
||||||
Add(safenew AStaticBitmap(this,
|
|
||||||
wxID_ANY,
|
|
||||||
theTheme.Bitmap(bmpSpeaker)), 0, wxALIGN_CENTER);
|
|
||||||
mOutputSlider = safenew ASlider(this, wxID_ANY, XO("Playback Volume"),
|
|
||||||
wxDefaultPosition, wxSize(130, 25),
|
|
||||||
ASlider::Options{}.Line( 0.1f ).Page( 2.0f ));
|
|
||||||
Add(mOutputSlider, 1, wxALIGN_CENTER);
|
|
||||||
mOutputSlider->SetSizeHints(wxSize(75, 25), wxSize(1000, 25));
|
|
||||||
|
|
||||||
// this bit taken from SelectionBar::Populate()
|
|
||||||
mInputSlider->Bind(wxEVT_SET_FOCUS,
|
|
||||||
&MixerToolBar::OnFocus,
|
|
||||||
this);
|
|
||||||
mInputSlider->Bind(wxEVT_KILL_FOCUS,
|
|
||||||
&MixerToolBar::OnFocus,
|
|
||||||
this);
|
|
||||||
mOutputSlider->Bind(wxEVT_SET_FOCUS,
|
|
||||||
&MixerToolBar::OnFocus,
|
|
||||||
this);
|
|
||||||
mOutputSlider->Bind(wxEVT_KILL_FOCUS,
|
|
||||||
&MixerToolBar::OnFocus,
|
|
||||||
this);
|
|
||||||
// Show or hide the input slider based on whether it works
|
|
||||||
auto gAudioIO = AudioIO::Get();
|
|
||||||
mInputSlider->Enable(mEnabled && gAudioIO->InputMixerWorks());
|
|
||||||
mOutputSlider->Enable(mEnabled);
|
|
||||||
|
|
||||||
UpdateControls();
|
|
||||||
|
|
||||||
// Add a little space
|
|
||||||
Add(2, -1);
|
|
||||||
|
|
||||||
// Listen for capture events
|
|
||||||
wxTheApp->Bind(EVT_AUDIOIO_CAPTURE,
|
|
||||||
&MixerToolBar::OnAudioCapture,
|
|
||||||
this);
|
|
||||||
}
|
|
||||||
|
|
||||||
void MixerToolBar::OnAudioCapture(wxCommandEvent & event)
|
|
||||||
{
|
|
||||||
event.Skip();
|
|
||||||
|
|
||||||
AudacityProject *p = &mProject;
|
|
||||||
if ((AudacityProject *) event.GetEventObject() != p)
|
|
||||||
{
|
|
||||||
mEnabled = !event.GetInt();
|
|
||||||
mInputSlider->Enable(mEnabled);
|
|
||||||
mOutputSlider->Enable(mEnabled);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//Also from SelectionBar;
|
|
||||||
void MixerToolBar::OnFocus(wxFocusEvent &event)
|
|
||||||
{
|
|
||||||
KeyboardCapture::OnFocus( *this, event );
|
|
||||||
}
|
|
||||||
|
|
||||||
void MixerToolBar::OnCaptureKey(wxCommandEvent &event)
|
|
||||||
{
|
|
||||||
wxKeyEvent *kevent = (wxKeyEvent *)event.GetEventObject();
|
|
||||||
int keyCode = kevent->GetKeyCode();
|
|
||||||
|
|
||||||
// Pass LEFT/RIGHT/UP/DOWN/PAGEUP/PAGEDOWN through for input/output sliders
|
|
||||||
if (FindFocus() == mInputSlider && (keyCode == WXK_LEFT || keyCode == WXK_RIGHT
|
|
||||||
|| keyCode == WXK_UP || keyCode == WXK_DOWN
|
|
||||||
|| keyCode == WXK_PAGEUP || keyCode == WXK_PAGEDOWN)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (FindFocus() == mOutputSlider && (keyCode == WXK_LEFT || keyCode == WXK_RIGHT
|
|
||||||
|| keyCode == WXK_UP || keyCode == WXK_DOWN
|
|
||||||
|| keyCode == WXK_PAGEUP || keyCode == WXK_PAGEDOWN)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
event.Skip();
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
void MixerToolBar::UpdatePrefs()
|
|
||||||
{
|
|
||||||
#if USE_PORTMIXER
|
|
||||||
float inputVolume;
|
|
||||||
float playbackVolume;
|
|
||||||
int inputSource;
|
|
||||||
|
|
||||||
// Reset the selected source
|
|
||||||
auto gAudioIO = AudioIO::Get();
|
|
||||||
gAudioIO->GetMixer(&inputSource, &inputVolume, &playbackVolume);
|
|
||||||
|
|
||||||
// Show or hide the input slider based on whether it works
|
|
||||||
mInputSlider->Enable(mEnabled && gAudioIO->InputMixerWorks());
|
|
||||||
Layout();
|
|
||||||
|
|
||||||
// This code is from before the mixer toolbar was resizable.
|
|
||||||
// Now that it is resizable we trust the user to resize the mixer toolbar themselves.
|
|
||||||
#if 0
|
|
||||||
wxSize oldSize( GetSize() );
|
|
||||||
// Layout the toolbar
|
|
||||||
Layout();
|
|
||||||
// Resize the toolbar to fit the contents
|
|
||||||
//Fit();
|
|
||||||
// And make that size the minimum
|
|
||||||
wxSize newMinSize( wxWindow::GetSizer()->GetMinSize() );
|
|
||||||
SetMinSize( newMinSize );
|
|
||||||
// IF size must increase, do so.
|
|
||||||
if( newMinSize.x > oldSize.x ){
|
|
||||||
SetSize( newMinSize );
|
|
||||||
// Notify someone that we've changed our size
|
|
||||||
Updated();
|
|
||||||
}
|
|
||||||
// ELSE preserve original size.
|
|
||||||
else
|
|
||||||
SetSize( oldSize );
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Set label to pull in language change
|
|
||||||
SetLabel(XO("Mixer"));
|
|
||||||
|
|
||||||
RegenerateTooltips();
|
|
||||||
|
|
||||||
// Give base class a chance
|
|
||||||
ToolBar::UpdatePrefs();
|
|
||||||
}
|
|
||||||
|
|
||||||
void MixerToolBar::UpdateControls()
|
|
||||||
{
|
|
||||||
#if USE_PORTMIXER
|
|
||||||
float inputVolume;
|
|
||||||
float playbackVolume;
|
|
||||||
int inputSource;
|
|
||||||
|
|
||||||
// Show or hide the input slider based on whether it works
|
|
||||||
auto gAudioIO = AudioIO::Get();
|
|
||||||
mInputSlider->Enable(mEnabled && 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
|
|
||||||
}
|
|
||||||
|
|
||||||
void MixerToolBar::SetMixer(wxCommandEvent & WXUNUSED(event))
|
|
||||||
{
|
|
||||||
#if USE_PORTMIXER
|
|
||||||
float inputVolume = mInputSlider->Get();
|
|
||||||
float outputVolume = mOutputSlider->Get();
|
|
||||||
float oldIn, oldOut;
|
|
||||||
int inputSource;
|
|
||||||
|
|
||||||
auto gAudioIO = AudioIO::Get();
|
|
||||||
gAudioIO->GetMixer(&inputSource, &oldIn, &oldOut);
|
|
||||||
gAudioIO->SetMixer(inputSource, inputVolume, outputVolume);
|
|
||||||
mOutputSliderVolume = outputVolume;
|
|
||||||
mInputSliderVolume = inputVolume;
|
|
||||||
SetToolTips();
|
|
||||||
#endif // USE_PORTMIXER
|
|
||||||
}
|
|
||||||
|
|
||||||
void MixerToolBar::ShowOutputGainDialog()
|
|
||||||
{
|
|
||||||
mOutputSlider->ShowDialog();
|
|
||||||
wxCommandEvent e;
|
|
||||||
SetMixer(e);
|
|
||||||
UpdateControls();
|
|
||||||
}
|
|
||||||
|
|
||||||
void MixerToolBar::ShowInputGainDialog()
|
|
||||||
{
|
|
||||||
mInputSlider->ShowDialog();
|
|
||||||
wxCommandEvent e;
|
|
||||||
SetMixer(e);
|
|
||||||
UpdateControls();
|
|
||||||
}
|
|
||||||
|
|
||||||
void MixerToolBar::AdjustOutputGain(int adj)
|
|
||||||
{
|
|
||||||
if (adj < 0) {
|
|
||||||
mOutputSlider->Decrease(-adj);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
mOutputSlider->Increase(adj);
|
|
||||||
}
|
|
||||||
wxCommandEvent e;
|
|
||||||
SetMixer(e);
|
|
||||||
UpdateControls();
|
|
||||||
}
|
|
||||||
|
|
||||||
void MixerToolBar::AdjustInputGain(int adj)
|
|
||||||
{
|
|
||||||
if (adj < 0) {
|
|
||||||
mInputSlider->Decrease(-adj);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
mInputSlider->Increase(adj);
|
|
||||||
}
|
|
||||||
wxCommandEvent e;
|
|
||||||
SetMixer(e);
|
|
||||||
UpdateControls();
|
|
||||||
}
|
|
||||||
|
|
||||||
void MixerToolBar::SetToolTips()
|
|
||||||
{
|
|
||||||
if (mInputSlider->IsEnabled()) {
|
|
||||||
mInputSlider->SetToolTipTemplate(XO("Recording Volume: %.2f"));
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
mInputSlider->SetToolTipTemplate(XO("Recording Volume (Unavailable; use system mixer.)"));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mOutputSlider->IsEnabled()) {
|
|
||||||
auto format = (AudioIO::Get()->OutputMixerEmulated()
|
|
||||||
? XO("Playback Volume: %.2f (emulated)")
|
|
||||||
: XO("Playback Volume: %.2f"));
|
|
||||||
|
|
||||||
mOutputSlider->SetToolTipTemplate( format );
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
mOutputSlider->SetToolTipTemplate(XO("Playback Volume (Unavailable; use system mixer.)"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static RegisteredToolbarFactory factory{ MixerBarID,
|
|
||||||
[]( AudacityProject &project ){
|
|
||||||
return ToolBar::Holder{ safenew MixerToolBar{ project } }; }
|
|
||||||
};
|
|
||||||
|
|
||||||
namespace {
|
|
||||||
AttachedToolBarMenuItem sAttachment{
|
|
||||||
/* i18n-hint: Clicking this menu item shows the toolbar
|
|
||||||
with the mixer */
|
|
||||||
MixerBarID, wxT("ShowMixerTB"), XXO("Mi&xer Toolbar")
|
|
||||||
};
|
|
||||||
}
|
|
@ -1,79 +0,0 @@
|
|||||||
/**********************************************************************
|
|
||||||
|
|
||||||
Audacity: A Digital Audio Editor
|
|
||||||
|
|
||||||
MixerToolbar.h
|
|
||||||
|
|
||||||
Dominic Mazzoni
|
|
||||||
|
|
||||||
**********************************************************************/
|
|
||||||
|
|
||||||
#ifndef __AUDACITY_MIXER_TOOLBAR__
|
|
||||||
#define __AUDACITY_MIXER_TOOLBAR__
|
|
||||||
|
|
||||||
#include "ToolBar.h"
|
|
||||||
|
|
||||||
class wxSize;
|
|
||||||
class wxPoint;
|
|
||||||
|
|
||||||
class ASlider;
|
|
||||||
class AudacityProject;
|
|
||||||
|
|
||||||
class MixerToolBar final : public ToolBar {
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
MixerToolBar( AudacityProject &project );
|
|
||||||
virtual ~MixerToolBar();
|
|
||||||
|
|
||||||
static MixerToolBar &Get( AudacityProject &project );
|
|
||||||
static const MixerToolBar &Get( const AudacityProject &project );
|
|
||||||
|
|
||||||
void Create(wxWindow * parent) override;
|
|
||||||
|
|
||||||
void UpdatePrefs() override;
|
|
||||||
void UpdateControls();
|
|
||||||
void SetMixer(wxCommandEvent &event);
|
|
||||||
|
|
||||||
void Populate() override;
|
|
||||||
void Repaint(wxDC * WXUNUSED(dc)) override {};
|
|
||||||
void EnableDisableButtons() override {};
|
|
||||||
int GetMinToolbarWidth() override { return 250; }
|
|
||||||
int GetInitialWidth() override { return 327; }
|
|
||||||
|
|
||||||
void OnFocus(wxFocusEvent &event);
|
|
||||||
void OnCaptureKey(wxCommandEvent &event);
|
|
||||||
|
|
||||||
void OnSlider(wxCommandEvent & event);
|
|
||||||
|
|
||||||
void OnAudioCapture(wxCommandEvent & event);
|
|
||||||
|
|
||||||
void ShowOutputGainDialog();
|
|
||||||
void ShowInputGainDialog();
|
|
||||||
|
|
||||||
void AdjustOutputGain(int adj);
|
|
||||||
void AdjustInputGain(int adj);
|
|
||||||
|
|
||||||
void RegenerateTooltips() override {};
|
|
||||||
|
|
||||||
protected:
|
|
||||||
float mInputSliderVolume;
|
|
||||||
float mOutputSliderVolume;
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
void InitializeMixerToolBar();
|
|
||||||
void SetToolTips();
|
|
||||||
|
|
||||||
ASlider *mInputSlider;
|
|
||||||
ASlider *mOutputSlider;
|
|
||||||
bool mEnabled;
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
DECLARE_CLASS(MixerToolBar)
|
|
||||||
DECLARE_EVENT_TABLE()
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
@ -74,7 +74,6 @@ enum ToolBarID
|
|||||||
MeterBarID,
|
MeterBarID,
|
||||||
RecordMeterBarID,
|
RecordMeterBarID,
|
||||||
PlayMeterBarID,
|
PlayMeterBarID,
|
||||||
MixerBarID,
|
|
||||||
EditBarID,
|
EditBarID,
|
||||||
TranscriptionBarID,
|
TranscriptionBarID,
|
||||||
ScrubbingBarID,
|
ScrubbingBarID,
|
||||||
|
@ -533,8 +533,7 @@ static struct DefaultConfigEntry {
|
|||||||
{ ToolsBarID, TransportBarID, NoBarID },
|
{ ToolsBarID, TransportBarID, NoBarID },
|
||||||
{ RecordMeterBarID, ToolsBarID, NoBarID },
|
{ RecordMeterBarID, ToolsBarID, NoBarID },
|
||||||
{ PlayMeterBarID, RecordMeterBarID, NoBarID },
|
{ PlayMeterBarID, RecordMeterBarID, NoBarID },
|
||||||
{ MixerBarID, PlayMeterBarID, NoBarID },
|
{ EditBarID, PlayMeterBarID, NoBarID },
|
||||||
{ EditBarID, MixerBarID, NoBarID },
|
|
||||||
|
|
||||||
// DA: Transcription Toolbar not docked, by default.
|
// DA: Transcription Toolbar not docked, by default.
|
||||||
#ifdef EXPERIMENTAL_DA
|
#ifdef EXPERIMENTAL_DA
|
||||||
|
Loading…
x
Reference in New Issue
Block a user