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

869: wxWindow(parent, -1, pos, size)
870{
871 // public data members
872
873 // mute & solo button images
874 // Create once and store on MixerBoard for use in all MixerTrackClusters.
875 mImageMuteUp = NULL;
876 mImageMuteOver = NULL;
877 mImageMuteDown = NULL;
879 mImageMuteDisabled = NULL;
880 mImageSoloUp = NULL;
881 mImageSoloOver = NULL;
882 mImageSoloDown = NULL;
883 mImageSoloDisabled = NULL;
884
885 mMuteSoloWidth = kRightSideStackWidth - kInset; // correct for max width, but really set in MixerBoard::CreateMuteSoloImages
886
887 // private data members
888 this->LoadMusicalInstruments(); // Set up mMusicalInstruments.
889 mProject = pProject;
890
891 wxASSERT(pProject); // to justify safenew
894 pProject, // AudacityProject* project,
895 this, -1, // wxWindow* parent, wxWindowID id = -1,
896 this->GetClientAreaOrigin(), // const wxPoint& pos = wxDefaultPosition,
897 size, // const wxSize& size = wxDefaultSize,
898 wxHSCROLL); // long style = wxHSCROLL | wxVSCROLL, const wxString& name = "scrolledWindow")
899
900 // Set background color to same as TrackPanel background.
901// #ifdef EXPERIMENTAL_THEMING
902// mScrolledWindow->SetBackgroundColour(this->GetParent()->GetBackgroundColour());
903// #else
904// mScrolledWindow->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_3DSHADOW));
905// #endif
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 mTracks->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:133
const int kRightSideStackWidth
Definition: MixerBoard.cpp:144
THEME_API Theme theTheme
Definition: Theme.cpp:82
static AudioIO * Get()
Definition: AudioIO.cpp:147
void OnStartStop(AudioIOEvent)
std::unique_ptr< wxImage > mImageMuteDownWhileSolo
Definition: MixerBoard.h:246
TrackList * mTracks
Definition: MixerBoard.h:263
std::unique_ptr< wxImage > mImageMuteDown
Definition: MixerBoard.h:245
std::unique_ptr< wxImage > mImageMuteDisabled
Definition: MixerBoard.h:247
std::unique_ptr< wxImage > mImageMuteOver
Definition: MixerBoard.h:245
std::unique_ptr< wxImage > mImageSoloDown
Definition: MixerBoard.h:247
void OnTimer(Observer::Message)
MixerBoardScrolledWindow * mScrolledWindow
Definition: MixerBoard.h:261
std::unique_ptr< wxImage > mImageMuteUp
Definition: MixerBoard.h:245
Observer::Subscription mTrackPanelSubscription
Definition: MixerBoard.h:253
Observer::Subscription mAudioIOSubscription
Definition: MixerBoard.h:254
std::unique_ptr< wxImage > mImageSoloDisabled
Definition: MixerBoard.h:247
std::unique_ptr< wxImage > mImageSoloUp
Definition: MixerBoard.h:247
std::unique_ptr< wxImage > mImageSoloOver
Definition: MixerBoard.h:247
void LoadMusicalInstruments()
AudacityProject * mProject
Definition: MixerBoard.h:260
int mMuteSoloWidth
Definition: MixerBoard.h:249
Observer::Subscription mPlaybackScrollerSubscription
Definition: MixerBoard.h:252
double mPrevT1
Definition: MixerBoard.h:262
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:486
Notification of changes in individual tracks of TrackList, or of TrackList's composition.
Definition: Track.h:1288
const Type mType
Definition: Track.h:1325

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

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

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

References mMixerTrackClusters.

Referenced by OnTrackChanged().

Here is the caller graph for this function:

◆ GetMusicalInstrumentBitmap()

wxBitmap * MixerBoard::GetMusicalInstrumentBitmap ( const Track pTrack)

Definition at line 1075 of file MixerBoard.cpp.

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

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

1043{
1044 return
1045 kInset + // extra margin at left for first one
1046 (mMixerTrackClusters.size() * // number of tracks times
1047 (kInset + kMixerTrackClusterWidth)) + // left margin and width for each
1048 kDoubleInset; // plus final right margin
1049}
const int kDoubleInset
Definition: MixerBoard.cpp:134
const int kMixerTrackClusterWidth
Definition: MixerBoard.cpp:145

References kDoubleInset, kInset, kMixerTrackClusterWidth, and mMixerTrackClusters.

Referenced by UpdateWidth().

Here is the caller graph for this function:

◆ HasSolo()

bool MixerBoard::HasSolo ( )

Definition at line 1119 of file MixerBoard.cpp.

