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

#include <MixerBoard.h>

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

Public Member Functions

 MixerTrackCluster (wxWindow *parent, MixerBoard *grandParent, AudacityProject *project, PlayableTrack &track, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize)
 
virtual ~MixerTrackCluster ()
 
WaveTrackGetWave () const
 
WaveChannelGetRight () const
 
NoteTrackGetNote () const
 
void HandleResize ()
 
void HandleSliderGain (const bool bWantPushState=false)
 
void HandleSliderVelocity (const bool bWantPushState=false)
 
void HandleSliderPan (const bool bWantPushState=false)
 
void ResetMeter (const bool bResetClipping)
 
void UpdateForStateChange ()
 
void UpdateMeter (const double t0, const double t1)
 
- Public Member Functions inherited from wxPanelWrapper
 wxPanelWrapper ()
 
 wxPanelWrapper (wxWindow *parent, wxWindowID winid=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL|wxNO_BORDER, const TranslatableString &name=XO("Panel"))
 
bool Create (wxWindow *parent, wxWindowID winid=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL|wxNO_BORDER, const TranslatableString &name=XO("Panel"))
 
void SetLabel (const TranslatableString &label)
 
void SetName (const TranslatableString &name)
 
void SetToolTip (const TranslatableString &toolTip)
 
void SetName ()
 
- Public Member Functions inherited from wxTabTraversalWrapper< wxPanel >
 wxTabTraversalWrapper (Args &&... args)
 
 wxTabTraversalWrapper (const wxTabTraversalWrapper &)=delete
 
 wxTabTraversalWrapper (wxTabTraversalWrapper &&)=delete
 
wxTabTraversalWrapperoperator= (const wxTabTraversalWrapper &)=delete
 
wxTabTraversalWrapperoperator= (wxTabTraversalWrapper &&)=delete
 

Public Attributes

std::shared_ptr< PlayableTrackmTrack
 Invariant not null. More...
 

Private Member Functions

wxColour GetTrackColor ()
 
void HandleSelect (bool bShiftDown, bool bControlDown)
 
void OnKeyEvent (wxKeyEvent &event)
 
void OnMouseEvent (wxMouseEvent &event)
 
void OnPaint (wxPaintEvent &evt)
 
void OnButton_MusicalInstrument (wxCommandEvent &event)
 
void OnSlider_Gain (wxCommandEvent &event)
 
void OnSlider_Velocity (wxCommandEvent &event)
 
void OnSlider_Pan (wxCommandEvent &event)
 
void OnButton_Mute (wxCommandEvent &event)
 
void OnButton_Solo (wxCommandEvent &event)
 

Private Attributes

MixerBoardmMixerBoard
 
AudacityProjectmProject
 
auStaticTextmStaticText_TrackName
 
wxBitmapButton * mBitmapButton_MusicalInstrument
 
AButtonmToggleButton_Mute
 
AButtonmToggleButton_Solo
 
MixerTrackSlidermSlider_Pan
 
MixerTrackSlidermSlider_Volume
 
MixerTrackSlidermSlider_Velocity
 
wxWeakRef< MeterPanelmMeter
 
ChannelGroupSampleView mSampleView
 

Detailed Description

Definition at line 81 of file MixerBoard.h.

Constructor & Destructor Documentation

◆ MixerTrackCluster()

MixerTrackCluster::MixerTrackCluster ( wxWindow *  parent,
MixerBoard grandParent,
AudacityProject project,
PlayableTrack track,
const wxPoint &  pos = wxDefaultPosition,
const wxSize &  size = wxDefaultSize 
)

Definition at line 173 of file MixerBoard.cpp.

