1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-09-18 17:10:55 +02:00

Merge branch 'master' into scrubbing-temp

This commit is contained in:
Paul Licameli 2015-06-08 09:56:04 -04:00
commit 70d9e7b746
3 changed files with 27 additions and 21 deletions

View File

@ -122,7 +122,7 @@ public:
// or child. // or child.
virtual wxAccStatus GetValue( int childId, wxString *strValue ); virtual wxAccStatus GetValue( int childId, wxString *strValue );
void SetSelected( int item ); void SetSelected( int item, bool focused = true );
private: private:
wxListCtrl *mParent; wxListCtrl *mParent;
@ -140,7 +140,7 @@ CheckListAx::~CheckListAx()
{ {
} }
void CheckListAx::SetSelected( int item ) void CheckListAx::SetSelected( int item, bool focused )
{ {
if (mLastId != -1) if (mLastId != -1)
{ {
@ -153,10 +153,13 @@ void CheckListAx::SetSelected( int item )
if (item != -1) if (item != -1)
{ {
NotifyEvent( wxACC_EVENT_OBJECT_FOCUS, if (focused)
mParent, {
wxOBJID_CLIENT, NotifyEvent( wxACC_EVENT_OBJECT_FOCUS,
item + 1 ); mParent,
wxOBJID_CLIENT,
item + 1 );
}
NotifyEvent( wxACC_EVENT_OBJECT_SELECTION, NotifyEvent( wxACC_EVENT_OBJECT_SELECTION,
mParent, mParent,
@ -747,7 +750,7 @@ void PluginRegistrationDialog::RegenerateEffectsList(int filter)
// mEffects->SetFocus(); // mEffects->SetFocus();
mEffects->SetItemState(0, wxLIST_STATE_FOCUSED|wxLIST_STATE_SELECTED, wxLIST_STATE_FOCUSED|wxLIST_STATE_SELECTED); mEffects->SetItemState(0, wxLIST_STATE_FOCUSED|wxLIST_STATE_SELECTED, wxLIST_STATE_FOCUSED|wxLIST_STATE_SELECTED);
#if wxUSE_ACCESSIBILITY #if wxUSE_ACCESSIBILITY
mAx->SetSelected(0); mAx->SetSelected(0, false);
#endif #endif
} }
} }

View File

@ -1021,7 +1021,7 @@ AudacityProject::AudacityProject(wxWindow * parent, wxWindowID id,
mTrackFactory = new TrackFactory(mDirManager); mTrackFactory = new TrackFactory(mDirManager);
int widths[] = {0, GetControlToolBar()->WidthForStatusBar(mStatusBar), -2, -1}; int widths[] = {0, GetControlToolBar()->WidthForStatusBar(mStatusBar), -1, 150};
mStatusBar->SetStatusWidths(4, widths); mStatusBar->SetStatusWidths(4, widths);
wxString msg = wxString::Format(_("Welcome to Audacity version %s"), wxString msg = wxString::Format(_("Welcome to Audacity version %s"),
AUDACITY_VERSION_STRING); AUDACITY_VERSION_STRING);

View File

@ -850,14 +850,18 @@ void SpecCache::CalculateOneSpectrum
sampleCount len = windowSize; sampleCount len = windowSize;
if (start <= 0 || start >= numSamples) { if (start <= 0 || start >= numSamples) {
// Pixel column is out of bounds of the clip! Should not happen.
std::fill(results, results + half, 0.0f); std::fill(results, results + half, 0.0f);
} }
else { else {
bool copy = !autocorrelation || (padding > 0); bool copy = !autocorrelation || (padding > 0);
float *useBuffer = 0; float *useBuffer = 0;
float *adj = scratch + padding; float *adj = scratch + padding;
// Take a window of the track centered at this sample.
start -= windowSize >> 1; start -= windowSize >> 1;
if (start < 0) { if (start < 0) {
// Near the start of the clip, pad left with zeroes as needed.
for (sampleCount ii = start; ii < 0; ++ii) for (sampleCount ii = start; ii < 0; ++ii)
*adj++ = 0; *adj++ = 0;
len += start; len += start;
@ -874,6 +878,7 @@ void SpecCache::CalculateOneSpectrum
} }
#else //!EXPERIMENTAL_FFT_SKIP_POINTS #else //!EXPERIMENTAL_FFT_SKIP_POINTS
if (start + len > numSamples) { if (start + len > numSamples) {
// Near the end of the clip, pad right with zeroes as needed.
int newlen = numSamples - start; int newlen = numSamples - start;
for (sampleCount ii = newlen; ii < (sampleCount)len; ++ii) for (sampleCount ii = newlen; ii < (sampleCount)len; ++ii)
adj[ii] = 0; adj[ii] = 0;
@ -883,6 +888,7 @@ void SpecCache::CalculateOneSpectrum
#endif //EXPERIMENTAL_FFT_SKIP_POINTS #endif //EXPERIMENTAL_FFT_SKIP_POINTS
if (len > 0) { if (len > 0) {
// Copy samples out of the track.
#ifdef EXPERIMENTAL_FFT_SKIP_POINTS #ifdef EXPERIMENTAL_FFT_SKIP_POINTS
useBuffer = (float*)(waveTrackCache.Get(floatSample, useBuffer = (float*)(waveTrackCache.Get(floatSample,
floor(0.5 + start + offset * rate), len*fftSkipPoints1)); floor(0.5 + start + offset * rate), len*fftSkipPoints1));
@ -912,6 +918,10 @@ void SpecCache::CalculateOneSpectrum
rate, results, rate, results,
autocorrelation, settings.windowType); autocorrelation, settings.windowType);
else else
// Do the FFT. Note that scratch is multiplied by the window,
// and the window is initialized with leading and trailing zeroes
// when there is padding. Therefore we did not need to reinitialize
// the part of scratch in the padding zones.
ComputeSpectrumUsingRealFFTf ComputeSpectrumUsingRealFFTf
(useBuffer, settings.hFFT, settings.window, fftLen, results); (useBuffer, settings.hFFT, settings.window, fftLen, results);
#else // EXPERIMENTAL_USE_REALFFTF #else // EXPERIMENTAL_USE_REALFFTF
@ -964,26 +974,19 @@ void SpecCache::Populate
#endif //EXPERIMENTAL_FFT_SKIP_POINTS #endif //EXPERIMENTAL_FFT_SKIP_POINTS
); );
// Initialize zero padding in the buffer
for (int ii = 0; ii < padding; ++ii) {
buffer[ii] = 0.0;
buffer[fftLen - ii - 1] = 0.0;
}
std::vector<float> gainFactors; std::vector<float> gainFactors;
ComputeSpectrogramGainFactors(fftLen, rate, frequencyGain, gainFactors); ComputeSpectrogramGainFactors(fftLen, rate, frequencyGain, gainFactors);
// Loop over the ranges before and after the copied portion and compute anew. // Loop over the ranges before and after the copied portion and compute anew.
// One of the ranges may be empty. // One of the ranges may be empty.
for (sampleCount xx = 0; xx < copyBegin; ++xx) for (int jj = 0; jj < 2; ++jj) {
CalculateOneSpectrum( const int lowerBoundX = jj == 0 ? 0 : copyEnd;
settings, waveTrackCache, xx, numSamples, const int upperBoundX = jj == 0 ? copyBegin : numPixels;
offset, rate, autocorrelation, gainFactors, &buffer[0]); for (sampleCount xx = lowerBoundX; xx < upperBoundX; ++xx)
CalculateOneSpectrum(
for (sampleCount xx = copyEnd; xx < numPixels; ++xx)
CalculateOneSpectrum(
settings, waveTrackCache, xx, numSamples, settings, waveTrackCache, xx, numSamples,
offset, rate, autocorrelation, gainFactors, &buffer[0]); offset, rate, autocorrelation, gainFactors, &buffer[0]);
}
} }
bool WaveClip::GetSpectrogram(WaveTrackCache &waveTrackCache, bool WaveClip::GetSpectrogram(WaveTrackCache &waveTrackCache,