1120{
1121 return !(( mTracks->Any<PlayableTrack>() + &PlayableTrack::GetSolo ).empty());
1122}
AudioTrack subclass that can also be audibly replayed by the program.
Definition: Track.h:916
bool GetSolo() const
Definition: Track.h:924
auto Any() -> TrackIterRange< TrackType >
Definition: Track.h:1437

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

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

1195{
1196
1197 const auto translation = str.Translation();
1198 int textWidth, textHeight;
1199
1200 int fontSize = 10;
1201 #ifdef __WXMSW__
1202 fontSize = 8;
1203 #endif
1204 wxFont font(fontSize, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
1205 GetTextExtent(translation, &textWidth, &textHeight, NULL, NULL, &font);
1206
1207 AColor::UseThemeColour( &dc, clrMedium );
1208 dc.DrawRectangle(bev);
1209
1210 AColor::Bevel2( dc, up, bev, false );
1211
1212 wxCoord x = bev.x + (bev.width - textWidth) / 2;
1213 wxCoord y = bev.y + (bev.height - textHeight) / 2;
1214 dc.SetFont(font);
1215 dc.SetTextForeground(theTheme.Colour(clrTrackPanelText));
1216 dc.SetBackgroundMode(wxTRANSPARENT);
1217 dc.DrawText(translation, x, y);
1218// dc.DrawText(translation, 0, 0);
1219}
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 1321 of file MixerBoard.cpp.

1322{
1323 if (!mUpToDate) {
1324 mUpToDate = true;
1326 Refresh();
1327 }
1328 // Does the base class do anything for repainting?
1329 evt.Skip();
1330}
bool mUpToDate
Definition: MixerBoard.h:264
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 1332 of file MixerBoard.cpp.

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

1386{
1387 if (evt.type == AudioIOEvent::PLAYBACK)
1388 ResetMeters( evt.on );
1389}
void ResetMeters(const bool bResetClipping)
bool on
Definition: AudioIO.h:77
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 1341 of file MixerBoard.cpp.

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

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

1379{
1380 mUpToDate = false;
1382 Refresh();
1383}

References mUpToDate, and UpdateTrackClusters().

Here is the call graph for this function:

◆ RefreshTrackClusters()

void MixerBoard::RefreshTrackClusters ( bool  bEraseBackground = true)

Definition at line 1124 of file MixerBoard.cpp.

1125{
1126 for (unsigned int i = 0; i < mMixerTrackClusters.size(); i++)
1127 mMixerTrackClusters[i]->Refresh(bEraseBackground);
1128}

References mMixerTrackClusters.

Referenced by OnSize().

Here is the caller graph for this function:

◆ RemoveTrackCluster()

void MixerBoard::RemoveTrackCluster ( size_t  nIndex)
private

Definition at line 1051 of file MixerBoard.cpp.

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

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

1131{
1132 for (unsigned int nClusterIndex = 0; nClusterIndex < mMixerTrackClusters.size(); nClusterIndex++)
1133 mMixerTrackClusters[nClusterIndex]->HandleResize();
1134}

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

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

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->Leaders<PlayableTrack>()) {
996 // TODO: more-than-two-channels
997 auto spTrack = pPlayableTrack->SharedPointer<PlayableTrack>();
998 if (nClusterIndex < nClusterCount)
999 {
1000 // Already showing it.
1001 // Track clusters are maintained in the same order as the WaveTracks.
1002 // Track pointers can change for the "same" track for different states
1003 // on the undo stack, so update the pointers and display name.
1004 mMixerTrackClusters[nClusterIndex]->mTrack = spTrack;
1005 // Assume linked track is wave or null
1006 mMixerTrackClusters[nClusterIndex]->UpdateForStateChange();
1007 }
1008 else
1009 {
1010 // Not already showing it. Add a NEW MixerTrackCluster.
1011 wxPoint clusterPos(
1012 kInset + nClusterIndex * kMixerTrackClusterWidth,
1013 kInset);
1014 wxSize clusterSize(kMixerTrackClusterWidth, nClusterHeight);
1015 pMixerTrackCluster =
1017 spTrack,
1018 clusterPos, clusterSize);
1019 if (pMixerTrackCluster)
1020 mMixerTrackClusters.push_back(pMixerTrackCluster);
1021 }
1022 nClusterIndex++;
1023 }
1024
1025 if (pMixerTrackCluster)
1026 {
1027 // Added at least one MixerTrackCluster.
1028 this->UpdateWidth();
1029 this->ResizeTrackClusters();
1030 }
1031 else while (nClusterIndex < nClusterCount)
1032 {
1033 // We've got too many clusters.
1034 // This can happen only on things like Undo New Audio Track or Undo Import
1035 // that don't call RemoveTrackCluster explicitly.
1036 // We've already updated the track pointers for the clusters to the left, so just remove all the rest.
1037 // Successively DELETE from right to left.
1038 RemoveTrackCluster(--nClusterCount);
1039 }
1040}
void RemoveTrackCluster(size_t nIndex)
void CreateMuteSoloImages()
auto Leaders() -> TrackIterRange< TrackType >
Definition: Track.h:1471

