Audacity  3.0.3
Public Member Functions | Private Member Functions | Private Attributes | List of all members
ExportMixerDialog Class Referencefinal

Dialog for advanced mixing. More...

#include <Export.h>

Inheritance diagram for ExportMixerDialog:
[legend]
Collaboration diagram for ExportMixerDialog:
[legend]

Public Member Functions

 ExportMixerDialog (const TrackList *tracks, bool selectedOnly, unsigned maxNumChannels, wxWindow *parent, wxWindowID id, const TranslatableString &title, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER)
 
virtual ~ExportMixerDialog ()
 
MixerSpecGetMixerSpec ()
 
- Public Member Functions inherited from wxDialogWrapper
 wxDialogWrapper ()
 
 wxDialogWrapper (wxWindow *parent, wxWindowID id, const TranslatableString &title, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxDEFAULT_DIALOG_STYLE, const TranslatableString &name=XO("Dialog"))
 
bool Create (wxWindow *parent, wxWindowID id, const TranslatableString &title, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxDEFAULT_DIALOG_STYLE, const TranslatableString &name=XO("Dialog"))
 
void SetTitle (const TranslatableString &title)
 
void SetLabel (const TranslatableString &title)
 
void SetName (const TranslatableString &title)
 
void SetName ()
 
- Public Member Functions inherited from wxTabTraversalWrapper< wxDialog >
 wxTabTraversalWrapper (Args &&... args)
 
 wxTabTraversalWrapper (const wxTabTraversalWrapper &)=delete
 
 wxTabTraversalWrapper (wxTabTraversalWrapper &&)=delete
 
wxTabTraversalWrapperoperator= (const wxTabTraversalWrapper &)=delete
 
wxTabTraversalWrapperoperator= (wxTabTraversalWrapper &&)=delete
 

Private Member Functions

void OnOk (wxCommandEvent &event)
 
void OnCancel (wxCommandEvent &event)
 
void OnMixerPanelHelp (wxCommandEvent &event)
 
void OnSlider (wxCommandEvent &event)
 
void OnSize (wxSizeEvent &event)
 

Private Attributes

wxStaticText * mChannelsText
 
std::unique_ptr< MixerSpecmMixerSpec
 
wxArrayString mTrackNames
 

Detailed Description

Dialog for advanced mixing.

Definition at line 298 of file Export.h.

Constructor & Destructor Documentation

◆ ExportMixerDialog()

ExportMixerDialog::ExportMixerDialog ( const TrackList tracks,
bool  selectedOnly,
unsigned  maxNumChannels,
wxWindow *  parent,
wxWindowID  id,
const TranslatableString title,
const wxPoint &  pos = wxDefaultPosition,
const wxSize &  size = wxDefaultSize,
long  style = wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER 
)

Definition at line 1374 of file Export.cpp.

