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 200 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 888 of file MixerBoard.cpp.

892: wxWindow(parent, -1, pos, size)
893{
894 // public data members
895
896 // mute & solo button images
897 // Create once and store on MixerBoard for use in all MixerTrackClusters.
898 mImageMuteUp = NULL;
899 mImageMuteOver = NULL;
900 mImageMuteDown = NULL;
902 mImageMuteDisabled = NULL;
903 mImageSoloUp = NULL;
904 mImageSoloOver = NULL;
905 mImageSoloDown = NULL;
906 mImageSoloDisabled = NULL;
907
908 mMuteSoloWidth = kRightSideStackWidth - kInset; // correct for max width, but really set in MixerBoard::CreateMuteSoloImages
909
910 // private data members
911 this->LoadMusicalInstruments(); // Set up mMusicalInstruments.
912 mProject = pProject;
913
914 wxASSERT(pProject); // to justify safenew
917 pProject, // AudacityProject* project,
918 this, -1, // wxWindow* parent, wxWindowID id = -1,
919 this->GetClientAreaOrigin(), // const wxPoint& pos = wxDefaultPosition,
920 size, // const wxSize& size = wxDefaultSize,
921 wxHSCROLL); // long style = wxHSCROLL | wxVSCROLL, const wxString& name = "scrolledWindow")
922
923 // Set background color to same as TrackPanel background.
924// #ifdef EXPERIMENTAL_THEMING
925// mScrolledWindow->SetBackgroundColour(this->GetParent()->GetBackgroundColour());
926// #else
927// mScrolledWindow->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_3DSHADOW));
928// #endif
929 mScrolledWindow->SetBackgroundColour( theTheme.Colour( clrMedium ) );
931
932 mScrolledWindow->SetScrollRate(10, 0); // no vertical scroll
933 mScrolledWindow->SetVirtualSize(size);
934
935 /* This doesn't work to make the mScrolledWindow automatically resize, so do it explicitly in OnSize.
936 auto pBoxSizer = std::make_unique<wxBoxSizer>(wxVERTICAL);
937 pBoxSizer->push_back(mScrolledWindow, 0, wxExpand, 0);
938 this->SetAutoLayout(true);
939 this->SetSizer(pBoxSizer);
940 pBoxSizer->Fit(this);
941 pBoxSizer->SetSizeHints(this);
942 */
943
944 mPrevT1 = 0.0;
946
947 // Events from the project don't propagate directly to this other frame, so...
951
953 mTracks->Subscribe([this](const TrackListEvent &event){
954 switch (event.mType) {
955 case TrackListEvent::SELECTION_CHANGE:
956 case TrackListEvent::TRACK_DATA_CHANGE:
957 OnTrackChanged(event); break;
958 case TrackListEvent::PERMUTED:
959 case TrackListEvent::ADDITION:
960 case TrackListEvent::DELETION:
961 OnTrackSetChanged(); break;
962 default:
963 break;
964 }
965 });
966
969}
#define RTL_WORKAROUND(pWnd)
Definition: GUISettings.h:20
#define safenew
Definition: MemoryX.h:9
const int kInset
Definition: MixerBoard.cpp:136
const int kRightSideStackWidth
Definition: MixerBoard.cpp:147
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:251
TrackList * mTracks
Definition: MixerBoard.h:268
std::unique_ptr< wxImage > mImageMuteDown
Definition: MixerBoard.h:250
std::unique_ptr< wxImage > mImageMuteDisabled
Definition: MixerBoard.h:252
std::unique_ptr< wxImage > mImageMuteOver
Definition: MixerBoard.h:250
std::unique_ptr< wxImage > mImageSoloDown
Definition: MixerBoard.h:252
void OnTimer(Observer::Message)
MixerBoardScrolledWindow * mScrolledWindow
Definition: MixerBoard.h:266
std::unique_ptr< wxImage > mImageMuteUp
Definition: MixerBoard.h:250
Observer::Subscription mTrackPanelSubscription
Definition: MixerBoard.h:258
Observer::Subscription mAudioIOSubscription
Definition: MixerBoard.h:259
std::unique_ptr< wxImage > mImageSoloDisabled
Definition: MixerBoard.h:252
std::unique_ptr< wxImage > mImageSoloUp
Definition: MixerBoard.h:252
std::unique_ptr< wxImage > mImageSoloOver
Definition: MixerBoard.h:252
void LoadMusicalInstruments()
AudacityProject * mProject
Definition: MixerBoard.h:265
int mMuteSoloWidth
Definition: MixerBoard.h:254
Observer::Subscription mPlaybackScrollerSubscription
Definition: MixerBoard.h:257
double mPrevT1
Definition: MixerBoard.h:267
Subscription Subscribe(Callback callback)
Connect a callback to the Publisher; later-connected are called earlier.
Definition: Observer.h:199
PlaybackScroller & GetPlaybackScroller()
static ProjectWindow & Get(AudacityProject &project)
wxColour & Colour(int iIndex)
static TrackList & Get(AudacityProject &project)
Definition: Track.cpp:347
Notification of changes in individual tracks of TrackList, or of TrackList's composition.
Definition: Track.h:946
const Type mType
Definition: Track.h:980

