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

873: wxWindow(parent, -1, pos, size)
874{
875 // public data members
876
877 // mute & solo button images
878 // Create once and store on MixerBoard for use in all MixerTrackClusters.
879 mImageMuteUp = NULL;
880 mImageMuteOver = NULL;
881 mImageMuteDown = NULL;
883 mImageMuteDisabled = NULL;
884 mImageSoloUp = NULL;
885 mImageSoloOver = NULL;
886 mImageSoloDown = NULL;
887 mImageSoloDisabled = NULL;
888
889 mMuteSoloWidth = kRightSideStackWidth - kInset; // correct for max width, but really set in MixerBoard::CreateMuteSoloImages
890
891 // private data members
892 this->LoadMusicalInstruments(); // Set up mMusicalInstruments.
893 mProject = pProject;
894
895 wxASSERT(pProject); // to justify safenew
898 pProject, // AudacityProject* project,
899 this, -1, // wxWindow* parent, wxWindowID id = -1,
900 this->GetClientAreaOrigin(), // const wxPoint& pos = wxDefaultPosition,
901 size, // const wxSize& size = wxDefaultSize,
902 wxHSCROLL); // long style = wxHSCROLL | wxVSCROLL, const wxString& name = "scrolledWindow")
903
904 // Set background color to same as TrackPanel background.
905// mScrolledWindow->SetBackgroundColour(this->GetParent()->GetBackgroundColour());
906 mScrolledWindow->SetBackgroundColour( theTheme.Colour( clrMedium ) );
908
909 mScrolledWindow->SetScrollRate(10, 0); // no vertical scroll
910 mScrolledWindow->SetVirtualSize(size);
911
912 /* This doesn't work to make the mScrolledWindow automatically resize, so do it explicitly in OnSize.
913 auto pBoxSizer = std::make_unique<wxBoxSizer>(wxVERTICAL);
914 pBoxSizer->push_back(mScrolledWindow, 0, wxExpand, 0);
915 this->SetAutoLayout(true);
916 this->SetSizer(pBoxSizer);
917 pBoxSizer->Fit(this);
918 pBoxSizer->SetSizeHints(this);
919 */
920
921 mPrevT1 = 0.0;
923
924 // Events from the project don't propagate directly to this other frame, so...
928
930 PendingTracks::Get(*mProject).Subscribe([this](const TrackListEvent &event){
931 switch (event.mType) {
932 case TrackListEvent::SELECTION_CHANGE:
933 case TrackListEvent::TRACK_DATA_CHANGE:
934 OnTrackChanged(event); break;
935 case TrackListEvent::PERMUTED:
936 case TrackListEvent::ADDITION:
937 case TrackListEvent::DELETION:
938 OnTrackSetChanged(); break;
939 default:
940 break;
941 }
942 });
943
946}
#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:244
TrackList * mTracks
Definition: MixerBoard.h:261
std::unique_ptr< wxImage > mImageMuteDown
Definition: MixerBoard.h:243
std::unique_ptr< wxImage > mImageMuteDisabled
Definition: MixerBoard.h:245
std::unique_ptr< wxImage > mImageMuteOver
Definition: MixerBoard.h:243
std::unique_ptr< wxImage > mImageSoloDown
Definition: MixerBoard.h:245
void OnTimer(Observer::Message)
MixerBoardScrolledWindow * mScrolledWindow
Definition: MixerBoard.h:259
std::unique_ptr< wxImage > mImageMuteUp
Definition: MixerBoard.h:243
Observer::Subscription mTrackPanelSubscription
Definition: MixerBoard.h:251
Observer::Subscription mAudioIOSubscription
Definition: MixerBoard.h:252
std::unique_ptr< wxImage > mImageSoloDisabled
Definition: MixerBoard.h:245
std::unique_ptr< wxImage > mImageSoloUp
Definition: MixerBoard.h:245
std::unique_ptr< wxImage > mImageSoloOver
Definition: MixerBoard.h:245
void LoadMusicalInstruments()
AudacityProject * mProject
Definition: MixerBoard.h:258
int mMuteSoloWidth
Definition: MixerBoard.h:247
Observer::Subscription mPlaybackScrollerSubscription
Definition: MixerBoard.h:250
double mPrevT1
Definition: MixerBoard.h:260
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 1225 of file MixerBoard.cpp.