1376  :
1377  wxDialogWrapper( parent, id, title, position, size, style | wxRESIZE_BORDER )
1378 {
1379  SetName();
1380 
1381  unsigned numTracks = 0;
1382 
1383  bool anySolo = !(( tracks->Any<const WaveTrack>() + &WaveTrack::GetSolo ).empty());
1384 
1385  for (auto t :
1386  tracks->Any< const WaveTrack >()
1387  + ( selectedOnly ? &Track::IsSelected : &Track::Any )
1388  - ( anySolo ? &WaveTrack::GetNotSolo : &WaveTrack::GetMute)
1389  ) {
1390  numTracks++;
1391  const wxString sTrackName = (t->GetName()).Left(20);
1392  if( t->GetChannel() == Track::LeftChannel )
1393  /* i18n-hint: track name and L abbreviating Left channel */
1394  mTrackNames.push_back( wxString::Format( _( "%s - L" ), sTrackName ) );
1395  else if( t->GetChannel() == Track::RightChannel )
1396  /* i18n-hint: track name and R abbreviating Right channel */
1397  mTrackNames.push_back( wxString::Format( _( "%s - R" ), sTrackName ) );
1398  else
1399  mTrackNames.push_back(sTrackName);
1400  }
1401 
1402  // JKC: This is an attempt to fix a 'watching brief' issue, where the slider is
1403  // sometimes not slidable. My suspicion is that a mixer may incorrectly
1404  // state the number of channels - so we assume there are always at least two.
1405  // The downside is that if someone is exporting to a mono device, the dialog
1406  // will allow them to output to two channels. Hmm. We may need to revisit this.
1407 
1408  if (maxNumChannels < 2 )
1409  // STF (April 2016): AMR (narrowband) and MP3 may export 1 channel.
1410  // maxNumChannels = 2;
1411  maxNumChannels = 1;
1412  if (maxNumChannels > 32)
1413  maxNumChannels = 32;
1414 
1415  mMixerSpec = std::make_unique<MixerSpec>(numTracks, maxNumChannels);
1416 
1417  auto label = XO("Output Channels: %2d")
1418  .Format( mMixerSpec->GetNumChannels() );
1419 
1420  ShuttleGui S{ this, eIsCreating };
1421  {
1422  S.SetBorder( 5 );
1423 
1424  auto mixerPanel = safenew ExportMixerPanel(
1425  S.GetParent(), ID_MIXERPANEL, mMixerSpec.get(),
1426  mTrackNames, wxDefaultPosition, wxSize(400, -1));
1427  S.Prop(1)
1428  .Name(XO("Mixer Panel"))
1429  .Position(wxEXPAND | wxALL)
1430  .AddWindow(mixerPanel);
1431 
1432  S.StartHorizontalLay(wxALIGN_CENTER | wxALL, 0);
1433  {
1434  mChannelsText = S.AddVariableText(
1435  label,
1436  false, wxALIGN_LEFT | wxALL );
1437 
1438  S
1439  .Id(ID_SLIDER_CHANNEL)
1440  .Name(label)
1441  .Size({300, -1})
1442  .Style(wxSL_HORIZONTAL)
1443  .Position(wxEXPAND | wxALL)
1444  .AddSlider( {},
1445  mMixerSpec->GetNumChannels(),
1446  mMixerSpec->GetMaxNumChannels(), 1 );
1447  }
1448  S.EndHorizontalLay();
1449 
1450  S.AddStandardButtons( eCancelButton | eOkButton | eHelpButton );
1451  }
1452 
1453  SetAutoLayout(true);
1454  GetSizer()->Fit( this );
1455  GetSizer()->SetSizeHints( this );
1456 
1457  SetSizeHints( 640, 480, 20000, 20000 );
1458 
1459  SetSize( 640, 480 );
1460  Center();
1461 }

References _, ShuttleGuiBase::AddSlider(), ShuttleGui::AddStandardButtons(), ShuttleGuiBase::AddVariableText(), ShuttleGuiBase::AddWindow(), Track::Any(), eCancelButton, eHelpButton, eIsCreating, ShuttleGuiBase::EndHorizontalLay(), eOkButton, PlayableTrack::GetMute(), PlayableTrack::GetNotSolo(), ShuttleGuiBase::GetParent(), PlayableTrack::GetSolo(), ShuttleGui::Id(), ID_MIXERPANEL, ID_SLIDER_CHANNEL, Track::IsSelected(), label, Track::LeftChannel, ShuttleGui::Name(), ShuttleGui::Position(), ShuttleGui::Prop(), Track::RightChannel, safenew, ShuttleGuiBase::SetBorder(), ShuttleGui::Size(), ShuttleGuiBase::StartHorizontalLay(), and XO.

Here is the call graph for this function:

◆ ~ExportMixerDialog()

ExportMixerDialog::~ExportMixerDialog ( )
virtual

Definition at line 1463 of file Export.cpp.

1464 {
1465 }

Member Function Documentation

◆ GetMixerSpec()

MixerSpec* ExportMixerDialog::GetMixerSpec ( )
inline

Definition at line 309 of file Export.h.

309 { return mMixerSpec.get(); }

Referenced by Exporter::CheckMix().

Here is the caller graph for this function:

◆ OnCancel()

void ExportMixerDialog::OnCancel ( wxCommandEvent &  event)
private

Definition at line 1491 of file Export.cpp.

1492 {
1493  EndModal( wxID_CANCEL );
1494 }

◆ OnMixerPanelHelp()

void ExportMixerDialog::OnMixerPanelHelp ( wxCommandEvent &  event)
private

Definition at line 1496 of file Export.cpp.

1497 {
1498  HelpSystem::ShowHelp(this, L"Advanced_Mixing_Options", true);
1499 }

References HelpSystem::ShowHelp().

Here is the call graph for this function:

◆ OnOk()

void ExportMixerDialog::OnOk ( wxCommandEvent &  event)
private

Definition at line 1486 of file Export.cpp.

1487 {
1488  EndModal( wxID_OK );
1489 }

◆ OnSize()