References ThemeBase::Colour(), AudioIO::Get(), TrackList::Get(), ProjectWindow::Get(), ProjectWindow::GetPlaybackScroller(), kInset, kRightSideStackWidth, TrackListEvent::mType, OnStartStop(), 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 1246 of file MixerBoard.cpp.

1247{
1248 // Much of this is similar to TrackInfo::MuteOrSoloDrawFunction.
1249 wxMemoryDC dc;
1250 auto str = XO("Mute");
1251
1252 //mMuteSoloWidth = textWidth + kQuadrupleInset;
1253 //if (mMuteSoloWidth < kRightSideStackWidth - kInset)
1255
1256 wxBitmap bitmap(mMuteSoloWidth, MUTE_SOLO_HEIGHT,24);
1257 dc.SelectObject(bitmap);
1258 wxRect bev(0, 0, mMuteSoloWidth, MUTE_SOLO_HEIGHT);
1259
1260 const bool up=true;
1261 const bool down=false;
1262
1263 MakeButtonBitmap( dc, bitmap, bev, str, up );
1264 mImageMuteUp = std::make_unique<wxImage>(bitmap.ConvertToImage());
1265 mImageMuteOver = std::make_unique<wxImage>(bitmap.ConvertToImage()); // Same as up, for now.
1266
1267 MakeButtonBitmap( dc, bitmap, bev, str, down );
1268 //AColor::Bevel(dc, false, bev);
1269 mImageMuteDown = std::make_unique<wxImage>(bitmap.ConvertToImage());
1270
1271 MakeButtonBitmap( dc, bitmap, bev, str, down );
1272 mImageMuteDownWhileSolo = std::make_unique<wxImage>(bitmap.ConvertToImage());
1273
1274 mImageMuteDisabled = std::make_unique<wxImage>(mMuteSoloWidth, MUTE_SOLO_HEIGHT); // Leave empty because unused.
1275
1276 str = XO("Solo");
1277 MakeButtonBitmap( dc, bitmap, bev, str, up );
1278 mImageSoloUp = std::make_unique<wxImage>(bitmap.ConvertToImage());
1279 mImageSoloOver = std::make_unique<wxImage>(bitmap.ConvertToImage()); // Same as up, for now.
1280
1281 MakeButtonBitmap( dc, bitmap, bev, str, down );
1282 mImageSoloDown = std::make_unique<wxImage>(bitmap.ConvertToImage());
1283
1284 mImageSoloDisabled = std::make_unique<wxImage>(mMuteSoloWidth, MUTE_SOLO_HEIGHT); // Leave empty because unused.
1285}
#define str(a)
XO("Cut/Copy/Paste")
const int MUTE_SOLO_HEIGHT
Definition: MixerBoard.cpp:143
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 1287 of file MixerBoard.cpp.

1289{
1290 *hMixerTrackCluster = NULL;
1291 for (unsigned int i = 0; i < mMixerTrackClusters.size(); i++)
1292 {
1293 if (mMixerTrackClusters[i]->mTrack.get() == pTrack)
1294 {
1295 *hMixerTrackCluster = mMixerTrackClusters[i];
1296 return i;
1297 }
1298 }
1299 return -1;
1300}
std::vector< MixerTrackCluster * > mMixerTrackClusters
Definition: MixerBoard.h:262