178: wxPanelWrapper(parent, -1, pos, size)
180{
181 mMixerBoard = grandParent;
183 assert(mTrack);
184
185 SetName( Verbatim( mTrack->GetName() ) );
186
187 //this->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE));
188 this->SetBackgroundColour( theTheme.Colour( clrMedium ) );
189 // Not sure why, but sizers weren't getting offset vertically,
190 // probably because not using wxDefaultPosition,
191 // so positions are calculated explicitly below, and sizers code was removed.
192 // (Still available in Audacity_UmixIt branch off 1.2.6.)
193
194 // track name
195 wxPoint ctrlPos(kDoubleInset, kDoubleInset);
196 wxSize ctrlSize(size.GetWidth() - kQuadrupleInset, TRACK_NAME_HEIGHT);
198 safenew auStaticText(this, mTrack->GetName());
199 //v Useful when different tracks are different colors, but not now.
200 // mStaticText_TrackName->SetBackgroundColour(this->GetTrackColor());
201 mStaticText_TrackName->SetForegroundColour(theTheme.Colour(clrMedium));
202 mStaticText_TrackName->SetForegroundColour(theTheme.Colour(clrTrackPanelText));
203 mStaticText_TrackName->SetSize( ctrlSize );
204 mStaticText_TrackName->SetPosition( ctrlPos );
205
206
207 // volume and velocity sliders at left (both in same place)
208 ctrlPos.x = kDoubleInset;
209 ctrlPos.y += TRACK_NAME_HEIGHT + kDoubleInset;
210 const int nGainSliderHeight =
211 size.GetHeight() - ctrlPos.y - kQuadrupleInset;
212 ctrlSize.Set(kLeftSideStackWidth - kQuadrupleInset, nGainSliderHeight);
213
216 this, ID_SLIDER_GAIN,
217 /* i18n-hint: title of the Volume slider, used to adjust the volume */
218 XO("Volume"),
219 ctrlPos, ctrlSize,
221 .Style( DB_SLIDER )
222 .Orientation( wxVERTICAL ));
223 mSlider_Volume->SetName(_("Volume"));
224
227 this, ID_SLIDER_VELOCITY,
228 /* i18n-hint: title of the MIDI Velocity slider */
229 XO("Velocity"),
230 ctrlPos, ctrlSize,
232 .Style( VEL_SLIDER )
233 .Orientation( wxVERTICAL ));
234 mSlider_Velocity->SetName(_("Velocity"));
235
236 // other controls and meter at right
237
238 // musical instrument image
239 ctrlPos.x += kLeftSideStackWidth + kInset; // + kInset to center it in right side stack
241 wxBitmap* bitmap = mMixerBoard->GetMusicalInstrumentBitmap(mTrack.get());
242 wxASSERT(bitmap);
244 safenew wxBitmapButton(this, ID_BITMAPBUTTON_MUSICAL_INSTRUMENT, *bitmap,
245 ctrlPos, ctrlSize,
246 wxBU_AUTODRAW, wxDefaultValidator,
247 _("Musical Instrument"));
248 mBitmapButton_MusicalInstrument->SetName(_("Musical Instrument"));
249
250
251 // pan slider
252 ctrlPos.x -= kInset; // Remove inset for instrument, so Pan is at leftmost of left side stack.
254 ctrlSize.Set(kRightSideStackWidth, PAN_HEIGHT);
255
256 // The width of the pan slider must be odd (don't ask).
257 if (!(ctrlSize.x & 1))
258 ctrlSize.x--;
259
262 this, ID_SLIDER_PAN,
263 /* i18n-hint: Title of the Pan slider, used to move the sound left or right */
264 XO("Pan"),
265 ctrlPos, ctrlSize,
267 mSlider_Pan->SetName(_("Pan"));
268
269 // mute/solo buttons stacked below Pan slider
270 ctrlPos.y += PAN_HEIGHT + kDoubleInset;
274 ctrlPos, ctrlSize,
278 true); // toggle button
279 mToggleButton_Mute->SetName(_("Mute"));
281 1,
285
286 ctrlPos.y += MUTE_SOLO_HEIGHT;
289 ctrlPos, ctrlSize,
293 true); // toggle button
294 mToggleButton_Solo->SetName(_("Solo"));
295
296
297 // meter
298 ctrlPos.y += MUTE_SOLO_HEIGHT + kDoubleInset;
299 const int nMeterHeight =
300 nGainSliderHeight -
304 ctrlSize.Set(kRightSideStackWidth, nMeterHeight);
305
306 mMeter.Release();
307 if (GetWave()) {
308 mMeter =
309 safenew MeterPanel(mProject, // AudacityProject* project,
310 this, -1, // wxWindow* parent, wxWindowID id,
311 false, // bool isInput
312 ctrlPos, ctrlSize, // const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
313 MeterPanel::MixerTrackCluster); // Style style = HorizontalStereo,
314 mMeter->SetName(XO("Signal Level Meter"));
315 }
316
317 #if wxUSE_TOOLTIPS
318 mStaticText_TrackName->SetToolTip(mTrack->GetName());
321 if (GetWave())
322 mMeter->SetToolTip(XO("Signal Level Meter"));
323 #endif // wxUSE_TOOLTIPS
324
326
327 #ifdef __WXMAC__
328 wxSizeEvent event(GetSize(), GetId());
329 event.SetEventObject(this);
330 GetEventHandler()->ProcessEvent(event);
331 #endif
332}
#define VEL_SLIDER
Definition: ASlider.h:37
#define DB_SLIDER
Definition: ASlider.h:33
#define PAN_SLIDER
Definition: ASlider.h:34
XO("Cut/Copy/Paste")
#define _(s)
Definition: Internat.h:73
#define safenew
Definition: MemoryX.h:10
const int MUSICAL_INSTRUMENT_HEIGHT_AND_WIDTH
Definition: MixerBoard.cpp:143
const int kDoubleInset
Definition: MixerBoard.cpp:138
const int kQuadrupleInset
Definition: MixerBoard.cpp:140
const int MUTE_SOLO_HEIGHT
Definition: MixerBoard.cpp:144
const int PAN_HEIGHT
Definition: MixerBoard.cpp:145
const int kLeftSideStackWidth
Definition: MixerBoard.cpp:147
const int kInset
Definition: MixerBoard.cpp:137
const int kRightSideStackWidth
Definition: MixerBoard.cpp:148
const int TRACK_NAME_HEIGHT
Definition: MixerBoard.cpp:142
@ ID_BITMAPBUTTON_MUSICAL_INSTRUMENT
Definition: MixerBoard.cpp:152
@ ID_SLIDER_PAN
Definition: MixerBoard.cpp:153
@ ID_SLIDER_VELOCITY
Definition: MixerBoard.cpp:155
@ ID_SLIDER_GAIN
Definition: MixerBoard.cpp:154
@ ID_TOGGLEBUTTON_MUTE
Definition: MixerBoard.cpp:156
@ ID_TOGGLEBUTTON_SOLO
Definition: MixerBoard.cpp:157
const auto project
THEME_API Theme theTheme
Definition: Theme.cpp:82
TranslatableString Verbatim(wxString str)
Require calls to the one-argument constructor to go through this distinct global function name.
A wxButton with mouse-over behaviour.
Definition: AButton.h:104
void SetToolTip(const TranslatableString &toolTip)
Definition: AButton.cpp:200
void SetAlternateImages(unsigned idx, const wxImage &up, const wxImage &over, const wxImage &down, const wxImage &overDown, const wxImage &dis)
Definition: AButton.cpp:226
MeterPanel is a panel that paints the meter used for monitoring or playback.
Definition: MeterPanel.h:91
@ MixerTrackCluster
Definition: MeterPanel.h:101
std::unique_ptr< wxImage > mImageMuteDown
Definition: MixerBoard.h:241
std::unique_ptr< wxImage > mImageMuteDisabled
Definition: MixerBoard.h:243
std::unique_ptr< wxImage > mImageMuteOver
Definition: MixerBoard.h:241
std::unique_ptr< wxImage > mImageSoloDown
Definition: MixerBoard.h:243
std::unique_ptr< wxImage > mImageMuteUp
Definition: MixerBoard.h:241
wxBitmap * GetMusicalInstrumentBitmap(const Track *pTrack)
std::unique_ptr< wxImage > mImageSoloDisabled
Definition: MixerBoard.h:243
std::unique_ptr< wxImage > mImageSoloUp
Definition: MixerBoard.h:243
std::unique_ptr< wxImage > mImageSoloOver
Definition: MixerBoard.h:243
int mMuteSoloWidth
Definition: MixerBoard.h:245
wxBitmapButton * mBitmapButton_MusicalInstrument
Definition: MixerBoard.h:135
void UpdateForStateChange()
Definition: MixerBoard.cpp:453
std::shared_ptr< PlayableTrack > mTrack
Invariant not null.
Definition: MixerBoard.h:127
AudacityProject * mProject
Definition: MixerBoard.h:131
WaveTrack * GetWave() const
Definition: MixerBoard.cpp:334
AButton * mToggleButton_Mute
Definition: MixerBoard.h:136
MixerBoard * mMixerBoard
Definition: MixerBoard.h:130
wxWeakRef< MeterPanel > mMeter
Definition: MixerBoard.h:141
MixerTrackSlider * mSlider_Volume
Definition: MixerBoard.h:139
MixerTrackSlider * mSlider_Velocity
Definition: MixerBoard.h:140
MixerTrackSlider * mSlider_Pan
Definition: MixerBoard.h:138
auStaticText * mStaticText_TrackName
Definition: MixerBoard.h:134
AButton * mToggleButton_Solo
Definition: MixerBoard.h:137
AudioTrack subclass that can also be audibly replayed by the program.
Definition: PlayableTrack.h:40
wxColour & Colour(int iIndex)
std::shared_ptr< Subclass > SharedPointer()
Definition: Track.h:146
is like wxStaticText, except it can be themed. wxStaticText can't be.
Definition: auStaticText.h:20
Options & Style(int s)
Definition: ASlider.h:280