void ExportMixerDialog::OnSize ( wxSizeEvent &  event)
private

Definition at line 1467 of file Export.cpp.

1468 {
1469  ExportMixerPanel *pnl = ( ( ExportMixerPanel* ) FindWindow( ID_MIXERPANEL ) );
1470  pnl->Refresh( false );
1471  event.Skip();
1472 }

References ID_MIXERPANEL.

◆ OnSlider()

void ExportMixerDialog::OnSlider ( wxCommandEvent &  event)
private

Definition at line 1474 of file Export.cpp.

1475 {
1476  wxSlider *channels = ( wxSlider* )FindWindow( ID_SLIDER_CHANNEL );
1477  ExportMixerPanel *pnl = ( ( ExportMixerPanel* ) FindWindow( ID_MIXERPANEL ) );
1478  mMixerSpec->SetNumChannels( channels->GetValue() );
1479  pnl->Refresh( false );
1480  wxString label;
1481  label.Printf( _( "Output Channels: %2d" ), mMixerSpec->GetNumChannels() );
1482  mChannelsText->SetLabel( label );
1483  channels->SetName( label );
1484 }

References _, ID_MIXERPANEL, ID_SLIDER_CHANNEL, label, mChannelsText, and mMixerSpec.

Member Data Documentation

◆ mChannelsText

wxStaticText* ExportMixerDialog::mChannelsText
private

Definition at line 312 of file Export.h.

Referenced by OnSlider().

◆ mMixerSpec

std::unique_ptr<MixerSpec> ExportMixerDialog::mMixerSpec
private

Definition at line 313 of file Export.h.

Referenced by OnSlider().

◆ mTrackNames

wxArrayString ExportMixerDialog::mTrackNames
private

Definition at line 314 of file Export.h.


The documentation for this class was generated from the following files:
size
size_t size
Definition: ffmpeg-2.3.6-single-header.h:412
eIsCreating
@ eIsCreating
Definition: ShuttleGui.h:38
ExportMixerDialog::mChannelsText
wxStaticText * mChannelsText
Definition: Export.h:312
WaveTrack
A Track that contains audio waveform data.
Definition: WaveTrack.h:69
PlayableTrack::GetSolo
bool GetSolo() const
Definition: Track.h:861
PlayableTrack::GetMute
bool GetMute() const
Definition: Track.h:860
eHelpButton
@ eHelpButton
Definition: ShuttleGui.h:604
ID_MIXERPANEL
@ ID_MIXERPANEL
Definition: Export.cpp:1362
XO
#define XO(s)
Definition: Internat.h:31
Track::Any
bool Any() const
Definition: Track.cpp:370
HelpSystem::ShowHelp
static void ShowHelp(wxWindow *parent, const FilePath &localFileName, const URLString &remoteURL, bool bModal=false, bool alwaysDefaultBrowser=false)
Definition: HelpSystem.cpp:237
eCancelButton
@ eCancelButton
Definition: ShuttleGui.h:601
label
TranslatableString label
Definition: Tags.cpp:756
ExportMixerPanel
Panel that displays mixing for advanced mixing option.
Definition: Export.h:265
Track::RightChannel
@ RightChannel
Definition: Track.h:277
Track::IsSelected
bool IsSelected() const
Definition: Track.cpp:373
ExportMixerDialog::mTrackNames
wxArrayString mTrackNames
Definition: Export.h:314
PlayableTrack::GetNotSolo
bool GetNotSolo() const
Definition: Track.h:863
ID_SLIDER_CHANNEL
@ ID_SLIDER_CHANNEL
Definition: Export.cpp:1363
title
static const auto title
Definition: NoUpdatesAvailableDialog.cpp:22
eOkButton
@ eOkButton
Definition: ShuttleGui.h:600
_
#define _(s)
Definition: Internat.h:75
wxDialogWrapper::wxDialogWrapper
wxDialogWrapper()
Definition: wxPanelWrapper.h:84
TrackList::Any
auto Any() -> TrackIterRange< TrackType >
Definition: Track.h:1371
wxDialogWrapper::SetName
void SetName()
Definition: wxPanelWrapper.cpp:81
safenew
#define safenew
Definition: MemoryX.h:10
Track::LeftChannel
@ LeftChannel
Definition: Track.h:276
ShuttleGui
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
Definition: ShuttleGui.h:631
ExportMixerDialog::mMixerSpec
std::unique_ptr< MixerSpec > mMixerSpec
Definition: Export.h:313