Audacity 3.2.0
Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | Friends | List of all members
MixerBoard Class Referencefinal

#include <MixerBoard.h>

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

Public Member Functions

 MixerBoard (AudacityProject *pProject, wxFrame *parent, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize)
 
void UpdatePrefs () override
 
void UpdateTrackClusters ()
 
int GetTrackClustersWidth ()
 
wxBitmap * GetMusicalInstrumentBitmap (const Track *pTrack)
 
bool HasSolo ()
 
void RefreshTrackClusters (bool bEraseBackground=true)
 
void ResizeTrackClusters ()
 
void UpdateMeters (const double t1, const bool bLoopedPlay)
 
void UpdateWidth ()
 

Public Attributes

std::unique_ptr< wxImagemImageMuteUp
 
std::unique_ptr< wxImagemImageMuteOver
 
std::unique_ptr< wxImagemImageMuteDown
 
std::unique_ptr< wxImagemImageMuteDownWhileSolo
 
std::unique_ptr< wxImagemImageMuteDisabled
 
std::unique_ptr< wxImagemImageSoloUp
 
std::unique_ptr< wxImagemImageSoloOver
 
std::unique_ptr< wxImagemImageSoloDown
 
std::unique_ptr< wxImagemImageSoloDisabled
 
int mMuteSoloWidth
 

Private Member Functions

void ResetMeters (const bool bResetClipping)
 
void RemoveTrackCluster (size_t nIndex)
 
void MakeButtonBitmap (wxMemoryDC &dc, wxBitmap &bitmap, wxRect &bev, const TranslatableString &str, bool up)
 
void CreateMuteSoloImages ()
 
int FindMixerTrackCluster (const PlayableTrack *pTrack, MixerTrackCluster **hMixerTrackCluster) const
 
void LoadMusicalInstruments ()
 
void OnPaint (wxPaintEvent &evt)
 
void OnSize (wxSizeEvent &evt)
 
void OnTimer (Observer::Message)
 
void OnTrackSetChanged ()
 
void OnTrackChanged (const TrackListEvent &event)
 
void OnStartStop (AudioIOEvent)
 
- Private Member Functions inherited from PrefsListener
 PrefsListener ()
 
virtual ~PrefsListener ()
 
virtual void UpdatePrefs ()=0
 
virtual void UpdateSelectedPrefs (int id)
 

Private Attributes

Observer::Subscription mPlaybackScrollerSubscription
 
Observer::Subscription mTrackPanelSubscription
 
Observer::Subscription mAudioIOSubscription
 
std::vector< MixerTrackCluster * > mMixerTrackClusters
 
MusicalInstrumentArray mMusicalInstruments
 
AudacityProjectmProject
 
MixerBoardScrolledWindowmScrolledWindow
 
double mPrevT1
 
TrackListmTracks
 
bool mUpToDate { false }
 

Friends

class MixerBoardFrame
 

Additional Inherited Members

- Static Private Member Functions inherited from PrefsListener
static void Broadcast (int id=0)
 Call this static function to notify all PrefsListener objects. More...
 

Detailed Description

Definition at line 191 of file MixerBoard.h.

Constructor & Destructor Documentation

◆ MixerBoard()

MixerBoard::MixerBoard ( AudacityProject pProject,
wxFrame *  parent,
const wxPoint &  pos = wxDefaultPosition,
const wxSize &  size = wxDefaultSize 
)

Definition at line 854 of file MixerBoard.cpp.

