Audacity  2.2.2
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:
wxDialogWrapper wxTabTraversalWrapper< wxDialog >

Public Member Functions

 ExportMixerDialog (const TrackList *tracks, bool selectedOnly, unsigned maxNumChannels, wxWindow *parent, wxWindowID id, const wxString &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 wxString &title, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxDEFAULT_DIALOG_STYLE, const wxString &name=_("Dialog"))
 
bool Create (wxWindow *parent, wxWindowID id, const wxString &title, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxDEFAULT_DIALOG_STYLE, const wxString &name=_("Dialog"))
 
- Public Member Functions inherited from wxTabTraversalWrapper< wxDialog >
 wxTabTraversalWrapper (Args &&...args)
 

Private Member Functions

void OnOk (wxCommandEvent &event)
 
void OnCancel (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 269 of file Export.h.

Constructor & Destructor Documentation

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

Definition at line 1261 of file Export.cpp.

References _(), CreateStdButtonSizer(), eCancelButton, eOkButton, TrackListConstIterator::First(), ID_MIXERPANEL, label, Track::LeftChannel, TrackListConstIterator::Next(), Track::RightChannel, safenew, and Track::Wave.

1263  :
1264  wxDialogWrapper( parent, id, title, position, size, style | wxRESIZE_BORDER )
1265 {
1266  SetName(GetTitle());
1267 
1268  unsigned numTracks = 0;
1269  TrackListConstIterator iter( tracks );
1270 
1271  for( const Track *t = iter.First(); t; t = iter.Next() )
1272  {
1273  auto wt = static_cast<const WaveTrack *>(t);
1274  if( t->GetKind() == Track::Wave && ( t->GetSelected() || !selectedOnly ) &&
1275  !wt->GetMute() )
1276  {
1277  numTracks++;
1278  const wxString sTrackName = (t->GetName()).Left(20);
1279  if( t->GetChannel() == Track::LeftChannel )
1280  /* i18n-hint: track name and L abbreviating Left channel */
1281  mTrackNames.Add( wxString::Format( _( "%s - L" ), sTrackName ) );
1282  else if( t->GetChannel() == Track::RightChannel )
1283  /* i18n-hint: track name and R abbreviating Right channel */
1284  mTrackNames.Add( wxString::Format( _( "%s - R" ), sTrackName ) );
1285  else
1286  mTrackNames.Add(sTrackName);
1287  }
1288  }
1289 
1290  // JKC: This is an attempt to fix a 'watching brief' issue, where the slider is
1291  // sometimes not slidable. My suspicion is that a mixer may incorrectly
1292  // state the number of channels - so we assume there are always at least two.
1293  // The downside is that if someone is exporting to a mono device, the dialog
1294  // will allow them to output to two channels. Hmm. We may need to revisit this.
1295 
1296  if (maxNumChannels < 2 )
1297  // STF (April 2016): AMR (narrowband) and MP3 may export 1 channel.
1298  // maxNumChannels = 2;
1299  maxNumChannels = 1;
1300  if (maxNumChannels > 32)
1301  maxNumChannels = 32;
1302 
1303  mMixerSpec = std::make_unique<MixerSpec>(numTracks, maxNumChannels);
1304 
1305  wxBoxSizer *vertSizer;
1306  {
1307  auto uVertSizer = std::make_unique<wxBoxSizer>(wxVERTICAL);
1308  vertSizer = uVertSizer.get();
1309 
1310  wxWindow *mixerPanel = safenew ExportMixerPanel(this, ID_MIXERPANEL,
1311  mMixerSpec.get(), mTrackNames,
1312  wxDefaultPosition, wxSize(400, -1));
1313  mixerPanel->SetName(_("Mixer Panel"));
1314  vertSizer->Add(mixerPanel, 1, wxEXPAND | wxALIGN_CENTRE | wxALL, 5);
1315 
1316  {
1317  auto horSizer = std::make_unique<wxBoxSizer>(wxHORIZONTAL);
1318 
1319  wxString label;
1320  label.Printf(_("Output Channels: %2d"), mMixerSpec->GetNumChannels());
1321  mChannelsText = safenew wxStaticText(this, -1, label);
1322  horSizer->Add(mChannelsText, 0, wxALIGN_LEFT | wxALL, 5);
1323 
1324  wxSlider *channels = safenew wxSlider(this, ID_SLIDER_CHANNEL,
1325  mMixerSpec->GetNumChannels(), 1, mMixerSpec->GetMaxNumChannels(),
1326  wxDefaultPosition, wxSize(300, -1));
1327  channels->SetName(label);
1328  horSizer->Add(channels, 0, wxEXPAND | wxALL, 5);
1329 
1330  vertSizer->Add(horSizer.release(), 0, wxALIGN_CENTRE | wxALL, 5);
1331  }
1332 
1333  vertSizer->Add(CreateStdButtonSizer(this, eCancelButton | eOkButton).release(), 0, wxEXPAND);
1334 
1335  SetAutoLayout(true);
1336  SetSizer(uVertSizer.release());
1337  }
1338 
1339  vertSizer->Fit( this );
1340  vertSizer->SetSizeHints( this );
1341 
1342  SetSizeHints( 640, 480, 20000, 20000 );
1343 
1344  SetSize( 640, 480 );
1345  Center();
1346 }
std::unique_ptr< wxSizer > CreateStdButtonSizer(wxWindow *parent, long buttons, wxWindow *extra)
std::unique_ptr< MixerSpec > mMixerSpec
Definition: Export.h:284
wxStaticText * mChannelsText
Definition: Export.h:283
wxString label
Definition: Tags.cpp:727
wxArrayString mTrackNames
Definition: Export.h:285
#define safenew
Definition: Audacity.h:230
A Track that contains audio waveform data.
Definition: WaveTrack.h:60
Fundamental data object of Audacity, placed in the TrackPanel. Classes derived form it include the Wa...
Definition: Track.h:102
_("Move Track &Down")+wxT("\t")+(GetActiveProject() -> GetCommandManager() ->GetKeyFromName(wxT("TrackMoveDown")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveTopID, _("Move Track to &Top")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveTop")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveBottomID, _("Move Track to &Bottom")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveBottom")).Raw()), OnMoveTrack)#define SET_TRACK_NAME_PLUGIN_SYMBOLclass SetTrackNameCommand:public AudacityCommand
Panel that displays mixing for advanced mixing option.
Definition: Export.h:235
ExportMixerDialog::~ExportMixerDialog ( )
virtual

