Mercurial > hg > easaier-soundaccess
changeset 180:41998908f0c9
cleaning
author | lbajardsilogic |
---|---|
date | Wed, 21 Nov 2007 14:32:58 +0000 |
parents | c77d6434d60c |
children | 3d68e73a877b |
files | sv/audioio/AudioCallbackPlaySource.cpp sv/main/EasaierSessionManager.cpp sv/main/MainWindow.cpp |
diffstat | 3 files changed, 10 insertions(+), 179 deletions(-) [+] |
line wrap: on
line diff
--- a/sv/audioio/AudioCallbackPlaySource.cpp Wed Nov 21 14:23:19 2007 +0000 +++ b/sv/audioio/AudioCallbackPlaySource.cpp Wed Nov 21 14:32:58 2007 +0000 @@ -94,7 +94,7 @@ clearModels(); if (m_readBuffers != m_writeBuffers) { - delete m_readBuffers; + delete m_readBuffers; } delete m_writeBuffers; @@ -308,8 +308,8 @@ m_writeBufferFill = sf; if (m_readBuffers != m_writeBuffers) { - delete m_writeBuffers; - m_writeBuffers = 0; + delete m_writeBuffers; + m_writeBuffers = 0; } m_writeBuffers = new RingBufferVector; @@ -799,134 +799,6 @@ if (count == 0) return 0; -/* PhaseVocoderTimeStretcher *ts = m_timeStretcher; - - if (!ts || ts->getRatio() == 1) { - - size_t got = 0; - - for (size_t ch = 0; ch < getTargetChannelCount(); ++ch) { - - RingBuffer<float> *rb = getReadRingBuffer(ch); - - if (rb) { - - // this is marginally more likely to leave our channels in - // sync after a processing failure than just passing "count": - size_t request = count; - if (ch > 0) request = got; - - got = rb->read(buffer[ch], request); - -#ifdef DEBUG_AUDIO_PLAY_SOURCE_PLAYING - std::cout << "AudioCallbackPlaySource::getSamples: got " << got << " (of " << count << ") samples on channel " << ch << ", signalling for more (possibly)" << std::endl; -#endif - } - - for (size_t ch = 0; ch < getTargetChannelCount(); ++ch) { - for (size_t i = got; i < count; ++i) { - buffer[ch][i] = 0.0; - } - } - } - - applyAuditioningEffect(count, buffer); - - applyRealTimeFilters(count, buffer); - - m_condition.wakeAll(); - return got; - } - - float ratio = ts->getRatio(); - -// std::cout << "ratio = " << ratio << std::endl; - - size_t channels = getTargetChannelCount(); - bool mix = (channels > 1 && ts->getChannelCount() == 1); - - size_t available; - - int warned = 0; - - // We want output blocks of e.g. 1024 (probably fixed, certainly - // bounded). We can provide input blocks of any size (unbounded) - // at the timestretcher's request. The input block for a given - // output is approx output / ratio, but we can't predict it - // exactly, for an adaptive timestretcher. The stretcher will - // need some additional buffer space. See the time stretcher code - // and comments. - - while ((available = ts->getAvailableOutputSamples()) < count) { - - size_t reqd = lrintf((count - available) / ratio); - reqd = max(reqd, ts->getRequiredInputSamples()); - if (reqd == 0) reqd = 1; - - //float *ib[channels]; - float **ib = (float**) malloc(channels*sizeof(float*)); - - size_t got = reqd; - - if (mix) { - for (size_t c = 0; c < channels; ++c) { - if (c == 0) ib[c] = new float[reqd]; //!!! fix -- this is a rt function - else ib[c] = 0; - RingBuffer<float> *rb = getReadRingBuffer(c); - if (rb) { - size_t gotHere; - if (c > 0) gotHere = rb->readAdding(ib[0], got); - else gotHere = rb->read(ib[0], got); - if (gotHere < got) got = gotHere; - } - } - } else { - for (size_t c = 0; c < channels; ++c) { - ib[c] = new float[reqd]; //!!! fix -- this is a rt function - RingBuffer<float> *rb = getReadRingBuffer(c); - if (rb) { - size_t gotHere = rb->read(ib[c], got); - if (gotHere < got) got = gotHere; - } - } - } - - if (got < reqd) { - std::cerr << "WARNING: Read underrun in playback (" - << got << " < " << reqd << ")" << std::endl; - } - - ts->putInput(ib, got); - - for (size_t c = 0; c < channels; ++c) { - delete[] ib[c]; - } - - if (got == 0) break; - - if (ts->getAvailableOutputSamples() == available) { - std::cerr << "WARNING: AudioCallbackPlaySource::getSamples: Added " << got << " samples to time stretcher, created no new available output samples (warned = " << warned << ")" << std::endl; - if (++warned == 5) break; - } - } - - ts->getOutput(buffer, count); - - if (mix) { - for (size_t c = 1; c < channels; ++c) { - for (size_t i = 0; i < count; ++i) { - buffer[c][i] = buffer[0][i] / channels; - } - } - for (size_t i = 0; i < count; ++i) { - buffer[0][i] /= channels; - } - } - - applyAuditioningEffect(count, buffer); - - */ - applyRealTimeFilters(count, buffer); applyAuditioningEffect(count, buffer); @@ -1480,52 +1352,6 @@ { if (!m_filterStack) return; -/* size_t required = m_filterStack->getRequiredInputSamples(count); - - if (required <= count) - { - m_filterStack->putInput(buffers, count); - - } else - { - size_t missing = required - count; - - size_t channels = getTargetChannelCount(); - - size_t got = required; - - float **ib = (float**) malloc(channels*sizeof(float*)); - - for (size_t c = 0; c < channels; ++c) { - ib[c] = (float*) malloc(required*sizeof(float)); - for (int i=0; i<count; i++) - { - ib[c][i] = buffers[c][i]; - } - RingBuffer<float> *rb = getReadRingBuffer(c); - if (rb) { - size_t gotHere = rb->peek(ib[c]+count, missing); //should be got not missing parameter !!!! - if (gotHere < got) - got = gotHere; - } - } - if (got < missing) - { - std::cerr << "ERROR applyRealTimeFilters(): Read underrun in playback (" - << got << " < " << required << ")" << std::endl; - return; - } - - m_filterStack->putInput(ib, required); - - for (size_t c = 0; c < channels; ++c) { - delete ib[c]; - } - delete ib; - } - m_filterStack->getOutput(buffers, count); -*/ - size_t required = m_filterStack->getRequiredInputSamples(count); size_t channels = getTargetChannelCount();
--- a/sv/main/EasaierSessionManager.cpp Wed Nov 21 14:23:19 2007 +0000 +++ b/sv/main/EasaierSessionManager.cpp Wed Nov 21 14:32:58 2007 +0000 @@ -211,6 +211,7 @@ //delete de file and erase from the loaded file queue delete loadedFile; m_loadFile.erase(iter); + loadedFile = 0; std::cerr << "fileLoaded() : file loaded, start to read file " << index << std::endl;
--- a/sv/main/MainWindow.cpp Wed Nov 21 14:23:19 2007 +0000 +++ b/sv/main/MainWindow.cpp Wed Nov 21 14:32:58 2007 +0000 @@ -2585,6 +2585,7 @@ bool ok = lid->exec(); QString item = lid->getCurrentString(); delete lid; + lid = 0; if (!ok || item.isEmpty()) return; @@ -2609,6 +2610,7 @@ } delete image; + image = 0; } // Ivan Damnjanovic 09-10/2007 added video file import @@ -2640,9 +2642,10 @@ WaveFileModel *newModel = new WaveFileModel(path, location); if (!newModel->isOK()) { - delete newModel; + delete newModel; + newModel = 0; m_openingAudioFile = false; - return FileOpenFailed; + return FileOpenFailed; } bool setAsMain = true; @@ -2666,6 +2669,7 @@ if (!ok || item.isEmpty()) { delete newModel; + newModel = 0; m_openingAudioFile = false; return FileOpenCancelled; }