References mMixerTrackClusters.

Referenced by OnTrackChanged().

Here is the caller graph for this function:

◆ GetMusicalInstrumentBitmap()

wxBitmap * MixerBoard::GetMusicalInstrumentBitmap ( const Track pTrack)

Definition at line 1098 of file MixerBoard.cpp.

1099{
1100 if (mMusicalInstruments.empty())
1101 return NULL;
1102
1103 // random choice: return mMusicalInstruments[(int)pTrack % mMusicalInstruments.size()].mBitmap;
1104
1105 const wxString strTrackName(
1106 wxString{ pTrack->GetName() }.MakeLower());
1107 size_t nBestItemIndex = 0;
1108 unsigned int nBestScore = 0;
1109 unsigned int nInstrIndex = 0;
1110 unsigned int nKeywordIndex;
1111 unsigned int nNumKeywords;
1112 unsigned int nPointsPerMatch;
1113 unsigned int nScore;
1114 for (nInstrIndex = 0; nInstrIndex < mMusicalInstruments.size(); nInstrIndex++)
1115 {
1116 nScore = 0;
1117
1118 nNumKeywords = mMusicalInstruments[nInstrIndex]->mKeywords.size();
1119 if (nNumKeywords > 0)
1120 {
1121 nPointsPerMatch = 10 / nNumKeywords;
1122 for (nKeywordIndex = 0; nKeywordIndex < nNumKeywords; nKeywordIndex++)
1123 if (strTrackName.Contains(mMusicalInstruments[nInstrIndex]->mKeywords[nKeywordIndex]))
1124 {
1125 nScore +=
1126 nPointsPerMatch +
1127 // Longer keywords get more points.
1128 (2 * mMusicalInstruments[nInstrIndex]->mKeywords[nKeywordIndex].length());
1129 }
1130 }
1131
1132 // Choose later one if just matching nBestScore, for better variety,
1133 // and so default works as last element.
1134 if (nScore >= nBestScore)
1135 {
1136 nBestScore = nScore;
1137 nBestItemIndex = nInstrIndex;
1138 }
1139 }
1140 return mMusicalInstruments[nBestItemIndex]->mBitmap.get();
1141}
MusicalInstrumentArray mMusicalInstruments
Definition: MixerBoard.h:264
const wxString & GetName() const
Name is always the same for all channels of a group.
Definition: Track.cpp:56

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 1065 of file MixerBoard.cpp.

1066{
1067 return
1068 kInset + // extra margin at left for first one
1069 (mMixerTrackClusters.size() * // number of tracks times
1070 (kInset + kMixerTrackClusterWidth)) + // left margin and width for each
1071 kDoubleInset; // plus final right margin
1072}
const int kDoubleInset
Definition: MixerBoard.cpp:137
const int kMixerTrackClusterWidth
Definition: MixerBoard.cpp:148

References kDoubleInset, kInset, kMixerTrackClusterWidth, and mMixerTrackClusters.

Referenced by UpdateWidth().

Here is the caller graph for this function:

◆ HasSolo()

bool MixerBoard::HasSolo ( )

Definition at line 1143 of file MixerBoard.cpp.

1144{
1145 return
1147}
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:1097

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 1302 of file MixerBoard.cpp.