858: wxWindow(parent, -1, pos, size)
859{
860 // public data members
861
862 // mute & solo button images
863 // Create once and store on MixerBoard for use in all MixerTrackClusters.
864 mImageMuteUp = NULL;
865 mImageMuteOver = NULL;
866 mImageMuteDown = NULL;
868 mImageMuteDisabled = NULL;
869 mImageSoloUp = NULL;
870 mImageSoloOver = NULL;
871 mImageSoloDown = NULL;
872 mImageSoloDisabled = NULL;
873
874 mMuteSoloWidth = kRightSideStackWidth - kInset; // correct for max width, but really set in MixerBoard::CreateMuteSoloImages
875
876 // private data members
877 this->LoadMusicalInstruments(); // Set up mMusicalInstruments.
878 mProject = pProject;
879
880 wxASSERT(pProject); // to justify safenew
883 pProject, // AudacityProject* project,
884 this, -1, // wxWindow* parent, wxWindowID id = -1,
885 this->GetClientAreaOrigin(), // const wxPoint& pos = wxDefaultPosition,
886 size, // const wxSize& size = wxDefaultSize,
887 wxHSCROLL); // long style = wxHSCROLL | wxVSCROLL, const wxString& name = "scrolledWindow")
888
889 // Set background color to same as TrackPanel background.
890// mScrolledWindow->SetBackgroundColour(this->GetParent()->GetBackgroundColour());
891 mScrolledWindow->SetBackgroundColour( theTheme.Colour( clrMedium ) );
893
894 mScrolledWindow->SetScrollRate(10, 0); // no vertical scroll
895 mScrolledWindow->SetVirtualSize(size);
896
897 /* This doesn't work to make the mScrolledWindow automatically resize, so do it explicitly in OnSize.
898 auto pBoxSizer = std::make_unique<wxBoxSizer>(wxVERTICAL);
899 pBoxSizer->push_back(mScrolledWindow, 0, wxExpand, 0);
900 this->SetAutoLayout(true);
901 this->SetSizer(pBoxSizer);
902 pBoxSizer->Fit(this);
903 pBoxSizer->SetSizeHints(this);
904 */
905
906 mPrevT1 = 0.0;
908
909 // Events from the project don't propagate directly to this other frame, so...
913
915 PendingTracks::Get(*mProject).Subscribe([this](const TrackListEvent &event){
916 switch (event.mType) {
917 case TrackListEvent::SELECTION_CHANGE:
918 case TrackListEvent::TRACK_DATA_CHANGE:
919 OnTrackChanged(event); break;
920 case TrackListEvent::PERMUTED:
921 case TrackListEvent::ADDITION:
922 case TrackListEvent::DELETION:
923 OnTrackSetChanged(); break;
924 default:
925 break;
926 }
927 });
928
931}
#define RTL_WORKAROUND(pWnd)
Definition: GUISettings.h:20
#define safenew
Definition: MemoryX.h:10
const int kInset
Definition: MixerBoard.cpp:137
const int kRightSideStackWidth
Definition: MixerBoard.cpp:148
THEME_API Theme theTheme
Definition: Theme.cpp:82
static AudioIO * Get()
Definition: AudioIO.cpp:126
void OnStartStop(AudioIOEvent)
std::unique_ptr< wxImage > mImageMuteDownWhileSolo
Definition: MixerBoard.h:242
TrackList * mTracks
Definition: MixerBoard.h:259
std::unique_ptr< wxImage > mImageMuteDown
Definition: MixerBoard.h:241
std::unique_ptr< wxImage > mImageMuteDisabled
Definition: MixerBoard.h:243
std::unique_ptr< wxImage > mImageMuteOver
Definition: MixerBoard.h:241
std::unique_ptr< wxImage > mImageSoloDown
Definition: MixerBoard.h:243
void OnTimer(Observer::Message)
MixerBoardScrolledWindow * mScrolledWindow
Definition: MixerBoard.h:257
std::unique_ptr< wxImage > mImageMuteUp
Definition: MixerBoard.h:241
Observer::Subscription mTrackPanelSubscription
Definition: MixerBoard.h:249
Observer::Subscription mAudioIOSubscription
Definition: MixerBoard.h:250
std::unique_ptr< wxImage > mImageSoloDisabled
Definition: MixerBoard.h:243
std::unique_ptr< wxImage > mImageSoloUp
Definition: MixerBoard.h:243
std::unique_ptr< wxImage > mImageSoloOver
Definition: MixerBoard.h:243
void LoadMusicalInstruments()
AudacityProject * mProject
Definition: MixerBoard.h:256
int mMuteSoloWidth
Definition: MixerBoard.h:245
Observer::Subscription mPlaybackScrollerSubscription
Definition: MixerBoard.h:248
double mPrevT1
Definition: MixerBoard.h:258
Subscription Subscribe(Callback callback)
Connect a callback to the Publisher; later-connected are called earlier.
Definition: Observer.h:199
static PendingTracks & Get(AudacityProject &project)
PlaybackScroller & GetPlaybackScroller()
static ProjectWindow & Get(AudacityProject &project)
wxColour & Colour(int iIndex)
static TrackList & Get(AudacityProject &project)
Definition: Track.cpp:314
Notification of changes in individual tracks of TrackList, or of TrackList's composition.
Definition: Track.h:803

References ThemeBase::Colour(), PendingTracks::Get(), TrackList::Get(), ProjectWindow::Get(), ProjectWindow::GetPlaybackScroller(), kInset, kRightSideStackWidth, OnTimer(), RTL_WORKAROUND, safenew, size, Observer::Publisher< Message, NotifyAll >::Subscribe(), and theTheme.

Here is the call graph for this function:

Member Function Documentation

◆ CreateMuteSoloImages()

void MixerBoard::CreateMuteSoloImages ( )
private

Definition at line 1210 of file MixerBoard.cpp.

