mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-20 14:20:06 +02:00
Remove some naked new amd delete in: tracks and clips
This commit is contained in:
parent
8392a57d34
commit
20bee00115
@ -129,10 +129,6 @@ NoteTrack::~NoteTrack()
|
|||||||
if (mSerializationBuffer) {
|
if (mSerializationBuffer) {
|
||||||
delete [] mSerializationBuffer;
|
delete [] mSerializationBuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mSeq) {
|
|
||||||
delete mSeq;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Track::Holder NoteTrack::Duplicate() const
|
Track::Holder NoteTrack::Duplicate() const
|
||||||
@ -154,10 +150,10 @@ Track::Holder NoteTrack::Duplicate() const
|
|||||||
} else if (mSerializationBuffer) {
|
} else if (mSerializationBuffer) {
|
||||||
SonifyBeginUnserialize();
|
SonifyBeginUnserialize();
|
||||||
assert(!mSeq);
|
assert(!mSeq);
|
||||||
Alg_track_ptr alg_track = Alg_seq::unserialize(mSerializationBuffer,
|
std::unique_ptr<Alg_track> alg_track{ Alg_seq::unserialize(mSerializationBuffer,
|
||||||
mSerializationLength);
|
mSerializationLength) };
|
||||||
assert(alg_track->get_type() == 's');
|
assert(alg_track->get_type() == 's');
|
||||||
duplicate->mSeq = (Alg_seq_ptr) alg_track;
|
duplicate->mSeq.reset(static_cast<Alg_seq*>(alg_track.release()));
|
||||||
SonifyEndUnserialize();
|
SonifyEndUnserialize();
|
||||||
} else assert(false); // bug if neither mSeq nor mSerializationBuffer
|
} else assert(false); // bug if neither mSeq nor mSerializationBuffer
|
||||||
// copy some other fields here
|
// copy some other fields here
|
||||||
@ -206,8 +202,7 @@ void NoteTrack::WarpAndTransposeNotes(double t0, double t1,
|
|||||||
nt->mSerializationLength = mSerializationLength;
|
nt->mSerializationLength = mSerializationLength;
|
||||||
mSerializationBuffer = NULL;
|
mSerializationBuffer = NULL;
|
||||||
mSerializationLength = 0;
|
mSerializationLength = 0;
|
||||||
mSeq = nt->mSeq;
|
mSeq = std::move(nt->mSeq);
|
||||||
nt->mSeq = NULL;
|
|
||||||
}
|
}
|
||||||
mSeq->convert_to_seconds(); // make sure time units are right
|
mSeq->convert_to_seconds(); // make sure time units are right
|
||||||
t1 -= offset; // adjust time range to compensate for track offset
|
t1 -= offset; // adjust time range to compensate for track offset
|
||||||
@ -216,7 +211,7 @@ void NoteTrack::WarpAndTransposeNotes(double t0, double t1,
|
|||||||
t1 = mSeq->get_dur();
|
t1 = mSeq->get_dur();
|
||||||
if (t0 >= t1) return;
|
if (t0 >= t1) return;
|
||||||
}
|
}
|
||||||
Alg_iterator iter(mSeq, false);
|
Alg_iterator iter(mSeq.get(), false);
|
||||||
iter.begin();
|
iter.begin();
|
||||||
Alg_event_ptr event;
|
Alg_event_ptr event;
|
||||||
while (0 != (event = iter.next()) && event->time < t1) {
|
while (0 != (event = iter.next()) && event->time < t1) {
|
||||||
@ -368,17 +363,14 @@ bool NoteTrack::LabelClick(wxRect & r, int mx, int my, bool right)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void NoteTrack::SetSequence(Alg_seq_ptr seq)
|
void NoteTrack::SetSequence(std::unique_ptr<Alg_seq> &&seq)
|
||||||
{
|
{
|
||||||
if (mSeq)
|
mSeq = std::move(seq);
|
||||||
delete mSeq;
|
|
||||||
|
|
||||||
mSeq = seq;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Alg_seq* NoteTrack::GetSequence()
|
Alg_seq* NoteTrack::GetSequence()
|
||||||
{
|
{
|
||||||
return mSeq;
|
return mSeq.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
void NoteTrack::PrintSequence()
|
void NoteTrack::PrintSequence()
|
||||||
@ -454,7 +446,7 @@ Track::Holder NoteTrack::Cut(double t0, double t1)
|
|||||||
newTrack->Init(*this);
|
newTrack->Init(*this);
|
||||||
|
|
||||||
mSeq->convert_to_seconds();
|
mSeq->convert_to_seconds();
|
||||||
newTrack->mSeq = mSeq->cut(t0 - GetOffset(), len, false);
|
newTrack->mSeq.reset(mSeq->cut(t0 - GetOffset(), len, false));
|
||||||
newTrack->SetOffset(GetOffset());
|
newTrack->SetOffset(GetOffset());
|
||||||
|
|
||||||
// What should be done with the rest of newTrack's members?
|
// What should be done with the rest of newTrack's members?
|
||||||
@ -475,7 +467,7 @@ Track::Holder NoteTrack::Copy(double t0, double t1) const
|
|||||||
newTrack->Init(*this);
|
newTrack->Init(*this);
|
||||||
|
|
||||||
mSeq->convert_to_seconds();
|
mSeq->convert_to_seconds();
|
||||||
newTrack->mSeq = mSeq->copy(t0 - GetOffset(), len, false);
|
newTrack->mSeq.reset(mSeq->copy(t0 - GetOffset(), len, false));
|
||||||
newTrack->SetOffset(GetOffset());
|
newTrack->SetOffset(GetOffset());
|
||||||
|
|
||||||
// What should be done with the rest of newTrack's members?
|
// What should be done with the rest of newTrack's members?
|
||||||
@ -530,14 +522,14 @@ bool NoteTrack::Paste(double t, const Track *src)
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
if(!mSeq)
|
if(!mSeq)
|
||||||
mSeq = new Alg_seq();
|
mSeq = std::make_unique<Alg_seq>();
|
||||||
|
|
||||||
if (other->GetOffset() > 0) {
|
if (other->GetOffset() > 0) {
|
||||||
mSeq->convert_to_seconds();
|
mSeq->convert_to_seconds();
|
||||||
mSeq->insert_silence(t - GetOffset(), other->GetOffset());
|
mSeq->insert_silence(t - GetOffset(), other->GetOffset());
|
||||||
t += other->GetOffset();
|
t += other->GetOffset();
|
||||||
}
|
}
|
||||||
mSeq->paste(t - GetOffset(), other->mSeq);
|
mSeq->paste(t - GetOffset(), other->mSeq.get());
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -596,24 +588,34 @@ bool NoteTrack::StretchRegion(double t0, double t1, double dur)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
Alg_seq_ptr NoteTrack::MakeExportableSeq()
|
namespace
|
||||||
{
|
{
|
||||||
|
void swap(std::unique_ptr<Alg_seq> &a, std::unique_ptr<Alg_seq> &b)
|
||||||
|
{
|
||||||
|
std::unique_ptr<Alg_seq> tmp = std::move(a);
|
||||||
|
a = std::move(b);
|
||||||
|
b = std::move(tmp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Alg_seq *NoteTrack::MakeExportableSeq(std::unique_ptr<Alg_seq> &cleanup)
|
||||||
|
{
|
||||||
|
cleanup.reset();
|
||||||
double offset = GetOffset();
|
double offset = GetOffset();
|
||||||
if (offset == 0)
|
if (offset == 0)
|
||||||
return mSeq;
|
return mSeq.get();
|
||||||
// make a copy, deleting events that are shifted before time 0
|
// make a copy, deleting events that are shifted before time 0
|
||||||
double start = -offset;
|
double start = -offset;
|
||||||
if (start < 0) start = 0;
|
if (start < 0) start = 0;
|
||||||
// notes that begin before "start" are not included even if they
|
// notes that begin before "start" are not included even if they
|
||||||
// extend past "start" (because "all" parameter is set to false)
|
// extend past "start" (because "all" parameter is set to false)
|
||||||
Alg_seq_ptr seq = mSeq->copy(start, mSeq->get_dur() - start, false);
|
cleanup.reset( mSeq->copy(start, mSeq->get_dur() - start, false) );
|
||||||
|
auto seq = cleanup.get();
|
||||||
if (offset > 0) {
|
if (offset > 0) {
|
||||||
// swap seq and mSeq so that Shift operates on the NEW copy
|
// swap cleanup and mSeq so that Shift operates on the NEW copy
|
||||||
Alg_seq_ptr old_seq = mSeq;
|
swap(mSeq, cleanup);
|
||||||
mSeq = seq;
|
|
||||||
Shift(offset);
|
Shift(offset);
|
||||||
seq = mSeq; // undo the swap
|
swap(mSeq, cleanup); // undo the swap
|
||||||
mSeq = old_seq;
|
|
||||||
#ifdef OLD_CODE
|
#ifdef OLD_CODE
|
||||||
// now shift events by offset. This must be done with an integer
|
// now shift events by offset. This must be done with an integer
|
||||||
// number of measures, so first, find the beats-per-measure
|
// number of measures, so first, find the beats-per-measure
|
||||||
@ -717,9 +719,9 @@ Alg_seq_ptr NoteTrack::MakeExportableSeq()
|
|||||||
|
|
||||||
bool NoteTrack::ExportMIDI(const wxString &f)
|
bool NoteTrack::ExportMIDI(const wxString &f)
|
||||||
{
|
{
|
||||||
Alg_seq_ptr seq = MakeExportableSeq();
|
std::unique_ptr<Alg_seq> cleanup;
|
||||||
|
auto seq = MakeExportableSeq(cleanup);
|
||||||
bool rslt = seq->smf_write(f.mb_str());
|
bool rslt = seq->smf_write(f.mb_str());
|
||||||
if (seq != mSeq) delete seq;
|
|
||||||
return rslt;
|
return rslt;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -782,7 +784,7 @@ bool NoteTrack::HandleXMLTag(const wxChar *tag, const wxChar **attrs)
|
|||||||
else if (!wxStrcmp(attr, wxT("data"))) {
|
else if (!wxStrcmp(attr, wxT("data"))) {
|
||||||
std::string s(strValue.mb_str(wxConvUTF8));
|
std::string s(strValue.mb_str(wxConvUTF8));
|
||||||
std::istringstream data(s);
|
std::istringstream data(s);
|
||||||
mSeq = new Alg_seq(data, false);
|
mSeq = std::make_unique<Alg_seq>(data, false);
|
||||||
}
|
}
|
||||||
} // while
|
} // while
|
||||||
return true;
|
return true;
|
||||||
|
@ -72,13 +72,13 @@ class AUDACITY_DLL_API NoteTrack final : public Track {
|
|||||||
int DrawLabelControls(wxDC & dc, wxRect & r);
|
int DrawLabelControls(wxDC & dc, wxRect & r);
|
||||||
bool LabelClick(wxRect & r, int x, int y, bool right);
|
bool LabelClick(wxRect & r, int x, int y, bool right);
|
||||||
|
|
||||||
void SetSequence(Alg_seq *seq);
|
void SetSequence(std::unique_ptr<Alg_seq> &&seq);
|
||||||
Alg_seq* GetSequence();
|
Alg_seq* GetSequence();
|
||||||
void PrintSequence();
|
void PrintSequence();
|
||||||
|
|
||||||
int GetVisibleChannels();
|
int GetVisibleChannels();
|
||||||
|
|
||||||
Alg_seq_ptr MakeExportableSeq();
|
Alg_seq *MakeExportableSeq(std::unique_ptr<Alg_seq> &cleanup);
|
||||||
bool ExportMIDI(const wxString &f);
|
bool ExportMIDI(const wxString &f);
|
||||||
bool ExportAllegro(const wxString &f);
|
bool ExportAllegro(const wxString &f);
|
||||||
|
|
||||||
@ -186,7 +186,7 @@ class AUDACITY_DLL_API NoteTrack final : public Track {
|
|||||||
void ClearVisibleChan(int c) { mVisibleChannels &= ~CHANNEL_BIT(c); }
|
void ClearVisibleChan(int c) { mVisibleChannels &= ~CHANNEL_BIT(c); }
|
||||||
void ToggleVisibleChan(int c) { mVisibleChannels ^= CHANNEL_BIT(c); }
|
void ToggleVisibleChan(int c) { mVisibleChannels ^= CHANNEL_BIT(c); }
|
||||||
private:
|
private:
|
||||||
Alg_seq *mSeq; // NULL means no sequence
|
std::unique_ptr<Alg_seq> mSeq; // NULL means no sequence
|
||||||
// when Duplicate() is called, assume that it is to put a copy
|
// when Duplicate() is called, assume that it is to put a copy
|
||||||
// of the track into the undo stack or to redo/copy from the
|
// of the track into the undo stack or to redo/copy from the
|
||||||
// stack to the project object. We want copies to the stack
|
// stack to the project object. We want copies to the stack
|
||||||
|
@ -44,7 +44,7 @@ TimeTrack::TimeTrack(DirManager *projDirManager, const ZoomInfo *zoomInfo):
|
|||||||
mRangeUpper = 1.1;
|
mRangeUpper = 1.1;
|
||||||
mDisplayLog = false;
|
mDisplayLog = false;
|
||||||
|
|
||||||
mEnvelope = new Envelope();
|
mEnvelope = std::make_unique<Envelope>();
|
||||||
mEnvelope->SetTrackLen(1000000000.0);
|
mEnvelope->SetTrackLen(1000000000.0);
|
||||||
mEnvelope->SetInterpolateDB(true);
|
mEnvelope->SetInterpolateDB(true);
|
||||||
mEnvelope->Flatten(1.0);
|
mEnvelope->Flatten(1.0);
|
||||||
@ -55,7 +55,7 @@ TimeTrack::TimeTrack(DirManager *projDirManager, const ZoomInfo *zoomInfo):
|
|||||||
SetDefaultName(_("Time Track"));
|
SetDefaultName(_("Time Track"));
|
||||||
SetName(GetDefaultName());
|
SetName(GetDefaultName());
|
||||||
|
|
||||||
mRuler = new Ruler;
|
mRuler = std::make_unique<Ruler>();
|
||||||
mRuler->SetUseZoomInfo(0, mZoomInfo);
|
mRuler->SetUseZoomInfo(0, mZoomInfo);
|
||||||
mRuler->SetLabelEdges(false);
|
mRuler->SetLabelEdges(false);
|
||||||
mRuler->SetFormat(Ruler::TimeFormat);
|
mRuler->SetFormat(Ruler::TimeFormat);
|
||||||
@ -71,17 +71,17 @@ TimeTrack::TimeTrack(const TimeTrack &orig):
|
|||||||
Init(orig); // this copies the TimeTrack metadata (name, range, etc)
|
Init(orig); // this copies the TimeTrack metadata (name, range, etc)
|
||||||
|
|
||||||
///@TODO: Give Envelope:: a copy-constructor instead of this?
|
///@TODO: Give Envelope:: a copy-constructor instead of this?
|
||||||
mEnvelope = new Envelope();
|
mEnvelope = std::make_unique<Envelope>();
|
||||||
mEnvelope->SetTrackLen(1000000000.0);
|
mEnvelope->SetTrackLen(1000000000.0);
|
||||||
SetInterpolateLog(orig.GetInterpolateLog()); // this calls Envelope::SetInterpolateDB
|
SetInterpolateLog(orig.GetInterpolateLog()); // this calls Envelope::SetInterpolateDB
|
||||||
mEnvelope->Flatten(1.0);
|
mEnvelope->Flatten(1.0);
|
||||||
mEnvelope->Mirror(false);
|
mEnvelope->Mirror(false);
|
||||||
mEnvelope->SetOffset(0);
|
mEnvelope->SetOffset(0);
|
||||||
mEnvelope->SetRange(orig.mEnvelope->GetMinValue(), orig.mEnvelope->GetMaxValue());
|
mEnvelope->SetRange(orig.mEnvelope->GetMinValue(), orig.mEnvelope->GetMaxValue());
|
||||||
mEnvelope->Paste(0.0, orig.mEnvelope);
|
mEnvelope->Paste(0.0, orig.mEnvelope.get());
|
||||||
|
|
||||||
///@TODO: Give Ruler:: a copy-constructor instead of this?
|
///@TODO: Give Ruler:: a copy-constructor instead of this?
|
||||||
mRuler = new Ruler;
|
mRuler = std::make_unique<Ruler>();
|
||||||
mRuler->SetUseZoomInfo(0, mZoomInfo);
|
mRuler->SetUseZoomInfo(0, mZoomInfo);
|
||||||
mRuler->SetLabelEdges(false);
|
mRuler->SetLabelEdges(false);
|
||||||
mRuler->SetFormat(Ruler::TimeFormat);
|
mRuler->SetFormat(Ruler::TimeFormat);
|
||||||
@ -103,10 +103,6 @@ void TimeTrack::Init(const TimeTrack &orig)
|
|||||||
|
|
||||||
TimeTrack::~TimeTrack()
|
TimeTrack::~TimeTrack()
|
||||||
{
|
{
|
||||||
delete mEnvelope;
|
|
||||||
mEnvelope = NULL;
|
|
||||||
|
|
||||||
delete mRuler;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Track::Holder TimeTrack::Duplicate() const
|
Track::Holder TimeTrack::Duplicate() const
|
||||||
@ -205,7 +201,7 @@ void TimeTrack::HandleXMLEndTag(const wxChar * WXUNUSED(tag))
|
|||||||
XMLTagHandler *TimeTrack::HandleXMLChild(const wxChar *tag)
|
XMLTagHandler *TimeTrack::HandleXMLChild(const wxChar *tag)
|
||||||
{
|
{
|
||||||
if (!wxStrcmp(tag, wxT("envelope")))
|
if (!wxStrcmp(tag, wxT("envelope")))
|
||||||
return mEnvelope;
|
return mEnvelope.get();
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -67,8 +67,8 @@ class TimeTrack final : public Track {
|
|||||||
|
|
||||||
// Access the track's speed envelope
|
// Access the track's speed envelope
|
||||||
|
|
||||||
Envelope *GetEnvelope() { return mEnvelope; }
|
Envelope *GetEnvelope() { return mEnvelope.get(); }
|
||||||
const Envelope *GetEnvelope() const { return mEnvelope; }
|
const Envelope *GetEnvelope() const { return mEnvelope.get(); }
|
||||||
|
|
||||||
//Note: The meaning of this function has changed (December 2012)
|
//Note: The meaning of this function has changed (December 2012)
|
||||||
//Previously this function did something that was close to the opposite (but not entirely accurate).
|
//Previously this function did something that was close to the opposite (but not entirely accurate).
|
||||||
@ -119,8 +119,8 @@ class TimeTrack final : public Track {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
const ZoomInfo *const mZoomInfo;
|
const ZoomInfo *const mZoomInfo;
|
||||||
Envelope *mEnvelope;
|
std::unique_ptr<Envelope> mEnvelope;
|
||||||
Ruler *mRuler;
|
std::unique_ptr<Ruler> mRuler;
|
||||||
double mRangeLower;
|
double mRangeLower;
|
||||||
double mRangeUpper;
|
double mRangeUpper;
|
||||||
bool mDisplayLog;
|
bool mDisplayLog;
|
||||||
|
@ -2232,8 +2232,7 @@ void TrackArtist::DrawClipSpectrum(WaveTrackCache &waveTrackCache,
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Update the spectrum pixel cache
|
// Update the spectrum pixel cache
|
||||||
delete clip->mSpecPxCache;
|
clip->mSpecPxCache = std::make_unique<SpecPxCache>(hiddenMid.width * hiddenMid.height);
|
||||||
clip->mSpecPxCache = new SpecPxCache(hiddenMid.width * hiddenMid.height);
|
|
||||||
clip->mSpecPxCache->valid = true;
|
clip->mSpecPxCache->valid = true;
|
||||||
clip->mSpecPxCache->scaleType = scaleType;
|
clip->mSpecPxCache->scaleType = scaleType;
|
||||||
clip->mSpecPxCache->gain = gain;
|
clip->mSpecPxCache->gain = gain;
|
||||||
@ -2727,7 +2726,7 @@ void TrackArtist::DrawNoteBackground(const NoteTrack *track, wxDC &dc,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// draw bar lines
|
// draw bar lines
|
||||||
Alg_seq_ptr seq = track->mSeq;
|
Alg_seq_ptr seq = track->mSeq.get();
|
||||||
// We assume that sliding a NoteTrack around slides the barlines
|
// We assume that sliding a NoteTrack around slides the barlines
|
||||||
// along with the notes. This means that when we write out a track
|
// along with the notes. This means that when we write out a track
|
||||||
// as Allegro or MIDI without the offset, we'll need to insert an
|
// as Allegro or MIDI without the offset, we'll need to insert an
|
||||||
@ -2779,16 +2778,16 @@ void TrackArtist::DrawNoteTrack(const NoteTrack *track,
|
|||||||
const double h = X_TO_TIME(rect.x);
|
const double h = X_TO_TIME(rect.x);
|
||||||
const double h1 = X_TO_TIME(rect.x + rect.width);
|
const double h1 = X_TO_TIME(rect.x + rect.width);
|
||||||
|
|
||||||
Alg_seq_ptr seq = track->mSeq;
|
Alg_seq_ptr seq = track->mSeq.get();
|
||||||
if (!seq) {
|
if (!seq) {
|
||||||
assert(track->mSerializationBuffer);
|
assert(track->mSerializationBuffer);
|
||||||
// JKC: Previously this indirected via seq->, a NULL pointer.
|
// JKC: Previously this indirected via seq->, a NULL pointer.
|
||||||
// This was actually OK, since unserialize is a static function.
|
// This was actually OK, since unserialize is a static function.
|
||||||
// Alg_seq:: is clearer.
|
// Alg_seq:: is clearer.
|
||||||
Alg_track_ptr alg_track = Alg_seq::unserialize(track->mSerializationBuffer,
|
std::unique_ptr<Alg_track> alg_track{ Alg_seq::unserialize(track->mSerializationBuffer,
|
||||||
track->mSerializationLength);
|
track->mSerializationLength) };
|
||||||
assert(alg_track->get_type() == 's');
|
assert(alg_track->get_type() == 's');
|
||||||
const_cast<NoteTrack*>(track)->mSeq = seq = (Alg_seq_ptr) alg_track;
|
const_cast<NoteTrack*>(track)->mSeq.reset(seq = static_cast<Alg_seq*>(alg_track.release()));
|
||||||
free(track->mSerializationBuffer);
|
free(track->mSerializationBuffer);
|
||||||
track->mSerializationBuffer = NULL;
|
track->mSerializationBuffer = NULL;
|
||||||
}
|
}
|
||||||
|
@ -293,10 +293,10 @@ WaveClip::WaveClip(DirManager *projDirManager, sampleFormat format, int rate)
|
|||||||
mOffset = 0;
|
mOffset = 0;
|
||||||
mRate = rate;
|
mRate = rate;
|
||||||
mSequence = std::make_unique<Sequence>(projDirManager, format);
|
mSequence = std::make_unique<Sequence>(projDirManager, format);
|
||||||
mEnvelope = new Envelope();
|
mEnvelope = std::make_unique<Envelope>();
|
||||||
mWaveCache = new WaveCache();
|
mWaveCache = std::make_unique<WaveCache>();
|
||||||
mSpecCache = new SpecCache();
|
mSpecCache = std::make_unique<SpecCache>();
|
||||||
mSpecPxCache = new SpecPxCache(1);
|
mSpecPxCache = std::make_unique<SpecPxCache>(1);
|
||||||
mAppendBufferLen = 0;
|
mAppendBufferLen = 0;
|
||||||
mDirty = 0;
|
mDirty = 0;
|
||||||
mIsPlaceholder = false;
|
mIsPlaceholder = false;
|
||||||
@ -311,13 +311,13 @@ WaveClip::WaveClip(const WaveClip& orig, DirManager *projDirManager)
|
|||||||
mOffset = orig.mOffset;
|
mOffset = orig.mOffset;
|
||||||
mRate = orig.mRate;
|
mRate = orig.mRate;
|
||||||
mSequence = std::make_unique<Sequence>(*orig.mSequence, projDirManager);
|
mSequence = std::make_unique<Sequence>(*orig.mSequence, projDirManager);
|
||||||
mEnvelope = new Envelope();
|
mEnvelope = std::make_unique<Envelope>();
|
||||||
mEnvelope->Paste(0.0, orig.mEnvelope);
|
mEnvelope->Paste(0.0, orig.mEnvelope.get());
|
||||||
mEnvelope->SetOffset(orig.GetOffset());
|
mEnvelope->SetOffset(orig.GetOffset());
|
||||||
mEnvelope->SetTrackLen(((double)orig.mSequence->GetNumSamples()) / orig.mRate);
|
mEnvelope->SetTrackLen(((double)orig.mSequence->GetNumSamples()) / orig.mRate);
|
||||||
mWaveCache = new WaveCache();
|
mWaveCache = std::make_unique<WaveCache>();
|
||||||
mSpecCache = new SpecCache();
|
mSpecCache = std::make_unique<SpecCache>();
|
||||||
mSpecPxCache = new SpecPxCache(1);
|
mSpecPxCache = std::make_unique<SpecPxCache>(1);
|
||||||
|
|
||||||
for (WaveClipList::compatibility_iterator it=orig.mCutLines.GetFirst(); it; it=it->GetNext())
|
for (WaveClipList::compatibility_iterator it=orig.mCutLines.GetFirst(); it; it=it->GetNext())
|
||||||
mCutLines.Append(new WaveClip(*it->GetData(), projDirManager));
|
mCutLines.Append(new WaveClip(*it->GetData(), projDirManager));
|
||||||
@ -329,13 +329,6 @@ WaveClip::WaveClip(const WaveClip& orig, DirManager *projDirManager)
|
|||||||
|
|
||||||
WaveClip::~WaveClip()
|
WaveClip::~WaveClip()
|
||||||
{
|
{
|
||||||
delete mEnvelope;
|
|
||||||
mEnvelope = NULL;
|
|
||||||
|
|
||||||
delete mWaveCache;
|
|
||||||
delete mSpecCache;
|
|
||||||
delete mSpecPxCache;
|
|
||||||
|
|
||||||
mCutLines.DeleteContents(true);
|
mCutLines.DeleteContents(true);
|
||||||
mCutLines.Clear();
|
mCutLines.Clear();
|
||||||
}
|
}
|
||||||
@ -416,12 +409,10 @@ bool WaveClip::AfterClip(double t) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
///Delete the wave cache - force redraw. Thread-safe
|
///Delete the wave cache - force redraw. Thread-safe
|
||||||
void WaveClip::DeleteWaveCache()
|
void WaveClip::ClearWaveCache()
|
||||||
{
|
{
|
||||||
ODLocker locker(&mWaveCacheMutex);
|
ODLocker locker(&mWaveCacheMutex);
|
||||||
if(mWaveCache!=NULL)
|
mWaveCache = std::make_unique<WaveCache>();
|
||||||
delete mWaveCache;
|
|
||||||
mWaveCache = new WaveCache();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
///Adds an invalid region to the wavecache so it redraws that portion only.
|
///Adds an invalid region to the wavecache so it redraws that portion only.
|
||||||
@ -556,8 +547,7 @@ bool WaveClip::GetWaveDisplay(WaveDisplay &display, double t0,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<WaveCache> oldCache(mWaveCache);
|
std::unique_ptr<WaveCache> oldCache(std::move(mWaveCache));
|
||||||
mWaveCache = 0;
|
|
||||||
|
|
||||||
int oldX0 = 0;
|
int oldX0 = 0;
|
||||||
double correction = 0.0;
|
double correction = 0.0;
|
||||||
@ -577,7 +567,7 @@ bool WaveClip::GetWaveDisplay(WaveDisplay &display, double t0,
|
|||||||
if (!(copyEnd > copyBegin))
|
if (!(copyEnd > copyBegin))
|
||||||
oldCache.reset(0);
|
oldCache.reset(0);
|
||||||
|
|
||||||
mWaveCache = new WaveCache(numPixels, pixelsPerSecond, mRate, t0, mDirty);
|
mWaveCache = std::make_unique<WaveCache>(numPixels, pixelsPerSecond, mRate, t0, mDirty);
|
||||||
min = &mWaveCache->min[0];
|
min = &mWaveCache->min[0];
|
||||||
max = &mWaveCache->max[0];
|
max = &mWaveCache->max[0];
|
||||||
rms = &mWaveCache->rms[0];
|
rms = &mWaveCache->rms[0];
|
||||||
@ -1098,8 +1088,7 @@ bool WaveClip::GetSpectrogram(WaveTrackCache &waveTrackCache,
|
|||||||
// a complete hit, because of the complications of time reassignment
|
// a complete hit, because of the complications of time reassignment
|
||||||
match = false;
|
match = false;
|
||||||
|
|
||||||
std::unique_ptr<SpecCache> oldCache(mSpecCache);
|
std::unique_ptr<SpecCache> oldCache(std::move(mSpecCache));
|
||||||
mSpecCache = 0;
|
|
||||||
|
|
||||||
const double tstep = 1.0 / pixelsPerSecond;
|
const double tstep = 1.0 / pixelsPerSecond;
|
||||||
const double samplesPerPixel = mRate * tstep;
|
const double samplesPerPixel = mRate * tstep;
|
||||||
@ -1124,7 +1113,7 @@ bool WaveClip::GetSpectrogram(WaveTrackCache &waveTrackCache,
|
|||||||
if (!(copyEnd > copyBegin))
|
if (!(copyEnd > copyBegin))
|
||||||
oldCache.reset(0);
|
oldCache.reset(0);
|
||||||
|
|
||||||
mSpecCache = new SpecCache(
|
mSpecCache = std::make_unique<SpecCache>(
|
||||||
numPixels, settings.algorithm, pixelsPerSecond, t0,
|
numPixels, settings.algorithm, pixelsPerSecond, t0,
|
||||||
windowType, windowSize, zeroPaddingFactor, frequencyGain);
|
windowType, windowSize, zeroPaddingFactor, frequencyGain);
|
||||||
|
|
||||||
@ -1368,7 +1357,7 @@ XMLTagHandler *WaveClip::HandleXMLChild(const wxChar *tag)
|
|||||||
if (!wxStrcmp(tag, wxT("sequence")))
|
if (!wxStrcmp(tag, wxT("sequence")))
|
||||||
return mSequence.get();
|
return mSequence.get();
|
||||||
else if (!wxStrcmp(tag, wxT("envelope")))
|
else if (!wxStrcmp(tag, wxT("envelope")))
|
||||||
return mEnvelope;
|
return mEnvelope.get();
|
||||||
else if (!wxStrcmp(tag, wxT("waveclip")))
|
else if (!wxStrcmp(tag, wxT("waveclip")))
|
||||||
{
|
{
|
||||||
// Nested wave clips are cut lines
|
// Nested wave clips are cut lines
|
||||||
@ -1402,16 +1391,14 @@ bool WaveClip::CreateFromCopy(double t0, double t1, const WaveClip* other)
|
|||||||
other->TimeToSamplesClip(t1, &s1);
|
other->TimeToSamplesClip(t1, &s1);
|
||||||
|
|
||||||
std::unique_ptr<Sequence> oldSequence = std::move(mSequence);
|
std::unique_ptr<Sequence> oldSequence = std::move(mSequence);
|
||||||
mSequence = NULL;
|
|
||||||
if (!other->mSequence->Copy(s0, s1, mSequence))
|
if (!other->mSequence->Copy(s0, s1, mSequence))
|
||||||
{
|
{
|
||||||
mSequence = std::move(oldSequence);
|
mSequence = std::move(oldSequence);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
delete mEnvelope;
|
mEnvelope = std::make_unique<Envelope>();
|
||||||
mEnvelope = new Envelope();
|
mEnvelope->CopyFrom(other->mEnvelope.get(), (double)s0/mRate, (double)s1/mRate);
|
||||||
mEnvelope->CopyFrom(other->mEnvelope, (double)s0/mRate, (double)s1/mRate);
|
|
||||||
|
|
||||||
MarkChanged();
|
MarkChanged();
|
||||||
|
|
||||||
@ -1450,7 +1437,7 @@ bool WaveClip::Paste(double t0, const WaveClip* other)
|
|||||||
if (mSequence->Paste(s0, pastedClip->mSequence.get()))
|
if (mSequence->Paste(s0, pastedClip->mSequence.get()))
|
||||||
{
|
{
|
||||||
MarkChanged();
|
MarkChanged();
|
||||||
mEnvelope->Paste((double)s0/mRate + mOffset, pastedClip->mEnvelope);
|
mEnvelope->Paste((double)s0/mRate + mOffset, pastedClip->mEnvelope.get());
|
||||||
mEnvelope->RemoveUnneededPoints();
|
mEnvelope->RemoveUnneededPoints();
|
||||||
OffsetCutLines(t0, pastedClip->GetEndTime() - pastedClip->GetStartTime());
|
OffsetCutLines(t0, pastedClip->GetEndTime() - pastedClip->GetStartTime());
|
||||||
|
|
||||||
@ -1788,16 +1775,9 @@ bool WaveClip::Resample(int rate, ProgressDialog *progress)
|
|||||||
mRate = rate;
|
mRate = rate;
|
||||||
|
|
||||||
// Invalidate wave display cache
|
// Invalidate wave display cache
|
||||||
if (mWaveCache)
|
mWaveCache = std::make_unique<WaveCache>();
|
||||||
{
|
|
||||||
delete mWaveCache;
|
|
||||||
mWaveCache = NULL;
|
|
||||||
}
|
|
||||||
mWaveCache = new WaveCache();
|
|
||||||
// Invalidate the spectrum display cache
|
// Invalidate the spectrum display cache
|
||||||
if (mSpecCache)
|
mSpecCache = std::make_unique<SpecCache>();
|
||||||
delete mSpecCache;
|
|
||||||
mSpecCache = new SpecCache();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return !error;
|
return !error;
|
||||||
|
@ -251,8 +251,8 @@ public:
|
|||||||
bool SetSamples(samplePtr buffer, sampleFormat format,
|
bool SetSamples(samplePtr buffer, sampleFormat format,
|
||||||
sampleCount start, sampleCount len);
|
sampleCount start, sampleCount len);
|
||||||
|
|
||||||
Envelope* GetEnvelope() { return mEnvelope; }
|
Envelope* GetEnvelope() { return mEnvelope.get(); }
|
||||||
const Envelope* GetEnvelope() const { return mEnvelope; }
|
const Envelope* GetEnvelope() const { return mEnvelope.get(); }
|
||||||
BlockArray* GetSequenceBlockArray();
|
BlockArray* GetSequenceBlockArray();
|
||||||
|
|
||||||
// Get low-level access to the sequence. Whenever possible, don't use this,
|
// Get low-level access to the sequence. Whenever possible, don't use this,
|
||||||
@ -348,7 +348,7 @@ public:
|
|||||||
// not balanced by unlocking calls.
|
// not balanced by unlocking calls.
|
||||||
|
|
||||||
///Delete the wave cache - force redraw. Thread-safe
|
///Delete the wave cache - force redraw. Thread-safe
|
||||||
void DeleteWaveCache();
|
void ClearWaveCache();
|
||||||
|
|
||||||
///Adds an invalid region to the wavecache so it redraws that portion only.
|
///Adds an invalid region to the wavecache so it redraws that portion only.
|
||||||
void AddInvalidRegion(long startSample, long endSample);
|
void AddInvalidRegion(long startSample, long endSample);
|
||||||
@ -363,7 +363,7 @@ public:
|
|||||||
void WriteXML(XMLWriter &xmlFile) /* not override */;
|
void WriteXML(XMLWriter &xmlFile) /* not override */;
|
||||||
|
|
||||||
// Cache of values to colour pixels of Spectrogram - used by TrackArtist
|
// Cache of values to colour pixels of Spectrogram - used by TrackArtist
|
||||||
mutable SpecPxCache *mSpecPxCache;
|
mutable std::unique_ptr<SpecPxCache> mSpecPxCache;
|
||||||
|
|
||||||
// AWD, Oct 2009: for pasting whitespace at the end of selection
|
// AWD, Oct 2009: for pasting whitespace at the end of selection
|
||||||
bool GetIsPlaceholder() const { return mIsPlaceholder; }
|
bool GetIsPlaceholder() const { return mIsPlaceholder; }
|
||||||
@ -377,11 +377,11 @@ protected:
|
|||||||
int mDirty;
|
int mDirty;
|
||||||
bool mIsCutLine;
|
bool mIsCutLine;
|
||||||
std::unique_ptr<Sequence> mSequence;
|
std::unique_ptr<Sequence> mSequence;
|
||||||
Envelope *mEnvelope;
|
std::unique_ptr<Envelope> mEnvelope;
|
||||||
|
|
||||||
mutable WaveCache *mWaveCache;
|
mutable std::unique_ptr<WaveCache> mWaveCache;
|
||||||
mutable ODLock mWaveCacheMutex;
|
mutable ODLock mWaveCacheMutex;
|
||||||
mutable SpecCache *mSpecCache;
|
mutable std::unique_ptr<SpecCache> mSpecCache;
|
||||||
SampleBuffer mAppendBuffer;
|
SampleBuffer mAppendBuffer;
|
||||||
sampleCount mAppendBufferLen;
|
sampleCount mAppendBufferLen;
|
||||||
|
|
||||||
|
@ -78,8 +78,6 @@ WaveTrack::Holder TrackFactory::NewWaveTrack(sampleFormat format, double rate)
|
|||||||
|
|
||||||
WaveTrack::WaveTrack(DirManager *projDirManager, sampleFormat format, double rate) :
|
WaveTrack::WaveTrack(DirManager *projDirManager, sampleFormat format, double rate) :
|
||||||
Track(projDirManager)
|
Track(projDirManager)
|
||||||
, mpSpectrumSettings(0)
|
|
||||||
, mpWaveformSettings(0)
|
|
||||||
{
|
{
|
||||||
if (format == (sampleFormat)0)
|
if (format == (sampleFormat)0)
|
||||||
{
|
{
|
||||||
@ -163,9 +161,9 @@ void WaveTrack::Merge(const Track &orig)
|
|||||||
mDisplayMin = wt.mDisplayMin;
|
mDisplayMin = wt.mDisplayMin;
|
||||||
mDisplayMax = wt.mDisplayMax;
|
mDisplayMax = wt.mDisplayMax;
|
||||||
SetSpectrogramSettings(wt.mpSpectrumSettings
|
SetSpectrogramSettings(wt.mpSpectrumSettings
|
||||||
? new SpectrogramSettings(*wt.mpSpectrumSettings) : 0);
|
? std::make_unique<SpectrogramSettings>(*wt.mpSpectrumSettings) : nullptr);
|
||||||
SetWaveformSettings
|
SetWaveformSettings
|
||||||
(wt.mpWaveformSettings ? new WaveformSettings(*wt.mpWaveformSettings) : 0);
|
(wt.mpWaveformSettings ? std::make_unique<WaveformSettings>(*wt.mpWaveformSettings) : nullptr);
|
||||||
}
|
}
|
||||||
Track::Merge(orig);
|
Track::Merge(orig);
|
||||||
}
|
}
|
||||||
@ -180,9 +178,6 @@ WaveTrack::~WaveTrack()
|
|||||||
for (WaveClipList::compatibility_iterator it=GetClipIterator(); it; it=it->GetNext())
|
for (WaveClipList::compatibility_iterator it=GetClipIterator(); it; it=it->GetNext())
|
||||||
delete it->GetData();
|
delete it->GetData();
|
||||||
mClips.Clear();
|
mClips.Clear();
|
||||||
|
|
||||||
delete mpSpectrumSettings;
|
|
||||||
delete mpWaveformSettings;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
double WaveTrack::GetOffset() const
|
double WaveTrack::GetOffset() const
|
||||||
@ -763,15 +758,14 @@ SpectrogramSettings &WaveTrack::GetIndependentSpectrogramSettings()
|
|||||||
{
|
{
|
||||||
if (!mpSpectrumSettings)
|
if (!mpSpectrumSettings)
|
||||||
mpSpectrumSettings =
|
mpSpectrumSettings =
|
||||||
new SpectrogramSettings(SpectrogramSettings::defaults());
|
std::make_unique<SpectrogramSettings>(SpectrogramSettings::defaults());
|
||||||
return *mpSpectrumSettings;
|
return *mpSpectrumSettings;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaveTrack::SetSpectrogramSettings(SpectrogramSettings *pSettings)
|
void WaveTrack::SetSpectrogramSettings(std::unique_ptr<SpectrogramSettings> &&pSettings)
|
||||||
{
|
{
|
||||||
if (mpSpectrumSettings != pSettings) {
|
if (mpSpectrumSettings != pSettings) {
|
||||||
delete mpSpectrumSettings;
|
mpSpectrumSettings = std::move(pSettings);
|
||||||
mpSpectrumSettings = pSettings;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -794,15 +788,14 @@ WaveformSettings &WaveTrack::GetWaveformSettings()
|
|||||||
WaveformSettings &WaveTrack::GetIndependentWaveformSettings()
|
WaveformSettings &WaveTrack::GetIndependentWaveformSettings()
|
||||||
{
|
{
|
||||||
if (!mpWaveformSettings)
|
if (!mpWaveformSettings)
|
||||||
mpWaveformSettings = new WaveformSettings(WaveformSettings::defaults());
|
mpWaveformSettings = std::make_unique<WaveformSettings>(WaveformSettings::defaults());
|
||||||
return *mpWaveformSettings;
|
return *mpWaveformSettings;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaveTrack::SetWaveformSettings(WaveformSettings *pSettings)
|
void WaveTrack::SetWaveformSettings(std::unique_ptr<WaveformSettings> &&pSettings)
|
||||||
{
|
{
|
||||||
if (mpWaveformSettings != pSettings) {
|
if (mpWaveformSettings != pSettings) {
|
||||||
delete mpWaveformSettings;
|
mpWaveformSettings = std::move(pSettings);
|
||||||
mpWaveformSettings = pSettings;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2643,10 +2636,10 @@ void WaveTrack::FillSortedClipArray(WaveClipArray& clips) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
///Deletes all clips' wavecaches. Careful, This may not be threadsafe.
|
///Deletes all clips' wavecaches. Careful, This may not be threadsafe.
|
||||||
void WaveTrack::DeleteWaveCaches()
|
void WaveTrack::ClearWaveCaches()
|
||||||
{
|
{
|
||||||
for (WaveClipList::compatibility_iterator it=GetClipIterator(); it; it=it->GetNext())
|
for (WaveClipList::compatibility_iterator it=GetClipIterator(); it; it=it->GetNext())
|
||||||
it->GetData()->DeleteWaveCache();
|
it->GetData()->ClearWaveCache();
|
||||||
}
|
}
|
||||||
|
|
||||||
///Adds an invalid region to the wavecache so it redraws that portion only.
|
///Adds an invalid region to the wavecache so it redraws that portion only.
|
||||||
|
@ -145,12 +145,12 @@ class AUDACITY_DLL_API WaveTrack final : public Track {
|
|||||||
const SpectrogramSettings &GetSpectrogramSettings() const;
|
const SpectrogramSettings &GetSpectrogramSettings() const;
|
||||||
SpectrogramSettings &GetSpectrogramSettings();
|
SpectrogramSettings &GetSpectrogramSettings();
|
||||||
SpectrogramSettings &GetIndependentSpectrogramSettings();
|
SpectrogramSettings &GetIndependentSpectrogramSettings();
|
||||||
void SetSpectrogramSettings(SpectrogramSettings *pSettings);
|
void SetSpectrogramSettings(std::unique_ptr<SpectrogramSettings> &&pSettings);
|
||||||
|
|
||||||
const WaveformSettings &GetWaveformSettings() const;
|
const WaveformSettings &GetWaveformSettings() const;
|
||||||
WaveformSettings &GetWaveformSettings();
|
WaveformSettings &GetWaveformSettings();
|
||||||
WaveformSettings &GetIndependentWaveformSettings();
|
WaveformSettings &GetIndependentWaveformSettings();
|
||||||
void SetWaveformSettings(WaveformSettings *pSettings);
|
void SetWaveformSettings(std::unique_ptr<WaveformSettings> &&pSettings);
|
||||||
|
|
||||||
//
|
//
|
||||||
// High-level editing
|
// High-level editing
|
||||||
@ -219,8 +219,8 @@ class AUDACITY_DLL_API WaveTrack final : public Track {
|
|||||||
///gets an int with OD flags so that we can determine which ODTasks should be run on this track after save/open, etc.
|
///gets an int with OD flags so that we can determine which ODTasks should be run on this track after save/open, etc.
|
||||||
unsigned int GetODFlags();
|
unsigned int GetODFlags();
|
||||||
|
|
||||||
///Deletes all clips' wavecaches. Careful, This may not be threadsafe.
|
///Invalidates all clips' wavecaches. Careful, This may not be threadsafe.
|
||||||
void DeleteWaveCaches();
|
void ClearWaveCaches();
|
||||||
|
|
||||||
///Adds an invalid region to the wavecache so it redraws that portion only.
|
///Adds an invalid region to the wavecache so it redraws that portion only.
|
||||||
void AddInvalidRegion(sampleCount startSample, sampleCount endSample);
|
void AddInvalidRegion(sampleCount startSample, sampleCount endSample);
|
||||||
@ -520,8 +520,8 @@ class AUDACITY_DLL_API WaveTrack final : public Track {
|
|||||||
double mLegacyProjectFileOffset;
|
double mLegacyProjectFileOffset;
|
||||||
int mAutoSaveIdent;
|
int mAutoSaveIdent;
|
||||||
|
|
||||||
SpectrogramSettings *mpSpectrumSettings;
|
std::unique_ptr<SpectrogramSettings> mpSpectrumSettings;
|
||||||
WaveformSettings *mpWaveformSettings;
|
std::unique_ptr<WaveformSettings> mpWaveformSettings;
|
||||||
};
|
};
|
||||||
|
|
||||||
// This is meant to be a short-lived object, during whose lifetime,
|
// This is meant to be a short-lived object, during whose lifetime,
|
||||||
|
@ -47,23 +47,22 @@ bool ImportMIDI(const wxString &fName, NoteTrack * dest)
|
|||||||
}
|
}
|
||||||
|
|
||||||
double offset = 0.0;
|
double offset = 0.0;
|
||||||
Alg_seq_ptr new_seq = new Alg_seq(fName.mb_str(), is_midi, &offset);
|
auto new_seq = std::make_unique<Alg_seq>(fName.mb_str(), is_midi, &offset);
|
||||||
|
|
||||||
//Should we also check if(seq->tracks() == 0) ?
|
//Should we also check if(seq->tracks() == 0) ?
|
||||||
if(new_seq->get_read_error() == alg_error_open){
|
if(new_seq->get_read_error() == alg_error_open){
|
||||||
wxMessageBox( _("Could not open file ") + fName + wxT("."));
|
wxMessageBox( _("Could not open file ") + fName + wxT("."));
|
||||||
mf.Close();
|
mf.Close();
|
||||||
delete new_seq;
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
dest->SetSequence(new_seq);
|
dest->SetSequence(std::move(new_seq));
|
||||||
dest->SetOffset(offset);
|
dest->SetOffset(offset);
|
||||||
wxString trackNameBase = fName.AfterLast(wxFILE_SEP_PATH).BeforeLast('.');
|
wxString trackNameBase = fName.AfterLast(wxFILE_SEP_PATH).BeforeLast('.');
|
||||||
dest->SetName(trackNameBase);
|
dest->SetName(trackNameBase);
|
||||||
mf.Close();
|
mf.Close();
|
||||||
// the mean pitch should be somewhere in the middle of the display
|
// the mean pitch should be somewhere in the middle of the display
|
||||||
Alg_iterator iterator(new_seq, false);
|
Alg_iterator iterator(dest->GetSequence(), false);
|
||||||
iterator.begin();
|
iterator.begin();
|
||||||
// for every event
|
// for every event
|
||||||
Alg_event_ptr evt;
|
Alg_event_ptr evt;
|
||||||
|
@ -382,11 +382,11 @@ bool SpectrumPrefs::Apply()
|
|||||||
|
|
||||||
if (mWt) {
|
if (mWt) {
|
||||||
if (mDefaulted) {
|
if (mDefaulted) {
|
||||||
mWt->SetSpectrogramSettings(NULL);
|
mWt->SetSpectrogramSettings({});
|
||||||
// ... and so that the vertical scale also defaults:
|
// ... and so that the vertical scale also defaults:
|
||||||
mWt->SetSpectrumBounds(-1, -1);
|
mWt->SetSpectrumBounds(-1, -1);
|
||||||
if (partner) {
|
if (partner) {
|
||||||
partner->SetSpectrogramSettings(NULL);
|
partner->SetSpectrogramSettings({});
|
||||||
partner->SetSpectrumBounds(-1, -1);
|
partner->SetSpectrumBounds(-1, -1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -147,9 +147,9 @@ bool WaveformPrefs::Apply()
|
|||||||
|
|
||||||
if (mWt) {
|
if (mWt) {
|
||||||
if (mDefaulted) {
|
if (mDefaulted) {
|
||||||
mWt->SetWaveformSettings(NULL);
|
mWt->SetWaveformSettings({});
|
||||||
if (partner)
|
if (partner)
|
||||||
partner->SetWaveformSettings(NULL);
|
partner->SetWaveformSettings({});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
WaveformSettings *pSettings =
|
WaveformSettings *pSettings =
|
||||||
|
Loading…
x
Reference in New Issue
Block a user