1303{
1304 const struct Data { const char * const *bitmap; wxString name; } table[] = {
1305 {acoustic_guitar_gtr_xpm, wxT("acoustic_guitar_gtr")},
1306 {acoustic_piano_pno_xpm, wxT("acoustic_piano_pno")},
1307 {back_vocal_bg_vox_xpm, wxT("back_vocal_bg_vox")},
1308 {clap_xpm, wxT("clap")},
1309 {drums_dr_xpm, wxT("drums_dr")},
1310 {electric_bass_guitar_bs_gtr_xpm, wxT("electric_bass_guitar_bs_gtr")},
1311 {electric_guitar_gtr_xpm, wxT("electric_guitar_gtr")},
1312 {electric_piano_pno_key_xpm, wxT("electric_piano_pno_key")},
1313 {kick_xpm, wxT("kick")},
1314 {loop_xpm, wxT("loop")},
1315 {organ_org_xpm, wxT("organ_org")},
1316 {perc_xpm, wxT("perc")},
1317 {sax_xpm, wxT("sax")},
1318 {snare_xpm, wxT("snare")},
1319 {string_violin_cello_xpm, wxT("string_violin_cello")},
1320 {synth_xpm, wxT("synth")},
1321 {tambo_xpm, wxT("tambo")},
1322 {trumpet_horn_xpm, wxT("trumpet_horn")},
1323 {turntable_xpm, wxT("turntable")},
1324 {vibraphone_vibes_xpm, wxT("vibraphone_vibes")},
1325 {vocal_vox_xpm, wxT("vocal_vox")},
1326
1327 // This one must be last, so it wins when best score is 0.
1328 {_default_instrument_xpm, wxEmptyString},
1329 };
1330
1332 wxMemoryDC dc;
1333
1334 for (const auto &data : table) {
1335 auto bmp = std::make_unique<wxBitmap>(data.bitmap);
1336 dc.SelectObject(*bmp);
1337 AColor::Bevel(dc, false, bev);
1338 mMusicalInstruments.push_back(std::make_unique<MusicalInstrument>(
1339 std::move(bmp), data.name
1340 ));
1341 };
1342}
wxT("CloseDown"))
const TranslatableString name
Definition: Distortion.cpp:76
const int MUSICAL_INSTRUMENT_HEIGHT_AND_WIDTH
Definition: MixerBoard.cpp:142
static void Bevel(wxDC &dc, bool up, const wxRect &r)
Definition: AColor.cpp:266

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 1219 of file MixerBoard.cpp.

1220{
1221
1222 const auto translation = str.Translation();
1223 int textWidth, textHeight;
1224
1225 int fontSize = 10;
1226 #ifdef __WXMSW__
1227 fontSize = 8;
1228 #endif
1229 wxFont font(fontSize, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
1230 GetTextExtent(translation, &textWidth, &textHeight, NULL, NULL, &font);
1231
1232 AColor::UseThemeColour( &dc, clrMedium );
1233 dc.DrawRectangle(bev);
1234
1235 AColor::Bevel2( dc, up, bev, false );
1236
1237 wxCoord x = bev.x + (bev.width - textWidth) / 2;
1238 wxCoord y = bev.y + (bev.height - textHeight) / 2;
1239 dc.SetFont(font);
1240 dc.SetTextForeground(theTheme.Colour(clrTrackPanelText));
1241 dc.SetBackgroundMode(wxTRANSPARENT);
1242 dc.DrawText(translation, x, y);
1243// dc.DrawText(translation, 0, 0);
1244}
static void Bevel2(wxDC &dc, bool up, const wxRect &r, bool bSel=false, bool bHighlight=false)
Definition: AColor.cpp:294
static void UseThemeColour(wxDC *dc, int iBrush, int iPen=-1, int alpha=255)
Definition: AColor.cpp:372

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 1346 of file MixerBoard.cpp.

1347{
1348 if (!mUpToDate) {
1349 mUpToDate = true;
1351 Refresh();
1352 }
1353 // Does the base class do anything for repainting?
1354 evt.Skip();
1355}
bool mUpToDate
Definition: MixerBoard.h:269
void UpdateTrackClusters()

References mUpToDate, and UpdateTrackClusters().

Here is the call graph for this function:

◆ OnSize()

void MixerBoard::OnSize ( wxSizeEvent &  evt)
private

Definition at line 1357 of file MixerBoard.cpp.

1358{
1359 // this->FitInside() doesn't work, and it doesn't happen automatically. Is wxScrolledWindow wrong?
1360 mScrolledWindow->SetSize(evt.GetSize());
1361
1362 this->ResizeTrackClusters();
1363 this->RefreshTrackClusters(true);
1364}
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 1410 of file MixerBoard.cpp.

1411{
1412 if (evt.type == AudioIOEvent::PLAYBACK)
1413 ResetMeters( evt.on );
1414}
void ResetMeters(const bool bResetClipping)
bool on
Definition: AudioIO.h:66
enum AudioIOEvent::Type type

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

Referenced by MixerBoard().

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

◆ OnTimer()

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

Definition at line 1366 of file MixerBoard.cpp.

1367{
1368 // PRL 12 Jul 2015: Moved the below (with comments) out of TrackPanel::OnTimer.
1369
1370 // Vaughan, 2011-01-28: No longer doing this on timer.
1371 // Now it's in AudioIO::SetMeters() and AudioIO::StopStream(), as with Meter Toolbar meters.
1372 //if (pMixerBoard)
1373 // pMixerBoard->ResetMeters(false);
1374
1375 //v Vaughan, 2011-02-25: Moved this update back here from audacityAudioCallback.
1376 // See note there.
1377 // Vaughan, 2010-01-30:
1378 // Since all we're doing here is updating the meters, I moved it to
1379 // audacityAudioCallback where it calls gAudioIO->mOutputMeter->UpdateDisplay().
1380 if (ProjectAudioIO::Get( *mProject ).IsAudioActive())
1381 {
1382 auto gAudioIO = AudioIO::Get();
1384 gAudioIO->GetStreamTime(),
1387 );
1388 }
1389}
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 1391 of file MixerBoard.cpp.