◆ ~MixerTrackCluster()

virtual MixerTrackCluster::~MixerTrackCluster ( )
inlinevirtual

Definition at line 89 of file MixerBoard.h.

89{}

Member Function Documentation

◆ GetNote()

NoteTrack * MixerTrackCluster::GetNote ( ) const

Definition at line 351 of file MixerBoard.cpp.

352{
353 return dynamic_cast< NoteTrack * >( mTrack.get() );
354}
A Track that is used for Midi notes. (Somewhat old code).
Definition: NoteTrack.h:78

References mTrack.

Referenced by HandleSliderVelocity(), and UpdateForStateChange().

Here is the caller graph for this function:

◆ GetRight()

WaveChannel * MixerTrackCluster::GetRight ( ) const

Definition at line 339 of file MixerBoard.cpp.

340{
341 // TODO: more-than-two-channels
342 auto left = GetWave();
343 if (left) {
344 auto channels = left->Channels();
345 if (channels.size() > 1)
346 return (* ++ channels.first).get();
347 }
348 return nullptr;
349}

References GetWave().

Here is the call graph for this function:

◆ GetTrackColor()

wxColour MixerTrackCluster::GetTrackColor ( )
private

Definition at line 679 of file MixerBoard.cpp.

680{
681 return wxColour(102, 255, 102); // same as Meter playback color
682}

◆ GetWave()

WaveTrack * MixerTrackCluster::GetWave ( ) const

Definition at line 334 of file MixerBoard.cpp.

335{
336 return dynamic_cast< WaveTrack * >( mTrack.get() );
337}
A Track that contains audio waveform data.
Definition: WaveTrack.h:203

References mTrack.

Referenced by GetRight(), HandleSliderGain(), HandleSliderPan(), ResetMeter(), UpdateForStateChange(), and UpdateMeter().

Here is the caller graph for this function:

◆ HandleResize()