1211{
1212 // Much of this is similar to TrackInfo::MuteOrSoloDrawFunction.
1213 wxMemoryDC dc;
1214 auto str = XO("Mute");
1215
1216 //mMuteSoloWidth = textWidth + kQuadrupleInset;
1217 //if (mMuteSoloWidth < kRightSideStackWidth - kInset)
1219
1220 wxBitmap bitmap(mMuteSoloWidth, MUTE_SOLO_HEIGHT,24);
1221 dc.SelectObject(bitmap);
1222 wxRect bev(0, 0, mMuteSoloWidth, MUTE_SOLO_HEIGHT);
1223
1224 const bool up=true;
1225 const bool down=false;
1226
1227 MakeButtonBitmap( dc, bitmap, bev, str, up );
1228 mImageMuteUp = std::make_unique<wxImage>(bitmap.ConvertToImage());
1229 mImageMuteOver = std::make_unique<wxImage>(bitmap.ConvertToImage()); // Same as up, for now.
1230
1231 MakeButtonBitmap( dc, bitmap, bev, str, down );
1232 //AColor::Bevel(dc, false, bev);
1233 mImageMuteDown = std::make_unique<wxImage>(bitmap.ConvertToImage());
1234
1235 MakeButtonBitmap( dc, bitmap, bev, str, down );
1236 mImageMuteDownWhileSolo = std::make_unique<wxImage>(bitmap.ConvertToImage());
1237
1238 mImageMuteDisabled = std::make_unique<wxImage>(mMuteSoloWidth, MUTE_SOLO_HEIGHT); // Leave empty because unused.
1239
1240 str = XO("Solo");
1241 MakeButtonBitmap( dc, bitmap, bev, str, up );
1242 mImageSoloUp = std::make_unique<wxImage>(bitmap.ConvertToImage());
1243 mImageSoloOver = std::make_unique<wxImage>(bitmap.ConvertToImage()); // Same as up, for now.
1244
1245 MakeButtonBitmap( dc, bitmap, bev, str, down );
1246 mImageSoloDown = std::make_unique<wxImage>(bitmap.ConvertToImage());
1247
1248 mImageSoloDisabled = std::make_unique<wxImage>(mMuteSoloWidth, MUTE_SOLO_HEIGHT); // Leave empty because unused.
1249}
#define str(a)
XO("Cut/Copy/Paste")
const int MUTE_SOLO_HEIGHT
Definition: MixerBoard.cpp:144
void MakeButtonBitmap(wxMemoryDC &dc, wxBitmap &bitmap, wxRect &bev, const TranslatableString &str, bool up)

References kInset, kRightSideStackWidth, MakeButtonBitmap(), mImageMuteDisabled, mImageMuteDown, mImageMuteDownWhileSolo, mImageMuteOver, mImageMuteUp, mImageSoloDisabled, mImageSoloDown, mImageSoloOver, mImageSoloUp, mMuteSoloWidth, MUTE_SOLO_HEIGHT, str, and XO().

Referenced by UpdateTrackClusters().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ FindMixerTrackCluster()

int MixerBoard::FindMixerTrackCluster ( const PlayableTrack pTrack,
MixerTrackCluster **  hMixerTrackCluster 
) const
private

Definition at line 1251 of file MixerBoard.cpp.

1253{
1254 *hMixerTrackCluster = NULL;
1255 for (unsigned int i = 0; i < mMixerTrackClusters.size(); i++)
1256 {
1257 if (mMixerTrackClusters[i]->mTrack.get() == pTrack)
1258 {
1259 *hMixerTrackCluster = mMixerTrackClusters[i];
1260 return i;
1261 }
1262 }
1263 return -1;
1264}
std::vector< MixerTrackCluster * > mMixerTrackClusters
Definition: MixerBoard.h:253

References mMixerTrackClusters.

Referenced by OnTrackChanged().

Here is the caller graph for this function:

◆ GetMusicalInstrumentBitmap()

wxBitmap * MixerBoard::GetMusicalInstrumentBitmap ( const Track pTrack)

Definition at line 1062 of file MixerBoard.cpp.

1063{
1064 if (mMusicalInstruments.empty())
1065 return NULL;
1066
1067 // random choice: return mMusicalInstruments[(int)pTrack % mMusicalInstruments.size()].mBitmap;
1068
1069 const wxString strTrackName(
1070 wxString{ pTrack->GetName() }.MakeLower());
1071 size_t nBestItemIndex = 0;
1072 unsigned int nBestScore = 0;
1073 unsigned int nInstrIndex = 0;
1074 unsigned int nKeywordIndex;
1075 unsigned int nNumKeywords;
1076 unsigned int nPointsPerMatch;
1077 unsigned int nScore;
1078 for (nInstrIndex = 0; nInstrIndex < mMusicalInstruments.size(); nInstrIndex++)
1079 {
1080 nScore = 0;
1081
1082 nNumKeywords = mMusicalInstruments[nInstrIndex]->mKeywords.size();
1083 if (nNumKeywords > 0)
1084 {
1085 nPointsPerMatch = 10 / nNumKeywords;
1086 for (nKeywordIndex = 0; nKeywordIndex < nNumKeywords; nKeywordIndex++)
1087 if (strTrackName.Contains(mMusicalInstruments[nInstrIndex]->mKeywords[nKeywordIndex]))
1088 {
1089 nScore +=
1090 nPointsPerMatch +
1091 // Longer keywords get more points.
1092 (2 * mMusicalInstruments[nInstrIndex]->mKeywords[nKeywordIndex].length());
1093 }
1094 }
1095
1096 // Choose later one if just matching nBestScore, for better variety,
1097 // and so default works as last element.
1098 if (nScore >= nBestScore)
1099 {
1100 nBestScore = nScore;
1101 nBestItemIndex = nInstrIndex;
1102 }
1103 }
1104 return mMusicalInstruments[nBestItemIndex]->mBitmap.get();
1105}
MusicalInstrumentArray mMusicalInstruments
Definition: MixerBoard.h:255
const wxString & GetName() const
Name is always the same for all channels of a group.
Definition: Track.cpp:64