1392{
1393 auto pTrack = evt.mpTrack.lock();
1394 auto pPlayable = dynamic_cast<PlayableTrack*>( pTrack.get() );
1395 if ( pPlayable ) {
1396 MixerTrackCluster *pMixerTrackCluster;
1397 FindMixerTrackCluster( pPlayable, &pMixerTrackCluster );
1398 if ( pMixerTrackCluster )
1399 pMixerTrackCluster->Refresh();
1400 }
1401}
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 1403 of file MixerBoard.cpp.

1404{
1405 mUpToDate = false;
1407 Refresh();
1408}

References mUpToDate, and UpdateTrackClusters().

Here is the call graph for this function:

◆ RefreshTrackClusters()

void MixerBoard::RefreshTrackClusters ( bool  bEraseBackground = true)

Definition at line 1149 of file MixerBoard.cpp.

1150{
1151 for (unsigned int i = 0; i < mMixerTrackClusters.size(); i++)
1152 mMixerTrackClusters[i]->Refresh(bEraseBackground);
1153}

References mMixerTrackClusters.

Referenced by OnSize().

Here is the caller graph for this function:

◆ RemoveTrackCluster()

void MixerBoard::RemoveTrackCluster ( size_t  nIndex)
private

Definition at line 1074 of file MixerBoard.cpp.

1075{
1076 auto pMixerTrackCluster = mMixerTrackClusters[nIndex];
1077 mMixerTrackClusters.erase(mMixerTrackClusters.begin() + nIndex);
1078 pMixerTrackCluster->Destroy(); // DELETE is unsafe on wxWindow.
1079
1080 // Close the gap, if any.
1081 wxPoint pos;
1082 int targetX;
1083 for (unsigned int i = nIndex; i < mMixerTrackClusters.size(); i++)
1084 {
1085 pos = mMixerTrackClusters[i]->GetPosition();
1086 targetX =
1087 kInset + // extra inset to left for first one, so it's double
1088 (i * (kInset + kMixerTrackClusterWidth)) + // left margin and width for each
1089 kInset; // plus left margin for this cluster
1090 if (pos.x != targetX)
1091 mMixerTrackClusters[i]->Move(targetX, pos.y);
1092 }
1093
1094 this->UpdateWidth();
1095}
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 1161 of file MixerBoard.cpp.

1162{
1164
1165 if (!this->IsShown())
1166 return;
1167
1168 for (unsigned int i = 0; i < mMixerTrackClusters.size(); i++)
1169 mMixerTrackClusters[i]->ResetMeter(bResetClipping);
1170}
#define BAD_STREAM_TIME
Definition: AudioIOBase.h:38

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 1155 of file MixerBoard.cpp.

1156{
1157 for (unsigned int nClusterIndex = 0; nClusterIndex < mMixerTrackClusters.size(); nClusterIndex++)
1158 mMixerTrackClusters[nClusterIndex]->HandleResize();
1159}

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 1172 of file MixerBoard.cpp.