References CreateMuteSoloImages(), kDoubleInset, kInset, kMixerTrackClusterWidth, TrackList::Leaders(), 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 1177 of file MixerBoard.cpp.

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

Member Data Documentation

◆ mAudioIOSubscription

Observer::Subscription MixerBoard::mAudioIOSubscription
private

Definition at line 254 of file MixerBoard.h.

◆ mImageMuteDisabled

std::unique_ptr<wxImage> MixerBoard::mImageMuteDisabled

Definition at line 247 of file MixerBoard.h.

Referenced by CreateMuteSoloImages(), and UpdatePrefs().

◆ mImageMuteDown

std::unique_ptr<wxImage> MixerBoard::mImageMuteDown

Definition at line 245 of file MixerBoard.h.

Referenced by CreateMuteSoloImages(), and UpdatePrefs().

◆ mImageMuteDownWhileSolo

std::unique_ptr<wxImage> MixerBoard::mImageMuteDownWhileSolo

Definition at line 246 of file MixerBoard.h.

Referenced by CreateMuteSoloImages(), and UpdatePrefs().

◆ mImageMuteOver

std::unique_ptr<wxImage> MixerBoard::mImageMuteOver

Definition at line 245 of file MixerBoard.h.

Referenced by CreateMuteSoloImages(), and UpdatePrefs().

◆ mImageMuteUp

std::unique_ptr<wxImage> MixerBoard::mImageMuteUp

Definition at line 245 of file MixerBoard.h.

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

◆ mImageSoloDisabled

std::unique_ptr<wxImage> MixerBoard::mImageSoloDisabled

Definition at line 247 of file MixerBoard.h.

Referenced by CreateMuteSoloImages(), and UpdatePrefs().

◆ mImageSoloDown

std::unique_ptr<wxImage> MixerBoard::mImageSoloDown

Definition at line 247 of file MixerBoard.h.

Referenced by CreateMuteSoloImages(), and UpdatePrefs().

◆ mImageSoloOver

std::unique_ptr<wxImage> MixerBoard::mImageSoloOver

Definition at line 247 of file MixerBoard.h.

Referenced by CreateMuteSoloImages(), and UpdatePrefs().

◆ mImageSoloUp

std::unique_ptr<wxImage> MixerBoard::mImageSoloUp

Definition at line 247 of file MixerBoard.h.

Referenced by CreateMuteSoloImages(), and UpdatePrefs().

◆ mMixerTrackClusters

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

◆ mMusicalInstruments

MusicalInstrumentArray MixerBoard::mMusicalInstruments
private

Definition at line 259 of file MixerBoard.h.

Referenced by GetMusicalInstrumentBitmap(), and LoadMusicalInstruments().

◆ mMuteSoloWidth

int MixerBoard::mMuteSoloWidth

Definition at line 249 of file MixerBoard.h.

Referenced by CreateMuteSoloImages().

◆ mPlaybackScrollerSubscription

Observer::Subscription MixerBoard::mPlaybackScrollerSubscription
private

Definition at line 252 of file MixerBoard.h.

◆ mPrevT1

double MixerBoard::mPrevT1
private

Definition at line 262 of file MixerBoard.h.

Referenced by ResetMeters(), and UpdateMeters().

◆ mProject

AudacityProject* MixerBoard::mProject
private

Definition at line 260 of file MixerBoard.h.

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

◆ mScrolledWindow

MixerBoardScrolledWindow* MixerBoard::mScrolledWindow
private

Definition at line 261 of file MixerBoard.h.

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

◆ mTrackPanelSubscription

Observer::Subscription MixerBoard::mTrackPanelSubscription
private

Definition at line 253 of file MixerBoard.h.

◆ mTracks

TrackList* MixerBoard::mTracks
private

Definition at line 263 of file MixerBoard.h.

Referenced by HasSolo(), and UpdateTrackClusters().

◆ mUpToDate

bool MixerBoard::mUpToDate { false }
private

Definition at line 264 of file MixerBoard.h.

Referenced by OnPaint(), and OnTrackSetChanged().


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