1226{
1227 // Much of this is similar to TrackInfo::MuteOrSoloDrawFunction.
1228 wxMemoryDC dc;
1229 auto str = XO("Mute");
1230
1231 //mMuteSoloWidth = textWidth + kQuadrupleInset;
1232 //if (mMuteSoloWidth < kRightSideStackWidth - kInset)
1234
1235 wxBitmap bitmap(mMuteSoloWidth, MUTE_SOLO_HEIGHT,24);
1236 dc.SelectObject(bitmap);
1237 wxRect bev(0, 0, mMuteSoloWidth, MUTE_SOLO_HEIGHT);
1238
1239 const bool up=true;
1240 const bool down=false;
1241
1242 MakeButtonBitmap( dc, bitmap, bev, str, up );
1243 mImageMuteUp = std::make_unique<wxImage>(bitmap.ConvertToImage());
1244 mImageMuteOver = std::make_unique<wxImage>(bitmap.ConvertToImage()); // Same as up, for now.
1245
1246 MakeButtonBitmap( dc, bitmap, bev, str, down );
1247 //AColor::Bevel(dc, false, bev);
1248 mImageMuteDown = std::make_unique<wxImage>(bitmap.ConvertToImage());
1249
1250 MakeButtonBitmap( dc, bitmap, bev, str, down );
1251 mImageMuteDownWhileSolo = std::make_unique<wxImage>(bitmap.ConvertToImage());
1252
1253 mImageMuteDisabled = std::make_unique<wxImage>(mMuteSoloWidth, MUTE_SOLO_HEIGHT); // Leave empty because unused.
1254
1255 str = XO("Solo");
1256 MakeButtonBitmap( dc, bitmap, bev, str, up );
1257 mImageSoloUp = std::make_unique<wxImage>(bitmap.ConvertToImage());
1258 mImageSoloOver = std::make_unique<wxImage>(bitmap.ConvertToImage()); // Same as up, for now.
1259
1260 MakeButtonBitmap( dc, bitmap, bev, str, down );
1261 mImageSoloDown = std::make_unique<wxImage>(bitmap.ConvertToImage());
1262
1263 mImageSoloDisabled = std::make_unique<wxImage>(mMuteSoloWidth, MUTE_SOLO_HEIGHT); // Leave empty because unused.
1264}
#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 1266 of file MixerBoard.cpp.

1268{
1269 *hMixerTrackCluster = NULL;
1270 for (unsigned int i = 0; i < mMixerTrackClusters.size(); i++)
1271 {
1272 if (mMixerTrackClusters[i]->mTrack.get() == pTrack)
1273 {
1274 *hMixerTrackCluster = mMixerTrackClusters[i];
1275 return i;
1276 }
1277 }
1278 return -1;
1279}
std::vector< MixerTrackCluster * > mMixerTrackClusters
Definition: MixerBoard.h:255

References mMixerTrackClusters.

Referenced by OnTrackChanged().

Here is the caller graph for this function:

◆ GetMusicalInstrumentBitmap()

wxBitmap * MixerBoard::GetMusicalInstrumentBitmap ( const Track pTrack)

Definition at line 1077 of file MixerBoard.cpp.