1173{
1174 if (!this->IsShown() || (t1 == BAD_STREAM_TIME))
1175 return;
1176
1177 if (mPrevT1 == BAD_STREAM_TIME)
1178 {
1179 mPrevT1 = t1;
1180 return;
1181 }
1182
1183 // PRL: TODO: reexamine the assumptions below
1184
1185 // In loopedPlay mode, at the end of the loop, mPrevT1 is set to
1186 // selection end, so the next t1 will be less, but we do want to
1187 // keep updating the meters.
1188 if (t1 <= mPrevT1)
1189 {
1190 if (bLoopedPlay)
1191 mPrevT1 = t1;
1192 return;
1193 }
1194
1195 for (unsigned int i = 0; i < mMixerTrackClusters.size(); i++)
1196 mMixerTrackClusters[i]->UpdateMeter(mPrevT1, t1);
1197
1198 mPrevT1 = t1;
1199}

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 974 of file MixerBoard.cpp.

975{
976 // Destroys this:
977 static_cast<MixerBoardFrame*>(GetParent())->Recreate( mProject );
978
979// Old approach modified things in situ.
980// However with a theme change there is so much to modify, it is easier
981// to recreate.
982#if 0
983 mScrolledWindow->SetBackgroundColour( theTheme.Colour( clrMedium ) );
984 if( mImageMuteUp ){
985 mImageMuteUp.reset();
986 mImageMuteOver.reset();
987 mImageMuteDown.reset();
989 mImageMuteDisabled.reset();
990 mImageSoloUp.reset();
991 mImageSoloOver.reset();
992 mImageSoloDown.reset();
993 mImageSoloDisabled.reset();
994 }
995 for (unsigned int nClusterIndex = 0; nClusterIndex < mMixerTrackClusters.size(); nClusterIndex++)
996 mMixerTrackClusters[nClusterIndex]->UpdatePrefs();
997 Refresh();
998#endif
999}
void UpdatePrefs() override
Definition: MixerBoard.cpp:974

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 1008 of file MixerBoard.cpp.

1009{
1010 if (!mImageMuteUp)
1011 this->CreateMuteSoloImages();
1012
1013 const int nClusterHeight = mScrolledWindow->GetClientSize().GetHeight() - kDoubleInset;
1014 size_t nClusterCount = mMixerTrackClusters.size();
1015 unsigned int nClusterIndex = 0;
1016 MixerTrackCluster* pMixerTrackCluster = NULL;
1017
1018 for (auto pPlayableTrack: mTracks->Any<PlayableTrack>()) {
1019 // TODO: more-than-two-channels
1020 auto spTrack = pPlayableTrack->SharedPointer<PlayableTrack>();
1021 if (nClusterIndex < nClusterCount)
1022 {
1023 // Already showing it.
1024 // Track clusters are maintained in the same order as the WaveTracks.
1025 // Track pointers can change for the "same" track for different states
1026 // on the undo stack, so update the pointers and display name.
1027 mMixerTrackClusters[nClusterIndex]->mTrack = spTrack;
1028 // Assume linked track is wave or null
1029 mMixerTrackClusters[nClusterIndex]->UpdateForStateChange();
1030 }
1031 else
1032 {
1033 // Not already showing it. Add a NEW MixerTrackCluster.
1034 wxPoint clusterPos(
1035 kInset + nClusterIndex * kMixerTrackClusterWidth,
1036 kInset);
1037 wxSize clusterSize(kMixerTrackClusterWidth, nClusterHeight);
1038 pMixerTrackCluster =
1040 spTrack,
1041 clusterPos, clusterSize);
1042 if (pMixerTrackCluster)
1043 mMixerTrackClusters.push_back(pMixerTrackCluster);
1044 }
1045 nClusterIndex++;
1046 }
1047
1048 if (pMixerTrackCluster)
1049 {
1050 // Added at least one MixerTrackCluster.
1051 this->UpdateWidth();
1052 this->ResizeTrackClusters();
1053 }
1054 else while (nClusterIndex < nClusterCount)
1055 {
1056 // We've got too many clusters.
1057 // This can happen only on things like Undo New Audio Track or Undo Import
1058 // that don't call RemoveTrackCluster explicitly.
1059 // We've already updated the track pointers for the clusters to the left, so just remove all the rest.
1060 // Successively DELETE from right to left.
1061 RemoveTrackCluster(--nClusterCount);
1062 }
1063}
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 1202 of file MixerBoard.cpp.