References Track::GetName(), and mMusicalInstruments.

Referenced by MixerTrackCluster::UpdateForStateChange().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetTrackClustersWidth()

int MixerBoard::GetTrackClustersWidth ( )

Definition at line 1029 of file MixerBoard.cpp.

1030{
1031 return
1032 kInset + // extra margin at left for first one
1033 (mMixerTrackClusters.size() * // number of tracks times
1034 (kInset + kMixerTrackClusterWidth)) + // left margin and width for each
1035 kDoubleInset; // plus final right margin
1036}
const int kDoubleInset
Definition: MixerBoard.cpp:138
const int kMixerTrackClusterWidth
Definition: MixerBoard.cpp:149

References kDoubleInset, kInset, kMixerTrackClusterWidth, and mMixerTrackClusters.

Referenced by UpdateWidth().

Here is the caller graph for this function:

◆ HasSolo()

bool MixerBoard::HasSolo ( )

Definition at line 1107 of file MixerBoard.cpp.

1108{
1109 return
1111}
AudioTrack subclass that can also be audibly replayed by the program.
Definition: PlayableTrack.h:40
bool GetSolo() const
Definition: PlayableTrack.h:48
auto Any() -> TrackIterRange< TrackType >
Definition: Track.h:950

References TrackList::Any(), PlayableTrack::GetSolo(), and mTracks.

Referenced by MixerTrackCluster::UpdateMeter().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ LoadMusicalInstruments()

void MixerBoard::LoadMusicalInstruments ( )
private

Definition at line 1266 of file MixerBoard.cpp.

1267{
1268 const struct Data { const char * const *bitmap; wxString name; } table[] = {
1269 {acoustic_guitar_gtr_xpm, wxT("acoustic_guitar_gtr")},
1270 {acoustic_piano_pno_xpm, wxT("acoustic_piano_pno")},
1271 {back_vocal_bg_vox_xpm, wxT("back_vocal_bg_vox")},
1272 {clap_xpm, wxT("clap")},
1273 {drums_dr_xpm, wxT("drums_dr")},
1274 {electric_bass_guitar_bs_gtr_xpm, wxT("electric_bass_guitar_bs_gtr")},
1275 {electric_guitar_gtr_xpm, wxT("electric_guitar_gtr")},
1276 {electric_piano_pno_key_xpm, wxT("electric_piano_pno_key")},
1277 {kick_xpm, wxT("kick")},
1278 {loop_xpm, wxT("loop")},
1279 {organ_org_xpm, wxT("organ_org")},
1280 {perc_xpm, wxT("perc")},
1281 {sax_xpm, wxT("sax")},
1282 {snare_xpm, wxT("snare")},
1283 {string_violin_cello_xpm, wxT("string_violin_cello")},
1284 {synth_xpm, wxT("synth")},
1285 {tambo_xpm, wxT("tambo")},
1286 {trumpet_horn_xpm, wxT("trumpet_horn")},
1287 {turntable_xpm, wxT("turntable")},
1288 {vibraphone_vibes_xpm, wxT("vibraphone_vibes")},
1289 {vocal_vox_xpm, wxT("vocal_vox")},
1290
1291 // This one must be last, so it wins when best score is 0.
1292 {_default_instrument_xpm, wxEmptyString},
1293 };
1294
1296 wxMemoryDC dc;
1297
1298 for (const auto &data : table) {
1299 auto bmp = std::make_unique<wxBitmap>(data.bitmap);
1300 dc.SelectObject(*bmp);
1301 AColor::Bevel(dc, false, bev);
1302 mMusicalInstruments.push_back(std::make_unique<MusicalInstrument>(
1303 std::move(bmp), data.name
1304 ));
1305 };
1306}
wxT("CloseDown"))
const int MUSICAL_INSTRUMENT_HEIGHT_AND_WIDTH
Definition: MixerBoard.cpp:143
wxString name
Definition: TagsEditor.cpp:166
static void Bevel(wxDC &dc, bool up, const wxRect &r)
Definition: AColor.cpp:278

References AColor::Bevel(), mMusicalInstruments, MUSICAL_INSTRUMENT_HEIGHT_AND_WIDTH, name, and wxT().

Here is the call graph for this function:

◆ MakeButtonBitmap()

void MixerBoard::MakeButtonBitmap ( wxMemoryDC &  dc,
wxBitmap &  bitmap,
wxRect &  bev,
const TranslatableString str,
bool  up 
)
private

Definition at line 1183 of file MixerBoard.cpp.