1078{
1079 if (mMusicalInstruments.empty())
1080 return NULL;
1081
1082 // random choice: return mMusicalInstruments[(int)pTrack % mMusicalInstruments.size()].mBitmap;
1083
1084 const wxString strTrackName(
1085 wxString{ pTrack->GetName() }.MakeLower());
1086 size_t nBestItemIndex = 0;
1087 unsigned int nBestScore = 0;
1088 unsigned int nInstrIndex = 0;
1089 unsigned int nKeywordIndex;
1090 unsigned int nNumKeywords;
1091 unsigned int nPointsPerMatch;
1092 unsigned int nScore;
1093 for (nInstrIndex = 0; nInstrIndex < mMusicalInstruments.size(); nInstrIndex++)
1094 {
1095 nScore = 0;
1096
1097 nNumKeywords = mMusicalInstruments[nInstrIndex]->mKeywords.size();
1098 if (nNumKeywords > 0)
1099 {
1100 nPointsPerMatch = 10 / nNumKeywords;
1101 for (nKeywordIndex = 0; nKeywordIndex < nNumKeywords; nKeywordIndex++)
1102 if (strTrackName.Contains(mMusicalInstruments[nInstrIndex]->mKeywords[nKeywordIndex]))
1103 {
1104 nScore +=
1105 nPointsPerMatch +
1106 // Longer keywords get more points.
1107 (2 * mMusicalInstruments[nInstrIndex]->mKeywords[nKeywordIndex].length());
1108 }
1109 }
1110
1111 // Choose later one if just matching nBestScore, for better variety,
1112 // and so default works as last element.
1113 if (nScore >= nBestScore)
1114 {
1115 nBestScore = nScore;
1116 nBestItemIndex = nInstrIndex;
1117 }
1118 }
1119 return mMusicalInstruments[nBestItemIndex]->mBitmap.get();
1120}
MusicalInstrumentArray mMusicalInstruments
Definition: MixerBoard.h:257
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 1044 of file MixerBoard.cpp.

1045{
1046 return
1047 kInset + // extra margin at left for first one
1048 (mMixerTrackClusters.size() * // number of tracks times
1049 (kInset + kMixerTrackClusterWidth)) + // left margin and width for each
1050 kDoubleInset; // plus final right margin
1051}
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 1122 of file MixerBoard.cpp.

1123{
1124 return
1126}
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 1281 of file MixerBoard.cpp.

1282{
1283 const struct Data { const char * const *bitmap; wxString name; } table[] = {
1284 {acoustic_guitar_gtr_xpm, wxT("acoustic_guitar_gtr")},
1285 {acoustic_piano_pno_xpm, wxT("acoustic_piano_pno")},
1286 {back_vocal_bg_vox_xpm, wxT("back_vocal_bg_vox")},
1287 {clap_xpm, wxT("clap")},
1288 {drums_dr_xpm, wxT("drums_dr")},
1289 {electric_bass_guitar_bs_gtr_xpm, wxT("electric_bass_guitar_bs_gtr")},
1290 {electric_guitar_gtr_xpm, wxT("electric_guitar_gtr")},
1291 {electric_piano_pno_key_xpm, wxT("electric_piano_pno_key")},
1292 {kick_xpm, wxT("kick")},
1293 {loop_xpm, wxT("loop")},
1294 {organ_org_xpm, wxT("organ_org")},
1295 {perc_xpm, wxT("perc")},
1296 {sax_xpm, wxT("sax")},
1297 {snare_xpm, wxT("snare")},
1298 {string_violin_cello_xpm, wxT("string_violin_cello")},
1299 {synth_xpm, wxT("synth")},
1300 {tambo_xpm, wxT("tambo")},
1301 {trumpet_horn_xpm, wxT("trumpet_horn")},
1302 {turntable_xpm, wxT("turntable")},
1303 {vibraphone_vibes_xpm, wxT("vibraphone_vibes")},
1304 {vocal_vox_xpm, wxT("vocal_vox")},
1305
1306 // This one must be last, so it wins when best score is 0.
1307 {_default_instrument_xpm, wxEmptyString},
1308 };
1309
1311 wxMemoryDC dc;
1312
1313 for (const auto &data : table) {
1314 auto bmp = std::make_unique<wxBitmap>(data.bitmap);
1315 dc.SelectObject(*bmp);
1316 AColor::Bevel(dc, false, bev);
1317 mMusicalInstruments.push_back(std::make_unique<MusicalInstrument>(
1318 std::move(bmp), data.name
1319 ));
1320 };
1321}
wxT("CloseDown"))
const TranslatableString name
Definition: Distortion.cpp:76
const int MUSICAL_INSTRUMENT_HEIGHT_AND_WIDTH
Definition: MixerBoard.cpp:143
static void Bevel(wxDC &dc, bool up, const wxRect &r)
Definition: AColor.cpp:264

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