1203{
1204 int newWidth = this->GetTrackClustersWidth();
1205
1206 // Min width is one cluster wide, plus margins.
1207 if (newWidth < MIXER_BOARD_MIN_WIDTH)
1208 newWidth = MIXER_BOARD_MIN_WIDTH;
1209
1210 mScrolledWindow->SetVirtualSize(newWidth, -1);
1211 this->GetParent()->SetSize(newWidth + kDoubleInset, -1);
1212}
#define MIXER_BOARD_MIN_WIDTH
Definition: MixerBoard.cpp:880
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 202 of file MixerBoard.h.

Member Data Documentation

◆ mAudioIOSubscription

Observer::Subscription MixerBoard::mAudioIOSubscription
private

Definition at line 259 of file MixerBoard.h.

◆ mImageMuteDisabled

std::unique_ptr<wxImage> MixerBoard::mImageMuteDisabled

Definition at line 252 of file MixerBoard.h.

Referenced by CreateMuteSoloImages(), and UpdatePrefs().

◆ mImageMuteDown

std::unique_ptr<wxImage> MixerBoard::mImageMuteDown

Definition at line 250 of file MixerBoard.h.

Referenced by CreateMuteSoloImages(), and UpdatePrefs().

◆ mImageMuteDownWhileSolo

std::unique_ptr<wxImage> MixerBoard::mImageMuteDownWhileSolo

Definition at line 251 of file MixerBoard.h.

Referenced by CreateMuteSoloImages(), and UpdatePrefs().

◆ mImageMuteOver

std::unique_ptr<wxImage> MixerBoard::mImageMuteOver

Definition at line 250 of file MixerBoard.h.

Referenced by CreateMuteSoloImages(), and UpdatePrefs().

◆ mImageMuteUp

std::unique_ptr<wxImage> MixerBoard::mImageMuteUp

Definition at line 250 of file MixerBoard.h.

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

◆ mImageSoloDisabled

std::unique_ptr<wxImage> MixerBoard::mImageSoloDisabled

Definition at line 252 of file MixerBoard.h.

Referenced by CreateMuteSoloImages(), and UpdatePrefs().

◆ mImageSoloDown

std::unique_ptr<wxImage> MixerBoard::mImageSoloDown

Definition at line 252 of file MixerBoard.h.

Referenced by CreateMuteSoloImages(), and UpdatePrefs().

◆ mImageSoloOver

std::unique_ptr<wxImage> MixerBoard::mImageSoloOver

Definition at line 252 of file MixerBoard.h.

Referenced by CreateMuteSoloImages(), and UpdatePrefs().

◆ mImageSoloUp

std::unique_ptr<wxImage> MixerBoard::mImageSoloUp

Definition at line 252 of file MixerBoard.h.

Referenced by CreateMuteSoloImages(), and UpdatePrefs().

◆ mMixerTrackClusters

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

◆ mMusicalInstruments

MusicalInstrumentArray MixerBoard::mMusicalInstruments
private

Definition at line 264 of file MixerBoard.h.

Referenced by GetMusicalInstrumentBitmap(), and LoadMusicalInstruments().

◆ mMuteSoloWidth

int MixerBoard::mMuteSoloWidth

Definition at line 254 of file MixerBoard.h.

Referenced by CreateMuteSoloImages().

◆ mPlaybackScrollerSubscription

Observer::Subscription MixerBoard::mPlaybackScrollerSubscription
private

Definition at line 257 of file MixerBoard.h.

◆ mPrevT1

double MixerBoard::mPrevT1
private

Definition at line 267 of file MixerBoard.h.

Referenced by ResetMeters(), and UpdateMeters().

◆ mProject

AudacityProject* MixerBoard::mProject
private

Definition at line 265 of file MixerBoard.h.

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

◆ mScrolledWindow

MixerBoardScrolledWindow* MixerBoard::mScrolledWindow
private

Definition at line 266 of file MixerBoard.h.

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

◆ mTrackPanelSubscription

Observer::Subscription MixerBoard::mTrackPanelSubscription
private

Definition at line 258 of file MixerBoard.h.

◆ mTracks

TrackList* MixerBoard::mTracks
private

Definition at line 268 of file MixerBoard.h.

Referenced by HasSolo(), and UpdateTrackClusters().

◆ mUpToDate

bool MixerBoard::mUpToDate { false }
private

Definition at line 269 of file MixerBoard.h.

Referenced by OnPaint(), and OnTrackSetChanged().


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