Definition at line 1348 of file Export.cpp.

1349 {
1350 }

Member Function Documentation

MixerSpec* ExportMixerDialog::GetMixerSpec ( )
inline

Definition at line 280 of file Export.h.

References mMixerSpec.

280 { return mMixerSpec.get(); }
std::unique_ptr< MixerSpec > mMixerSpec
Definition: Export.h:284
void ExportMixerDialog::OnCancel ( wxCommandEvent &  event)
private

Definition at line 1376 of file Export.cpp.

1377 {
1378  EndModal( wxID_CANCEL );
1379 }
void ExportMixerDialog::OnOk ( wxCommandEvent &  event)
private

Definition at line 1371 of file Export.cpp.

1372 {
1373  EndModal( wxID_OK );
1374 }
void ExportMixerDialog::OnSize ( wxSizeEvent &  event)
private

Definition at line 1352 of file Export.cpp.

References ID_MIXERPANEL.

1353 {
1354  ExportMixerPanel *pnl = ( ( ExportMixerPanel* ) FindWindow( ID_MIXERPANEL ) );
1355  pnl->Refresh( false );
1356  event.Skip();
1357 }
Panel that displays mixing for advanced mixing option.
Definition: Export.h:235
void ExportMixerDialog::OnSlider ( wxCommandEvent &  event)
private

Definition at line 1359 of file Export.cpp.

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

1360 {
1361  wxSlider *channels = ( wxSlider* )FindWindow( ID_SLIDER_CHANNEL );
1362  ExportMixerPanel *pnl = ( ( ExportMixerPanel* ) FindWindow( ID_MIXERPANEL ) );
1363  mMixerSpec->SetNumChannels( channels->GetValue() );
1364  pnl->Refresh( false );
1365  wxString label;
1366  label.Printf( _( "Output Channels: %2d" ), mMixerSpec->GetNumChannels() );
1367  mChannelsText->SetLabel( label );
1368  channels->SetName( label );
1369 }
std::unique_ptr< MixerSpec > mMixerSpec
Definition: Export.h:284
wxStaticText * mChannelsText
Definition: Export.h:283
wxString label
Definition: Tags.cpp:727
_("Move Track &Down")+wxT("\t")+(GetActiveProject() -> GetCommandManager() ->GetKeyFromName(wxT("TrackMoveDown")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveTopID, _("Move Track to &Top")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveTop")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveBottomID, _("Move Track to &Bottom")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveBottom")).Raw()), OnMoveTrack)#define SET_TRACK_NAME_PLUGIN_SYMBOLclass SetTrackNameCommand:public AudacityCommand
Panel that displays mixing for advanced mixing option.
Definition: Export.h:235

Member Data Documentation

wxStaticText* ExportMixerDialog::mChannelsText
private

Definition at line 283 of file Export.h.

Referenced by OnSlider().

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

Definition at line 284 of file Export.h.

Referenced by GetMixerSpec(), and OnSlider().

wxArrayString ExportMixerDialog::mTrackNames
private

Definition at line 285 of file Export.h.


The documentation for this class was generated from the following files: