mirror of
https://github.com/cookiengineer/audacity
synced 2025-04-30 15:49:41 +02:00
Change almost all uses of WaveTrack::Get() to GetFloats() ...
... A call graph browser easily shows that the extra generality of fetching samples in some other format is only used in Benchmark -- where the format is always the same as what the track is constructed with. This makes re-verification of the claims in comments two commits ago easier.
This commit is contained in:
parent
0aa8625cff
commit
f369b5109b
@ -602,7 +602,7 @@ void FrequencyPlotDialog::GetAudio()
|
||||
mDataLen = dataLen.as_size_t();
|
||||
mData = Floats{ mDataLen };
|
||||
// Don't allow throw for bad reads
|
||||
track->Get((samplePtr)mData.get(), floatSample, start, mDataLen,
|
||||
track->GetFloats(mData.get(), start, mDataLen,
|
||||
fillZero, false);
|
||||
}
|
||||
else {
|
||||
@ -617,7 +617,7 @@ void FrequencyPlotDialog::GetAudio()
|
||||
auto start = track->TimeToLongSamples(selectedRegion.t0());
|
||||
Floats buffer2{ mDataLen };
|
||||
// Again, stop exceptions
|
||||
track->Get((samplePtr)buffer2.get(), floatSample, start, mDataLen,
|
||||
track->GetFloats(buffer2.get(), start, mDataLen,
|
||||
fillZero, false);
|
||||
for (size_t i = 0; i < mDataLen; i++)
|
||||
mData[i] += buffer2[i];
|
||||
|
@ -610,8 +610,8 @@ void MixerTrackCluster::UpdateMeter(const double t0, const double t1)
|
||||
Floats tempFloatsArray{ nFrames };
|
||||
decltype(tempFloatsArray) meterFloatsArray;
|
||||
// Don't throw on read error in this drawing update routine
|
||||
bool bSuccess = pTrack->Get((samplePtr)tempFloatsArray.get(),
|
||||
floatSample, startSample, nFrames, fillZero, false);
|
||||
bool bSuccess = pTrack->GetFloats(tempFloatsArray.get(),
|
||||
startSample, nFrames, fillZero, false);
|
||||
if (bSuccess)
|
||||
{
|
||||
// We always pass a stereo sample array to the meter, as it shows 2 channels.
|
||||
@ -625,8 +625,8 @@ void MixerTrackCluster::UpdateMeter(const double t0, const double t1)
|
||||
|
||||
if (GetRight())
|
||||
// Again, don't throw
|
||||
bSuccess = GetRight()->Get((samplePtr)tempFloatsArray.get(),
|
||||
floatSample, startSample, nFrames, fillZero, false);
|
||||
bSuccess = GetRight()->GetFloats(tempFloatsArray.get(),
|
||||
startSample, nFrames, fillZero, false);
|
||||
|
||||
if (bSuccess)
|
||||
// Interleave right channel, or duplicate same signal for "right" channel in mono case.
|
||||
|
@ -149,7 +149,7 @@ sampleCount VoiceKey::OnForward (
|
||||
//To speed things up, create a local buffer to store things in, to avoid the costly t.Get();
|
||||
//Only go through the first SignalWindowSizeInt samples, and choose the first that trips the key.
|
||||
Floats buffer{ remaining };
|
||||
t.Get((samplePtr)buffer.get(), floatSample,
|
||||
t.GetFloats(buffer.get(),
|
||||
lastsubthresholdsample, remaining);
|
||||
|
||||
|
||||
@ -299,7 +299,7 @@ sampleCount VoiceKey::OnBackward (
|
||||
//To speed things up, create a local buffer to store things in, to avoid the costly t.Get();
|
||||
//Only go through the first mSilentWindowSizeInt samples, and choose the first that trips the key.
|
||||
Floats buffer{ remaining };
|
||||
t.Get((samplePtr)buffer.get(), floatSample,
|
||||
t.GetFloats(buffer.get(),
|
||||
lastsubthresholdsample - remaining, remaining);
|
||||
|
||||
//Initialize these trend markers atrend and ztrend. They keep track of the
|
||||
@ -442,7 +442,7 @@ sampleCount VoiceKey::OffForward (
|
||||
//To speed things up, create a local buffer to store things in, to avoid the costly t.Get();
|
||||
//Only go through the first SilentWindowSizeInt samples, and choose the first that trips the key.
|
||||
Floats buffer{ remaining };
|
||||
t.Get((samplePtr)buffer.get(), floatSample,
|
||||
t.GetFloats(buffer.get(),
|
||||
lastsubthresholdsample, remaining);
|
||||
|
||||
//Initialize these trend markers atrend and ztrend. They keep track of the
|
||||
@ -579,7 +579,7 @@ sampleCount VoiceKey::OffBackward (
|
||||
//To speed things up, create a local buffer to store things in, to avoid the costly t.Get();
|
||||
//Only go through the first SilentWindowSizeInt samples, and choose the first that trips the key.
|
||||
Floats buffer{ remaining };
|
||||
t.Get((samplePtr)buffer.get(), floatSample,
|
||||
t.GetFloats(buffer.get(),
|
||||
lastsubthresholdsample - remaining, remaining);
|
||||
|
||||
//Initialize these trend markers atrend and ztrend. They keep track of the
|
||||
@ -870,7 +870,7 @@ double VoiceKey::TestEnergy (
|
||||
//Figure out how much to grab
|
||||
auto block = limitSampleBufferSize ( t.GetBestBlockSize(s), len );
|
||||
|
||||
t.Get((samplePtr)buffer.get(), floatSample, s,block); //grab the block;
|
||||
t.GetFloats(buffer.get(), s,block); //grab the block;
|
||||
|
||||
//Now, go through the block and calculate energy
|
||||
for(decltype(block) i = 0; i< block; i++)
|
||||
@ -913,7 +913,7 @@ double VoiceKey::TestSignChanges(
|
||||
//Figure out how much to grab
|
||||
auto block = limitSampleBufferSize ( t.GetBestBlockSize(s), len );
|
||||
|
||||
t.Get((samplePtr)buffer.get(), floatSample, s, block); //grab the block;
|
||||
t.GetFloats(buffer.get(), s, block); //grab the block;
|
||||
|
||||
if (len == originalLen)
|
||||
{
|
||||
@ -970,7 +970,7 @@ double VoiceKey::TestDirectionChanges(
|
||||
//Figure out how much to grab
|
||||
auto block = limitSampleBufferSize ( t.GetBestBlockSize(s), len );
|
||||
|
||||
t.Get((samplePtr)buffer.get(), floatSample, s, block); //grab the block;
|
||||
t.GetFloats(buffer.get(), s, block); //grab the block;
|
||||
|
||||
if (len == originalLen) {
|
||||
//The first time through, set stuff up special.
|
||||
|
@ -2594,8 +2594,8 @@ const float *WaveTrackCache::GetFloats(
|
||||
if (start0 >= 0) {
|
||||
const auto len0 = mPTrack->GetBestBlockSize(start0);
|
||||
wxASSERT(len0 <= mBufferSize);
|
||||
if (!mPTrack->Get(
|
||||
samplePtr(mBuffers[0].data.get()), floatSample, start0, len0,
|
||||
if (!mPTrack->GetFloats(
|
||||
mBuffers[0].data.get(), start0, len0,
|
||||
fillZero, mayThrow))
|
||||
return nullptr;
|
||||
mBuffers[0].start = start0;
|
||||
@ -2622,7 +2622,7 @@ const float *WaveTrackCache::GetFloats(
|
||||
if (start1 == end0) {
|
||||
const auto len1 = mPTrack->GetBestBlockSize(start1);
|
||||
wxASSERT(len1 <= mBufferSize);
|
||||
if (!mPTrack->Get(samplePtr(mBuffers[1].data.get()), floatSample, start1, len1, fillZero, mayThrow))
|
||||
if (!mPTrack->GetFloats(mBuffers[1].data.get(), start1, len1, fillZero, mayThrow))
|
||||
return nullptr;
|
||||
mBuffers[1].start = start1;
|
||||
mBuffers[1].len = len1;
|
||||
@ -2632,7 +2632,7 @@ const float *WaveTrackCache::GetFloats(
|
||||
}
|
||||
wxASSERT(mNValidBuffers < 2 || mBuffers[0].end() == mBuffers[1].start);
|
||||
|
||||
samplePtr buffer = 0;
|
||||
samplePtr buffer = nullptr; // will point into mOverlapBuffer
|
||||
auto remaining = len;
|
||||
|
||||
// Possibly get an initial portion that is uncached
|
||||
@ -2647,8 +2647,10 @@ const float *WaveTrackCache::GetFloats(
|
||||
mOverlapBuffer.Resize(len, format);
|
||||
// initLen is not more than len:
|
||||
auto sinitLen = initLen.as_size_t();
|
||||
if (!mPTrack->Get(mOverlapBuffer.ptr(), format, start, sinitLen,
|
||||
fillZero, mayThrow))
|
||||
if (!mPTrack->GetFloats(
|
||||
// See comment below about casting
|
||||
reinterpret_cast<float *>(mOverlapBuffer.ptr()),
|
||||
start, sinitLen, fillZero, mayThrow))
|
||||
return nullptr;
|
||||
wxASSERT( sinitLen <= remaining );
|
||||
remaining -= sinitLen;
|
||||
@ -2675,7 +2677,7 @@ const float *WaveTrackCache::GetFloats(
|
||||
else if (leni > 0) {
|
||||
// leni is nonnegative, therefore start falls within mBuffers[ii]
|
||||
// But we can't satisfy all from one buffer, so copy
|
||||
if (buffer == 0) {
|
||||
if (!buffer) {
|
||||
mOverlapBuffer.Resize(len, format);
|
||||
buffer = mOverlapBuffer.ptr();
|
||||
}
|
||||
@ -2693,11 +2695,13 @@ const float *WaveTrackCache::GetFloats(
|
||||
if (remaining > 0) {
|
||||
// Very big request!
|
||||
// Fall back to direct fetch
|
||||
if (buffer == 0) {
|
||||
if (!buffer) {
|
||||
mOverlapBuffer.Resize(len, format);
|
||||
buffer = mOverlapBuffer.ptr();
|
||||
}
|
||||
if (!mPTrack->Get(buffer, format, start, remaining, fillZero, mayThrow))
|
||||
// See comment below about casting
|
||||
if (!mPTrack->GetFloats( reinterpret_cast<float*>(buffer),
|
||||
start, remaining, fillZero, mayThrow))
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -246,6 +246,31 @@ private:
|
||||
/// same value for "start" in both calls to "Set" and "Get" it is
|
||||
/// guaranteed that the same samples are affected.
|
||||
///
|
||||
|
||||
//! Retrieve samples from a track in floating-point format, regardless of the storage format
|
||||
/*!
|
||||
@param buffer receives the samples
|
||||
@param start starting sample, relative to absolute time zero (not to the track's offset value)
|
||||
@param len how many samples to get. buffer is assumed sufficiently large
|
||||
@param fill how to assign values for sample positions between clips
|
||||
@param mayThrow if false, fill buffer with zeros when there is failure to retrieve samples; else throw
|
||||
@param[out] pNumWithinClips Report how many samples were copied from within clips, rather
|
||||
than filled according to fillFormat; but these were not necessarily one contiguous range.
|
||||
*/
|
||||
bool GetFloats(float *buffer, sampleCount start, size_t len,
|
||||
fillFormat fill = fillZero, bool mayThrow = true,
|
||||
sampleCount * pNumWithinClips = nullptr) const
|
||||
{
|
||||
//! Cast the pointer to pass it to Get() which handles multiple destination formats
|
||||
return Get(reinterpret_cast<samplePtr>(buffer),
|
||||
floatSample, start, len, fill, mayThrow, pNumWithinClips);
|
||||
}
|
||||
|
||||
//! Retrieve samples from a track in a specified format
|
||||
/*!
|
||||
@copydetails WaveTrack::GetFloats()
|
||||
@param format sample format of the destination buffer
|
||||
*/
|
||||
bool Get(samplePtr buffer, sampleFormat format,
|
||||
sampleCount start, size_t len,
|
||||
fillFormat fill = fillZero,
|
||||
@ -254,6 +279,7 @@ private:
|
||||
// filled according to fillFormat; but these were not necessarily one
|
||||
// contiguous range.
|
||||
sampleCount * pNumWithinClips = nullptr) const;
|
||||
|
||||
void Set(constSamplePtr buffer, sampleFormat format,
|
||||
sampleCount start, size_t len);
|
||||
|
||||
|
@ -138,8 +138,8 @@ bool CompareAudioCommand::Apply(const CommandContext & context)
|
||||
auto block = limitSampleBufferSize(
|
||||
mTrack0->GetBestBlockSize(position), s1 - position
|
||||
);
|
||||
mTrack0->Get((samplePtr)buff0.get(), floatSample, position, block);
|
||||
mTrack1->Get((samplePtr)buff1.get(), floatSample, position, block);
|
||||
mTrack0->GetFloats(buff0.get(), position, block);
|
||||
mTrack1->GetFloats(buff1.get(), position, block);
|
||||
|
||||
for (decltype(block) buffPos = 0; buffPos < block; ++buffPos)
|
||||
{
|
||||
|
@ -321,7 +321,7 @@ bool EffectAutoDuck::Process()
|
||||
{
|
||||
const auto len = limitSampleBufferSize( kBufSize, end - pos );
|
||||
|
||||
mControlTrack->Get((samplePtr)buf.get(), floatSample, pos, len);
|
||||
mControlTrack->GetFloats(buf.get(), pos, len);
|
||||
|
||||
for (auto i = pos; i < pos + len; i++)
|
||||
{
|
||||
@ -559,7 +559,7 @@ bool EffectAutoDuck::ApplyDuckFade(int trackNum, WaveTrack* t,
|
||||
{
|
||||
const auto len = limitSampleBufferSize( kBufSize, end - pos );
|
||||
|
||||
t->Get((samplePtr)buf.get(), floatSample, pos, len);
|
||||
t->GetFloats(buf.get(), pos, len);
|
||||
|
||||
for (auto i = pos; i < pos + len; i++)
|
||||
{
|
||||
|
@ -477,7 +477,7 @@ void EffectChangePitch::DeduceFrequencies()
|
||||
Floats freq{ windowSize / 2 };
|
||||
Floats freqa{ windowSize / 2, true };
|
||||
|
||||
track->Get((samplePtr) buffer.get(), floatSample, start, analyzeSize);
|
||||
track->GetFloats(buffer.get(), start, analyzeSize);
|
||||
for(unsigned i = 0; i < numWindows; i++) {
|
||||
ComputeSpectrum(buffer.get() + i * windowSize, windowSize,
|
||||
windowSize, rate, freq.get(), true);
|
||||
|
@ -520,7 +520,7 @@ bool EffectChangeSpeed::ProcessOne(WaveTrack * track,
|
||||
);
|
||||
|
||||
//Get the samples from the track and put them in the buffer
|
||||
track->Get((samplePtr) inBuffer.get(), floatSample, samplePos, blockSize);
|
||||
track->GetFloats(inBuffer.get(), samplePos, blockSize);
|
||||
|
||||
const auto results = resample.Process(mFactor,
|
||||
inBuffer.get(),
|
||||
|
@ -233,7 +233,7 @@ bool EffectClickRemoval::ProcessOne(int count, WaveTrack * track, sampleCount st
|
||||
{
|
||||
auto block = limitSampleBufferSize( idealBlockLen, len - s );
|
||||
|
||||
track->Get((samplePtr) buffer.get(), floatSample, start + s, block);
|
||||
track->GetFloats(buffer.get(), start + s, block);
|
||||
|
||||
for (decltype(block) i = 0; i + windowSize / 2 < block; i += windowSize / 2)
|
||||
{
|
||||
|
@ -1637,10 +1637,10 @@ bool Effect::ProcessTrack(int count,
|
||||
limitSampleBufferSize( mBufferSize, inputRemaining );
|
||||
|
||||
// Fill the input buffers
|
||||
left->Get((samplePtr) inBuffer[0].get(), floatSample, inPos, inputBufferCnt);
|
||||
left->GetFloats(inBuffer[0].get(), inPos, inputBufferCnt);
|
||||
if (right)
|
||||
{
|
||||
right->Get((samplePtr) inBuffer[1].get(), floatSample, inPos, inputBufferCnt);
|
||||
right->GetFloats(inBuffer[1].get(), inPos, inputBufferCnt);
|
||||
}
|
||||
|
||||
// Reset the input buffer positions
|
||||
|
@ -1330,7 +1330,7 @@ bool EffectEqualization::ProcessOne(int count, WaveTrack * t,
|
||||
{
|
||||
auto block = limitSampleBufferSize( idealBlockLen, len );
|
||||
|
||||
t->Get((samplePtr)buffer.get(), floatSample, s, block);
|
||||
t->GetFloats(buffer.get(), s, block);
|
||||
|
||||
for(size_t i = 0; i < block; i += L) //go through block in lumps of length L
|
||||
{
|
||||
|
@ -198,7 +198,7 @@ bool EffectFindClipping::ProcessOne(LabelTrack * lt,
|
||||
|
||||
block = limitSampleBufferSize( blockSize, len - s );
|
||||
|
||||
wt->Get((samplePtr)buffer.get(), floatSample, start + s, block);
|
||||
wt->GetFloats(buffer.get(), start + s, block);
|
||||
ptr = buffer.get();
|
||||
}
|
||||
|
||||
|
@ -515,7 +515,7 @@ void EffectLoudness::LoadBufferBlock(TrackIterRange<WaveTrack> range,
|
||||
int idx = 0;
|
||||
for(auto channel : range)
|
||||
{
|
||||
channel->Get((samplePtr) mTrackBuffer[idx].get(), floatSample, pos, len );
|
||||
channel->GetFloats(mTrackBuffer[idx].get(), pos, len );
|
||||
++idx;
|
||||
}
|
||||
mTrackBufferLen = len;
|
||||
|
@ -1330,7 +1330,7 @@ bool EffectNoiseReduction::Worker::ProcessOne
|
||||
);
|
||||
|
||||
//Get the samples from the track and put them in the buffer
|
||||
track->Get((samplePtr)&buffer[0], floatSample, samplePos, blockSize);
|
||||
track->GetFloats(&buffer[0], samplePos, blockSize);
|
||||
samplePos += blockSize;
|
||||
|
||||
mInSampleCount += blockSize;
|
||||
|
@ -435,7 +435,7 @@ bool EffectNormalize::AnalyseTrackData(const WaveTrack * track, const Translatab
|
||||
);
|
||||
|
||||
//Get the samples from the track and put them in the buffer
|
||||
track->Get((samplePtr) buffer.get(), floatSample, s, block, fillZero, true, &blockSamples);
|
||||
track->GetFloats(buffer.get(), s, block, fillZero, true, &blockSamples);
|
||||
totalSamples += blockSamples;
|
||||
|
||||
//Process the buffer.
|
||||
@ -495,7 +495,7 @@ bool EffectNormalize::ProcessOne(
|
||||
);
|
||||
|
||||
//Get the samples from the track and put them in the buffer
|
||||
track->Get((samplePtr) buffer.get(), floatSample, s, block);
|
||||
track->GetFloats(buffer.get(), s, block);
|
||||
|
||||
//Process the buffer.
|
||||
ProcessData(buffer.get(), block, offset);
|
||||
|
@ -359,7 +359,7 @@ bool EffectPaulstretch::ProcessOne(WaveTrack *track,double t0,double t1,int coun
|
||||
decltype(len) s=0;
|
||||
|
||||
while (s < len) {
|
||||
track->Get((samplePtr)bufferptr0, floatSample, start + s, nget);
|
||||
track->GetFloats(bufferptr0, start + s, nget);
|
||||
stretch.process(buffer0.get(), nget);
|
||||
|
||||
if (first_time) {
|
||||
@ -369,7 +369,7 @@ bool EffectPaulstretch::ProcessOne(WaveTrack *track,double t0,double t1,int coun
|
||||
s += nget;
|
||||
|
||||
if (first_time){//blend the start of the selection
|
||||
track->Get((samplePtr)fade_track_smps.get(), floatSample, start, fade_len);
|
||||
track->GetFloats(fade_track_smps.get(), start, fade_len);
|
||||
first_time = false;
|
||||
for (size_t i = 0; i < fade_len; i++){
|
||||
float fi = (float)i / (float)fade_len;
|
||||
@ -378,7 +378,7 @@ bool EffectPaulstretch::ProcessOne(WaveTrack *track,double t0,double t1,int coun
|
||||
}
|
||||
}
|
||||
if (s >= len){//blend the end of the selection
|
||||
track->Get((samplePtr)fade_track_smps.get(), floatSample, end - fade_len, fade_len);
|
||||
track->GetFloats(fade_track_smps.get(), end - fade_len, fade_len);
|
||||
for (size_t i = 0; i < fade_len; i++){
|
||||
float fi = (float)i / (float)fade_len;
|
||||
auto i2 = bufsize / 2 - 1 - i;
|
||||
|
@ -146,7 +146,7 @@ bool EffectRepair::ProcessOne(int count, WaveTrack * track,
|
||||
size_t repairStart, size_t repairLen)
|
||||
{
|
||||
Floats buffer{ len };
|
||||
track->Get((samplePtr) buffer.get(), floatSample, start, len);
|
||||
track->GetFloats(buffer.get(), start, len);
|
||||
InterpolateAudio(buffer.get(), len, repairStart, repairLen);
|
||||
track->Set((samplePtr)&buffer[repairStart], floatSample,
|
||||
start + repairStart, repairLen);
|
||||
|
@ -232,8 +232,8 @@ bool EffectReverse::ProcessOneClip(int count, WaveTrack *track,
|
||||
limitSampleBufferSize( track->GetBestBlockSize(first), len / 2 );
|
||||
auto second = first + (len - block);
|
||||
|
||||
track->Get((samplePtr)buffer1.get(), floatSample, first, block);
|
||||
track->Get((samplePtr)buffer2.get(), floatSample, second, block);
|
||||
track->GetFloats(buffer1.get(), first, block);
|
||||
track->GetFloats(buffer2.get(), second, block);
|
||||
for (decltype(block) i = 0; i < block; i++) {
|
||||
tmp = buffer1[i];
|
||||
buffer1[i] = buffer2[block-i-1];
|
||||
|
@ -99,10 +99,10 @@ long resampleCB(void *cb_data, SBSMSFrame *data)
|
||||
// does not seem to let us report error codes, so use this roundabout to
|
||||
// stop the effect early.
|
||||
try {
|
||||
r->leftTrack->Get(
|
||||
(samplePtr)(r->leftBuffer.get()), floatSample, r->offset, blockSize);
|
||||
r->rightTrack->Get(
|
||||
(samplePtr)(r->rightBuffer.get()), floatSample, r->offset, blockSize);
|
||||
r->leftTrack->GetFloats(
|
||||
(r->leftBuffer.get()), r->offset, blockSize);
|
||||
r->rightTrack->GetFloats(
|
||||
(r->rightBuffer.get()), r->offset, blockSize);
|
||||
}
|
||||
catch ( ... ) {
|
||||
// Save the exception object for re-throw when out of the library
|
||||
|
@ -96,7 +96,7 @@ bool EffectSimpleMono::ProcessOne(WaveTrack * track,
|
||||
limitSampleBufferSize( track->GetBestBlockSize(s), end - s );
|
||||
|
||||
//Get the samples from the track and put them in the buffer
|
||||
track->Get((samplePtr) buffer.get(), floatSample, s, block);
|
||||
track->GetFloats(buffer.get(), s, block);
|
||||
|
||||
//Process the buffer. If it fails, clean up and exit.
|
||||
if (!ProcessSimpleMono(buffer.get(), block))
|
||||
|
@ -217,7 +217,7 @@ bool EffectSoundTouch::ProcessOne(WaveTrack *track,
|
||||
limitSampleBufferSize( track->GetBestBlockSize(s), end - s ));
|
||||
|
||||
//Get the samples from the track and put them in the buffer
|
||||
track->Get((samplePtr)buffer.get(), floatSample, s, block);
|
||||
track->GetFloats(buffer.get(), s, block);
|
||||
|
||||
//Add samples to SoundTouch
|
||||
mSoundTouch->putSamples(buffer.get(), block);
|
||||
@ -298,8 +298,8 @@ bool EffectSoundTouch::ProcessStereo(
|
||||
);
|
||||
|
||||
// Get the samples from the tracks and put them in the buffers.
|
||||
leftTrack->Get((samplePtr)(leftBuffer.get()), floatSample, sourceSampleCount, blockSize);
|
||||
rightTrack->Get((samplePtr)(rightBuffer.get()), floatSample, sourceSampleCount, blockSize);
|
||||
leftTrack->GetFloats((leftBuffer.get()), sourceSampleCount, blockSize);
|
||||
rightTrack->GetFloats((rightBuffer.get()), sourceSampleCount, blockSize);
|
||||
|
||||
// Interleave into soundTouchBuffer.
|
||||
for (decltype(blockSize) index = 0; index < blockSize; index++) {
|
||||
|
@ -568,8 +568,8 @@ bool EffectTruncSilence::DoRemoval
|
||||
auto t1 = wt->TimeToLongSamples(cutStart) - blendFrames / 2;
|
||||
auto t2 = wt->TimeToLongSamples(cutEnd) - blendFrames / 2;
|
||||
|
||||
wt->Get((samplePtr)buf1.get(), floatSample, t1, blendFrames);
|
||||
wt->Get((samplePtr)buf2.get(), floatSample, t2, blendFrames);
|
||||
wt->GetFloats(buf1.get(), t1, blendFrames);
|
||||
wt->GetFloats(buf2.get(), t2, blendFrames);
|
||||
|
||||
for (decltype(blendFrames) i = 0; i < blendFrames; ++i)
|
||||
{
|
||||
@ -689,7 +689,7 @@ bool EffectTruncSilence::Analyze(RegionList& silenceList,
|
||||
auto count = limitSampleBufferSize( blockLen, end - *index );
|
||||
|
||||
// Fill buffer
|
||||
wt->Get((samplePtr)(buffer.get()), floatSample, *index, count);
|
||||
wt->GetFloats((buffer.get()), *index, count);
|
||||
|
||||
// Look for silenceList in current block
|
||||
for (decltype(count) i = 0; i < count; ++i) {
|
||||
|
@ -130,7 +130,7 @@ bool EffectTwoPassSimpleMono::ProcessOne(WaveTrack * track, WaveTrack * outTrack
|
||||
std::min( maxblock, track->GetBestBlockSize(start) ), end - start );
|
||||
|
||||
//Get the samples from the track and put them in the buffer
|
||||
track->Get((samplePtr) buffer1.get(), floatSample, start, samples1);
|
||||
track->GetFloats(buffer1.get(), start, samples1);
|
||||
|
||||
// Process the first buffer with a NULL previous buffer
|
||||
if (mPass == 0)
|
||||
@ -152,7 +152,7 @@ bool EffectTwoPassSimpleMono::ProcessOne(WaveTrack * track, WaveTrack * outTrack
|
||||
);
|
||||
|
||||
//Get the samples from the track and put them in the buffer
|
||||
track->Get((samplePtr)buffer2.get(), floatSample, s, samples2);
|
||||
track->GetFloats(buffer2.get(), s, samples2);
|
||||
|
||||
//Process the buffer. If it fails, clean up and exit.
|
||||
if (mPass == 0)
|
||||
|
@ -2449,8 +2449,8 @@ int NyquistEffect::GetCallback(float *buffer, int ch,
|
||||
|
||||
mCurBuffer[ch].Allocate(mCurBufferLen[ch], floatSample);
|
||||
try {
|
||||
mCurTrack[ch]->Get(
|
||||
mCurBuffer[ch].ptr(), floatSample,
|
||||
mCurTrack[ch]->GetFloats(
|
||||
reinterpret_cast<float*>(mCurBuffer[ch].ptr()),
|
||||
mCurBufferStart[ch], mCurBufferLen[ch]);
|
||||
}
|
||||
catch ( ... ) {
|
||||
|
@ -453,12 +453,12 @@ bool VampEffect::Process()
|
||||
|
||||
if (left)
|
||||
{
|
||||
left->Get((samplePtr)data[0].get(), floatSample, pos, request);
|
||||
left->GetFloats(data[0].get(), pos, request);
|
||||
}
|
||||
|
||||
if (right)
|
||||
{
|
||||
right->Get((samplePtr)data[1].get(), floatSample, pos, request);
|
||||
right->GetFloats(data[1].get(), pos, request);
|
||||
}
|
||||
|
||||
if (request < block)
|
||||
|
@ -70,7 +70,7 @@ double NearestZeroCrossing
|
||||
auto s = one->TimeToLongSamples(t0);
|
||||
// fillTwo to ensure that missing values are treated as 2, and hence do
|
||||
// not get used as zero crossings.
|
||||
one->Get((samplePtr)oneDist.get(), floatSample,
|
||||
one->GetFloats(oneDist.get(),
|
||||
s - (int)oneWindowSize/2, oneWindowSize, fillTwo);
|
||||
|
||||
|
||||
|
@ -593,7 +593,7 @@ void OnPunchAndRoll(const CommandContext &context)
|
||||
if (getLen > 0) {
|
||||
float *const samples = data.data();
|
||||
const sampleCount pos = wt->TimeToLongSamples(t1);
|
||||
wt->Get((samplePtr)samples, floatSample, pos, getLen);
|
||||
wt->GetFloats(samples, pos, getLen);
|
||||
}
|
||||
crossfadeData.push_back(std::move(data));
|
||||
}
|
||||
|
@ -127,7 +127,7 @@ UIHandlePtr SampleHandle::HitTest
|
||||
float oneSample;
|
||||
const double rate = wavetrack->GetRate();
|
||||
const auto s0 = (sampleCount)(tt * rate + 0.5);
|
||||
if (! wavetrack->Get((samplePtr)&oneSample, floatSample, s0, 1, fillZero,
|
||||
if (! wavetrack->GetFloats(&oneSample, s0, 1, fillZero,
|
||||
// Do not propagate exception but return a failure value
|
||||
false) )
|
||||
return {};
|
||||
@ -238,7 +238,7 @@ UIHandle::Result SampleHandle::Click
|
||||
Floats newSampleRegion{ 1 + 2 * (size_t)SMOOTHING_BRUSH_RADIUS };
|
||||
|
||||
//Get a sample from the track to do some tricks on.
|
||||
mClickedTrack->Get((samplePtr)sampleRegion.get(), floatSample,
|
||||
mClickedTrack->GetFloats(sampleRegion.get(),
|
||||
mClickedStartSample - SMOOTHING_KERNEL_RADIUS - SMOOTHING_BRUSH_RADIUS,
|
||||
sampleRegionSize);
|
||||
|
||||
|
@ -1364,9 +1364,9 @@ void SelectHandle::StartSnappingFreqSelection
|
||||
end - start));
|
||||
const auto effectiveLength = std::max(minLength, length);
|
||||
frequencySnappingData.resize(effectiveLength, 0.0f);
|
||||
pTrack->Get(
|
||||
reinterpret_cast<samplePtr>(&frequencySnappingData[0]),
|
||||
floatSample, start, length, fillZero,
|
||||
pTrack->GetFloats(
|
||||
&frequencySnappingData[0],
|
||||
start, length, fillZero,
|
||||
// Don't try to cope with exceptions, just read zeroes instead.
|
||||
false);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user