diff options
author | Robert Jonsson <spamatica@gmail.com> | 2010-07-12 20:16:20 +0000 |
---|---|---|
committer | Robert Jonsson <spamatica@gmail.com> | 2010-07-12 20:16:20 +0000 |
commit | 4da278e1a692d4d4a543b0738187b325b208d852 (patch) | |
tree | 153c80db54717155ff7a26c17b7ffeed57e2299e | |
parent | 009177f39db16272e129391164f5db5589dbe940 (diff) |
fixed wave file editing
-rw-r--r-- | muse/ChangeLog | 2 | ||||
-rw-r--r-- | muse/muse/wave.cpp | 4 | ||||
-rw-r--r-- | muse/muse/wave.h | 3 | ||||
-rw-r--r-- | muse/muse/waveedit/waveview.cpp | 2 |
4 files changed, 8 insertions, 3 deletions
diff --git a/muse/ChangeLog b/muse/ChangeLog index 4b47cca7..5793aab1 100644 --- a/muse/ChangeLog +++ b/muse/ChangeLog @@ -1,3 +1,5 @@ +12.07.2010 + * Fixed: When wave files were edited allocation was on stack which caused crashes for larger selections, now done on heap (rj) 10.07.2010 * Added: Insert measure, inserts empty space and moves everything after playpointer to the right and Part-insert, pastes parts and moves everything after the paste point to the right diff --git a/muse/muse/wave.cpp b/muse/muse/wave.cpp index 52c65b8d..371f6ee7 100644 --- a/muse/muse/wave.cpp +++ b/muse/muse/wave.cpp @@ -743,7 +743,7 @@ void SndFile::applyUndoFile(const QString& original, const QString& tmpfile, uns data2beoverwritten[i] = new float[tmpdatalen]; } orig->seek(startframe, 0); - orig->read(file_channels, data2beoverwritten, tmpdatalen); + orig->readWithHeap(file_channels, data2beoverwritten, tmpdatalen); orig->close(); @@ -753,7 +753,7 @@ void SndFile::applyUndoFile(const QString& original, const QString& tmpfile, uns tmpfiledata[i] = new float[tmpdatalen]; } tmp.seek(0, 0); - tmp.read(file_channels, tmpfiledata, tmpdatalen); + tmp.readWithHeap(file_channels, tmpfiledata, tmpdatalen); tmp.close(); // Write temporary data to original file: diff --git a/muse/muse/wave.h b/muse/muse/wave.h index 4094b753..f83e5bdb 100644 --- a/muse/muse/wave.h +++ b/muse/muse/wave.h @@ -146,6 +146,9 @@ class SndFileR { void setFormat(int fmt, int ch, int rate) { sf->setFormat(fmt, ch, rate); } + size_t readWithHeap(int channel, float** f, size_t n, bool overwrite = true) { + return sf->readWithHeap(channel, f, n, overwrite); + } size_t read(int channel, float** f, size_t n, bool overwrite = true) { return sf->read(channel, f, n, overwrite); } diff --git a/muse/muse/waveedit/waveview.cpp b/muse/muse/waveedit/waveview.cpp index 3dd76837..b3ea7f92 100644 --- a/muse/muse/waveedit/waveview.cpp +++ b/muse/muse/waveedit/waveview.cpp @@ -660,7 +660,7 @@ void WaveView::modifySelection(int operation, unsigned startpos, unsigned stoppo tmpdata[i] = new float[tmpdatalen]; } file.seek(tmpdataoffset, 0); - file.read(file_channels, tmpdata, tmpdatalen); + file.readWithHeap(file_channels, tmpdata, tmpdatalen); file.close(); tmpFile.write(file_channels, tmpdata, tmpdatalen); tmpFile.close(); |