1184{
1185
1186 const auto translation = str.Translation();
1187 int textWidth, textHeight;
1188
1189 int fontSize = 10;
1190 #ifdef __WXMSW__
1191 fontSize = 8;
1192 #endif
1193 wxFont font(fontSize, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
1194 GetTextExtent(translation, &textWidth, &textHeight, NULL, NULL, &font);
1195
1196 AColor::UseThemeColour( &dc, clrMedium );
1197 dc.DrawRectangle(bev);
1198
1199 AColor::Bevel2( dc, up, bev, false );
1200
1201 wxCoord x = bev.x + (bev.width - textWidth) / 2;
1202 wxCoord y = bev.y + (bev.height - textHeight) / 2;
1203 dc.SetFont(font);
1204 dc.SetTextForeground(theTheme.Colour(clrTrackPanelText));
1205 dc.SetBackgroundMode(wxTRANSPARENT);
1206 dc.DrawText(translation, x, y);
1207// dc.DrawText(translation, 0, 0);
1208}
static void Bevel2(wxDC &dc, bool up, const wxRect &r, bool bSel=false, bool bHighlight=false)
Definition: AColor.cpp:298
static void UseThemeColour(wxDC *dc, int iBrush, int iPen=-1, int alpha=255)
Definition: AColor.cpp:354

References AColor::Bevel2(), ThemeBase::Colour(), str, theTheme, and AColor::UseThemeColour().

Referenced by CreateMuteSoloImages().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnPaint()

void MixerBoard::OnPaint ( wxPaintEvent &  evt)
private

Definition at line 1310 of file MixerBoard.cpp.

1311{
1312 if (!mUpToDate) {
1313 mUpToDate = true;
1315 Refresh();
1316 }
1317 // Does the base class do anything for repainting?
1318 evt.Skip();
1319}
bool mUpToDate
Definition: MixerBoard.h:260
void UpdateTrackClusters()
Definition: MixerBoard.cpp:970

References mUpToDate, and UpdateTrackClusters().

Here is the call graph for this function:

◆ OnSize()

void MixerBoard::OnSize ( wxSizeEvent &  evt)
private

Definition at line 1321 of file MixerBoard.cpp.

1322{
1323 // this->FitInside() doesn't work, and it doesn't happen automatically. Is wxScrolledWindow wrong?
1324 mScrolledWindow->SetSize(evt.GetSize());
1325
1326 this->ResizeTrackClusters();
1327 this->RefreshTrackClusters(true);
1328}
void ResizeTrackClusters()
void RefreshTrackClusters(bool bEraseBackground=true)

References mScrolledWindow, RefreshTrackClusters(), and ResizeTrackClusters().

Here is the call graph for this function:

◆ OnStartStop()

void MixerBoard::OnStartStop ( AudioIOEvent  evt)
private

Definition at line 1374 of file MixerBoard.cpp.

1375{
1376 if (evt.type == AudioIOEvent::PLAYBACK)
1377 ResetMeters( evt.on );
1378}
void ResetMeters(const bool bResetClipping)
bool on
Definition: AudioIO.h:68
enum AudioIOEvent::Type type

References AudioIOEvent::on, AudioIOEvent::PLAYBACK, ResetMeters(), and AudioIOEvent::type.

Here is the call graph for this function:

◆ OnTimer()

void MixerBoard::OnTimer ( Observer::Message  )
private

Definition at line 1330 of file MixerBoard.cpp.

1331{
1332 // PRL 12 Jul 2015: Moved the below (with comments) out of TrackPanel::OnTimer.
1333
1334 // Vaughan, 2011-01-28: No longer doing this on timer.
1335 // Now it's in AudioIO::SetMeters() and AudioIO::StopStream(), as with Meter Toolbar meters.
1336 //if (pMixerBoard)
1337 // pMixerBoard->ResetMeters(false);
1338
1339 //v Vaughan, 2011-02-25: Moved this update back here from audacityAudioCallback.
1340 // See note there.
1341 // Vaughan, 2010-01-30:
1342 // Since all we're doing here is updating the meters, I moved it to
1343 // audacityAudioCallback where it calls gAudioIO->mOutputMeter->UpdateDisplay().
1344 if (ProjectAudioIO::Get( *mProject ).IsAudioActive())
1345 {
1346 auto gAudioIO = AudioIO::Get();
1348 gAudioIO->GetStreamTime(),
1351 );
1352 }
1353}
void UpdateMeters(const double t1, const bool bLoopedPlay)
bool IsAudioActive() const
static ProjectAudioIO & Get(AudacityProject &project)
static ProjectAudioManager & Get(AudacityProject &project)
PlayMode GetLastPlayMode() const

References AudioIO::Get(), ProjectAudioIO::Get(), ProjectAudioManager::Get(), ProjectAudioManager::GetLastPlayMode(), ProjectAudioIO::IsAudioActive(), loopedPlay, and UpdateMeters().

Referenced by MixerBoard().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnTrackChanged()

void MixerBoard::OnTrackChanged ( const TrackListEvent event)
private

Definition at line 1355 of file MixerBoard.cpp.

