mirror of
https://github.com/cookiengineer/audacity
synced 2025-11-08 14:13:57 +01:00
Disable spectral editing effects in one place in Nyquist.cpp...
... by passing invalid frequency values, rather than by checking the 'view property in each effect. Spectral editing is now permitted only for appropriate track view types. But I would suggest reconsideration of the exact conditions in which we do this.
This commit is contained in:
@@ -539,34 +539,6 @@ bool NyquistEffect::Process()
|
||||
Internat::ToString(mT1).c_str());
|
||||
mProps += wxString::Format(wxT("(putprop '*SELECTION* (list %s) 'TRACKS)\n"), waveTrackList.c_str());
|
||||
mProps += wxString::Format(wxT("(putprop '*SELECTION* %d 'CHANNELS)\n"), numChannels);
|
||||
|
||||
wxString lowHz = wxT("nil");
|
||||
wxString highHz = wxT("nil");
|
||||
wxString centerHz = wxT("nil");
|
||||
wxString bandwidth = wxT("nil");
|
||||
|
||||
#if defined(EXPERIMENTAL_SPECTRAL_EDITING)
|
||||
if (mF0 >= 0.0) {
|
||||
lowHz.Printf(wxT("(float %s)"), Internat::ToString(mF0).c_str());
|
||||
}
|
||||
|
||||
if (mF1 >= 0.0) {
|
||||
highHz.Printf(wxT("(float %s)"), Internat::ToString(mF1).c_str());
|
||||
}
|
||||
|
||||
if ((mF0 >= 0.0) && (mF1 >= 0.0)) {
|
||||
centerHz.Printf(wxT("(float %s)"), Internat::ToString(sqrt(mF0 * mF1)).c_str());
|
||||
}
|
||||
|
||||
if ((mF0 > 0.0) && (mF1 >= mF0)) {
|
||||
bandwidth.Printf(wxT("(float %s)"), Internat::ToString(log(mF1 / mF0)/log(2.0)).c_str());
|
||||
}
|
||||
|
||||
#endif
|
||||
mProps += wxString::Format(wxT("(putprop '*SELECTION* %s 'LOW-HZ)\n"), lowHz.c_str());
|
||||
mProps += wxString::Format(wxT("(putprop '*SELECTION* %s 'CENTER-HZ)\n"), centerHz.c_str());
|
||||
mProps += wxString::Format(wxT("(putprop '*SELECTION* %s 'HIGH-HZ)\n"), highHz.c_str());
|
||||
mProps += wxString::Format(wxT("(putprop '*SELECTION* %s 'BANDWIDTH)\n"), bandwidth.c_str());
|
||||
}
|
||||
|
||||
// Keep track of whether the current track is first selected in its sync-lock group
|
||||
@@ -621,6 +593,45 @@ bool NyquistEffect::Process()
|
||||
nyx_set_os_callback(StaticOSCallback, (void *)this);
|
||||
nyx_capture_output(StaticOutputCallback, (void *)this);
|
||||
|
||||
if (mVersion >= 4)
|
||||
{
|
||||
mPerTrackProps = wxEmptyString;
|
||||
wxString lowHz = wxT("nil");
|
||||
wxString highHz = wxT("nil");
|
||||
wxString centerHz = wxT("nil");
|
||||
wxString bandwidth = wxT("nil");
|
||||
|
||||
const WaveTrack::WaveTrackDisplay display = mCurTrack[0]->GetDisplay();
|
||||
const bool bAllowSpectralEditing =
|
||||
(display == WaveTrack::SpectralSelectionDisplay) ||
|
||||
(display == WaveTrack::SpectralSelectionLogDisplay);
|
||||
|
||||
if (bAllowSpectralEditing) {
|
||||
#if defined(EXPERIMENTAL_SPECTRAL_EDITING)
|
||||
if (mF0 >= 0.0) {
|
||||
lowHz.Printf(wxT("(float %s)"), Internat::ToString(mF0).c_str());
|
||||
}
|
||||
|
||||
if (mF1 >= 0.0) {
|
||||
highHz.Printf(wxT("(float %s)"), Internat::ToString(mF1).c_str());
|
||||
}
|
||||
|
||||
if ((mF0 >= 0.0) && (mF1 >= 0.0)) {
|
||||
centerHz.Printf(wxT("(float %s)"), Internat::ToString(sqrt(mF0 * mF1)).c_str());
|
||||
}
|
||||
|
||||
if ((mF0 > 0.0) && (mF1 >= mF0)) {
|
||||
bandwidth.Printf(wxT("(float %s)"), Internat::ToString(log(mF1 / mF0) / log(2.0)).c_str());
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
mPerTrackProps += wxString::Format(wxT("(putprop '*SELECTION* %s 'LOW-HZ)\n"), lowHz.c_str());
|
||||
mPerTrackProps += wxString::Format(wxT("(putprop '*SELECTION* %s 'CENTER-HZ)\n"), centerHz.c_str());
|
||||
mPerTrackProps += wxString::Format(wxT("(putprop '*SELECTION* %s 'HIGH-HZ)\n"), highHz.c_str());
|
||||
mPerTrackProps += wxString::Format(wxT("(putprop '*SELECTION* %s 'BANDWIDTH)\n"), bandwidth.c_str());
|
||||
}
|
||||
|
||||
success = ProcessOne();
|
||||
|
||||
nyx_capture_output(NULL, (void *)NULL);
|
||||
@@ -765,6 +776,7 @@ bool NyquistEffect::ProcessOne()
|
||||
|
||||
if (mVersion >= 4) {
|
||||
cmd += mProps;
|
||||
cmd += mPerTrackProps;
|
||||
|
||||
// Set the track TYPE and VIEW properties
|
||||
wxString type;
|
||||
|
||||
@@ -223,6 +223,7 @@ private:
|
||||
wxArrayString mCategories;
|
||||
|
||||
wxString mProps;
|
||||
wxString mPerTrackProps;
|
||||
|
||||
bool mRestoreSplits;
|
||||
int mMergeClips;
|
||||
|
||||
Reference in New Issue
Block a user