1199{
1200
1201 const auto translation = str.Translation();
1202 int textWidth, textHeight;
1203
1204 int fontSize = 10;
1205 #ifdef __WXMSW__
1206 fontSize = 8;
1207 #endif
1208 wxFont font(fontSize, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
1209 GetTextExtent(translation, &textWidth, &textHeight, NULL, NULL, &font);
1210
1211 AColor::UseThemeColour( &dc, clrMedium );
1212 dc.DrawRectangle(bev);
1213
1214 AColor::Bevel2( dc, up, bev, false );
1215
1216 wxCoord x = bev.x + (bev.width - textWidth) / 2;
1217 wxCoord y = bev.y + (bev.height - textHeight) / 2;
1218 dc.SetFont(font);
1219 dc.SetTextForeground(theTheme.Colour(clrTrackPanelText));
1220 dc.SetBackgroundMode(wxTRANSPARENT);
1221 dc.DrawText(translation, x, y);
1222// dc.DrawText(translation, 0, 0);
1223}
static void Bevel2(wxDC &dc, bool up, const wxRect &r, bool bSel=false, bool bHighlight=false)
Definition: AColor.cpp:292
static void UseThemeColour(wxDC *dc, int iBrush, int iPen=-1, int alpha=255)
Definition: AColor.cpp:366

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

1326{
1327 if (!mUpToDate) {
1328 mUpToDate = true;
1330 Refresh();
1331 }
1332 // Does the base class do anything for repainting?
1333 evt.Skip();
1334}
bool mUpToDate
Definition: MixerBoard.h:262
void UpdateTrackClusters()
Definition: MixerBoard.cpp:985

References mUpToDate, and UpdateTrackClusters().

Here is the call graph for this function:

◆ OnSize()

void MixerBoard::OnSize ( wxSizeEvent &  evt)
private

Definition at line 1336 of file MixerBoard.cpp.

1337{
1338 // this->FitInside() doesn't work, and it doesn't happen automatically. Is wxScrolledWindow wrong?
1339 mScrolledWindow->SetSize(evt.GetSize());
1340
1341 this->ResizeTrackClusters();
1342 this->RefreshTrackClusters(true);
1343}
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 1389 of file MixerBoard.cpp.

1390{
1391 if (evt.type == AudioIOEvent::PLAYBACK)
1392 ResetMeters( evt.on );
1393}
void ResetMeters(const bool bResetClipping)
bool on
Definition: AudioIO.h:66
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 1345 of file MixerBoard.cpp.

1346{
1347 // PRL 12 Jul 2015: Moved the below (with comments) out of TrackPanel::OnTimer.
1348
1349 // Vaughan, 2011-01-28: No longer doing this on timer.
1350 // Now it's in AudioIO::SetMeters() and AudioIO::StopStream(), as with Meter Toolbar meters.
1351 //if (pMixerBoard)
1352 // pMixerBoard->ResetMeters(false);
1353
1354 //v Vaughan, 2011-02-25: Moved this update back here from audacityAudioCallback.
1355 // See note there.
1356 // Vaughan, 2010-01-30:
1357 // Since all we're doing here is updating the meters, I moved it to
1358 // audacityAudioCallback where it calls gAudioIO->mOutputMeter->UpdateDisplay().
1359 if (ProjectAudioIO::Get( *mProject ).IsAudioActive())
1360 {
1361 auto gAudioIO = AudioIO::Get();
1363 gAudioIO->GetStreamTime(),
1366 );
1367 }
1368}
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 1370 of file MixerBoard.cpp.

1371{
1372 auto pTrack = evt.mpTrack.lock();
1373 auto pPlayable = dynamic_cast<PlayableTrack*>( pTrack.get() );
1374 if ( pPlayable ) {
1375 MixerTrackCluster *pMixerTrackCluster;
1376 FindMixerTrackCluster( pPlayable, &pMixerTrackCluster );
1377 if ( pMixerTrackCluster )
1378 pMixerTrackCluster->Refresh();
1379 }
1380}
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 1382 of file MixerBoard.cpp.

1383{
1384 mUpToDate = false;
1386 Refresh();
1387}

References mUpToDate, and UpdateTrackClusters().

Here is the call graph for this function:

◆ RefreshTrackClusters()

void MixerBoard::RefreshTrackClusters ( bool  bEraseBackground = true)

Definition at line 1128 of file MixerBoard.cpp.