void MixerTrackCluster::HandleResize ( )

Definition at line 368 of file MixerBoard.cpp.

369{
370 wxSize scrolledWindowClientSize = this->GetParent()->GetClientSize();
371 const int newClusterHeight =
372 scrolledWindowClientSize.GetHeight() - kDoubleInset - // nClusterHeight from MixerBoard::UpdateTrackClusters
373 wxSystemSettings::GetMetric(wxSYS_HSCROLL_Y) + // wxScrolledWindow::GetClientSize doesn't account for its scrollbar size.
375
376 this->SetSize(-1, newClusterHeight);
377
378 // Change only the heights of mSlider_Volume and mMeter.
379 // But update shown status of mToggleButton_Solo, which affects top of mMeter.
380 const int nGainSliderHeight =
381 newClusterHeight -
382 (kInset + // margin above mStaticText_TrackName
383 TRACK_NAME_HEIGHT + kDoubleInset) - // mStaticText_TrackName + margin
384 kQuadrupleInset; // margin below volume slider
385 mSlider_Volume->SetSize(-1, nGainSliderHeight);
386 mSlider_Velocity->SetSize(-1, nGainSliderHeight);
387
388 const int nRequiredHeightAboveMeter =
392 const int nMeterY =
393 kDoubleInset + // margin at top
395 nRequiredHeightAboveMeter;
396 const int nMeterHeight = nGainSliderHeight - nRequiredHeightAboveMeter;
397 if (mMeter)
398 mMeter->SetSize(-1, nMeterY, -1, nMeterHeight);
399}

References kDoubleInset, kInset, kQuadrupleInset, mMeter, mSlider_Velocity, mSlider_Volume, MUSICAL_INSTRUMENT_HEIGHT_AND_WIDTH, MUTE_SOLO_HEIGHT, PAN_HEIGHT, and TRACK_NAME_HEIGHT.

◆ HandleSelect()

void MixerTrackCluster::HandleSelect ( bool  bShiftDown,
bool  bControlDown 
)
private

Definition at line 687 of file MixerBoard.cpp.

688{
690 *mTrack, bShiftDown, bControlDown, true);
691}
void DoListSelection(AudacityProject &project, Track &t, bool shift, bool ctrl, bool modifyState)

References SelectUtilities::DoListSelection(), mProject, and mTrack.

Referenced by OnButton_MusicalInstrument(), and OnMouseEvent().

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

◆ HandleSliderGain()

void MixerTrackCluster::HandleSliderGain ( const bool  bWantPushState = false)

Definition at line 401 of file MixerBoard.cpp.

402{
403 float fValue = mSlider_Volume->Get();
404 if (GetWave())
405 GetWave()->SetVolume(fValue);
406
407 // Update the TrackPanel correspondingly.
408 TrackPanel::Get( *mProject ).RefreshTrack(mTrack.get());
409 if (bWantPushState)
411 .PushState(XO("Moved volume slider"), XO("Volume"), UndoPush::CONSOLIDATE );
412}
float Get(bool convert=true)
Definition: ASlider.cpp:1859
void PushState(const TranslatableString &desc, const TranslatableString &shortDesc)
static ProjectHistory & Get(AudacityProject &project)
static TrackPanel & Get(AudacityProject &project)
Definition: TrackPanel.cpp:234
void RefreshTrack(Track *trk, bool refreshbacking=true)
Definition: TrackPanel.cpp:768
void SetVolume(float newVolume)
Definition: WaveTrack.cpp:852

References CONSOLIDATE, ProjectHistory::Get(), TrackPanel::Get(), ASlider::Get(), GetWave(), mProject, mSlider_Volume, mTrack, ProjectHistory::PushState(), TrackPanel::RefreshTrack(), WaveTrack::SetVolume(), and XO().

Referenced by MixerTrackSlider::OnMouseEvent(), and OnSlider_Gain().

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

◆ HandleSliderPan()

void MixerTrackCluster::HandleSliderPan ( const bool  bWantPushState = false)

Definition at line 428 of file MixerBoard.cpp.

