mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-17 08:30:06 +02:00
Bug 258 (P2) - Mixer Board: max peak and clipping lines removed
Fixed bug in resetting mPrevT1. That caused remaining issue noted in Bug 258 comments 2 and 3. Moved call to UpdateMeters from TrackPanel::OnTimer() to audacityAudioCallback, where it calls gAudioIO->mOutputMeter->UpdateDisplay(), so the updates are synchronized with Meter Toolbar updates. Removed unnecessary call to MixerBoard::UpdateMeters() in AudacityProject::UpdateMixerBoard(). Various cleanup.
This commit is contained in:
parent
7d6c347140
commit
d2d876d9a5
@ -316,7 +316,6 @@ writing audio.
|
|||||||
#include "NoteTrack.h"
|
#include "NoteTrack.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define NO_STABLE_INDICATOR -1000000000
|
|
||||||
#define LOWER_BOUND 0.0
|
#define LOWER_BOUND 0.0
|
||||||
#define UPPER_BOUND 1.0
|
#define UPPER_BOUND 1.0
|
||||||
|
|
||||||
@ -1875,7 +1874,7 @@ double AudioIO::NormalizeStreamTime(double absoluteTime) const
|
|||||||
double AudioIO::GetStreamTime()
|
double AudioIO::GetStreamTime()
|
||||||
{
|
{
|
||||||
if( !IsStreamActive() )
|
if( !IsStreamActive() )
|
||||||
return -1000000000;
|
return BAD_STREAM_TIME;
|
||||||
|
|
||||||
return NormalizeStreamTime(mTime);
|
return NormalizeStreamTime(mTime);
|
||||||
}
|
}
|
||||||
@ -3648,6 +3647,11 @@ int audacityAudioCallback(const void *inputBuffer, void *outputBuffer,
|
|||||||
gAudioIO->mOutputMeter->UpdateDisplay(numPlaybackChannels,
|
gAudioIO->mOutputMeter->UpdateDisplay(numPlaybackChannels,
|
||||||
framesPerBuffer,
|
framesPerBuffer,
|
||||||
outputMeterFloats);
|
outputMeterFloats);
|
||||||
|
AudacityProject* pProj = GetActiveProject();
|
||||||
|
MixerBoard* pMixerBoard = pProj->GetMixerBoard();
|
||||||
|
if (pMixerBoard)
|
||||||
|
pMixerBoard->UpdateMeters(gAudioIO->GetStreamTime(),
|
||||||
|
(pProj->mLastPlayMode == loopedPlay));
|
||||||
}
|
}
|
||||||
gAudioIO->mUpdatingMeters = false;
|
gAudioIO->mUpdatingMeters = false;
|
||||||
} // end playback VU meter update
|
} // end playback VU meter update
|
||||||
|
@ -63,6 +63,8 @@ public:
|
|||||||
virtual void OnAudioIONewBlockFiles(const wxString& blockFileLog) = 0;
|
virtual void OnAudioIONewBlockFiles(const wxString& blockFileLog) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define BAD_STREAM_TIME -1000000000.0
|
||||||
|
|
||||||
#define MAX_MIDI_BUFFER_SIZE 5000
|
#define MAX_MIDI_BUFFER_SIZE 5000
|
||||||
#define DEFAULT_SYNTH_LATENCY 5
|
#define DEFAULT_SYNTH_LATENCY 5
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ LyricsWindow::LyricsWindow(AudacityProject *parent):
|
|||||||
wxPoint panelPos(0, 0);
|
wxPoint panelPos(0, 0);
|
||||||
wxSize panelSize = gSize;
|
wxSize panelSize = gSize;
|
||||||
|
|
||||||
//vvvvv not yet working right in ported version, so choice is disabled.
|
//vvv not yet working right in ported version, so choice is disabled.
|
||||||
// It seems when you select highlight style, the TrackPanel timer stops working, but
|
// It seems when you select highlight style, the TrackPanel timer stops working, but
|
||||||
// going back to bouncing ball style starts it up again (!!!), per breakpoints in TrackPanel::OnTimer().
|
// going back to bouncing ball style starts it up again (!!!), per breakpoints in TrackPanel::OnTimer().
|
||||||
//
|
//
|
||||||
@ -112,7 +112,7 @@ LyricsWindow::LyricsWindow(AudacityProject *parent):
|
|||||||
|
|
||||||
mLyricsPanel = new Lyrics(this, -1, panelPos, panelSize);
|
mLyricsPanel = new Lyrics(this, -1, panelPos, panelSize);
|
||||||
|
|
||||||
//vvvvv Highlight style is broken in ported version.
|
//vvv Highlight style is broken in ported version.
|
||||||
//switch (mLyricsPanel->GetLyricsStyle())
|
//switch (mLyricsPanel->GetLyricsStyle())
|
||||||
//{
|
//{
|
||||||
// case Lyrics::kBouncingBallLyrics:
|
// case Lyrics::kBouncingBallLyrics:
|
||||||
|
@ -78,6 +78,7 @@ void MixerTrackSlider::OnMouseEvent(wxMouseEvent &event)
|
|||||||
|
|
||||||
#define kInset 4
|
#define kInset 4
|
||||||
#define kDoubleInset (2 * kInset)
|
#define kDoubleInset (2 * kInset)
|
||||||
|
#define kTripleInset (3 * kInset)
|
||||||
#define kQuadrupleInset (4 * kInset)
|
#define kQuadrupleInset (4 * kInset)
|
||||||
|
|
||||||
#define TRACK_NAME_HEIGHT 18
|
#define TRACK_NAME_HEIGHT 18
|
||||||
@ -354,7 +355,7 @@ void MixerTrackCluster::UpdateForStateChange()
|
|||||||
|
|
||||||
void MixerTrackCluster::UpdateName()
|
void MixerTrackCluster::UpdateName()
|
||||||
{
|
{
|
||||||
wxString newName = mTrack->GetName();
|
wxString newName = mLeftTrack->GetName();
|
||||||
mStaticText_TrackName->SetLabel(newName);
|
mStaticText_TrackName->SetLabel(newName);
|
||||||
#if wxUSE_TOOLTIPS
|
#if wxUSE_TOOLTIPS
|
||||||
mStaticText_TrackName->SetToolTip(newName);
|
mStaticText_TrackName->SetToolTip(newName);
|
||||||
@ -429,7 +430,7 @@ void MixerTrackCluster::UpdateMeter(const double t0, const double t1)
|
|||||||
// instead of passing in all the data and asking the meter to derive peak and rms.
|
// instead of passing in all the data and asking the meter to derive peak and rms.
|
||||||
// May be worth revisiting as I think it should perform better, because it uses the min/max/rms
|
// May be worth revisiting as I think it should perform better, because it uses the min/max/rms
|
||||||
// stored in blockfiles, rather than calculating them, but for now, changing it to use the
|
// stored in blockfiles, rather than calculating them, but for now, changing it to use the
|
||||||
// original Meter::UpdateDisplay(). New code is intermixed with the previous (now commented out).
|
// original Meter::UpdateDisplay(). New code is below the previous (now commented out).
|
||||||
//
|
//
|
||||||
//const int kFramesPerBuffer = 4;
|
//const int kFramesPerBuffer = 4;
|
||||||
//float min; // dummy, since it's not shown in meters
|
//float min; // dummy, since it's not shown in meters
|
||||||
@ -519,6 +520,7 @@ void MixerTrackCluster::UpdateMeter(const double t0, const double t1)
|
|||||||
//if (bSuccess && bWantPostFadeValues)
|
//if (bSuccess && bWantPostFadeValues)
|
||||||
if (bSuccess)
|
if (bSuccess)
|
||||||
{
|
{
|
||||||
|
//vvv Need to apply envelope, too? See Mixer::MixSameRate.
|
||||||
float gain = mLeftTrack->GetChannelGain(0);
|
float gain = mLeftTrack->GetChannelGain(0);
|
||||||
if (gain < 1.0)
|
if (gain < 1.0)
|
||||||
for (int index = 0; index < nFrames; index++)
|
for (int index = 0; index < nFrames; index++)
|
||||||
@ -530,6 +532,13 @@ void MixerTrackCluster::UpdateMeter(const double t0, const double t1)
|
|||||||
if (gain < 1.0)
|
if (gain < 1.0)
|
||||||
for (int index = 0; index < nFrames; index++)
|
for (int index = 0; index < nFrames; index++)
|
||||||
meterFloatsArray[(2 * index) + 1] *= gain;
|
meterFloatsArray[(2 * index) + 1] *= gain;
|
||||||
|
// Clip to [-1.0, 1.0] range.
|
||||||
|
for (int index = 0; index < 2 * nFrames; index++)
|
||||||
|
if (meterFloatsArray[index] < -1.0)
|
||||||
|
meterFloatsArray[index] = -1.0;
|
||||||
|
else if (meterFloatsArray[index] > 1.0)
|
||||||
|
meterFloatsArray[index] = 1.0;
|
||||||
|
|
||||||
mMeter->UpdateDisplay(2, nFrames, meterFloatsArray);
|
mMeter->UpdateDisplay(2, nFrames, meterFloatsArray);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -771,7 +780,7 @@ void MixerBoardScrolledWindow::OnMouseEvent(wxMouseEvent& event)
|
|||||||
#define MIXER_BOARD_MIN_HEIGHT 460
|
#define MIXER_BOARD_MIN_HEIGHT 460
|
||||||
|
|
||||||
// Min width is one cluster wide, plus margins.
|
// Min width is one cluster wide, plus margins.
|
||||||
#define MIXER_BOARD_MIN_WIDTH kDoubleInset + kMixerTrackClusterWidth + kDoubleInset
|
#define MIXER_BOARD_MIN_WIDTH kTripleInset + kMixerTrackClusterWidth + kTripleInset
|
||||||
|
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(MixerBoard, wxWindow)
|
BEGIN_EVENT_TABLE(MixerBoard, wxWindow)
|
||||||
@ -1095,7 +1104,7 @@ void MixerBoard::ResizeTrackClusters()
|
|||||||
|
|
||||||
void MixerBoard::ResetMeters(const bool bResetClipping)
|
void MixerBoard::ResetMeters(const bool bResetClipping)
|
||||||
{
|
{
|
||||||
mPrevT1 = 0.0;
|
mPrevT1 = BAD_STREAM_TIME;
|
||||||
|
|
||||||
if (!this->IsShown())
|
if (!this->IsShown())
|
||||||
return;
|
return;
|
||||||
@ -1162,9 +1171,15 @@ void MixerBoard::UpdateGain(const Track* pTrack)
|
|||||||
|
|
||||||
void MixerBoard::UpdateMeters(const double t1, const bool bLoopedPlay)
|
void MixerBoard::UpdateMeters(const double t1, const bool bLoopedPlay)
|
||||||
{
|
{
|
||||||
if (!this->IsShown())
|
if (!this->IsShown() || (t1 == BAD_STREAM_TIME))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (mPrevT1 == BAD_STREAM_TIME)
|
||||||
|
{
|
||||||
|
mPrevT1 = t1;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// In loopedPlay mode, at the end of the loop, mPrevT1 is set to
|
// In loopedPlay mode, at the end of the loop, mPrevT1 is set to
|
||||||
// selection end, so the next t1 will be less, but we do want to
|
// selection end, so the next t1 will be less, but we do want to
|
||||||
// keep updating the meters.
|
// keep updating the meters.
|
||||||
|
@ -3647,7 +3647,10 @@ void AudacityProject::UpdateMixerBoard()
|
|||||||
if (!mMixerBoard)
|
if (!mMixerBoard)
|
||||||
return;
|
return;
|
||||||
mMixerBoard->UpdateTrackClusters();
|
mMixerBoard->UpdateTrackClusters();
|
||||||
mMixerBoard->UpdateMeters(gAudioIO->GetStreamTime(), (mLastPlayMode == loopedPlay));
|
|
||||||
|
// Vaughan, 2011-01-28: AudacityProject::UpdateMixerBoard() is called on state changes,
|
||||||
|
// so don't really need to call UpdateMeters().
|
||||||
|
//mMixerBoard->UpdateMeters(gAudioIO->GetStreamTime(), (mLastPlayMode == loopedPlay));
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -883,18 +883,17 @@ void TrackPanel::OnTimer()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//vvvvv Vaughan, 2010-11-27:
|
// Vaughan, 2010-01-30:
|
||||||
// Since all we're doing here is updating the meters, maybe we should remove it from here
|
// Since all we're doing here is updating the meters, I moved it to
|
||||||
// and we do that in audacityAudioCallback where it calls gAudioIO->mOutputMeter->UpdateDisplay().
|
// audacityAudioCallback where it calls gAudioIO->mOutputMeter->UpdateDisplay().
|
||||||
// Thread issues?
|
//MixerBoard* pMixerBoard = this->GetMixerBoard();
|
||||||
MixerBoard* pMixerBoard = this->GetMixerBoard();
|
//if (pMixerBoard &&
|
||||||
if (pMixerBoard &&
|
// (p->GetAudioIOToken() > 0) &&
|
||||||
(p->GetAudioIOToken() > 0) &&
|
// gAudioIO->IsStreamActive(p->GetAudioIOToken()))
|
||||||
gAudioIO->IsStreamActive(p->GetAudioIOToken()))
|
//{
|
||||||
{
|
// pMixerBoard->UpdateMeters(gAudioIO->GetStreamTime(),
|
||||||
pMixerBoard->UpdateMeters(gAudioIO->GetStreamTime(),
|
// (p->mLastPlayMode == loopedPlay));
|
||||||
(p->mLastPlayMode == loopedPlay));
|
//}
|
||||||
}
|
|
||||||
|
|
||||||
// Check whether we were playing or recording, but the stream has stopped.
|
// Check whether we were playing or recording, but the stream has stopped.
|
||||||
if (p->GetAudioIOToken()>0 &&
|
if (p->GetAudioIOToken()>0 &&
|
||||||
@ -912,8 +911,10 @@ void TrackPanel::OnTimer()
|
|||||||
pLyricsPanel->Update(p->GetSel0());
|
pLyricsPanel->Update(p->GetSel0());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pMixerBoard)
|
// Vaughan, 2011-01-28: No longer doing this on timer.
|
||||||
pMixerBoard->ResetMeters(false);
|
// Now it's in AudioIO::SetMeters() and AudioIO::StopStream(), as with Meter Toolbar meters.
|
||||||
|
//if (pMixerBoard)
|
||||||
|
// pMixerBoard->ResetMeters(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Next, check to see if we were playing or recording
|
// Next, check to see if we were playing or recording
|
||||||
|
@ -814,7 +814,7 @@ void Meter::HandleLayout()
|
|||||||
left += mLeftSize.x+4;
|
left += mLeftSize.x+4;
|
||||||
}
|
}
|
||||||
mRightTextPos = wxPoint(width-mLeftSize.x, height-2-mLeftSize.y);
|
mRightTextPos = wxPoint(width-mLeftSize.x, height-2-mLeftSize.y);
|
||||||
width -= mLeftSize.x + mRightSize.x + 8; //vvvvv ...but then -8 in UmixIt? -- for vertical only?
|
width -= mLeftSize.x + mRightSize.x + 8; //vvv ...but then -8 in UmixIt? -- for vertical only?
|
||||||
}
|
}
|
||||||
barw = (width-2)/2;
|
barw = (width-2)/2;
|
||||||
barh = height - 4;
|
barh = height - 4;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user