mirror of
https://github.com/cookiengineer/audacity
synced 2025-07-16 08:37:42 +02:00
Preliminary changes and fixes, before reducing uses of sampleCount...
Fix bug in update of progress in CompareAudioCommand EffectClientInterface::SetSampleRate takes double... Rewrite WaveTrack::GetEnvelopeValues, taking one less argument... Write and read the wide aliasStart fields carefully... Rewrite Sequence::FindBlock using size_t variables for indices Remove overloads for sampleCount from ConfigInterface... A mutex guarding access to this variable made volatile unnecessary time warper bug Fix bug in disabled experimental code...
This commit is contained in:
commit
c998f194c7
@ -42,8 +42,6 @@
|
||||
#ifndef __AUDACITY_CONFIGINTERFACE_H__
|
||||
#define __AUDACITY_CONFIGINTERFACE_H__
|
||||
|
||||
#include "audacity/Types.h"
|
||||
|
||||
class AUDACITY_DLL_API ConfigClientInterface /* not final */
|
||||
{
|
||||
public:
|
||||
@ -57,14 +55,12 @@ public:
|
||||
virtual bool GetSharedConfig(const wxString & group, const wxString & key, bool & value, bool defval) = 0;
|
||||
virtual bool GetSharedConfig(const wxString & group, const wxString & key, float & value, float defval) = 0;
|
||||
virtual bool GetSharedConfig(const wxString & group, const wxString & key, double & value, double defval) = 0;
|
||||
virtual bool GetSharedConfig(const wxString & group, const wxString & key, sampleCount & value, sampleCount defval) = 0;
|
||||
|
||||
virtual bool SetSharedConfig(const wxString & group, const wxString & key, const wxString & value) = 0;
|
||||
virtual bool SetSharedConfig(const wxString & group, const wxString & key, const int & value) = 0;
|
||||
virtual bool SetSharedConfig(const wxString & group, const wxString & key, const bool & value) = 0;
|
||||
virtual bool SetSharedConfig(const wxString & group, const wxString & key, const float & value) = 0;
|
||||
virtual bool SetSharedConfig(const wxString & group, const wxString & key, const double & value) = 0;
|
||||
virtual bool SetSharedConfig(const wxString & group, const wxString & key, const sampleCount & value) = 0;
|
||||
|
||||
virtual bool RemoveSharedConfigSubgroup(const wxString & group) = 0;
|
||||
virtual bool RemoveSharedConfig(const wxString & group, const wxString & key) = 0;
|
||||
@ -77,14 +73,12 @@ public:
|
||||
virtual bool GetPrivateConfig(const wxString & group, const wxString & key, bool & value, bool defval) = 0;
|
||||
virtual bool GetPrivateConfig(const wxString & group, const wxString & key, float & value, float defval) = 0;
|
||||
virtual bool GetPrivateConfig(const wxString & group, const wxString & key, double & value, double defval) = 0;
|
||||
virtual bool GetPrivateConfig(const wxString & group, const wxString & key, sampleCount & value, sampleCount defval) = 0;
|
||||
|
||||
virtual bool SetPrivateConfig(const wxString & group, const wxString & key, const wxString & value) = 0;
|
||||
virtual bool SetPrivateConfig(const wxString & group, const wxString & key, const int & value) = 0;
|
||||
virtual bool SetPrivateConfig(const wxString & group, const wxString & key, const bool & value) = 0;
|
||||
virtual bool SetPrivateConfig(const wxString & group, const wxString & key, const float & value) = 0;
|
||||
virtual bool SetPrivateConfig(const wxString & group, const wxString & key, const double & value) = 0;
|
||||
virtual bool SetPrivateConfig(const wxString & group, const wxString & key, const sampleCount & value) = 0;
|
||||
|
||||
virtual bool RemovePrivateConfigSubgroup(const wxString & group) = 0;
|
||||
virtual bool RemovePrivateConfig(const wxString & group, const wxString & key) = 0;
|
||||
|
@ -123,7 +123,7 @@ public:
|
||||
virtual int GetMidiInCount() = 0;
|
||||
virtual int GetMidiOutCount() = 0;
|
||||
|
||||
virtual void SetSampleRate(sampleCount rate) = 0;
|
||||
virtual void SetSampleRate(double rate) = 0;
|
||||
virtual sampleCount SetBlockSize(sampleCount maxBlockSize) = 0;
|
||||
|
||||
virtual sampleCount GetLatency() = 0;
|
||||
|
@ -42,7 +42,6 @@
|
||||
#ifndef __AUDACITY_PLUGININTERFACE_H__
|
||||
#define __AUDACITY_PLUGININTERFACE_H__
|
||||
|
||||
#include "audacity/Types.h"
|
||||
#include "audacity/ConfigInterface.h"
|
||||
#include "audacity/EffectInterface.h"
|
||||
#include "audacity/IdentInterface.h"
|
||||
@ -73,14 +72,12 @@ public:
|
||||
virtual bool GetSharedConfig(const PluginID & ID, const wxString & group, const wxString & key, bool & value, bool defval = false) = 0;
|
||||
virtual bool GetSharedConfig(const PluginID & ID, const wxString & group, const wxString & key, float & value, float defval = 0.0) = 0;
|
||||
virtual bool GetSharedConfig(const PluginID & ID, const wxString & group, const wxString & key, double & value, double defval = 0.0) = 0;
|
||||
virtual bool GetSharedConfig(const PluginID & ID, const wxString & group, const wxString & key, sampleCount & value, sampleCount defval = 0) = 0;
|
||||
|
||||
virtual bool SetSharedConfig(const PluginID & ID, const wxString & group, const wxString & key, const wxString & value) = 0;
|
||||
virtual bool SetSharedConfig(const PluginID & ID, const wxString & group, const wxString & key, const int & value) = 0;
|
||||
virtual bool SetSharedConfig(const PluginID & ID, const wxString & group, const wxString & key, const bool & value) = 0;
|
||||
virtual bool SetSharedConfig(const PluginID & ID, const wxString & group, const wxString & key, const float & value) = 0;
|
||||
virtual bool SetSharedConfig(const PluginID & ID, const wxString & group, const wxString & key, const double & value) = 0;
|
||||
virtual bool SetSharedConfig(const PluginID & ID, const wxString & group, const wxString & key, const sampleCount & value) = 0;
|
||||
|
||||
virtual bool RemoveSharedConfigSubgroup(const PluginID & ID, const wxString & group) = 0;
|
||||
virtual bool RemoveSharedConfig(const PluginID & ID, const wxString & group, const wxString & key) = 0;
|
||||
@ -92,14 +89,12 @@ public:
|
||||
virtual bool GetPrivateConfig(const PluginID & ID, const wxString & group, const wxString & key, bool & value, bool defval = false) = 0;
|
||||
virtual bool GetPrivateConfig(const PluginID & ID, const wxString & group, const wxString & key, float & value, float defval = 0.0) = 0;
|
||||
virtual bool GetPrivateConfig(const PluginID & ID, const wxString & group, const wxString & key, double & value, double defval = 0.0) = 0;
|
||||
virtual bool GetPrivateConfig(const PluginID & ID, const wxString & group, const wxString & key, sampleCount & value, sampleCount defval = 0) = 0;
|
||||
|
||||
virtual bool SetPrivateConfig(const PluginID & ID, const wxString & group, const wxString & key, const wxString & value) = 0;
|
||||
virtual bool SetPrivateConfig(const PluginID & ID, const wxString & group, const wxString & key, const int & value) = 0;
|
||||
virtual bool SetPrivateConfig(const PluginID & ID, const wxString & group, const wxString & key, const bool & value) = 0;
|
||||
virtual bool SetPrivateConfig(const PluginID & ID, const wxString & group, const wxString & key, const float & value) = 0;
|
||||
virtual bool SetPrivateConfig(const PluginID & ID, const wxString & group, const wxString & key, const double & value) = 0;
|
||||
virtual bool SetPrivateConfig(const PluginID & ID, const wxString & group, const wxString & key, const sampleCount & value) = 0;
|
||||
|
||||
virtual bool RemovePrivateConfigSubgroup(const PluginID & ID, const wxString & group) = 0;
|
||||
virtual bool RemovePrivateConfig(const PluginID & ID, const wxString & group, const wxString & key) = 0;
|
||||
|
@ -206,7 +206,10 @@ static bool ConvertLegacyTrack(wxTextFile *f, XMLFileWriter &xmlFile)
|
||||
xmlFile.WriteAttr(wxT("name"), localName);
|
||||
xmlFile.WriteAttr(wxT("alias"), 1);
|
||||
xmlFile.WriteAttr(wxT("aliaspath"), aliasPath);
|
||||
|
||||
// This was written but not read again?
|
||||
xmlFile.WriteAttr(wxT("aliasstart"), aliasStart);
|
||||
|
||||
xmlFile.WriteAttr(wxT("aliaslen"), aliasLen);
|
||||
xmlFile.WriteAttr(wxT("aliaschannel"), aliasChannel);
|
||||
xmlFile.WriteAttr(wxT("summarylen"), localLen);
|
||||
|
12
src/Mix.cpp
12
src/Mix.cpp
@ -460,8 +460,7 @@ sampleCount Mixer::MixVariableRates(int *channelFlags, WaveTrackCache &cache,
|
||||
|
||||
track->GetEnvelopeValues(mEnvValues,
|
||||
getLen,
|
||||
(*pos - (getLen- 1)) / trackRate,
|
||||
tstep);
|
||||
(*pos - (getLen- 1)) / trackRate);
|
||||
|
||||
*pos -= getLen;
|
||||
}
|
||||
@ -471,8 +470,7 @@ sampleCount Mixer::MixVariableRates(int *channelFlags, WaveTrackCache &cache,
|
||||
|
||||
track->GetEnvelopeValues(mEnvValues,
|
||||
getLen,
|
||||
(*pos) / trackRate,
|
||||
tstep);
|
||||
(*pos) / trackRate);
|
||||
|
||||
*pos += getLen;
|
||||
}
|
||||
@ -584,10 +582,12 @@ sampleCount Mixer::MixSameRate(int *channelFlags, WaveTrackCache &cache,
|
||||
if (slen > mMaxOut)
|
||||
slen = mMaxOut;
|
||||
|
||||
wxASSERT(slen >= 0);
|
||||
|
||||
if (backwards) {
|
||||
auto results = cache.Get(floatSample, *pos - (slen - 1), slen);
|
||||
memcpy(mFloatBuffer, results, sizeof(float) * slen);
|
||||
track->GetEnvelopeValues(mEnvValues, slen, t - (slen - 1) / mRate, 1.0 / mRate);
|
||||
track->GetEnvelopeValues(mEnvValues, slen, t - (slen - 1) / mRate);
|
||||
for(int i=0; i<slen; i++)
|
||||
mFloatBuffer[i] *= mEnvValues[i]; // Track gain control will go here?
|
||||
ReverseSamples((samplePtr)mFloatBuffer, floatSample, 0, slen);
|
||||
@ -597,7 +597,7 @@ sampleCount Mixer::MixSameRate(int *channelFlags, WaveTrackCache &cache,
|
||||
else {
|
||||
auto results = cache.Get(floatSample, *pos, slen);
|
||||
memcpy(mFloatBuffer, results, sizeof(float) * slen);
|
||||
track->GetEnvelopeValues(mEnvValues, slen, t, 1.0 / mRate);
|
||||
track->GetEnvelopeValues(mEnvValues, slen, t);
|
||||
for(int i=0; i<slen; i++)
|
||||
mFloatBuffer[i] *= mEnvValues[i]; // Track gain control will go here?
|
||||
|
||||
|
@ -1510,11 +1510,6 @@ bool PluginManager::GetSharedConfig(const PluginID & ID, const wxString & group,
|
||||
return GetConfig(SharedKey(ID, group, key), value, defval);
|
||||
}
|
||||
|
||||
bool PluginManager::GetSharedConfig(const PluginID & ID, const wxString & group, const wxString & key, sampleCount & value, sampleCount defval)
|
||||
{
|
||||
return GetConfig(SharedKey(ID, group, key), value, defval);
|
||||
}
|
||||
|
||||
bool PluginManager::SetSharedConfig(const PluginID & ID, const wxString & group, const wxString & key, const wxString & value)
|
||||
{
|
||||
return SetConfig(SharedKey(ID, group, key), value);
|
||||
@ -1540,11 +1535,6 @@ bool PluginManager::SetSharedConfig(const PluginID & ID, const wxString & group,
|
||||
return SetConfig(SharedKey(ID, group, key), value);
|
||||
}
|
||||
|
||||
bool PluginManager::SetSharedConfig(const PluginID & ID, const wxString & group, const wxString & key, const sampleCount & value)
|
||||
{
|
||||
return SetConfig(SharedKey(ID, group, key), value);
|
||||
}
|
||||
|
||||
bool PluginManager::RemoveSharedConfigSubgroup(const PluginID & ID, const wxString & group)
|
||||
{
|
||||
bool result = GetSettings()->DeleteGroup(SharedGroup(ID, group));
|
||||
@ -1602,11 +1592,6 @@ bool PluginManager::GetPrivateConfig(const PluginID & ID, const wxString & group
|
||||
return GetConfig(PrivateKey(ID, group, key), value, defval);
|
||||
}
|
||||
|
||||
bool PluginManager::GetPrivateConfig(const PluginID & ID, const wxString & group, const wxString & key, sampleCount & value, sampleCount defval)
|
||||
{
|
||||
return GetConfig(PrivateKey(ID, group, key), value, defval);
|
||||
}
|
||||
|
||||
bool PluginManager::SetPrivateConfig(const PluginID & ID, const wxString & group, const wxString & key, const wxString & value)
|
||||
{
|
||||
return SetConfig(PrivateKey(ID, group, key), value);
|
||||
@ -1632,11 +1617,6 @@ bool PluginManager::SetPrivateConfig(const PluginID & ID, const wxString & group
|
||||
return SetConfig(PrivateKey(ID, group, key), value);
|
||||
}
|
||||
|
||||
bool PluginManager::SetPrivateConfig(const PluginID & ID, const wxString & group, const wxString & key, const sampleCount & value)
|
||||
{
|
||||
return SetConfig(PrivateKey(ID, group, key), value);
|
||||
}
|
||||
|
||||
bool PluginManager::RemovePrivateConfigSubgroup(const PluginID & ID, const wxString & group)
|
||||
{
|
||||
bool result = GetSettings()->DeleteGroup(PrivateGroup(ID, group));
|
||||
@ -2643,24 +2623,6 @@ bool PluginManager::GetConfig(const wxString & key, double & value, double defva
|
||||
return result;
|
||||
}
|
||||
|
||||
bool PluginManager::GetConfig(const wxString & key, sampleCount & value, sampleCount defval)
|
||||
{
|
||||
bool result = false;
|
||||
|
||||
if (!key.IsEmpty())
|
||||
{
|
||||
wxString wxval = wxEmptyString;
|
||||
wxString wxdef;
|
||||
wchar_t *endptr;
|
||||
wxdef.Printf(wxT("%Ld"), defval);
|
||||
|
||||
result = GetSettings()->Read(key, &wxval, wxdef);
|
||||
value = wxStrtoll(wxval.c_str(), &endptr, 10);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
bool PluginManager::SetConfig(const wxString & key, const wxString & value)
|
||||
{
|
||||
bool result = false;
|
||||
@ -2742,22 +2704,6 @@ bool PluginManager::SetConfig(const wxString & key, const double & value)
|
||||
return result;
|
||||
}
|
||||
|
||||
bool PluginManager::SetConfig(const wxString & key, const sampleCount & value)
|
||||
{
|
||||
bool result = false;
|
||||
|
||||
if (!key.IsEmpty())
|
||||
{
|
||||
result = GetSettings()->Write(key, wxString::Format(wxT("%d"), (int) value));
|
||||
if (result)
|
||||
{
|
||||
result = GetSettings()->Flush();
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
wxString PluginManager::SettingsPath(const PluginID & ID, bool shared)
|
||||
{
|
||||
if (mPlugins.find(ID) == mPlugins.end())
|
||||
|
@ -195,14 +195,12 @@ public:
|
||||
bool GetSharedConfig(const PluginID & ID, const wxString & group, const wxString & key, bool & value, bool defval = false) override;
|
||||
bool GetSharedConfig(const PluginID & ID, const wxString & group, const wxString & key, float & value, float defval = 0.0) override;
|
||||
bool GetSharedConfig(const PluginID & ID, const wxString & group, const wxString & key, double & value, double defval = 0.0) override;
|
||||
bool GetSharedConfig(const PluginID & ID, const wxString & group, const wxString & key, sampleCount & value, sampleCount defval = 0) override;
|
||||
|
||||
bool SetSharedConfig(const PluginID & ID, const wxString & group, const wxString & key, const wxString & value) override;
|
||||
bool SetSharedConfig(const PluginID & ID, const wxString & group, const wxString & key, const int & value) override;
|
||||
bool SetSharedConfig(const PluginID & ID, const wxString & group, const wxString & key, const bool & value) override;
|
||||
bool SetSharedConfig(const PluginID & ID, const wxString & group, const wxString & key, const float & value) override;
|
||||
bool SetSharedConfig(const PluginID & ID, const wxString & group, const wxString & key, const double & value) override;
|
||||
bool SetSharedConfig(const PluginID & ID, const wxString & group, const wxString & key, const sampleCount & value) override;
|
||||
|
||||
bool RemoveSharedConfigSubgroup(const PluginID & ID, const wxString & group) override;
|
||||
bool RemoveSharedConfig(const PluginID & ID, const wxString & group, const wxString & key) override;
|
||||
@ -215,14 +213,12 @@ public:
|
||||
bool GetPrivateConfig(const PluginID & ID, const wxString & group, const wxString & key, bool & value, bool defval = false) override;
|
||||
bool GetPrivateConfig(const PluginID & ID, const wxString & group, const wxString & key, float & value, float defval = 0.0) override;
|
||||
bool GetPrivateConfig(const PluginID & ID, const wxString & group, const wxString & key, double & value, double defval = 0.0) override;
|
||||
bool GetPrivateConfig(const PluginID & ID, const wxString & group, const wxString & key, sampleCount & value, sampleCount defval = 0) override;
|
||||
|
||||
bool SetPrivateConfig(const PluginID & ID, const wxString & group, const wxString & key, const wxString & value) override;
|
||||
bool SetPrivateConfig(const PluginID & ID, const wxString & group, const wxString & key, const int & value) override;
|
||||
bool SetPrivateConfig(const PluginID & ID, const wxString & group, const wxString & key, const bool & value) override;
|
||||
bool SetPrivateConfig(const PluginID & ID, const wxString & group, const wxString & key, const float & value) override;
|
||||
bool SetPrivateConfig(const PluginID & ID, const wxString & group, const wxString & key, const double & value) override;
|
||||
bool SetPrivateConfig(const PluginID & ID, const wxString & group, const wxString & key, const sampleCount & value) override;
|
||||
|
||||
bool RemovePrivateConfigSubgroup(const PluginID & ID, const wxString & group) override;
|
||||
bool RemovePrivateConfig(const PluginID & ID, const wxString & group, const wxString & key) override;
|
||||
@ -289,14 +285,12 @@ private:
|
||||
bool GetConfig(const wxString & key, bool & value, bool defval = false);
|
||||
bool GetConfig(const wxString & key, float & value, float defval = 0.0);
|
||||
bool GetConfig(const wxString & key, double & value, double defval = 0.0);
|
||||
bool GetConfig(const wxString & key, sampleCount & value, sampleCount defval = 0);
|
||||
|
||||
bool SetConfig(const wxString & key, const wxString & value);
|
||||
bool SetConfig(const wxString & key, const int & value);
|
||||
bool SetConfig(const wxString & key, const bool & value);
|
||||
bool SetConfig(const wxString & key, const float & value);
|
||||
bool SetConfig(const wxString & key, const double & value);
|
||||
bool SetConfig(const wxString & key, const sampleCount & value);
|
||||
|
||||
wxString SettingsPath(const PluginID & ID, bool shared);
|
||||
wxString SharedGroup(const PluginID & ID, const wxString & group);
|
||||
|
@ -1051,16 +1051,15 @@ int Sequence::FindBlock(sampleCount pos) const
|
||||
|
||||
int numBlocks = mBlock.size();
|
||||
|
||||
sampleCount lo = 0, loSamples = 0;
|
||||
sampleCount hi = numBlocks, hiSamples = mNumSamples;
|
||||
sampleCount guess;
|
||||
size_t lo = 0, hi = numBlocks, guess;
|
||||
sampleCount loSamples = 0, hiSamples = mNumSamples;
|
||||
|
||||
while (true) {
|
||||
//this is not a binary search, but a
|
||||
//dictionary search where we guess something smarter than the binary division
|
||||
//of the unsearched area, since samples are usually proportional to block file number.
|
||||
const double frac = double(pos - loSamples) / (hiSamples - loSamples);
|
||||
guess = std::min(hi - 1, lo + sampleCount(frac * (hi - lo)));
|
||||
guess = std::min(hi - 1, lo + size_t(frac * (hi - lo)));
|
||||
const SeqBlock &block = mBlock[guess];
|
||||
|
||||
wxASSERT(block.f->GetLength() > 0);
|
||||
|
@ -2096,13 +2096,9 @@ bool WaveTrack::Set(samplePtr buffer, sampleFormat format,
|
||||
return result;
|
||||
}
|
||||
|
||||
void WaveTrack::GetEnvelopeValues(double *buffer, int bufferLen,
|
||||
double t0, double tstep) const
|
||||
void WaveTrack::GetEnvelopeValues(double *buffer, size_t bufferLen,
|
||||
double t0) const
|
||||
{
|
||||
// Possibly nothing to do.
|
||||
if( bufferLen <= 0 )
|
||||
return;
|
||||
|
||||
// The output buffer corresponds to an unbroken span of time which the callers expect
|
||||
// to be fully valid. As clips are processed below, the output buffer is updated with
|
||||
// envelope values from any portion of a clip, start, end, middle, or none at all.
|
||||
@ -2119,29 +2115,31 @@ void WaveTrack::GetEnvelopeValues(double *buffer, int bufferLen,
|
||||
}
|
||||
|
||||
double startTime = t0;
|
||||
double endTime = t0+tstep*bufferLen;
|
||||
auto tstep = 1.0 / mRate;
|
||||
double endTime = t0 + tstep * bufferLen;
|
||||
for (const auto &clip: mClips)
|
||||
{
|
||||
// IF clip intersects startTime..endTime THEN...
|
||||
double dClipStartTime = clip->GetStartTime();
|
||||
double dClipEndTime = clip->GetEndTime();
|
||||
auto dClipStartTime = clip->GetStartTime();
|
||||
auto dClipEndTime = clip->GetEndTime();
|
||||
if ((dClipStartTime < endTime) && (dClipEndTime > startTime))
|
||||
{
|
||||
double* rbuf = buffer;
|
||||
int rlen = bufferLen;
|
||||
double rt0 = t0;
|
||||
auto rbuf = buffer;
|
||||
auto rlen = bufferLen;
|
||||
auto rt0 = t0;
|
||||
|
||||
if (rt0 < dClipStartTime)
|
||||
{
|
||||
sampleCount nDiff = (sampleCount)floor((dClipStartTime - rt0) * mRate + 0.5);
|
||||
rbuf += nDiff;
|
||||
wxASSERT(nDiff <= rlen);
|
||||
rlen -= nDiff;
|
||||
rt0 = dClipStartTime;
|
||||
}
|
||||
|
||||
if (rt0 + rlen*tstep > dClipEndTime)
|
||||
{
|
||||
int nClipLen = clip->GetEndSample() - clip->GetStartSample();
|
||||
auto nClipLen = clip->GetEndSample() - clip->GetStartSample();
|
||||
|
||||
if (nClipLen <= 0) // Testing for bug 641, this problem is consistently '== 0', but doesn't hurt to check <.
|
||||
return;
|
||||
@ -2151,8 +2149,8 @@ void WaveTrack::GetEnvelopeValues(double *buffer, int bufferLen,
|
||||
// This conditional prevents the previous write past the buffer end, in clip->GetEnvelope() call.
|
||||
// Never increase rlen here.
|
||||
// PRL bug 827: rewrote it again
|
||||
rlen = std::min(rlen, nClipLen);
|
||||
rlen = std::min(rlen, int(floor(0.5 + (dClipEndTime - rt0) / tstep)));
|
||||
rlen = static_cast<size_t>( std::min(sampleCount( rlen ), nClipLen) );
|
||||
rlen = std::min(rlen, size_t(floor(0.5 + (dClipEndTime - rt0) / tstep)));
|
||||
}
|
||||
clip->GetEnvelope()->GetValues(rbuf, rlen, rt0, tstep);
|
||||
}
|
||||
|
@ -239,8 +239,8 @@ class AUDACITY_DLL_API WaveTrack final : public Track {
|
||||
sampleCount start, sampleCount len, fillFormat fill=fillZero) const;
|
||||
bool Set(samplePtr buffer, sampleFormat format,
|
||||
sampleCount start, sampleCount len);
|
||||
void GetEnvelopeValues(double *buffer, int bufferLen,
|
||||
double t0, double tstep) const;
|
||||
void GetEnvelopeValues(double *buffer, size_t bufferLen,
|
||||
double t0) const;
|
||||
bool GetMinMax(float *min, float *max,
|
||||
double t0, double t1) const;
|
||||
bool GetRMS(float *rms, double t0, double t1);
|
||||
|
@ -68,7 +68,8 @@ void LegacyAliasBlockFile::SaveXML(XMLWriter &xmlFile)
|
||||
xmlFile.WriteAttr(wxT("alias"), 1);
|
||||
xmlFile.WriteAttr(wxT("name"), mFileName.GetFullName());
|
||||
xmlFile.WriteAttr(wxT("aliaspath"), mAliasedFileName.GetFullPath());
|
||||
xmlFile.WriteAttr(wxT("aliasstart"), mAliasStart);
|
||||
xmlFile.WriteAttr(wxT("aliasstart"),
|
||||
static_cast<long long>( mAliasStart ));
|
||||
xmlFile.WriteAttr(wxT("aliaslen"), mLen);
|
||||
xmlFile.WriteAttr(wxT("aliaschannel"), mAliasChannel);
|
||||
xmlFile.WriteAttr(wxT("summarylen"), mSummaryInfo.totalSummaryBytes);
|
||||
@ -89,6 +90,7 @@ BlockFilePtr LegacyAliasBlockFile::BuildFromXML(const wxString &projDir, const w
|
||||
int summaryLen=0;
|
||||
bool noRMS = false;
|
||||
long nValue;
|
||||
long long nnValue;
|
||||
|
||||
while(*attrs)
|
||||
{
|
||||
@ -116,11 +118,15 @@ BlockFilePtr LegacyAliasBlockFile::BuildFromXML(const wxString &projDir, const w
|
||||
// but we want to keep the reference to the missing file because it's a good path string.
|
||||
aliasFileName.Assign(strValue);
|
||||
}
|
||||
else if ( !wxStricmp(attr, wxT("aliasstart")) )
|
||||
{
|
||||
if (XMLValueChecker::IsGoodInt64(strValue) &&
|
||||
strValue.ToLongLong(&nnValue) && (nnValue >= 0))
|
||||
aliasStart = nnValue;
|
||||
}
|
||||
else if (XMLValueChecker::IsGoodInt(strValue) && strValue.ToLong(&nValue))
|
||||
{ // integer parameters
|
||||
if (!wxStricmp(attr, wxT("aliasstart")) && (nValue >= 0))
|
||||
aliasStart = nValue;
|
||||
else if (!wxStricmp(attr, wxT("aliaslen")) && (nValue >= 0))
|
||||
if (!wxStricmp(attr, wxT("aliaslen")) && (nValue >= 0))
|
||||
aliasLen = nValue;
|
||||
else if (!wxStricmp(attr, wxT("aliaschannel")) && XMLValueChecker::IsValidChannel(aliasChannel))
|
||||
aliasChannel = nValue;
|
||||
|
@ -207,7 +207,8 @@ void ODDecodeBlockFile::SaveXML(XMLWriter &xmlFile)
|
||||
mFileNameMutex.Unlock();
|
||||
LockRead();
|
||||
xmlFile.WriteAttr(wxT("audiofile"), mAudioFileName.GetFullPath());
|
||||
xmlFile.WriteAttr(wxT("aliasstart"), mAliasStart);
|
||||
xmlFile.WriteAttr(wxT("aliasstart"),
|
||||
static_cast<long long>( mAliasStart ));
|
||||
xmlFile.WriteAttr(wxT("aliaslen"), mLen);
|
||||
xmlFile.WriteAttr(wxT("aliaschannel"), mAliasChannel);
|
||||
xmlFile.WriteAttr(wxT("decodetype"), (size_t)mType);
|
||||
@ -229,6 +230,7 @@ BlockFilePtr ODDecodeBlockFile::BuildFromXML(DirManager &dm, const wxChar **attr
|
||||
sampleCount aliasStart=0, aliasLen=0;
|
||||
int aliasChannel=0;
|
||||
long nValue;
|
||||
long long nnValue;
|
||||
unsigned int decodeType=0;
|
||||
|
||||
while(*attrs)
|
||||
@ -261,11 +263,15 @@ BlockFilePtr ODDecodeBlockFile::BuildFromXML(DirManager &dm, const wxChar **attr
|
||||
// but we want to keep the reference to the file because it's a good path string.
|
||||
audioFileName.Assign(strValue);
|
||||
}
|
||||
else if ( !wxStricmp(attr, wxT("aliasstart")) )
|
||||
{
|
||||
if (XMLValueChecker::IsGoodInt64(strValue) &&
|
||||
strValue.ToLongLong(&nnValue) && (nnValue >= 0))
|
||||
aliasStart = nnValue;
|
||||
}
|
||||
else if (XMLValueChecker::IsGoodInt(strValue) && strValue.ToLong(&nValue))
|
||||
{ // integer parameters
|
||||
if (!wxStricmp(attr, wxT("aliasstart")) && (nValue >= 0))
|
||||
aliasStart = nValue;
|
||||
else if (!wxStricmp(attr, wxT("aliaslen")) && (nValue >= 0))
|
||||
if (!wxStricmp(attr, wxT("aliaslen")) && (nValue >= 0))
|
||||
aliasLen = nValue;
|
||||
else if (!wxStricmp(attr, wxT("aliaschannel")) && XMLValueChecker::IsValidChannel(aliasChannel))
|
||||
aliasChannel = nValue;
|
||||
|
@ -247,7 +247,8 @@ void ODPCMAliasBlockFile::SaveXML(XMLWriter &xmlFile)
|
||||
LockRead();
|
||||
|
||||
xmlFile.WriteAttr(wxT("aliasfile"), mAliasedFileName.GetFullPath());
|
||||
xmlFile.WriteAttr(wxT("aliasstart"), mAliasStart);
|
||||
xmlFile.WriteAttr(wxT("aliasstart"),
|
||||
static_cast<long long>( mAliasStart));
|
||||
xmlFile.WriteAttr(wxT("aliaslen"), mLen);
|
||||
xmlFile.WriteAttr(wxT("aliaschannel"), mAliasChannel);
|
||||
|
||||
@ -269,6 +270,7 @@ BlockFilePtr ODPCMAliasBlockFile::BuildFromXML(DirManager &dm, const wxChar **at
|
||||
sampleCount aliasStart=0, aliasLen=0;
|
||||
int aliasChannel=0;
|
||||
long nValue;
|
||||
long long nnValue;
|
||||
|
||||
while(*attrs)
|
||||
{
|
||||
@ -300,11 +302,15 @@ BlockFilePtr ODPCMAliasBlockFile::BuildFromXML(DirManager &dm, const wxChar **at
|
||||
// but we want to keep the reference to the missing file because it's a good path string.
|
||||
aliasFileName.Assign(strValue);
|
||||
}
|
||||
else if ( !wxStricmp(attr, wxT("aliasstart")) )
|
||||
{
|
||||
if (XMLValueChecker::IsGoodInt64(strValue) &&
|
||||
strValue.ToLongLong(&nnValue) && (nnValue >= 0))
|
||||
aliasStart = nnValue;
|
||||
}
|
||||
else if (XMLValueChecker::IsGoodInt(strValue) && strValue.ToLong(&nValue))
|
||||
{ // integer parameters
|
||||
if (!wxStricmp(attr, wxT("aliasstart")) && (nValue >= 0))
|
||||
aliasStart = nValue;
|
||||
else if (!wxStricmp(attr, wxT("aliaslen")) && (nValue >= 0))
|
||||
if (!wxStricmp(attr, wxT("aliaslen")) && (nValue >= 0))
|
||||
aliasLen = nValue;
|
||||
else if (!wxStricmp(attr, wxT("aliaschannel")) && XMLValueChecker::IsValidChannel(aliasChannel))
|
||||
aliasChannel = nValue;
|
||||
|
@ -165,7 +165,8 @@ void PCMAliasBlockFile::SaveXML(XMLWriter &xmlFile)
|
||||
|
||||
xmlFile.WriteAttr(wxT("summaryfile"), mFileName.GetFullName());
|
||||
xmlFile.WriteAttr(wxT("aliasfile"), mAliasedFileName.GetFullPath());
|
||||
xmlFile.WriteAttr(wxT("aliasstart"), mAliasStart);
|
||||
xmlFile.WriteAttr(wxT("aliasstart"),
|
||||
static_cast<long long>( mAliasStart ));
|
||||
xmlFile.WriteAttr(wxT("aliaslen"), mLen);
|
||||
xmlFile.WriteAttr(wxT("aliaschannel"), mAliasChannel);
|
||||
xmlFile.WriteAttr(wxT("min"), mMin);
|
||||
@ -186,6 +187,7 @@ BlockFilePtr PCMAliasBlockFile::BuildFromXML(DirManager &dm, const wxChar **attr
|
||||
float min = 0.0f, max = 0.0f, rms = 0.0f;
|
||||
double dblValue;
|
||||
long nValue;
|
||||
long long nnValue;
|
||||
|
||||
while(*attrs)
|
||||
{
|
||||
@ -217,11 +219,15 @@ BlockFilePtr PCMAliasBlockFile::BuildFromXML(DirManager &dm, const wxChar **attr
|
||||
// but we want to keep the reference to the missing file because it's a good path string.
|
||||
aliasFileName.Assign(strValue);
|
||||
}
|
||||
else if ( !wxStricmp(attr, wxT("aliasstart")) )
|
||||
{
|
||||
if (XMLValueChecker::IsGoodInt64(strValue) &&
|
||||
strValue.ToLongLong(&nnValue) && (nnValue >= 0))
|
||||
aliasStart = nnValue;
|
||||
}
|
||||
else if (XMLValueChecker::IsGoodInt(strValue) && strValue.ToLong(&nValue))
|
||||
{ // integer parameters
|
||||
if (!wxStricmp(attr, wxT("aliasstart")) && (nValue >= 0))
|
||||
aliasStart = nValue;
|
||||
else if (!wxStricmp(attr, wxT("aliaslen")) && (nValue >= 0))
|
||||
if (!wxStricmp(attr, wxT("aliaslen")) && (nValue >= 0))
|
||||
aliasLen = nValue;
|
||||
else if (!wxStricmp(attr, wxT("aliaschannel")) && XMLValueChecker::IsValidChannel(aliasChannel))
|
||||
aliasChannel = nValue;
|
||||
|
@ -128,7 +128,7 @@ bool CompareAudioCommand::Apply(CommandExecutionContext context)
|
||||
}
|
||||
|
||||
position += block;
|
||||
Progress((position - mT0) / length);
|
||||
Progress((position - s0) / length);
|
||||
}
|
||||
|
||||
delete [] buff0;
|
||||
|
@ -325,7 +325,7 @@ int Effect::GetMidiOutCount()
|
||||
return 0;
|
||||
}
|
||||
|
||||
void Effect::SetSampleRate(sampleCount rate)
|
||||
void Effect::SetSampleRate(double rate)
|
||||
{
|
||||
if (mClient)
|
||||
{
|
||||
@ -847,11 +847,6 @@ bool Effect::GetSharedConfig(const wxString & group, const wxString & key, doubl
|
||||
return PluginManager::Get().GetSharedConfig(GetID(), group, key, value, defval);
|
||||
}
|
||||
|
||||
bool Effect::GetSharedConfig(const wxString & group, const wxString & key, sampleCount & value, sampleCount defval)
|
||||
{
|
||||
return PluginManager::Get().GetSharedConfig(GetID(), group, key, value, defval);
|
||||
}
|
||||
|
||||
bool Effect::SetSharedConfig(const wxString & group, const wxString & key, const wxString & value)
|
||||
{
|
||||
return PluginManager::Get().SetSharedConfig(GetID(), group, key, value);
|
||||
@ -877,11 +872,6 @@ bool Effect::SetSharedConfig(const wxString & group, const wxString & key, const
|
||||
return PluginManager::Get().SetSharedConfig(GetID(), group, key, value);
|
||||
}
|
||||
|
||||
bool Effect::SetSharedConfig(const wxString & group, const wxString & key, const sampleCount & value)
|
||||
{
|
||||
return PluginManager::Get().SetSharedConfig(GetID(), group, key, value);
|
||||
}
|
||||
|
||||
bool Effect::RemoveSharedConfigSubgroup(const wxString & group)
|
||||
{
|
||||
return PluginManager::Get().RemoveSharedConfigSubgroup(GetID(), group);
|
||||
@ -927,11 +917,6 @@ bool Effect::GetPrivateConfig(const wxString & group, const wxString & key, doub
|
||||
return PluginManager::Get().GetPrivateConfig(GetID(), group, key, value, defval);
|
||||
}
|
||||
|
||||
bool Effect::GetPrivateConfig(const wxString & group, const wxString & key, sampleCount & value, sampleCount defval)
|
||||
{
|
||||
return PluginManager::Get().GetPrivateConfig(GetID(), group, key, value, defval);
|
||||
}
|
||||
|
||||
bool Effect::SetPrivateConfig(const wxString & group, const wxString & key, const wxString & value)
|
||||
{
|
||||
return PluginManager::Get().SetPrivateConfig(GetID(), group, key, value);
|
||||
@ -957,11 +942,6 @@ bool Effect::SetPrivateConfig(const wxString & group, const wxString & key, cons
|
||||
return PluginManager::Get().SetPrivateConfig(GetID(), group, key, value);
|
||||
}
|
||||
|
||||
bool Effect::SetPrivateConfig(const wxString & group, const wxString & key, const sampleCount & value)
|
||||
{
|
||||
return PluginManager::Get().SetPrivateConfig(GetID(), group, key, value);
|
||||
}
|
||||
|
||||
bool Effect::RemovePrivateConfigSubgroup(const wxString & group)
|
||||
{
|
||||
return PluginManager::Get().RemovePrivateConfigSubgroup(GetID(), group);
|
||||
@ -1576,9 +1556,9 @@ bool Effect::ProcessTrack(int count,
|
||||
sampleCount genLength = 0;
|
||||
bool isGenerator = GetType() == EffectTypeGenerate;
|
||||
bool isProcessor = GetType() == EffectTypeProcess;
|
||||
double genDur = 0;
|
||||
if (isGenerator)
|
||||
{
|
||||
double genDur;
|
||||
if (mIsPreview) {
|
||||
gPrefs->Read(wxT("/AudioIO/EffectsPreviewLen"), &genDur, 6.0);
|
||||
genDur = wxMin(mDuration, CalcPreviewInputLength(genDur));
|
||||
@ -1850,17 +1830,33 @@ bool Effect::ProcessTrack(int count,
|
||||
if (isGenerator)
|
||||
{
|
||||
AudacityProject *p = GetActiveProject();
|
||||
StepTimeWarper warper(mT0 + genLength, genLength - (mT1 - mT0));
|
||||
|
||||
// PRL: this code was here and could not have been the right
|
||||
// intent, mixing time and sampleCount values:
|
||||
// StepTimeWarper warper(mT0 + genLength, genLength - (mT1 - mT0));
|
||||
|
||||
// This looks like what it should have been:
|
||||
// StepTimeWarper warper(mT0 + genDur, genDur - (mT1 - mT0));
|
||||
// But rather than fix it, I will just disable the use of it for now.
|
||||
// The purpose was to remap split lines inside the selected region when
|
||||
// a generator replaces it with sound of different duration. But
|
||||
// the "correct" version might have the effect of mapping some splits too
|
||||
// far left, to before the seletion.
|
||||
// In practice the wrong version probably did nothing most of the time,
|
||||
// because the cutoff time for the step time warper was 44100 times too
|
||||
// far from mT0.
|
||||
|
||||
// Transfer the data from the temporary tracks to the actual ones
|
||||
genLeft->Flush();
|
||||
// mT1 gives us the NEW selection. We want to replace up to GetSel1().
|
||||
left->ClearAndPaste(mT0, p->GetSel1(), genLeft.get(), true, true, &warper);
|
||||
left->ClearAndPaste(mT0, p->GetSel1(), genLeft.get(), true, true,
|
||||
nullptr /* &warper */);
|
||||
|
||||
if (genRight)
|
||||
{
|
||||
genRight->Flush();
|
||||
right->ClearAndPaste(mT0, mT1, genRight.get(), true, true, &warper);
|
||||
right->ClearAndPaste(mT0, mT1, genRight.get(), true, true,
|
||||
nullptr /* &warper */);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -106,7 +106,7 @@ class AUDACITY_DLL_API Effect /* not final */ : public wxEvtHandler,
|
||||
sampleCount GetLatency() override;
|
||||
sampleCount GetTailSize() override;
|
||||
|
||||
void SetSampleRate(sampleCount rate) override;
|
||||
void SetSampleRate(double rate) override;
|
||||
sampleCount SetBlockSize(sampleCount maxBlockSize) override;
|
||||
|
||||
bool IsReady() override;
|
||||
@ -182,14 +182,12 @@ class AUDACITY_DLL_API Effect /* not final */ : public wxEvtHandler,
|
||||
bool GetSharedConfig(const wxString & group, const wxString & key, bool & value, bool defval = false) override;
|
||||
bool GetSharedConfig(const wxString & group, const wxString & key, float & value, float defval = 0.0) override;
|
||||
bool GetSharedConfig(const wxString & group, const wxString & key, double & value, double defval = 0.0) override;
|
||||
bool GetSharedConfig(const wxString & group, const wxString & key, sampleCount & value, sampleCount defval = 0) override;
|
||||
|
||||
bool SetSharedConfig(const wxString & group, const wxString & key, const wxString & value) override;
|
||||
bool SetSharedConfig(const wxString & group, const wxString & key, const int & value) override;
|
||||
bool SetSharedConfig(const wxString & group, const wxString & key, const bool & value) override;
|
||||
bool SetSharedConfig(const wxString & group, const wxString & key, const float & value) override;
|
||||
bool SetSharedConfig(const wxString & group, const wxString & key, const double & value) override;
|
||||
bool SetSharedConfig(const wxString & group, const wxString & key, const sampleCount & value) override;
|
||||
|
||||
bool RemoveSharedConfigSubgroup(const wxString & group) override;
|
||||
bool RemoveSharedConfig(const wxString & group, const wxString & key) override;
|
||||
@ -202,14 +200,12 @@ class AUDACITY_DLL_API Effect /* not final */ : public wxEvtHandler,
|
||||
bool GetPrivateConfig(const wxString & group, const wxString & key, bool & value, bool defval = false) override;
|
||||
bool GetPrivateConfig(const wxString & group, const wxString & key, float & value, float defval = 0.0) override;
|
||||
bool GetPrivateConfig(const wxString & group, const wxString & key, double & value, double defval = 0.0) override;
|
||||
bool GetPrivateConfig(const wxString & group, const wxString & key, sampleCount & value, sampleCount defval = 0) override;
|
||||
|
||||
bool SetPrivateConfig(const wxString & group, const wxString & key, const wxString & value) override;
|
||||
bool SetPrivateConfig(const wxString & group, const wxString & key, const int & value) override;
|
||||
bool SetPrivateConfig(const wxString & group, const wxString & key, const bool & value) override;
|
||||
bool SetPrivateConfig(const wxString & group, const wxString & key, const float & value) override;
|
||||
bool SetPrivateConfig(const wxString & group, const wxString & key, const double & value) override;
|
||||
bool SetPrivateConfig(const wxString & group, const wxString & key, const sampleCount & value) override;
|
||||
|
||||
bool RemovePrivateConfigSubgroup(const wxString & group) override;
|
||||
bool RemovePrivateConfig(const wxString & group, const wxString & key) override;
|
||||
|
@ -1085,14 +1085,12 @@ VSTEffect::VSTEffect(const wxString & path, VSTEffect *master)
|
||||
mMidiIns = 0;
|
||||
mMidiOuts = 0;
|
||||
mSampleRate = 44100;
|
||||
mBlockSize = 0;
|
||||
mBlockSize = mUserBlockSize = 8192;
|
||||
mBufferDelay = 0;
|
||||
mProcessLevel = 1; // in GUI thread
|
||||
mHasPower = false;
|
||||
mWantsIdle = false;
|
||||
mWantsEditIdle = false;
|
||||
mUserBlockSize = 8192;
|
||||
mBlockSize = mUserBlockSize;
|
||||
mUseLatency = true;
|
||||
mReady = false;
|
||||
|
||||
@ -1330,19 +1328,11 @@ int VSTEffect::GetMidiOutCount()
|
||||
|
||||
sampleCount VSTEffect::SetBlockSize(sampleCount maxBlockSize)
|
||||
{
|
||||
if (mUserBlockSize > maxBlockSize)
|
||||
{
|
||||
mBlockSize = maxBlockSize;
|
||||
}
|
||||
else
|
||||
{
|
||||
mBlockSize = mUserBlockSize;
|
||||
}
|
||||
|
||||
mBlockSize = std::min((int)maxBlockSize, mUserBlockSize);
|
||||
return mBlockSize;
|
||||
}
|
||||
|
||||
void VSTEffect::SetSampleRate(sampleCount rate)
|
||||
void VSTEffect::SetSampleRate(double rate)
|
||||
{
|
||||
mSampleRate = (float) rate;
|
||||
}
|
||||
|
@ -108,7 +108,7 @@ class VSTEffect final : public wxEvtHandler,
|
||||
sampleCount GetLatency() override;
|
||||
sampleCount GetTailSize() override;
|
||||
|
||||
void SetSampleRate(sampleCount rate) override;
|
||||
void SetSampleRate(double rate) override;
|
||||
sampleCount SetBlockSize(sampleCount maxBlockSize) override;
|
||||
|
||||
bool IsReady() override;
|
||||
@ -268,7 +268,7 @@ private:
|
||||
int mMidiOuts;
|
||||
bool mAutomatable;
|
||||
float mSampleRate;
|
||||
sampleCount mUserBlockSize;
|
||||
int mUserBlockSize;
|
||||
wxString mName;
|
||||
wxString mVendor;
|
||||
wxString mDescription;
|
||||
@ -313,7 +313,7 @@ private:
|
||||
bool mUseLatency;
|
||||
int mBufferDelay;
|
||||
|
||||
sampleCount mBlockSize;
|
||||
int mBlockSize;
|
||||
|
||||
int mProcessLevel;
|
||||
bool mHasPower;
|
||||
|
@ -1187,7 +1187,7 @@ int AudioUnitEffect::GetMidiOutCount()
|
||||
return 0;
|
||||
}
|
||||
|
||||
void AudioUnitEffect::SetSampleRate(sampleCount rate)
|
||||
void AudioUnitEffect::SetSampleRate(double rate)
|
||||
{
|
||||
mSampleRate = rate;
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ public:
|
||||
int GetMidiInCount() override;
|
||||
int GetMidiOutCount() override;
|
||||
|
||||
void SetSampleRate(sampleCount rate) override;
|
||||
void SetSampleRate(double rate) override;
|
||||
sampleCount SetBlockSize(sampleCount maxBlockSize) override;
|
||||
|
||||
sampleCount GetLatency() override;
|
||||
|
@ -886,7 +886,7 @@ int LadspaEffect::GetMidiOutCount()
|
||||
return 0;
|
||||
}
|
||||
|
||||
void LadspaEffect::SetSampleRate(sampleCount rate)
|
||||
void LadspaEffect::SetSampleRate(double rate)
|
||||
{
|
||||
mSampleRate = rate;
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ public:
|
||||
int GetMidiInCount() override;
|
||||
int GetMidiOutCount() override;
|
||||
|
||||
void SetSampleRate(sampleCount rate) override;
|
||||
void SetSampleRate(double rate) override;
|
||||
sampleCount SetBlockSize(sampleCount maxBlockSize) override;
|
||||
|
||||
sampleCount GetLatency() override;
|
||||
|
@ -722,7 +722,7 @@ int LV2Effect::GetMidiOutCount()
|
||||
return 0;
|
||||
}
|
||||
|
||||
void LV2Effect::SetSampleRate(sampleCount rate)
|
||||
void LV2Effect::SetSampleRate(double rate)
|
||||
{
|
||||
mSampleRate = (double) rate;
|
||||
|
||||
|
@ -128,7 +128,7 @@ public:
|
||||
int GetMidiInCount() override;
|
||||
int GetMidiOutCount() override;
|
||||
|
||||
void SetSampleRate(sampleCount rate) override;
|
||||
void SetSampleRate(double rate) override;
|
||||
sampleCount SetBlockSize(sampleCount maxBlockSize) override;
|
||||
|
||||
sampleCount GetLatency() override;
|
||||
|
@ -592,7 +592,7 @@ int FFmpegImportFileHandle::Import(TrackFactory *trackFactory,
|
||||
sampleCount sampleDuration = 0;
|
||||
auto sc = scs[s].get();
|
||||
if (sc->m_stream->duration > 0)
|
||||
sampleDuration = ((sampleCount)sc->m_stream->duration * sc->m_stream->time_base.num), sc->m_stream->codec->sample_rate / sc->m_stream->time_base.den;
|
||||
sampleDuration = ((sampleCount)sc->m_stream->duration * sc->m_stream->time_base.num) * sc->m_stream->codec->sample_rate / sc->m_stream->time_base.den;
|
||||
else
|
||||
sampleDuration = ((sampleCount)mFormatContext->duration *sc->m_stream->codec->sample_rate) / AV_TIME_BASE;
|
||||
|
||||
|
@ -31,6 +31,7 @@ DEFINE_EVENT_TYPE(EVT_ODTASK_COMPLETE)
|
||||
|
||||
/// Constructs an ODTask
|
||||
ODTask::ODTask()
|
||||
: mDemandSample(0)
|
||||
{
|
||||
|
||||
static int sTaskNumber=0;
|
||||
@ -41,8 +42,6 @@ ODTask::ODTask()
|
||||
mIsRunning = false;
|
||||
|
||||
mTaskNumber=sTaskNumber++;
|
||||
|
||||
mDemandSample=0;
|
||||
}
|
||||
|
||||
//outside code must ensure this task is not scheduled again.
|
||||
|
@ -159,7 +159,7 @@ class ODTask /* not final */
|
||||
std::vector<WaveTrack*> mWaveTracks;
|
||||
ODLock mWaveTrackMutex;
|
||||
|
||||
volatile sampleCount mDemandSample;
|
||||
sampleCount mDemandSample;
|
||||
mutable ODLock mDemandSampleMutex;
|
||||
|
||||
volatile bool mIsRunning;
|
||||
|
Loading…
x
Reference in New Issue
Block a user