1356{
1357 auto pTrack = evt.mpTrack.lock();
1358 auto pPlayable = dynamic_cast<PlayableTrack*>( pTrack.get() );
1359 if ( pPlayable ) {
1360 MixerTrackCluster *pMixerTrackCluster;
1361 FindMixerTrackCluster( pPlayable, &pMixerTrackCluster );
1362 if ( pMixerTrackCluster )
1363 pMixerTrackCluster->Refresh();
1364 }
1365}
int FindMixerTrackCluster(const PlayableTrack *pTrack, MixerTrackCluster **hMixerTrackCluster) const

References FindMixerTrackCluster(), and TrackListEvent::mpTrack.

Here is the call graph for this function:

◆ OnTrackSetChanged()

void MixerBoard::OnTrackSetChanged ( )
private

Definition at line 1367 of file MixerBoard.cpp.

1368{
1369 mUpToDate = false;
1371 Refresh();
1372}

References mUpToDate, and UpdateTrackClusters().

Here is the call graph for this function:

◆ RefreshTrackClusters()

void MixerBoard::RefreshTrackClusters ( bool  bEraseBackground = true)

Definition at line 1113 of file MixerBoard.cpp.

1114{
1115 for (unsigned int i = 0; i < mMixerTrackClusters.size(); i++)
1116 mMixerTrackClusters[i]->Refresh(bEraseBackground);
1117}

References mMixerTrackClusters.

Referenced by OnSize().

Here is the caller graph for this function:

◆ RemoveTrackCluster()

void MixerBoard::RemoveTrackCluster ( size_t  nIndex)
private

Definition at line 1038 of file MixerBoard.cpp.

1039{
1040 auto pMixerTrackCluster = mMixerTrackClusters[nIndex];
1041 mMixerTrackClusters.erase(mMixerTrackClusters.begin() + nIndex);
1042 pMixerTrackCluster->Destroy(); // DELETE is unsafe on wxWindow.
1043
1044 // Close the gap, if any.
1045 wxPoint pos;
1046 int targetX;
1047 for (unsigned int i = nIndex; i < mMixerTrackClusters.size(); i++)
1048 {
1049 pos = mMixerTrackClusters[i]->GetPosition();
1050 targetX =
1051 kInset + // extra inset to left for first one, so it's double
1052 (i * (kInset + kMixerTrackClusterWidth)) + // left margin and width for each
1053 kInset; // plus left margin for this cluster
1054 if (pos.x != targetX)
1055 mMixerTrackClusters[i]->Move(targetX, pos.y);
1056 }
1057
1058 this->UpdateWidth();
1059}
void UpdateWidth()

References kInset, kMixerTrackClusterWidth, mMixerTrackClusters, and UpdateWidth().

Referenced by UpdateTrackClusters().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ResetMeters()

void MixerBoard::ResetMeters ( const bool  bResetClipping)
private

Definition at line 1125 of file MixerBoard.cpp.

1126{
1128
1129 if (!this->IsShown())
1130 return;
1131
1132 for (unsigned int i = 0; i < mMixerTrackClusters.size(); i++)
1133 mMixerTrackClusters[i]->ResetMeter(bResetClipping);
1134}
#define BAD_STREAM_TIME
Definition: AudioIOBase.h:40

References BAD_STREAM_TIME, mMixerTrackClusters, and mPrevT1.

Referenced by OnStartStop().

Here is the caller graph for this function:

◆ ResizeTrackClusters()

void MixerBoard::ResizeTrackClusters ( )

Definition at line 1119 of file MixerBoard.cpp.

1120{
1121 for (unsigned int nClusterIndex = 0; nClusterIndex < mMixerTrackClusters.size(); nClusterIndex++)
1122 mMixerTrackClusters[nClusterIndex]->HandleResize();
1123}

References mMixerTrackClusters.

Referenced by OnSize(), and UpdateTrackClusters().

Here is the caller graph for this function:

◆ UpdateMeters()

void MixerBoard::UpdateMeters ( const double  t1,
const bool  bLoopedPlay 
)

Definition at line 1136 of file MixerBoard.cpp.

1137{
1138 if (!this->IsShown() || (t1 == BAD_STREAM_TIME))
1139 return;
1140
1141 if (mPrevT1 == BAD_STREAM_TIME)
1142 {
1143 mPrevT1 = t1;
1144 return;
1145 }
1146
1147 // PRL: TODO: reexamine the assumptions below
1148
1149 // In loopedPlay mode, at the end of the loop, mPrevT1 is set to
1150 // selection end, so the next t1 will be less, but we do want to
1151 // keep updating the meters.
1152 if (t1 <= mPrevT1)
1153 {
1154 if (bLoopedPlay)
1155 mPrevT1 = t1;
1156 return;
1157 }
1158
1159 for (unsigned int i = 0; i < mMixerTrackClusters.size(); i++)
1160 mMixerTrackClusters[i]->UpdateMeter(mPrevT1, t1);
1161
1162 mPrevT1 = t1;
1163}

References BAD_STREAM_TIME, mMixerTrackClusters, and mPrevT1.

Referenced by OnTimer().

Here is the caller graph for this function:

◆ UpdatePrefs()

