mirror of
https://github.com/cookiengineer/audacity
synced 2025-07-31 16:09:28 +02:00
Working on new bug reported by Gale about MixerBoard clipping indicators on small clipped regions.
Remove some unused cruft. Rearrange some #includes so they are grouped logically. Add comment about unclear names (bools "clipping" vs "isclipping").
This commit is contained in:
parent
42d7d941e7
commit
08904c22c0
@ -294,27 +294,28 @@ writing audio.
|
||||
|
||||
#include "AudacityApp.h"
|
||||
#include "AudioIO.h"
|
||||
#include "WaveTrack.h"
|
||||
|
||||
#ifdef EXPERIMENTAL_MIDI_OUT
|
||||
#define MIDI_SLEEP 10 /* milliseconds */
|
||||
#define ROUND(x) (int) ((x)+0.5)
|
||||
//#include <string.h>
|
||||
#include "portmidi.h"
|
||||
#include "../src/common/pa_util.h"
|
||||
#include "NoteTrack.h"
|
||||
#endif
|
||||
|
||||
#include "Mix.h"
|
||||
#include "MixerBoard.h"
|
||||
#include "Resample.h"
|
||||
#include "RingBuffer.h"
|
||||
#include "Prefs.h"
|
||||
#include "Project.h"
|
||||
#include "toolbars/ControlToolBar.h"
|
||||
#include "WaveTrack.h"
|
||||
|
||||
#include "toolbars/ControlToolBar.h"
|
||||
#include "widgets/Meter.h"
|
||||
|
||||
#include "../Experimental.h"
|
||||
|
||||
#ifdef EXPERIMENTAL_MIDI_OUT
|
||||
#define MIDI_SLEEP 10 /* milliseconds */
|
||||
#define ROUND(x) (int) ((x)+0.5)
|
||||
//#include <string.h>
|
||||
#include "portmidi.h"
|
||||
#include "../src/common/pa_util.h"
|
||||
#include "NoteTrack.h"
|
||||
#endif
|
||||
|
||||
#define NO_STABLE_INDICATOR -1000000000
|
||||
#define LOWER_BOUND 0.0
|
||||
#define UPPER_BOUND 1.0
|
||||
@ -1414,6 +1415,11 @@ void AudioIO::SetMeters(Meter *inputMeter, Meter *outputMeter)
|
||||
if (mOutputMeter)
|
||||
mOutputMeter->Reset(mRate, true);
|
||||
|
||||
AudacityProject* pProj = GetActiveProject();
|
||||
MixerBoard* pMixerBoard = pProj->GetMixerBoard();
|
||||
if (pMixerBoard)
|
||||
pMixerBoard->ResetMeters(true);
|
||||
|
||||
mUpdateMeters = true;
|
||||
}
|
||||
|
||||
@ -1648,6 +1654,11 @@ void AudioIO::StopStream()
|
||||
if (mOutputMeter)
|
||||
mOutputMeter->Reset(mRate, false);
|
||||
|
||||
AudacityProject* pProj = GetActiveProject();
|
||||
MixerBoard* pMixerBoard = pProj->GetMixerBoard();
|
||||
if (pMixerBoard)
|
||||
pMixerBoard->ResetMeters(false);
|
||||
|
||||
if (mListener && mNumCaptureChannels > 0)
|
||||
mListener->OnAudioIOStopRecording();
|
||||
|
||||
|
@ -334,10 +334,10 @@ void MixerTrackCluster::HandleSliderPan(const bool bWantPushState /*= false*/)
|
||||
mProject->TP_PushState(_("Moved pan slider"), _("Pan"), true /* consolidate */);
|
||||
}
|
||||
|
||||
void MixerTrackCluster::ResetMeter()
|
||||
void MixerTrackCluster::ResetMeter(const bool bResetClipping)
|
||||
{
|
||||
if (mLeftTrack)
|
||||
mMeter->Reset(mLeftTrack->GetRate(), true);
|
||||
mMeter->Reset(mLeftTrack->GetRate(), bResetClipping);
|
||||
}
|
||||
|
||||
|
||||
@ -410,7 +410,7 @@ void MixerTrackCluster::UpdateMeter(const double t0, const double t1)
|
||||
if ((t0 < 0.0) || (t1 < 0.0) || (t0 >= t1) || // bad time value or nothing to show
|
||||
((mMixerBoard->HasSolo() || mTrack->GetMute()) && !mTrack->GetSolo()))
|
||||
{
|
||||
this->ResetMeter();
|
||||
this->ResetMeter(false);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1033,7 +1033,7 @@ void MixerBoard::ResizeTrackClusters()
|
||||
mMixerTrackClusters[nClusterIndex]->HandleResize();
|
||||
}
|
||||
|
||||
void MixerBoard::ResetMeters()
|
||||
void MixerBoard::ResetMeters(const bool bResetClipping)
|
||||
{
|
||||
mPrevT1 = 0.0;
|
||||
|
||||
@ -1041,7 +1041,7 @@ void MixerBoard::ResetMeters()
|
||||
return;
|
||||
|
||||
for (unsigned int i = 0; i < mMixerTrackClusters.GetCount(); i++)
|
||||
mMixerTrackClusters[i]->ResetMeter();
|
||||
mMixerTrackClusters[i]->ResetMeter(bResetClipping);
|
||||
}
|
||||
|
||||
void MixerBoard::UpdateName(const Track* pTrack)
|
||||
|
@ -80,7 +80,7 @@ public:
|
||||
void HandleSliderGain(const bool bWantPushState = false);
|
||||
void HandleSliderPan(const bool bWantPushState = false);
|
||||
|
||||
void ResetMeter();
|
||||
void ResetMeter(const bool bResetClipping);
|
||||
|
||||
// These are used by TrackPanel for synchronizing control states.
|
||||
void UpdateForStateChange(); // Update the controls that can be affected by state change.
|
||||
@ -214,7 +214,7 @@ public:
|
||||
void RefreshTrackClusters(bool bEraseBackground = true);
|
||||
void ResizeTrackClusters();
|
||||
|
||||
void ResetMeters();
|
||||
void ResetMeters(const bool bResetClipping);
|
||||
|
||||
void UpdateName(const Track* pTrack);
|
||||
void UpdateMute(const Track* pTrack = NULL); // NULL means update for all tracks.
|
||||
|
@ -909,7 +909,7 @@ void TrackPanel::OnTimer()
|
||||
}
|
||||
|
||||
if (pMixerBoard)
|
||||
pMixerBoard->ResetMeters();
|
||||
pMixerBoard->ResetMeters(false);
|
||||
}
|
||||
|
||||
// Next, check to see if we were playing or recording
|
||||
|
@ -97,14 +97,6 @@ void MeterToolBar::Populate()
|
||||
mSizer->Add( mRecordMeter, wxGBPosition( 0, 1 ), wxDefaultSpan, wxEXPAND );
|
||||
|
||||
RegenerateTooltips();
|
||||
|
||||
#if defined(THIS_PROBABY_SHOULD_NOT_BE_DONE_HERE)
|
||||
// If AudioIO changes the meters while it's currently busy, then crashes are
|
||||
// very likely.
|
||||
if (gAudioIO && !gAudioIO->IsBusy()) {
|
||||
gAudioIO->SetMeters(mRecordMeter, mPlayMeter);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void MeterToolBar::UpdatePrefs()
|
||||
@ -136,14 +128,6 @@ bool MeterToolBar::DestroyChildren()
|
||||
mPlayMeter = NULL;
|
||||
mRecordMeter = NULL;
|
||||
|
||||
#if defined(THIS_PROBABY_SHOULD_NOT_BE_DONE_HERE)
|
||||
// If AudioIO changes the meters while it's currently busy, then crashes are
|
||||
// very likely...especially in this case.
|
||||
if (gAudioIO && !gAudioIO->IsBusy()) {
|
||||
gAudioIO->SetMeters(NULL, NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
return ToolBar::DestroyChildren();
|
||||
}
|
||||
|
||||
|
@ -37,7 +37,7 @@ struct MeterBar {
|
||||
double peakHoldTime;
|
||||
wxRect rClip;
|
||||
bool clipping;
|
||||
bool isclipping;
|
||||
bool isclipping; //ANSWER-ME: What's the diff between these bools?! "clipping" vs "isclipping" is not clear.
|
||||
int tailPeakCount;
|
||||
float peakPeakHold;
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user