429{
430 float fValue = mSlider_Pan->Get();
431 if (GetWave()) // test in case track is a NoteTrack
432 GetWave()->SetPan(fValue);
433
434 // Update the TrackPanel correspondingly.
435 TrackPanel::Get( *mProject ).RefreshTrack(mTrack.get());
436
437 if (bWantPushState)
439 .PushState(XO("Moved pan slider"), XO("Pan"),
441}
void SetPan(float newPan)
Definition: WaveTrack.cpp:870

References CONSOLIDATE, ProjectHistory::Get(), TrackPanel::Get(), ASlider::Get(), GetWave(), mProject, mSlider_Pan, mTrack, ProjectHistory::PushState(), TrackPanel::RefreshTrack(), WaveTrack::SetPan(), and XO().

Referenced by MixerTrackSlider::OnMouseEvent(), and OnSlider_Pan().

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

◆ HandleSliderVelocity()

void MixerTrackCluster::HandleSliderVelocity ( const bool  bWantPushState = false)

Definition at line 414 of file MixerBoard.cpp.

415{
416 float fValue = mSlider_Velocity->Get();
417 if (GetNote())
418 GetNote()->SetVelocity(fValue);
419
420 // Update the TrackPanel correspondingly.
421 TrackPanel::Get( *mProject ).RefreshTrack(mTrack.get());
422 if (bWantPushState)
424 .PushState(XO("Moved velocity slider"), XO("Velocity"),
426}
NoteTrack * GetNote() const
Definition: MixerBoard.cpp:351
void SetVelocity(float velocity)
Definition: NoteTrack.cpp:514

References CONSOLIDATE, ProjectHistory::Get(), TrackPanel::Get(), ASlider::Get(), GetNote(), mProject, mSlider_Velocity, mTrack, ProjectHistory::PushState(), TrackPanel::RefreshTrack(), NoteTrack::SetVelocity(), and XO().

Referenced by OnSlider_Velocity().

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

◆ OnButton_MusicalInstrument()

void MixerTrackCluster::OnButton_MusicalInstrument ( wxCommandEvent &  event)
private

Definition at line 728 of file MixerBoard.cpp.

729{
730 const auto &state = ::wxGetMouseState();
731 this->HandleSelect(state.ShiftDown(), state.ControlDown());
732}
void HandleSelect(bool bShiftDown, bool bControlDown)
Definition: MixerBoard.cpp:687

References HandleSelect().

Here is the call graph for this function:

◆ OnButton_Mute()

void MixerTrackCluster::OnButton_Mute ( wxCommandEvent &  event)
private

Definition at line 749 of file MixerBoard.cpp.

750{
753 mToggleButton_Mute->SetAlternateIdx(mTrack->GetSolo() ? 1 : 0);
754
755 // Update the TrackPanel correspondingly.
756 if (TracksBehaviorsSolo.ReadEnum() == SoloBehaviorSimple)
757 Viewport::Get(*mProject).Redraw();
758 else
759 // Update only the changed track.
760 TrackPanel::Get( *mProject ).RefreshTrack(mTrack.get());
761}
EnumSetting< SoloBehavior > TracksBehaviorsSolo
@ SoloBehaviorSimple
Definition: PlayableTrack.h:70
void SetAlternateIdx(unsigned idx)
Definition: AButton.cpp:287
bool WasShiftDown()
Definition: AButton.cpp:628
void Redraw()
Definition: Viewport.cpp:753
static Viewport & Get(AudacityProject &project)
Definition: Viewport.cpp:33
AUDACITY_DLL_API void DoTrackMute(AudacityProject &project, Track &track, bool exclusive)
"exclusive" mute means mute the chosen track and unmute all others.

References TrackUtilities::DoTrackMute(), Viewport::Get(), TrackPanel::Get(), mProject, mToggleButton_Mute, mTrack, Viewport::Redraw(), TrackPanel::RefreshTrack(), AButton::SetAlternateIdx(), SoloBehaviorSimple, TracksBehaviorsSolo, and AButton::WasShiftDown().

Here is the call graph for this function:

◆ OnButton_Solo()

void MixerTrackCluster::OnButton_Solo ( wxCommandEvent &  event)
private

Definition at line 763 of file MixerBoard.cpp.

764{
767 bool bIsSolo = mTrack->GetSolo();
768 mToggleButton_Mute->SetAlternateIdx(bIsSolo ? 1 : 0);
769
770 // Update the TrackPanel correspondingly.
771 // Bug 509: Must repaint all, as many tracks can change with one Solo change.
772 Viewport::Get(*mProject).Redraw();
773}
AUDACITY_DLL_API void DoTrackSolo(AudacityProject &project, Track &track, bool exclusive)

References TrackUtilities::DoTrackSolo(), Viewport::Get(), mProject, mToggleButton_Mute, mToggleButton_Solo, mTrack, Viewport::Redraw(), AButton::SetAlternateIdx(), and AButton::WasShiftDown().

Here is the call graph for this function:

◆ OnKeyEvent()

void MixerTrackCluster::OnKeyEvent ( wxKeyEvent &  event)
private

◆ OnMouseEvent()

void MixerTrackCluster::OnMouseEvent ( wxMouseEvent &  event)
private

Definition at line 693 of file MixerBoard.cpp.

694{
695 if (event.ButtonUp())
696 this->HandleSelect(event.ShiftDown(), event.ControlDown());
697 else
698 event.Skip();
699}

References HandleSelect().

Here is the call graph for this function:

◆ OnPaint()

void MixerTrackCluster::OnPaint ( wxPaintEvent &  evt)
private

Definition at line 701 of file MixerBoard.cpp.

702{
704
705 auto selected = mTrack->GetSelected();
706
707 wxColour col = theTheme.Colour(selected ? clrTrackInfoSelected : clrTrackInfo) ;
708 SetBackgroundColour( col );
709 if (mMeter)
710 mMeter->SetBackgroundColour( col );
711 mStaticText_TrackName->SetBackgroundColour( col );
714
715 wxPaintDC dc(this);
716
717 AColor::MediumTrackInfo(&dc, selected);
718 dc.DrawRectangle(this->GetClientRect());
719
720 wxSize clusterSize = this->GetSize();
721 wxRect bev(0, 0, clusterSize.GetWidth() - 1, clusterSize.GetHeight() - 1);
722
723 //bev.Inflate(-1, -1);
724 AColor::Bevel(dc, true, bev);// same bevel whether selected or not.
725}
static void Bevel(wxDC &dc, bool up, const wxRect &r)
Definition: AColor.cpp:278
static void MediumTrackInfo(wxDC *dc, bool selected)
Definition: AColor.cpp:415
bool SetBackgroundColour(const wxColour &colour) override
Definition: ASlider.cpp:1743

References AColor::Bevel(), ThemeBase::Colour(), AColor::MediumTrackInfo(), mMeter, mSlider_Pan, mSlider_Volume, mStaticText_TrackName, mTrack, ASlider::SetBackgroundColour(), theTheme, and UpdateForStateChange().

Here is the call graph for this function:

◆ OnSlider_Gain()

void MixerTrackCluster::OnSlider_Gain ( wxCommandEvent &  event)
private

Definition at line 734 of file MixerBoard.cpp.

735{
736 this->HandleSliderGain();
737}
void HandleSliderGain(const bool bWantPushState=false)
Definition: MixerBoard.cpp:401

References HandleSliderGain().

Here is the call graph for this function:

◆ OnSlider_Pan()

void MixerTrackCluster::OnSlider_Pan ( wxCommandEvent &  event)
private

Definition at line 744 of file MixerBoard.cpp.

745{
746 this->HandleSliderPan();
747}
void HandleSliderPan(const bool bWantPushState=false)
Definition: MixerBoard.cpp:428

References HandleSliderPan().

Here is the call graph for this function:

◆ OnSlider_Velocity()

void MixerTrackCluster::OnSlider_Velocity ( wxCommandEvent &  event)
private

Definition at line 739 of file MixerBoard.cpp.

740{
741 this->HandleSliderVelocity();
742}
void HandleSliderVelocity(const bool bWantPushState=false)
Definition: MixerBoard.cpp:414

References HandleSliderVelocity().

Here is the call graph for this function:

◆ ResetMeter()

void MixerTrackCluster::ResetMeter ( const bool  bResetClipping)

Definition at line 443 of file MixerBoard.cpp.

444{
445 if (mMeter)
446 mMeter->Reset(GetWave()->GetRate(), bResetClipping);
447 // Release view to allow cache eviction after/before playback.
448 mSampleView.clear();
449}
ChannelGroupSampleView mSampleView
Definition: MixerBoard.h:142
double GetRate(const Track &track)
Definition: TimeTrack.cpp:182

References anonymous_namespace{TimeTrack.cpp}::GetRate(), GetWave(), mMeter, and mSampleView.

Referenced by UpdateMeter().

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

◆ UpdateForStateChange()

void MixerTrackCluster::UpdateForStateChange ( )

Definition at line 453 of file MixerBoard.cpp.

454{
455 const wxString newName = mTrack->GetName();
456 if (newName != GetName()) {
457 SetName( Verbatim( newName ) );
458 mStaticText_TrackName->SetLabel(newName);
459 mStaticText_TrackName->SetName(newName);
460#if wxUSE_TOOLTIPS
461 mStaticText_TrackName->SetToolTip(newName);
462#endif
463 mBitmapButton_MusicalInstrument->SetBitmapLabel(
465 }
466
467 mToggleButton_Mute->SetAlternateIdx(mTrack->GetSolo() ? 1 : 0);
468 if (mTrack->GetMute())
470 else
472
473 bool bIsSolo = mTrack->GetSolo();
474 if (bIsSolo)
476 else
478 mToggleButton_Mute->SetAlternateIdx(bIsSolo ? 1 : 0);
479
480 if (!GetWave())
481 mSlider_Pan->Hide();
482 else
483 mSlider_Pan->Set(GetWave()->GetPan());
484
485 if (!GetWave())
486 mSlider_Volume->Hide();
487 else
488 mSlider_Volume->Set(GetWave()->GetVolume());
489
490 if (!GetNote())
491 mSlider_Velocity->Hide();
492 else
493 mSlider_Velocity->Set(GetNote()->GetVelocity());
494}
void PushDown()
Definition: AButton.cpp:664
void PopUp()
Definition: AButton.cpp:672
void Set(float value)
Definition: ASlider.cpp:1864

References MixerBoard::GetMusicalInstrumentBitmap(), GetNote(), GetWave(), mBitmapButton_MusicalInstrument, mMixerBoard, mSlider_Pan, mSlider_Velocity, mSlider_Volume, mStaticText_TrackName, mToggleButton_Mute, mToggleButton_Solo, mTrack, AButton::PopUp(), AButton::PushDown(), ASlider::Set(), AButton::SetAlternateIdx(), wxPanelWrapper::SetName(), and Verbatim().

Referenced by OnPaint().

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

◆ UpdateMeter()

void MixerTrackCluster::UpdateMeter ( const double  t0,
const double  t1 
)

Definition at line 519 of file MixerBoard.cpp.

520{
521 // NoteTracks do not (currently) register on meters. It would probably be
522 // a good idea to display 16 channel "active" lights rather than a meter
523 if (!GetWave())
524 return;
525
526 if ((t0 < 0.0) || (t1 < 0.0) || (t0 >= t1) || // bad time value or nothing to show
527 ((mMixerBoard->HasSolo() || mTrack->GetMute()) && !mTrack->GetSolo())
528 )
529 {
530 //v Vaughan, 2011-02-25: Moved the update back to TrackPanel::OnTimer() as it helps with
531 // playback issues reported by Bill and noted on Bug 258, so no assert.
532 // Vaughan, 2011-02-04: Now that we're updating all meters from audacityAudioCallback,
533 // this causes an assert if you click Mute while playing, because ResetMeter() resets
534 // the timer, and wxTimerbase says that can only be done from main thread --
535 // but it seems to work fine.
536 this->ResetMeter(false);
537 return;
538 }
539
540 // Vaughan, 2010-11-27:
541 // This commented out code is flawed. Mistaken understanding of "frame" vs "window".
542 // Caused me to override MeterPanel::UpdateDisplay().
543 // But I think it's got a good idea, of calling WaveTracks' GetMinMax and GetRMS
544 // instead of passing in all the data and asking the meter to derive peak and rms.
545 // May be worth revisiting as I think it should perform better, because it uses the min/max/rms
546 // stored in sample blocks, rather than calculating them, but for now, changing it to use the
547 // original MeterPanel::UpdateDisplay(). New code is below the previous (now commented out).
548 //
549 //const size_t kFramesPerBuffer = 4;
550 //float min; // dummy, since it's not shown in meters
551 //Floats maxLeft{kFramesPerBuffer};
552 //Floats rmsLeft{kFramesPerBuffer};
553 //Floats maxRight{kFramesPerBuffer};
554 //Floats rmsRight{kFramesPerBuffer};
555 //
556 // bool bSuccess = (GetWave() != nullptr);
557
558 //const double dFrameInterval = (t1 - t0) / (double)kFramesPerBuffer;
559 //double dFrameT0 = t0;
560 //double dFrameT1 = t0 + dFrameInterval;
561 //int i = 0;
562 //while (bSuccess && (i < kFramesPerBuffer))
563 //{
564 // bSuccess &=
565 // mTrack->GetMinMax(&min, &(maxLeft[i]), dFrameT0, dFrameT1) &&
566 // mTrack->GetRMS(&(rmsLeft[i]), dFrameT0, dFrameT1);
567 // if (bSuccess && mRightTrack)
568 // bSuccess &=
569 // mRightTrack->GetMinMax(&min, &(maxRight[i]), dFrameT0, dFrameT1) &&
570 // mRightTrack->GetRMS(&(rmsRight[i]), dFrameT0, dFrameT1);
571 // else
572 // {
573 // // Mono: Start with raw values same as left.
574 // // To be modified by bWantPostFadeValues and channel pan/gain.
575 // maxRight[i] = maxLeft[i];
576 // rmsRight[i] = rmsLeft[i];
577 // }
578 // dFrameT0 += dFrameInterval;
579 // dFrameT1 += dFrameInterval;
580 // i++;
581 //}
582 //
583 //const bool bWantPostFadeValues = true; //v Turn this into a checkbox on MixerBoard? For now, always true.
584 //if (bSuccess && bWantPostFadeValues)
585 //if (bSuccess)
586 //{
587 // for (i = 0; i < kFramesPerBuffer; i++)
588 // {
589 // float gain = mTrack->GetChannelVolume(0);
590 // maxLeft[i] *= gain;
591 // rmsLeft[i] *= gain;
592 // if (mRightTrack)
593 // gain = mRightTrack->GetChannelVolume(1);
594 // maxRight[i] *= gain;
595 // rmsRight[i] *= gain;
596 // }
597 // if ( mMeter ) mMeter->UpdateDisplay(
598 // 2, // If mono, show left track values in both meters, as in MeterToolBar, rather than nChannels.
599 // kFramesPerBuffer,
600 // maxLeft, rmsLeft,
601 // maxRight, rmsRight,
602 // mTrack->TimeToLongSamples(t1 - t0));
603 //}
604 //
605
606 // PRL: TODO: don't fetch from wave tracks at calculated times, for update
607 // of the meter display, but instead consult PlaybackPolicy
608
609 const auto pTrack = GetWave();
610
611 // Don't throw on read error in this drawing update routine
612 constexpr auto mayThrow = false;
613
614 // Not sure how to prove satisfaction of the invariant of GetSampleView
615 mSampleView = pTrack->GetSampleView(t0, t1, mayThrow);
616
617 // Expect that the difference of t1 and t0 is the part of a track played
618 // in about 1/20 second (ticks of TrackPanel timer), so this won't overflow,
619 // unless stretch ratio is extremely low.
620 const auto nFrames = GetNumSamplesInView(mSampleView[0]);
621
622 Floats tempFloatsArray;
623 try {
624 tempFloatsArray.reinit(nFrames);
625 }
626 catch (const std::bad_alloc&) {
627 // Just in case we did not satisfy GetSampleView and computed a bogus
628 // size_t value
629 return;
630 }
631 FillBufferWithSampleView(tempFloatsArray.get(), mSampleView[0]);
632
633 decltype(tempFloatsArray) meterFloatsArray;
634 // We always pass a stereo sample array to the meter, as it shows 2 channels.
635 // Mono shows same in both meters.
636 // Since we're not mixing, need to duplicate same signal for "right" channel in mono case.
637 try {
638 meterFloatsArray.reinit(2 * nFrames );
639 }
640 catch (const std::bad_alloc&) {
641 // Just in case we did not satisfy GetSampleView and computed a bogus
642 // size_t value
643 return;
644 }
645
646 // Interleave for stereo. Left/mono first.
647 for (unsigned int index = 0; index < nFrames; index++)
648 meterFloatsArray[2 * index] = tempFloatsArray[index];
649
650 if (mSampleView.size() > 1u)
651 FillBufferWithSampleView(tempFloatsArray.get(), mSampleView[1]);
652
653 // Interleave right channel, or duplicate same signal for "right" channel in mono case.
654 for (unsigned int index = 0; index < nFrames; index++)
655 meterFloatsArray[(2 * index) + 1] = tempFloatsArray[index];
656
657 //const bool bWantPostFadeValues = true; //v Turn this into a checkbox on MixerBoard? For now, always true.
658 //if (bSuccess && bWantPostFadeValues)
659 //vvv Need to apply envelope, too? See Mixer::MixSameRate.
660 float volume = pTrack->GetChannelVolume(0);
661 for (unsigned int index = 0; index < nFrames; index++)
662 meterFloatsArray[2 * index] *= volume;
663 volume = pTrack->GetChannelVolume(1);
664 for (unsigned int index = 0; index < nFrames; index++)
665 meterFloatsArray[(2 * index) + 1] *= volume;
666 // Clip to [-1.0, 1.0] range.
667 for (unsigned int index = 0; index < 2 * nFrames; index++)
668 if (meterFloatsArray[index] < -1.0)
669 meterFloatsArray[index] = -1.0;
670 else if (meterFloatsArray[index] > 1.0)
671 meterFloatsArray[index] = 1.0;
672
673 if (mMeter)
674 mMeter->UpdateDisplay(2, nFrames, meterFloatsArray.get());
675}
void reinit(Integral count, bool initialize=false)
Definition: MemoryX.h:59
bool HasSolo()
void ResetMeter(const bool bResetClipping)
Definition: MixerBoard.cpp:443
size_t GetNumSamplesInView(const ChannelSampleView &view)
Definition: MixerBoard.cpp:497
void FillBufferWithSampleView(float *buffer, const ChannelSampleView &view)
Definition: MixerBoard.cpp:507

References anonymous_namespace{MixerBoard.cpp}::FillBufferWithSampleView(), anonymous_namespace{MixerBoard.cpp}::GetNumSamplesInView(), GetWave(), MixerBoard::HasSolo(), mMeter, mMixerBoard, mSampleView, mTrack, ArrayOf< X >::reinit(), and ResetMeter().

Here is the call graph for this function:

Member Data Documentation

◆ mBitmapButton_MusicalInstrument

wxBitmapButton* MixerTrackCluster::mBitmapButton_MusicalInstrument
private

Definition at line 135 of file MixerBoard.h.

Referenced by UpdateForStateChange().

◆ mMeter

wxWeakRef<MeterPanel> MixerTrackCluster::mMeter
private

Definition at line 141 of file MixerBoard.h.

Referenced by HandleResize(), OnPaint(), ResetMeter(), and UpdateMeter().

◆ mMixerBoard

MixerBoard* MixerTrackCluster::mMixerBoard
private

Definition at line 130 of file MixerBoard.h.

Referenced by UpdateForStateChange(), and UpdateMeter().

◆ mProject

AudacityProject* MixerTrackCluster::mProject
private

◆ mSampleView

ChannelGroupSampleView MixerTrackCluster::mSampleView
private

Definition at line 142 of file MixerBoard.h.

Referenced by ResetMeter(), and UpdateMeter().

◆ mSlider_Pan

MixerTrackSlider* MixerTrackCluster::mSlider_Pan
private

Definition at line 138 of file MixerBoard.h.

Referenced by HandleSliderPan(), OnPaint(), and UpdateForStateChange().

◆ mSlider_Velocity

MixerTrackSlider* MixerTrackCluster::mSlider_Velocity
private

Definition at line 140 of file MixerBoard.h.

Referenced by HandleResize(), HandleSliderVelocity(), and UpdateForStateChange().

◆ mSlider_Volume

MixerTrackSlider* MixerTrackCluster::mSlider_Volume
private

Definition at line 139 of file MixerBoard.h.

Referenced by HandleResize(), HandleSliderGain(), OnPaint(), and UpdateForStateChange().

◆ mStaticText_TrackName

auStaticText* MixerTrackCluster::mStaticText_TrackName
private

Definition at line 134 of file MixerBoard.h.

Referenced by OnPaint(), and UpdateForStateChange().

◆ mToggleButton_Mute

AButton* MixerTrackCluster::mToggleButton_Mute
private

Definition at line 136 of file MixerBoard.h.

Referenced by OnButton_Mute(), OnButton_Solo(), and UpdateForStateChange().

◆ mToggleButton_Solo

AButton* MixerTrackCluster::mToggleButton_Solo
private

Definition at line 137 of file MixerBoard.h.

Referenced by OnButton_Solo(), and UpdateForStateChange().

◆ mTrack

std::shared_ptr<PlayableTrack> MixerTrackCluster::mTrack

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