void MixerBoard::UpdatePrefs ( )
overridevirtual

Implements PrefsListener.

Definition at line 936 of file MixerBoard.cpp.

937{
938 // Destroys this:
939 static_cast<MixerBoardFrame*>(GetParent())->Recreate( mProject );
940
941// Old approach modified things in situ.
942// However with a theme change there is so much to modify, it is easier
943// to recreate.
944#if 0
945 mScrolledWindow->SetBackgroundColour( theTheme.Colour( clrMedium ) );
946 if( mImageMuteUp ){
947 mImageMuteUp.reset();
948 mImageMuteOver.reset();
949 mImageMuteDown.reset();
951 mImageMuteDisabled.reset();
952 mImageSoloUp.reset();
953 mImageSoloOver.reset();
954 mImageSoloDown.reset();
955 mImageSoloDisabled.reset();
956 }
957 for (unsigned int nClusterIndex = 0; nClusterIndex < mMixerTrackClusters.size(); nClusterIndex++)
958 mMixerTrackClusters[nClusterIndex]->UpdatePrefs();
959 Refresh();
960#endif
961}
void UpdatePrefs() override
Definition: MixerBoard.cpp:936

References ThemeBase::Colour(), mImageMuteDisabled, mImageMuteDown, mImageMuteDownWhileSolo, mImageMuteOver, mImageMuteUp, mImageSoloDisabled, mImageSoloDown, mImageSoloOver, mImageSoloUp, mMixerTrackClusters, mProject, mScrolledWindow, theTheme, and UpdatePrefs().

Referenced by UpdatePrefs().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ UpdateTrackClusters()

void MixerBoard::UpdateTrackClusters ( )

Definition at line 970 of file MixerBoard.cpp.

971{
972 if (!mImageMuteUp)
973 this->CreateMuteSoloImages();
974
975 const int nClusterHeight = mScrolledWindow->GetClientSize().GetHeight() - kDoubleInset;
976 size_t nClusterCount = mMixerTrackClusters.size();
977 unsigned int nClusterIndex = 0;
978 MixerTrackCluster* pMixerTrackCluster = NULL;
979
980 for (auto pPlayableTrack: mTracks->Any<PlayableTrack>()) {
981 // TODO: more-than-two-channels
982 auto spTrack = pPlayableTrack->SharedPointer<PlayableTrack>();
983 // Track iterations always yield non-null pointers; maintain invariant
984 // when reassigning
985 assert(spTrack);
986 if (nClusterIndex < nClusterCount)
987 {
988 // Already showing it.
989 // Track clusters are maintained in the same order as the WaveTracks.
990 // Track pointers can change for the "same" track for different states
991 // on the undo stack, so update the pointers and display name.
992 mMixerTrackClusters[nClusterIndex]->mTrack = spTrack;
993 // Assume linked track is wave or null
994 mMixerTrackClusters[nClusterIndex]->UpdateForStateChange();
995 }
996 else
997 {
998 // Not already showing it. Add a NEW MixerTrackCluster.
999 wxPoint clusterPos(
1000 kInset + nClusterIndex * kMixerTrackClusterWidth,
1001 kInset);
1002 wxSize clusterSize(kMixerTrackClusterWidth, nClusterHeight);
1003 pMixerTrackCluster =
1005 *spTrack, clusterPos, clusterSize);
1006 if (pMixerTrackCluster)
1007 mMixerTrackClusters.push_back(pMixerTrackCluster);
1008 }
1009 nClusterIndex++;
1010 }
1011
1012 if (pMixerTrackCluster)
1013 {
1014 // Added at least one MixerTrackCluster.
1015 this->UpdateWidth();
1016 this->ResizeTrackClusters();
1017 }
1018 else while (nClusterIndex < nClusterCount)
1019 {
1020 // We've got too many clusters.
1021 // This can happen only on things like Undo New Audio Track or Undo Import
1022 // that don't call RemoveTrackCluster explicitly.
1023 // We've already updated the track pointers for the clusters to the left, so just remove all the rest.
1024 // Successively DELETE from right to left.
1025 RemoveTrackCluster(--nClusterCount);
1026 }
1027}
void RemoveTrackCluster(size_t nIndex)
void CreateMuteSoloImages()

References TrackList::Any(), CreateMuteSoloImages(), kDoubleInset, kInset, kMixerTrackClusterWidth, mImageMuteUp, mMixerTrackClusters, mProject, mScrolledWindow, mTracks, RemoveTrackCluster(), ResizeTrackClusters(), safenew, and UpdateWidth().

Referenced by OnPaint(), OnTrackSetChanged(), and MixerBoardFrame::Recreate().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ UpdateWidth()

void MixerBoard::UpdateWidth ( )

Definition at line 1166 of file MixerBoard.cpp.