1129{
1130 for (unsigned int i = 0; i < mMixerTrackClusters.size(); i++)
1131 mMixerTrackClusters[i]->Refresh(bEraseBackground);
1132}

References mMixerTrackClusters.

Referenced by OnSize().

Here is the caller graph for this function:

◆ RemoveTrackCluster()

void MixerBoard::RemoveTrackCluster ( size_t  nIndex)
private

Definition at line 1053 of file MixerBoard.cpp.

1054{
1055 auto pMixerTrackCluster = mMixerTrackClusters[nIndex];
1056 mMixerTrackClusters.erase(mMixerTrackClusters.begin() + nIndex);
1057 pMixerTrackCluster->Destroy(); // DELETE is unsafe on wxWindow.
1058
1059 // Close the gap, if any.
1060 wxPoint pos;
1061 int targetX;
1062 for (unsigned int i = nIndex; i < mMixerTrackClusters.size(); i++)
1063 {
1064 pos = mMixerTrackClusters[i]->GetPosition();
1065 targetX =
1066 kInset + // extra inset to left for first one, so it's double
1067 (i * (kInset + kMixerTrackClusterWidth)) + // left margin and width for each
1068 kInset; // plus left margin for this cluster
1069 if (pos.x != targetX)
1070 mMixerTrackClusters[i]->Move(targetX, pos.y);
1071 }
1072
1073 this->UpdateWidth();
1074}
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 1140 of file MixerBoard.cpp.

1141{
1143
1144 if (!this->IsShown())
1145 return;
1146
1147 for (unsigned int i = 0; i < mMixerTrackClusters.size(); i++)
1148 mMixerTrackClusters[i]->ResetMeter(bResetClipping);
1149}
#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 1134 of file MixerBoard.cpp.

1135{
1136 for (unsigned int nClusterIndex = 0; nClusterIndex < mMixerTrackClusters.size(); nClusterIndex++)
1137 mMixerTrackClusters[nClusterIndex]->HandleResize();
1138}

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

1152{
1153 if (!this->IsShown() || (t1 == BAD_STREAM_TIME))
1154 return;
1155
1156 if (mPrevT1 == BAD_STREAM_TIME)
1157 {
1158 mPrevT1 = t1;
1159 return;
1160 }
1161
1162 // PRL: TODO: reexamine the assumptions below
1163
1164 // In loopedPlay mode, at the end of the loop, mPrevT1 is set to
1165 // selection end, so the next t1 will be less, but we do want to
1166 // keep updating the meters.
1167 if (t1 <= mPrevT1)
1168 {
1169 if (bLoopedPlay)
1170 mPrevT1 = t1;
1171 return;
1172 }
1173
1174 for (unsigned int i = 0; i < mMixerTrackClusters.size(); i++)
1175 mMixerTrackClusters[i]->UpdateMeter(mPrevT1, t1);
1176
1177 mPrevT1 = t1;
1178}

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

952{
953 // Destroys this:
954 static_cast<MixerBoardFrame*>(GetParent())->Recreate( mProject );
955
956// Old approach modified things in situ.
957// However with a theme change there is so much to modify, it is easier
958// to recreate.
959#if 0
960 mScrolledWindow->SetBackgroundColour( theTheme.Colour( clrMedium ) );
961 if( mImageMuteUp ){
962 mImageMuteUp.reset();
963 mImageMuteOver.reset();
964 mImageMuteDown.reset();
966 mImageMuteDisabled.reset();
967 mImageSoloUp.reset();
968 mImageSoloOver.reset();
969 mImageSoloDown.reset();
970 mImageSoloDisabled.reset();
971 }
972 for (unsigned int nClusterIndex = 0; nClusterIndex < mMixerTrackClusters.size(); nClusterIndex++)
973 mMixerTrackClusters[nClusterIndex]->UpdatePrefs();
974 Refresh();
975#endif
976}
void UpdatePrefs() override
Definition: MixerBoard.cpp:951

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

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

1182{
1183 int newWidth = this->GetTrackClustersWidth();
1184
1185 // Min width is one cluster wide, plus margins.
1186 if (newWidth < MIXER_BOARD_MIN_WIDTH)
1187 newWidth = MIXER_BOARD_MIN_WIDTH;
1188
1189 mScrolledWindow->SetVirtualSize(newWidth, -1);
1190 this->GetParent()->SetSize(newWidth + kDoubleInset, -1);
1191}
#define MIXER_BOARD_MIN_WIDTH
Definition: MixerBoard.cpp:861
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 195 of file MixerBoard.h.

Member Data Documentation

◆ mAudioIOSubscription

Observer::Subscription MixerBoard::mAudioIOSubscription
private

Definition at line 252 of file MixerBoard.h.

◆ mImageMuteDisabled

std::unique_ptr<wxImage> MixerBoard::mImageMuteDisabled

Definition at line 245 of file MixerBoard.h.

Referenced by CreateMuteSoloImages(), and UpdatePrefs().

◆ mImageMuteDown

std::unique_ptr<wxImage> MixerBoard::mImageMuteDown

Definition at line 243 of file MixerBoard.h.

Referenced by CreateMuteSoloImages(), and UpdatePrefs().

◆ mImageMuteDownWhileSolo

std::unique_ptr<wxImage> MixerBoard::mImageMuteDownWhileSolo

Definition at line 244 of file MixerBoard.h.

Referenced by CreateMuteSoloImages(), and UpdatePrefs().

◆ mImageMuteOver

std::unique_ptr<wxImage> MixerBoard::mImageMuteOver

Definition at line 243 of file MixerBoard.h.

Referenced by CreateMuteSoloImages(), and UpdatePrefs().

◆ mImageMuteUp

std::unique_ptr<wxImage> MixerBoard::mImageMuteUp

Definition at line 243 of file MixerBoard.h.

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

◆ mImageSoloDisabled

std::unique_ptr<wxImage> MixerBoard::mImageSoloDisabled

Definition at line 245 of file MixerBoard.h.

Referenced by CreateMuteSoloImages(), and UpdatePrefs().

◆ mImageSoloDown

std::unique_ptr<wxImage> MixerBoard::mImageSoloDown

Definition at line 245 of file MixerBoard.h.

Referenced by CreateMuteSoloImages(), and UpdatePrefs().

◆ mImageSoloOver

std::unique_ptr<wxImage> MixerBoard::mImageSoloOver

Definition at line 245 of file MixerBoard.h.

Referenced by CreateMuteSoloImages(), and UpdatePrefs().

◆ mImageSoloUp

std::unique_ptr<wxImage> MixerBoard::mImageSoloUp

Definition at line 245 of file MixerBoard.h.

Referenced by CreateMuteSoloImages(), and UpdatePrefs().

◆ mMixerTrackClusters

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

◆ mMusicalInstruments

MusicalInstrumentArray MixerBoard::mMusicalInstruments
private

Definition at line 257 of file MixerBoard.h.

Referenced by GetMusicalInstrumentBitmap(), and LoadMusicalInstruments().

◆ mMuteSoloWidth

int MixerBoard::mMuteSoloWidth

Definition at line 247 of file MixerBoard.h.

Referenced by CreateMuteSoloImages().

◆ mPlaybackScrollerSubscription

Observer::Subscription MixerBoard::mPlaybackScrollerSubscription
private

Definition at line 250 of file MixerBoard.h.

◆ mPrevT1

double MixerBoard::mPrevT1
private

Definition at line 260 of file MixerBoard.h.

Referenced by ResetMeters(), and UpdateMeters().

◆ mProject

AudacityProject* MixerBoard::mProject
private

Definition at line 258 of file MixerBoard.h.

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

◆ mScrolledWindow

MixerBoardScrolledWindow* MixerBoard::mScrolledWindow
private

Definition at line 259 of file MixerBoard.h.

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

◆ mTrackPanelSubscription

Observer::Subscription MixerBoard::mTrackPanelSubscription
private

Definition at line 251 of file MixerBoard.h.

◆ mTracks

TrackList* MixerBoard::mTracks
private

Definition at line 261 of file MixerBoard.h.

Referenced by HasSolo(), and UpdateTrackClusters().

◆ mUpToDate

bool MixerBoard::mUpToDate { false }
private

Definition at line 262 of file MixerBoard.h.

Referenced by OnPaint(), and OnTrackSetChanged().


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