1167{
1168 int newWidth = this->GetTrackClustersWidth();
1169
1170 // Min width is one cluster wide, plus margins.
1171 if (newWidth < MIXER_BOARD_MIN_WIDTH)
1172 newWidth = MIXER_BOARD_MIN_WIDTH;
1173
1174 mScrolledWindow->SetVirtualSize(newWidth, -1);
1175 this->GetParent()->SetSize(newWidth + kDoubleInset, -1);
1176}
#define MIXER_BOARD_MIN_WIDTH
Definition: MixerBoard.cpp:846
int GetTrackClustersWidth()

References GetTrackClustersWidth(), kDoubleInset, MIXER_BOARD_MIN_WIDTH, and mScrolledWindow.

Referenced by MixerBoardFrame::OnMaximize(), RemoveTrackCluster(), and UpdateTrackClusters().

Here is the call graph for this function:
Here is the caller graph for this function:

Friends And Related Function Documentation

◆ MixerBoardFrame

friend class MixerBoardFrame
friend

Definition at line 193 of file MixerBoard.h.

Member Data Documentation

◆ mAudioIOSubscription

Observer::Subscription MixerBoard::mAudioIOSubscription
private

Definition at line 250 of file MixerBoard.h.

◆ mImageMuteDisabled

std::unique_ptr<wxImage> MixerBoard::mImageMuteDisabled

Definition at line 243 of file MixerBoard.h.

Referenced by CreateMuteSoloImages(), and UpdatePrefs().

◆ mImageMuteDown

std::unique_ptr<wxImage> MixerBoard::mImageMuteDown

Definition at line 241 of file MixerBoard.h.

Referenced by CreateMuteSoloImages(), and UpdatePrefs().

◆ mImageMuteDownWhileSolo

std::unique_ptr<wxImage> MixerBoard::mImageMuteDownWhileSolo

Definition at line 242 of file MixerBoard.h.

Referenced by CreateMuteSoloImages(), and UpdatePrefs().

◆ mImageMuteOver

std::unique_ptr<wxImage> MixerBoard::mImageMuteOver

Definition at line 241 of file MixerBoard.h.

Referenced by CreateMuteSoloImages(), and UpdatePrefs().

◆ mImageMuteUp

std::unique_ptr<wxImage> MixerBoard::mImageMuteUp

Definition at line 241 of file MixerBoard.h.

Referenced by CreateMuteSoloImages(), UpdatePrefs(), and UpdateTrackClusters().

◆ mImageSoloDisabled

std::unique_ptr<wxImage> MixerBoard::mImageSoloDisabled

Definition at line 243 of file MixerBoard.h.

Referenced by CreateMuteSoloImages(), and UpdatePrefs().

◆ mImageSoloDown

std::unique_ptr<wxImage> MixerBoard::mImageSoloDown

Definition at line 243 of file MixerBoard.h.

Referenced by CreateMuteSoloImages(), and UpdatePrefs().

◆ mImageSoloOver

std::unique_ptr<wxImage> MixerBoard::mImageSoloOver

Definition at line 243 of file MixerBoard.h.

Referenced by CreateMuteSoloImages(), and UpdatePrefs().

◆ mImageSoloUp

std::unique_ptr<wxImage> MixerBoard::mImageSoloUp

Definition at line 243 of file MixerBoard.h.

Referenced by CreateMuteSoloImages(), and UpdatePrefs().

◆ mMixerTrackClusters

std::vector<MixerTrackCluster*> MixerBoard::mMixerTrackClusters
private

◆ mMusicalInstruments

MusicalInstrumentArray MixerBoard::mMusicalInstruments
private

Definition at line 255 of file MixerBoard.h.

Referenced by GetMusicalInstrumentBitmap(), and LoadMusicalInstruments().

◆ mMuteSoloWidth

int MixerBoard::mMuteSoloWidth

Definition at line 245 of file MixerBoard.h.

Referenced by CreateMuteSoloImages().

◆ mPlaybackScrollerSubscription

Observer::Subscription MixerBoard::mPlaybackScrollerSubscription
private

Definition at line 248 of file MixerBoard.h.

◆ mPrevT1

double MixerBoard::mPrevT1
private

Definition at line 258 of file MixerBoard.h.

Referenced by ResetMeters(), and UpdateMeters().

◆ mProject

AudacityProject* MixerBoard::mProject
private

Definition at line 256 of file MixerBoard.h.

Referenced by MixerBoardFrame::OnKeyEvent(), UpdatePrefs(), and UpdateTrackClusters().

◆ mScrolledWindow

MixerBoardScrolledWindow* MixerBoard::mScrolledWindow
private

Definition at line 257 of file MixerBoard.h.

Referenced by OnSize(), UpdatePrefs(), UpdateTrackClusters(), and UpdateWidth().

◆ mTrackPanelSubscription

Observer::Subscription MixerBoard::mTrackPanelSubscription
private

Definition at line 249 of file MixerBoard.h.

◆ mTracks

TrackList* MixerBoard::mTracks
private

Definition at line 259 of file MixerBoard.h.

Referenced by HasSolo(), and UpdateTrackClusters().

◆ mUpToDate

bool MixerBoard::mUpToDate { false }
private

Definition at line 260 of file MixerBoard.h.

Referenced by OnPaint(), and OnTrackSetChanged().


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