Make many counts of tracks and channels unsigned...

... And in some places where a library uses signed types, assert that
the reported number is not negative.

What led me to this, is that there are many places where a size_t value for
an allocation is the product of a number of channels and some other number.
This commit is contained in:
Paul Licameli 2016-09-02 15:53:09 -04:00
parent ef23de6a60
commit 67cec5ad83
81 changed files with 272 additions and 262 deletions

View File

@ -117,8 +117,8 @@ public:
virtual bool SetHost(EffectHostInterface *host) = 0;
virtual int GetAudioInCount() = 0;
virtual int GetAudioOutCount() = 0;
virtual unsigned GetAudioInCount() = 0;
virtual unsigned GetAudioOutCount() = 0;
virtual int GetMidiInCount() = 0;
virtual int GetMidiOutCount() = 0;
@ -135,7 +135,7 @@ public:
virtual sampleCount ProcessBlock(float **inBlock, float **outBlock, sampleCount blockLen) = 0;
virtual bool RealtimeInitialize() = 0;
virtual bool RealtimeAddProcessor(int numChannels, float sampleRate) = 0;
virtual bool RealtimeAddProcessor(unsigned numChannels, float sampleRate) = 0;
virtual bool RealtimeFinalize() = 0;
virtual bool RealtimeSuspend() = 0;
virtual bool RealtimeResume() = 0;

View File

@ -1948,7 +1948,7 @@ int AudioIO::StartStream(const WaveTrackArray &playbackTracks,
{
WaveTrack *vt = gAudioIO->mPlaybackTracks[i];
int chanCnt = 1;
unsigned chanCnt = 1;
if (vt->GetLinked())
{
i++;
@ -3634,7 +3634,7 @@ void AudioIO::FillBuffers()
// Append captured samples to the end of the WaveTracks.
// The WaveTracks have their own buffering for efficiency.
AutoSaveFile blockFileLog;
int numChannels = mCaptureTracks.size();
auto numChannels = mCaptureTracks.size();
for( i = 0; (int)i < numChannels; i++ )
{
@ -3871,9 +3871,8 @@ bool AudioIO::SetHasSolo(bool hasSolo)
void AudioIO::FillMidiBuffers()
{
bool hasSolo = false;
int numPlaybackTracks = gAudioIO->mPlaybackTracks.size();
int t;
for(t = 0; t < numPlaybackTracks; t++ )
auto numPlaybackTracks = gAudioIO->mPlaybackTracks.size();
for(unsigned t = 0; t < numPlaybackTracks; t++ )
if( gAudioIO->mPlaybackTracks[t]->GetSolo() ) {
hasSolo = true;
break;
@ -4120,7 +4119,7 @@ void AudioIO::AILAProcess(double maxPeak) {
static void DoSoftwarePlaythrough(const void *inputBuffer,
sampleFormat inputFormat,
int inputChannels,
unsigned inputChannels,
float *outputBuffer,
int len)
{
@ -4151,9 +4150,9 @@ int audacityAudioCallback(const void *inputBuffer, void *outputBuffer,
#endif
const PaStreamCallbackFlags WXUNUSED(statusFlags), void * WXUNUSED(userData) )
{
int numPlaybackChannels = gAudioIO->mNumPlaybackChannels;
int numPlaybackTracks = gAudioIO->mPlaybackTracks.size();
int numCaptureChannels = gAudioIO->mNumCaptureChannels;
auto numPlaybackChannels = gAudioIO->mNumPlaybackChannels;
auto numPlaybackTracks = gAudioIO->mPlaybackTracks.size();
auto numCaptureChannels = gAudioIO->mNumCaptureChannels;
int callbackReturn = paContinue;
void *tempBuffer = alloca(framesPerBuffer*sizeof(float)*
MAX(numCaptureChannels,numPlaybackChannels));
@ -4178,7 +4177,6 @@ int audacityAudioCallback(const void *inputBuffer, void *outputBuffer,
#endif
unsigned int i;
int t;
/* Send data to recording VU meter if applicable */
@ -4322,7 +4320,7 @@ int audacityAudioCallback(const void *inputBuffer, void *outputBuffer,
gAudioIO->mWarpedTime = std::abs(gAudioIO->mWarpedTime);
// Reset mixer positions and flush buffers for all tracks
for (i = 0; i < (unsigned int)numPlaybackTracks; i++)
for (i = 0; i < numPlaybackTracks; i++)
{
gAudioIO->mPlaybackMixers[i]->Reposition(gAudioIO->mTime);
const auto toDiscard =
@ -4347,8 +4345,8 @@ int audacityAudioCallback(const void *inputBuffer, void *outputBuffer,
return paContinue;
}
int numSolo = 0;
for( t = 0; t < numPlaybackTracks; t++ )
unsigned numSolo = 0;
for(unsigned t = 0; t < numPlaybackTracks; t++ )
if( gAudioIO->mPlaybackTracks[t]->GetSolo() )
numSolo++;
#ifdef EXPERIMENTAL_MIDI_OUT
@ -4372,7 +4370,7 @@ int audacityAudioCallback(const void *inputBuffer, void *outputBuffer,
int group = 0;
int chanCnt = 0;
int maxLen = 0;
for (t = 0; t < numPlaybackTracks; t++)
for (unsigned t = 0; t < numPlaybackTracks; t++)
{
WaveTrack *vt = gAudioIO->mPlaybackTracks[t];
@ -4573,7 +4571,7 @@ int audacityAudioCallback(const void *inputBuffer, void *outputBuffer,
if( inputBuffer && (numCaptureChannels > 0) )
{
size_t len = framesPerBuffer;
for( t = 0; t < numCaptureChannels; t++) {
for(unsigned t = 0; t < numCaptureChannels; t++) {
len = std::min( len,
gAudioIO->mCaptureBuffers[t]->AvailForPut());
}
@ -4585,7 +4583,7 @@ int audacityAudioCallback(const void *inputBuffer, void *outputBuffer,
}
if (len > 0) {
for( t = 0; t < numCaptureChannels; t++) {
for(unsigned t = 0; t < numCaptureChannels; t++) {
// dmazzoni:
// Un-interleave. Ugly special-case code required because the

View File

@ -350,8 +350,8 @@ class AUDACITY_DLL_API AudioIO final {
double GetStreamTime();
sampleFormat GetCaptureFormat() { return mCaptureFormat; }
int GetNumPlaybackChannels() const { return mNumPlaybackChannels; }
int GetNumCaptureChannels() const { return mNumCaptureChannels; }
unsigned GetNumPlaybackChannels() const { return mNumPlaybackChannels; }
unsigned GetNumCaptureChannels() const { return mNumCaptureChannels; }
/** \brief Array of common audio sample rates
*

View File

@ -460,7 +460,7 @@ wxString BatchCommands::BuildCleanFileName(const wxString &fileName, const wxStr
bool BatchCommands::WriteMp3File( const wxString & Name, int bitrate )
{ //check if current project is mono or stereo
int numChannels = 2;
unsigned numChannels = 2;
if (IsMono()) {
numChannels = 1;
}
@ -509,7 +509,7 @@ bool BatchCommands::ApplySpecialCommand(int WXUNUSED(iCommand), const wxString &
AudacityProject *project = GetActiveProject();
int numChannels = 1; //used to switch between mono and stereo export
unsigned numChannels = 1; //used to switch between mono and stereo export
if (IsMono()) {
numChannels = 1; //export in mono
} else {

View File

@ -241,7 +241,7 @@ Mixer::WarpOptions::WarpOptions(double min, double max)
Mixer::Mixer(const WaveTrackConstArray &inputTracks,
const WarpOptions &warpOptions,
double startTime, double stopTime,
int numOutChannels, int outBufferSize, bool outInterleaved,
unsigned numOutChannels, int outBufferSize, bool outInterleaved,
double outRate, sampleFormat outFormat,
bool highQuality, MixerSpec *mixerSpec)
{
@ -376,7 +376,7 @@ void Mixer::Clear()
}
}
void MixBuffers(int numChannels, int *channelFlags, float *gains,
void MixBuffers(unsigned numChannels, int *channelFlags, float *gains,
samplePtr src, SampleBuffer *dests,
int len, bool interleaved)
{
@ -385,7 +385,7 @@ void MixBuffers(int numChannels, int *channelFlags, float *gains,
continue;
samplePtr destPtr;
int skip;
unsigned skip;
if (interleaved) {
destPtr = dests[0].ptr() + c*SAMPLE_SIZE(floatSample);
@ -747,7 +747,7 @@ void Mixer::SetTimesAndSpeed(double t0, double t1, double speed)
Reposition(t0);
}
MixerSpec::MixerSpec( int numTracks, int maxNumChannels )
MixerSpec::MixerSpec( unsigned numTracks, unsigned maxNumChannels )
{
mNumTracks = mNumChannels = numTracks;
mMaxNumChannels = maxNumChannels;
@ -795,7 +795,7 @@ void MixerSpec::Free()
delete[] mMap;
}
bool MixerSpec::SetNumChannels( int newNumChannels )
bool MixerSpec::SetNumChannels( unsigned newNumChannels )
{
if( mNumChannels == newNumChannels )
return true;

View File

@ -42,13 +42,13 @@ void MixAndRender(TrackList * tracks, TrackFactory *factory,
double startTime, double endTime,
std::unique_ptr<WaveTrack> &uLeft, std::unique_ptr<WaveTrack> &uRight);
void MixBuffers(int numChannels, int *channelFlags, float *gains,
void MixBuffers(unsigned numChannels, int *channelFlags, float *gains,
samplePtr src,
samplePtr *dests, int len, bool interleaved);
class AUDACITY_DLL_API MixerSpec
{
int mNumTracks, mNumChannels, mMaxNumChannels;
unsigned mNumTracks, mNumChannels, mMaxNumChannels;
void Alloc();
void Free();
@ -56,15 +56,15 @@ class AUDACITY_DLL_API MixerSpec
public:
bool **mMap;
MixerSpec( int numTracks, int maxNumChannels );
MixerSpec( unsigned numTracks, unsigned maxNumChannels );
MixerSpec( const MixerSpec &mixerSpec );
virtual ~MixerSpec();
bool SetNumChannels( int numChannels );
int GetNumChannels() { return mNumChannels; }
bool SetNumChannels( unsigned numChannels );
unsigned GetNumChannels() { return mNumChannels; }
int GetMaxNumChannels() { return mMaxNumChannels; }
int GetNumTracks() { return mNumTracks; }
unsigned GetMaxNumChannels() { return mMaxNumChannels; }
unsigned GetNumTracks() { return mNumTracks; }
MixerSpec& operator=( const MixerSpec &mixerSpec );
};
@ -95,7 +95,7 @@ class AUDACITY_DLL_API Mixer {
Mixer(const WaveTrackConstArray &inputTracks,
const WarpOptions &warpOptions,
double startTime, double stopTime,
int numOutChannels, int outBufferSize, bool outInterleaved,
unsigned numOutChannels, int outBufferSize, bool outInterleaved,
double outRate, sampleFormat outFormat,
bool highQuality = true, MixerSpec *mixerSpec = NULL);
@ -173,8 +173,8 @@ class AUDACITY_DLL_API Mixer {
// Output
int mMaxOut;
int mNumChannels;
int mNumBuffers;
unsigned mNumChannels;
unsigned mNumBuffers;
int mBufferSize;
int mInterleavedBufferSize;
sampleFormat mFormat;

View File

@ -1194,7 +1194,7 @@ const TimeTrack *TrackList::GetTimeTrack() const
return const_cast<TrackList*>(this)->GetTimeTrack();
}
int TrackList::GetNumExportChannels(bool selectionOnly) const
unsigned TrackList::GetNumExportChannels(bool selectionOnly) const
{
/* counters for tracks panned different places */
int numLeft = 0;

View File

@ -482,7 +482,7 @@ class TrackList final : public wxEvtHandler, public ListOfTracks
* Mono, Stereo etc. @param selectionOnly Whether to consider the entire track
* list or only the selected members of it
*/
int GetNumExportChannels(bool selectionOnly) const;
unsigned GetNumExportChannels(bool selectionOnly) const;
WaveTrackArray GetWaveTrackArray(bool selectionOnly, bool includeMuted = true);
WaveTrackConstArray GetWaveTrackConstArray(bool selectionOnly, bool includeMuted = true) const;

View File

@ -530,6 +530,7 @@ int ODPCMAliasBlockFile::ReadData(samplePtr data, sampleFormat format,
SFCall<sf_count_t>(sf_seek, sf.get(), mAliasStart + start, SEEK_SET);
wxASSERT(info.channels >= 0);
SampleBuffer buffer(len * info.channels, floatSample);
int framesRead = 0;

View File

@ -117,6 +117,7 @@ int PCMAliasBlockFile::ReadData(samplePtr data, sampleFormat format,
mSilentAliasLog=FALSE;
SFCall<sf_count_t>(sf_seek, sf.get(), mAliasStart + start, SEEK_SET);
wxASSERT(info.channels >= 0);
SampleBuffer buffer(len * info.channels, floatSample);
int framesRead = 0;

View File

@ -102,7 +102,8 @@ bool ExportCommand::Apply(CommandExecutionContext context)
Exporter exporter;
bool exportSuccess = exporter.Process(context.GetProject(), numChannels,
bool exportSuccess = exporter.Process(context.GetProject(),
std::max(0L, numChannels),
extension.c_str(), filename,
selection, t0, t1);

View File

@ -99,12 +99,12 @@ EffectType EffectAmplify::GetType()
// EffectClientInterface implementation
int EffectAmplify::GetAudioInCount()
unsigned EffectAmplify::GetAudioInCount()
{
return 1;
}
int EffectAmplify::GetAudioOutCount()
unsigned EffectAmplify::GetAudioOutCount()
{
return 1;
}

View File

@ -44,8 +44,8 @@ public:
// EffectClientInterface implementation
int GetAudioInCount() override;
int GetAudioOutCount() override;
unsigned GetAudioInCount() override;
unsigned GetAudioOutCount() override;
sampleCount ProcessBlock(float **inBlock, float **outBlock, sampleCount blockLen) override;
bool GetAutomationParameters(EffectAutomationParameters & parms) override;
bool SetAutomationParameters(EffectAutomationParameters & parms) override;

View File

@ -111,12 +111,12 @@ bool EffectBassTreble::SupportsRealtime()
// EffectClientInterface implementation
int EffectBassTreble::GetAudioInCount()
unsigned EffectBassTreble::GetAudioInCount()
{
return 1;
}
int EffectBassTreble::GetAudioOutCount()
unsigned EffectBassTreble::GetAudioOutCount()
{
return 1;
}
@ -142,7 +142,7 @@ bool EffectBassTreble::RealtimeInitialize()
return true;
}
bool EffectBassTreble::RealtimeAddProcessor(int WXUNUSED(numChannels), float sampleRate)
bool EffectBassTreble::RealtimeAddProcessor(unsigned WXUNUSED(numChannels), float sampleRate)
{
EffectBassTrebleState slave;

View File

@ -59,12 +59,12 @@ public:
// EffectClientInterface implementation
int GetAudioInCount() override;
int GetAudioOutCount() override;
unsigned GetAudioInCount() override;
unsigned GetAudioOutCount() override;
bool ProcessInitialize(sampleCount totalLen, ChannelNames chanMap = NULL) override;
sampleCount ProcessBlock(float **inBlock, float **outBlock, sampleCount blockLen) override;
bool RealtimeInitialize() override;
bool RealtimeAddProcessor(int numChannels, float sampleRate) override;
bool RealtimeAddProcessor(unsigned numChannels, float sampleRate) override;
bool RealtimeFinalize() override;
sampleCount RealtimeProcess(int group,
float **inbuf,

View File

@ -208,12 +208,12 @@ bool EffectDistortion::SupportsRealtime()
// EffectClientInterface implementation
int EffectDistortion::GetAudioInCount()
unsigned EffectDistortion::GetAudioInCount()
{
return 1;
}
int EffectDistortion::GetAudioOutCount()
unsigned EffectDistortion::GetAudioOutCount()
{
return 1;
}
@ -238,7 +238,7 @@ bool EffectDistortion::RealtimeInitialize()
return true;
}
bool EffectDistortion::RealtimeAddProcessor(int WXUNUSED(numChannels), float sampleRate)
bool EffectDistortion::RealtimeAddProcessor(unsigned WXUNUSED(numChannels), float sampleRate)
{
EffectDistortionState slave;

View File

@ -76,12 +76,12 @@ public:
// EffectClientInterface implementation
int GetAudioInCount() override;
int GetAudioOutCount() override;
unsigned GetAudioInCount() override;
unsigned GetAudioOutCount() override;
bool ProcessInitialize(sampleCount totalLen, ChannelNames chanMap = NULL) override;
sampleCount ProcessBlock(float **inBlock, float **outBlock, sampleCount blockLen) override;
bool RealtimeInitialize() override;
bool RealtimeAddProcessor(int numChannels, float sampleRate) override;
bool RealtimeAddProcessor(unsigned numChannels, float sampleRate) override;
bool RealtimeFinalize() override;
sampleCount RealtimeProcess(int group,
float **inbuf,

View File

@ -102,7 +102,7 @@ EffectType EffectDtmf::GetType()
// EffectClientInterface implementation
int EffectDtmf::GetAudioOutCount()
unsigned EffectDtmf::GetAudioOutCount()
{
return 1;
}

View File

@ -44,7 +44,7 @@ public:
// EffectClientInterface implementation
int GetAudioOutCount() override;
unsigned GetAudioOutCount() override;
bool ProcessInitialize(sampleCount totalLen, ChannelNames chanMap = NULL) override;
sampleCount ProcessBlock(float **inBlock, float **outBlock, sampleCount blockLen) override;
bool GetAutomationParameters(EffectAutomationParameters & parms) override;

View File

@ -68,12 +68,12 @@ EffectType EffectEcho::GetType()
// EffectClientInterface implementation
int EffectEcho::GetAudioInCount()
unsigned EffectEcho::GetAudioInCount()
{
return 1;
}
int EffectEcho::GetAudioOutCount()
unsigned EffectEcho::GetAudioOutCount()
{
return 1;
}

View File

@ -39,8 +39,8 @@ public:
// EffectClientInterface implementation
int GetAudioInCount() override;
int GetAudioOutCount() override;
unsigned GetAudioInCount() override;
unsigned GetAudioOutCount() override;
bool ProcessInitialize(sampleCount totalLen, ChannelNames chanMap = NULL) override;
bool ProcessFinalize() override;
sampleCount ProcessBlock(float **inBlock, float **outBlock, sampleCount blockLen) override;

View File

@ -285,7 +285,7 @@ bool Effect::SetHost(EffectHostInterface *host)
return true;
}
int Effect::GetAudioInCount()
unsigned Effect::GetAudioInCount()
{
if (mClient)
{
@ -295,7 +295,7 @@ int Effect::GetAudioInCount()
return 0;
}
int Effect::GetAudioOutCount()
unsigned Effect::GetAudioOutCount()
{
if (mClient)
{
@ -420,7 +420,7 @@ bool Effect::RealtimeInitialize()
return false;
}
bool Effect::RealtimeAddProcessor(int numChannels, float sampleRate)
bool Effect::RealtimeAddProcessor(unsigned numChannels, float sampleRate)
{
if (mClient)
{
@ -1548,7 +1548,7 @@ bool Effect::ProcessTrack(int count,
decltype(mBufferSize) outputBufferCnt = 0;
bool cleared = false;
int chans = wxMin(mNumAudioOut, mNumChannels);
auto chans = std::min(mNumAudioOut, mNumChannels);
std::unique_ptr<WaveTrack> genLeft, genRight;
decltype(len) genLength = 0;
@ -2282,11 +2282,11 @@ double Effect::CalcPreviewInputLength(double previewLength)
// RealtimeAddProcessor and RealtimeProcess use the same method of
// determining the current processor index, so updates to one should
// be reflected in the other.
bool Effect::RealtimeAddProcessor(int group, int chans, float rate)
bool Effect::RealtimeAddProcessor(int group, unsigned chans, float rate)
{
int ichans = chans;
int ochans = chans;
int gchans = chans;
auto ichans = chans;
auto ochans = chans;
auto gchans = chans;
// Reset processor index
if (group == 0)
@ -2348,7 +2348,7 @@ bool Effect::RealtimeAddProcessor(int group, int chans, float rate)
// determining the current processor group, so updates to one should
// be reflected in the other.
sampleCount Effect::RealtimeProcess(int group,
int chans,
unsigned chans,
float **inbuf,
float **outbuf,
sampleCount numSamples)
@ -2366,9 +2366,9 @@ sampleCount Effect::RealtimeProcess(int group,
float **clientOut = (float **) alloca(mNumAudioOut * sizeof(float *));
float *dummybuf = (float *) alloca(numSamples * sizeof(float));
decltype(numSamples) len = 0;
int ichans = chans;
int ochans = chans;
int gchans = chans;
auto ichans = chans;
auto ochans = chans;
auto gchans = chans;
int indx = 0;
int ondx = 0;

View File

@ -97,8 +97,8 @@ class AUDACITY_DLL_API Effect /* not final */ : public wxEvtHandler,
bool SetHost(EffectHostInterface *host) override;
int GetAudioInCount() override;
int GetAudioOutCount() override;
unsigned GetAudioInCount() override;
unsigned GetAudioOutCount() override;
int GetMidiInCount() override;
int GetMidiOutCount() override;
@ -115,7 +115,7 @@ class AUDACITY_DLL_API Effect /* not final */ : public wxEvtHandler,
sampleCount ProcessBlock(float **inBlock, float **outBlock, sampleCount blockLen) override;
bool RealtimeInitialize() override;
bool RealtimeAddProcessor(int numChannels, float sampleRate) override;
bool RealtimeAddProcessor(unsigned numChannels, float sampleRate) override;
bool RealtimeFinalize() override;
bool RealtimeSuspend() override;
bool RealtimeResume() override;
@ -242,9 +242,9 @@ class AUDACITY_DLL_API Effect /* not final */ : public wxEvtHandler,
bool shouldPrompt = true);
// Realtime Effect Processing
/* not virtual */ bool RealtimeAddProcessor(int group, int chans, float rate);
/* not virtual */ bool RealtimeAddProcessor(int group, unsigned chans, float rate);
/* not virtual */ sampleCount RealtimeProcess(int group,
int chans,
unsigned chans,
float **inbuf,
float **outbuf,
sampleCount numSamples);
@ -502,8 +502,8 @@ private:
// For client driver
EffectClientInterface *mClient;
int mNumAudioIn;
int mNumAudioOut;
unsigned mNumAudioIn;
unsigned mNumAudioOut;
float **mInBuffer;
float **mOutBuffer;
@ -512,7 +512,7 @@ private:
sampleCount mBufferSize;
sampleCount mBlockSize;
int mNumChannels;
unsigned mNumChannels;
wxArrayInt mGroupProcessor;
int mCurrentProcessor;

View File

@ -427,7 +427,7 @@ void EffectManager::RealtimeAddEffect(Effect *effect)
effect->RealtimeInitialize();
// Add the required processors
for (size_t i = 0, cnt = mRealtimeChans.GetCount(); i < cnt; i++)
for (size_t i = 0, cnt = mRealtimeChans.size(); i < cnt; i++)
{
effect->RealtimeAddProcessor(i, mRealtimeChans[i], mRealtimeRates[i]);
}
@ -464,7 +464,7 @@ void EffectManager::RealtimeInitialize()
RealtimeSuspend();
// (Re)Set processor parameters
mRealtimeChans.Clear();
mRealtimeChans.clear();
mRealtimeRates.Clear();
// RealtimeAdd/RemoveEffect() needs to know when we're active so it can
@ -481,14 +481,14 @@ void EffectManager::RealtimeInitialize()
RealtimeResume();
}
void EffectManager::RealtimeAddProcessor(int group, int chans, float rate)
void EffectManager::RealtimeAddProcessor(int group, unsigned chans, float rate)
{
for (size_t i = 0, cnt = mRealtimeEffects.GetCount(); i < cnt; i++)
{
mRealtimeEffects[i]->RealtimeAddProcessor(group, chans, rate);
}
mRealtimeChans.Add(chans);
mRealtimeChans.push_back(chans);
mRealtimeRates.Add(rate);
}
@ -507,7 +507,7 @@ void EffectManager::RealtimeFinalize()
}
// Reset processor parameters
mRealtimeChans.Clear();
mRealtimeChans.clear();
mRealtimeRates.Clear();
// No longer active
@ -587,7 +587,7 @@ void EffectManager::RealtimeProcessStart()
//
// This will be called in a different thread than the main GUI thread.
//
sampleCount EffectManager::RealtimeProcess(int group, int chans, float **buffers, sampleCount numSamples)
sampleCount EffectManager::RealtimeProcess(int group, unsigned chans, float **buffers, sampleCount numSamples)
{
// Protect ourselves from the main thread
mRealtimeLock.Enter();

View File

@ -103,12 +103,12 @@ public:
void RealtimeRemoveEffect(Effect *effect);
void RealtimeSetEffects(const EffectArray & mActive);
void RealtimeInitialize();
void RealtimeAddProcessor(int group, int chans, float rate);
void RealtimeAddProcessor(int group, unsigned chans, float rate);
void RealtimeFinalize();
void RealtimeSuspend();
void RealtimeResume();
void RealtimeProcessStart();
sampleCount RealtimeProcess(int group, int chans, float **buffers, sampleCount numSamples);
sampleCount RealtimeProcess(int group, unsigned chans, float **buffers, sampleCount numSamples);
void RealtimeProcessEnd();
int GetRealtimeLatency();
@ -137,7 +137,7 @@ private:
int mRealtimeLatency;
bool mRealtimeSuspended;
bool mRealtimeActive;
wxArrayInt mRealtimeChans;
std::vector<unsigned> mRealtimeChans;
wxArrayDouble mRealtimeRates;
// Set true if we want to skip pushing state

View File

@ -58,12 +58,12 @@ bool EffectFade::IsInteractive()
// EffectClientInterface implementation
int EffectFade::GetAudioInCount()
unsigned EffectFade::GetAudioInCount()
{
return 1;
}
int EffectFade::GetAudioOutCount()
unsigned EffectFade::GetAudioOutCount()
{
return 1;
}

View File

@ -36,8 +36,8 @@ public:
// EffectClientInterface implementation
int GetAudioInCount() override;
int GetAudioOutCount() override;
unsigned GetAudioInCount() override;
unsigned GetAudioOutCount() override;
bool ProcessInitialize(sampleCount totalLen, ChannelNames chanMap = NULL) override;
sampleCount ProcessBlock(float **inBlock, float **outBlock, sampleCount blockLen) override;

View File

@ -54,12 +54,12 @@ bool EffectInvert::IsInteractive()
// EffectClientInterface implementation
int EffectInvert::GetAudioInCount()
unsigned EffectInvert::GetAudioInCount()
{
return 1;
}
int EffectInvert::GetAudioOutCount()
unsigned EffectInvert::GetAudioOutCount()
{
return 1;
}

View File

@ -37,8 +37,8 @@ public:
// EffectClientInterface implementation
int GetAudioInCount() override;
int GetAudioOutCount() override;
unsigned GetAudioInCount() override;
unsigned GetAudioOutCount() override;
sampleCount ProcessBlock(float **inBlock, float **outBlock, sampleCount blockLen) override;
};

View File

@ -92,12 +92,12 @@ EffectType EffectLeveller::GetType()
// EffectClientInterface implementation
int EffectLeveller::GetAudioInCount()
unsigned EffectLeveller::GetAudioInCount()
{
return 1;
}
int EffectLeveller::GetAudioOutCount()
unsigned EffectLeveller::GetAudioOutCount()
{
return 1;
}

View File

@ -37,8 +37,8 @@ public:
// EffectClientInterface implementation
int GetAudioInCount() override;
int GetAudioOutCount() override;
unsigned GetAudioInCount() override;
unsigned GetAudioOutCount() override;
sampleCount ProcessBlock(float **inBlock, float **outBlock, sampleCount blockLen) override;
bool GetAutomationParameters(EffectAutomationParameters & parms) override;
bool SetAutomationParameters(EffectAutomationParameters & parms) override;

View File

@ -87,7 +87,7 @@ EffectType EffectNoise::GetType()
// EffectClientInterface implementation
int EffectNoise::GetAudioOutCount()
unsigned EffectNoise::GetAudioOutCount()
{
return 1;
}

View File

@ -40,7 +40,7 @@ public:
// EffectClientInterface implementation
int GetAudioOutCount() override;
unsigned GetAudioOutCount() override;
sampleCount ProcessBlock(float **inBlock, float **outBlock, sampleCount blockLen) override;
bool GetAutomationParameters(EffectAutomationParameters & parms) override;
bool SetAutomationParameters(EffectAutomationParameters & parms) override;

View File

@ -130,12 +130,12 @@ bool EffectPhaser::SupportsRealtime()
// EffectClientInterface implementation
int EffectPhaser::GetAudioInCount()
unsigned EffectPhaser::GetAudioInCount()
{
return 1;
}
int EffectPhaser::GetAudioOutCount()
unsigned EffectPhaser::GetAudioOutCount()
{
return 1;
}
@ -165,7 +165,7 @@ bool EffectPhaser::RealtimeInitialize()
return true;
}
bool EffectPhaser::RealtimeAddProcessor(int WXUNUSED(numChannels), float sampleRate)
bool EffectPhaser::RealtimeAddProcessor(unsigned WXUNUSED(numChannels), float sampleRate)
{
EffectPhaserState slave;

View File

@ -64,12 +64,12 @@ public:
// EffectClientInterface implementation
int GetAudioInCount() override;
int GetAudioOutCount() override;
unsigned GetAudioInCount() override;
unsigned GetAudioOutCount() override;
bool ProcessInitialize(sampleCount totalLen, ChannelNames chanMap = NULL) override;
sampleCount ProcessBlock(float **inBlock, float **outBlock, sampleCount blockLen) override;
bool RealtimeInitialize() override;
bool RealtimeAddProcessor(int numChannels, float sampleRate) override;
bool RealtimeAddProcessor(unsigned numChannels, float sampleRate) override;
bool RealtimeFinalize() override;
sampleCount RealtimeProcess(int group,
float **inbuf,

View File

@ -149,12 +149,12 @@ EffectType EffectReverb::GetType()
// EffectClientInterface implementation
int EffectReverb::GetAudioInCount()
unsigned EffectReverb::GetAudioInCount()
{
return mParams.mStereoWidth ? 2 : 1;
}
int EffectReverb::GetAudioOutCount()
unsigned EffectReverb::GetAudioOutCount()
{
return mParams.mStereoWidth ? 2 : 1;
}

View File

@ -57,8 +57,8 @@ public:
// EffectClientInterface implementation
int GetAudioInCount() override;
int GetAudioOutCount() override;
unsigned GetAudioInCount() override;
unsigned GetAudioOutCount() override;
bool ProcessInitialize(sampleCount totalLen, ChannelNames chanMap = NULL) override;
bool ProcessFinalize() override;
sampleCount ProcessBlock(float **inBlock, float **outBlock, sampleCount blockLen) override;
@ -96,7 +96,7 @@ private:
#undef SpinSliderHandlers
private:
int mNumChans;
unsigned mNumChans {};
Reverb_priv_t *mP;
Params mParams;

View File

@ -205,12 +205,12 @@ EffectType EffectScienFilter::GetType()
// EffectClientInterface implementation
int EffectScienFilter::GetAudioInCount()
unsigned EffectScienFilter::GetAudioInCount()
{
return 1;
}
int EffectScienFilter::GetAudioOutCount()
unsigned EffectScienFilter::GetAudioOutCount()
{
return 1;
}

View File

@ -52,8 +52,8 @@ public:
// EffectClientInterface implementation
int GetAudioInCount() override;
int GetAudioOutCount() override;
unsigned GetAudioInCount() override;
unsigned GetAudioOutCount() override;
bool ProcessInitialize(sampleCount totalLen, ChannelNames chanMap = NULL) override;
sampleCount ProcessBlock(float **inBlock, float **outBlock, sampleCount blockLen) override;
bool GetAutomationParameters(EffectAutomationParameters & parms) override;

View File

@ -56,12 +56,12 @@ bool EffectStereoToMono::IsInteractive()
// EffectClientInterface implementation
int EffectStereoToMono::GetAudioInCount()
unsigned EffectStereoToMono::GetAudioInCount()
{
return 2;
}
int EffectStereoToMono::GetAudioOutCount()
unsigned EffectStereoToMono::GetAudioOutCount()
{
return 1;
}

View File

@ -35,8 +35,8 @@ public:
// EffectClientInterface implementation
int GetAudioInCount() override;
int GetAudioOutCount() override;
unsigned GetAudioInCount() override;
unsigned GetAudioOutCount() override;
// Effect implementation

View File

@ -142,7 +142,7 @@ EffectType EffectToneGen::GetType()
// EffectClientInterface implementation
int EffectToneGen::GetAudioOutCount()
unsigned EffectToneGen::GetAudioOutCount()
{
return 1;
}

View File

@ -42,7 +42,7 @@ public:
// EffectClientInterface implementation
int GetAudioOutCount() override;
unsigned GetAudioOutCount() override;
bool ProcessInitialize(sampleCount totalLen, ChannelNames chanMap = NULL) override;
sampleCount ProcessBlock(float **inBlock, float **outBlock, sampleCount blockLen) override;
bool GetAutomationParameters(EffectAutomationParameters & parms) override;

View File

@ -1306,12 +1306,12 @@ bool VSTEffect::SetHost(EffectHostInterface *host)
return true;
}
int VSTEffect::GetAudioInCount()
unsigned VSTEffect::GetAudioInCount()
{
return mAudioIns;
}
int VSTEffect::GetAudioOutCount()
unsigned VSTEffect::GetAudioOutCount()
{
return mAudioOuts;
}
@ -1410,12 +1410,12 @@ sampleCount VSTEffect::ProcessBlock(float **inBlock, float **outBlock, sampleCou
return blockLen;
}
int VSTEffect::GetChannelCount()
unsigned VSTEffect::GetChannelCount()
{
return mNumChannels;
}
void VSTEffect::SetChannelCount(int numChannels)
void VSTEffect::SetChannelCount(unsigned numChannels)
{
mNumChannels = numChannels;
}
@ -1438,7 +1438,7 @@ bool VSTEffect::RealtimeInitialize()
return ProcessInitialize(0, NULL);
}
bool VSTEffect::RealtimeAddProcessor(int numChannels, float sampleRate)
bool VSTEffect::RealtimeAddProcessor(unsigned numChannels, float sampleRate)
{
VSTEffect *slave = new VSTEffect(mPath, this);
mSlaves.Add(slave);

View File

@ -99,8 +99,8 @@ class VSTEffect final : public wxEvtHandler,
bool SetHost(EffectHostInterface *host) override;
int GetAudioInCount() override;
int GetAudioOutCount() override;
unsigned GetAudioInCount() override;
unsigned GetAudioOutCount() override;
int GetMidiInCount() override;
int GetMidiOutCount() override;
@ -117,7 +117,7 @@ class VSTEffect final : public wxEvtHandler,
sampleCount ProcessBlock(float **inBlock, float **outBlock, sampleCount blockLen) override;
bool RealtimeInitialize() override;
bool RealtimeAddProcessor(int numChannels, float sampleRate) override;
bool RealtimeAddProcessor(unsigned numChannels, float sampleRate) override;
bool RealtimeFinalize() override;
bool RealtimeSuspend() override;
bool RealtimeResume() override;
@ -183,8 +183,8 @@ private:
static int b64decode(const wxString &in, void *out);
// Realtime
int GetChannelCount();
void SetChannelCount(int numChannels);
unsigned GetChannelCount();
void SetChannelCount(unsigned numChannels);
// UI
void OnSlider(wxCommandEvent & evt);
@ -262,8 +262,8 @@ private:
EffectHostInterface *mHost;
PluginID mID;
wxString mPath;
int mAudioIns;
int mAudioOuts;
unsigned mAudioIns;
unsigned mAudioOuts;
int mMidiIns;
int mMidiOuts;
bool mAutomatable;
@ -328,7 +328,7 @@ private:
// Realtime processing
VSTEffect *mMaster; // non-NULL if a slave
VSTEffectArray mSlaves;
int mNumChannels;
unsigned mNumChannels;
float **mMasterIn;
float **mMasterOut;
sampleCount mNumSamples;

View File

@ -121,12 +121,12 @@ bool EffectWahwah::SupportsRealtime()
// EffectClientInterface implementation
int EffectWahwah::GetAudioInCount()
unsigned EffectWahwah::GetAudioInCount()
{
return 1;
}
int EffectWahwah::GetAudioOutCount()
unsigned EffectWahwah::GetAudioOutCount()
{
return 1;
}
@ -157,7 +157,7 @@ bool EffectWahwah::RealtimeInitialize()
return true;
}
bool EffectWahwah::RealtimeAddProcessor(int WXUNUSED(numChannels), float sampleRate)
bool EffectWahwah::RealtimeAddProcessor(unsigned WXUNUSED(numChannels), float sampleRate)
{
EffectWahwahState slave;

View File

@ -61,12 +61,12 @@ public:
// EffectClientInterface implementation
int GetAudioInCount() override;
int GetAudioOutCount() override;
unsigned GetAudioInCount() override;
unsigned GetAudioOutCount() override;
bool ProcessInitialize(sampleCount totalLen, ChannelNames chanMap = NULL) override;
sampleCount ProcessBlock(float **inBlock, float **outBlock, sampleCount blockLen) override;
bool RealtimeInitialize() override;
bool RealtimeAddProcessor(int numChannels, float sampleRate) override;
bool RealtimeAddProcessor(unsigned numChannels, float sampleRate) override;
bool RealtimeFinalize() override;
sampleCount RealtimeProcess(int group,
float **inbuf,

View File

@ -1167,12 +1167,12 @@ bool AudioUnitEffect::SetHost(EffectHostInterface *host)
return true;
}
int AudioUnitEffect::GetAudioInCount()
unsigned AudioUnitEffect::GetAudioInCount()
{
return mAudioIns;
}
int AudioUnitEffect::GetAudioOutCount()
unsigned AudioUnitEffect::GetAudioOutCount()
{
return mAudioOuts;
}
@ -1361,7 +1361,7 @@ bool AudioUnitEffect::RealtimeInitialize()
return ProcessInitialize(0);
}
bool AudioUnitEffect::RealtimeAddProcessor(int numChannels, float sampleRate)
bool AudioUnitEffect::RealtimeAddProcessor(unsigned numChannels, float sampleRate)
{
auto slave = make_movable<AudioUnitEffect>(mPath, mName, mComponent, this);
if (!slave->SetHost(NULL))
@ -2114,12 +2114,12 @@ bool AudioUnitEffect::CopyParameters(AudioUnit srcUnit, AudioUnit dstUnit)
return true;
}
int AudioUnitEffect::GetChannelCount()
unsigned AudioUnitEffect::GetChannelCount()
{
return mNumChannels;
}
void AudioUnitEffect::SetChannelCount(int numChannels)
void AudioUnitEffect::SetChannelCount(unsigned numChannels)
{
mNumChannels = numChannels;
}

View File

@ -72,8 +72,8 @@ public:
bool SetHost(EffectHostInterface *host) override;
int GetAudioInCount() override;
int GetAudioOutCount() override;
unsigned GetAudioInCount() override;
unsigned GetAudioOutCount() override;
int GetMidiInCount() override;
int GetMidiOutCount() override;
@ -90,7 +90,7 @@ public:
sampleCount ProcessBlock(float **inBlock, float **outBlock, sampleCount blockLen) override;
bool RealtimeInitialize() override;
bool RealtimeAddProcessor(int numChannels, float sampleRate) override;
bool RealtimeAddProcessor(unsigned numChannels, float sampleRate) override;
bool RealtimeFinalize() override;
bool RealtimeSuspend() override;
bool RealtimeResume() override;
@ -137,8 +137,8 @@ private:
bool CopyParameters(AudioUnit srcUnit, AudioUnit dstUnit);
// Realtime
int GetChannelCount();
void SetChannelCount(int numChannels);
unsigned GetChannelCount();
void SetChannelCount(unsigned numChannels);
static OSStatus RenderCallback(void *inRefCon,
AudioUnitRenderActionFlags *inActionFlags,
@ -181,7 +181,7 @@ private:
bool mSupportsStereo;
EffectHostInterface *mHost;
int mAudioIns;
unsigned mAudioIns;
int mAudioOuts;
bool mInteractive;
bool mLatencyDone;
@ -205,7 +205,7 @@ private:
AudioUnitEffect *mMaster; // non-NULL if a slave
AudioUnitEffectArray mSlaves;
int mNumChannels;
unsigned mNumChannels;
float **mMasterIn;
float **mMasterOut;
sampleCount mNumSamples;

View File

@ -866,12 +866,12 @@ bool LadspaEffect::SetHost(EffectHostInterface *host)
return true;
}
int LadspaEffect::GetAudioInCount()
unsigned LadspaEffect::GetAudioInCount()
{
return mAudioIns;
}
int LadspaEffect::GetAudioOutCount()
unsigned LadspaEffect::GetAudioOutCount()
{
return mAudioOuts;
}
@ -974,7 +974,7 @@ bool LadspaEffect::RealtimeInitialize()
return true;
}
bool LadspaEffect::RealtimeAddProcessor(int WXUNUSED(numChannels), float sampleRate)
bool LadspaEffect::RealtimeAddProcessor(unsigned WXUNUSED(numChannels), float sampleRate)
{
LADSPA_Handle slave = InitInstance(sampleRate);
if (!slave)

View File

@ -67,8 +67,8 @@ public:
bool SetHost(EffectHostInterface *host) override;
int GetAudioInCount() override;
int GetAudioOutCount() override;
unsigned GetAudioInCount() override;
unsigned GetAudioOutCount() override;
int GetMidiInCount() override;
int GetMidiOutCount() override;
@ -85,7 +85,7 @@ public:
sampleCount ProcessBlock(float **inBlock, float **outBlock, sampleCount blockLen) override;
bool RealtimeInitialize() override;
bool RealtimeAddProcessor(int numChannels, float sampleRate) override;
bool RealtimeAddProcessor(unsigned numChannels, float sampleRate) override;
bool RealtimeFinalize() override;
bool RealtimeSuspend() override;
bool RealtimeResume() override;
@ -162,10 +162,10 @@ private:
bool mInteractive;
int mAudioIns;
unsigned mAudioIns;
unsigned long *mInputPorts;
int mAudioOuts;
unsigned mAudioOuts;
unsigned long *mOutputPorts;
int mNumInputControls;

View File

@ -702,14 +702,14 @@ bool LV2Effect::SetHost(EffectHostInterface *host)
return true;
}
int LV2Effect::GetAudioInCount()
unsigned LV2Effect::GetAudioInCount()
{
return (int) mAudioInputs.GetCount();
return mAudioInputs.GetCount();
}
int LV2Effect::GetAudioOutCount()
unsigned LV2Effect::GetAudioOutCount()
{
return (int) mAudioOutputs.GetCount();
return mAudioOutputs.GetCount();
}
int LV2Effect::GetMidiInCount()
@ -943,7 +943,7 @@ sampleCount LV2Effect::RealtimeProcess(int group,
return numSamples;
}
bool LV2Effect::RealtimeAddProcessor(int WXUNUSED(numChannels), float sampleRate)
bool LV2Effect::RealtimeAddProcessor(unsigned WXUNUSED(numChannels), float sampleRate)
{
LilvInstance *slave = InitInstance(sampleRate);
if (!slave)

View File

@ -122,8 +122,8 @@ public:
bool SetHost(EffectHostInterface *host) override;
int GetAudioInCount() override;
int GetAudioOutCount() override;
unsigned GetAudioInCount() override;
unsigned GetAudioOutCount() override;
int GetMidiInCount() override;
int GetMidiOutCount() override;
@ -140,7 +140,7 @@ public:
sampleCount ProcessBlock(float **inbuf, float **outbuf, sampleCount size) override;
bool RealtimeInitialize() override;
bool RealtimeAddProcessor(int numChannels, float sampleRate) override;
bool RealtimeAddProcessor(unsigned numChannels, float sampleRate) override;
bool RealtimeFinalize() override;
bool RealtimeSuspend() override;
bool RealtimeResume() override;

View File

@ -1156,9 +1156,7 @@ bool NyquistEffect::ProcessOne()
return false;
}
int outChannels;
outChannels = nyx_get_audio_num_channels();
auto outChannels = nyx_get_audio_num_channels();
if (outChannels > mCurNumChannels) {
wxMessageBox(_("Nyquist returned too many audio channels.\n"),
wxT("Nyquist"),

View File

@ -205,7 +205,7 @@ private:
int mVersion;
NyqControlArray mControls;
int mCurNumChannels;
unsigned mCurNumChannels;
WaveTrack *mCurTrack[2];
sampleCount mCurStart[2];
sampleCount mCurLen;
@ -213,8 +213,8 @@ private:
int mTrackIndex;
bool mFirstInGroup;
double mOutputTime;
int mCount;
int mNumSelectedChannels;
unsigned mCount;
unsigned mNumSelectedChannels;
double mProgressIn;
double mProgressOut;
double mProgressTot;

View File

@ -184,7 +184,7 @@ bool VampEffect::IsDefault()
// EffectClientInterface implementation
int VampEffect::GetAudioInCount()
unsigned VampEffect::GetAudioInCount()
{
return mPlugin->getMaxChannelCount();
}
@ -400,7 +400,7 @@ bool VampEffect::Process()
WaveTrack *left = (WaveTrack *)iter.First();
bool multiple = false;
int prevTrackChannels = 0;
unsigned prevTrackChannels = 0;
if (GetNumWaveGroups() > 1)
{
@ -420,7 +420,7 @@ bool VampEffect::Process()
GetSamples(left, &lstart, &len);
WaveTrack *right = NULL;
int channels = 1;
unsigned channels = 1;
if (left->GetLinked())
{

View File

@ -59,7 +59,7 @@ public:
// EffectClientInterface implementation
int GetAudioInCount() override;
unsigned GetAudioInCount() override;
bool GetAutomationParameters(EffectAutomationParameters & parms) override;
bool SetAutomationParameters(EffectAutomationParameters & parms) override;

View File

@ -140,7 +140,7 @@ void ExportPlugin::SetMask(const wxString & mask, int index)
mFormatInfos[index].mMask = mask;
}
void ExportPlugin::SetMaxChannels(int maxchannels, int index)
void ExportPlugin::SetMaxChannels(unsigned maxchannels, unsigned index)
{
mFormatInfos[index].mMaxChannels = maxchannels;
}
@ -188,7 +188,7 @@ wxString ExportPlugin::GetMask(int index)
return mask;
}
int ExportPlugin::GetMaxChannels(int index)
unsigned ExportPlugin::GetMaxChannels(int index)
{
return mFormatInfos[index].mMaxChannels;
}
@ -240,7 +240,7 @@ wxWindow *ExportPlugin::OptionsCreate(wxWindow *parent, int WXUNUSED(format))
std::unique_ptr<Mixer> ExportPlugin::CreateMixer(const WaveTrackConstArray &inputTracks,
const TimeTrack *timeTrack,
double startTime, double stopTime,
int numOutChannels, int outBufferSize, bool outInterleaved,
unsigned numOutChannels, int outBufferSize, bool outInterleaved,
double outRate, sampleFormat outFormat,
bool highQuality, MixerSpec *mixerSpec)
{
@ -369,7 +369,7 @@ bool Exporter::Process(AudacityProject *project, bool selectedOnly, double t0, d
return success;
}
bool Exporter::Process(AudacityProject *project, int numChannels,
bool Exporter::Process(AudacityProject *project, unsigned numChannels,
const wxChar *type, const wxString & filename,
bool selectedOnly, double t0, double t1)
{
@ -747,11 +747,11 @@ bool Exporter::CheckMix()
else {
mChannels = 1;
}
if (mChannels > mPlugins[mFormat]->GetMaxChannels(mSubFormat))
mChannels = mPlugins[mFormat]->GetMaxChannels(mSubFormat);
mChannels = std::min(mChannels,
mPlugins[mFormat]->GetMaxChannels(mSubFormat));
int numLeft = mNumLeft + mNumMono;
int numRight = mNumRight + mNumMono;
auto numLeft = mNumLeft + mNumMono;
auto numRight = mNumRight + mNumMono;
if (numLeft > 1 || numRight > 1 || mNumLeft + mNumRight + mNumMono > mChannels) {
wxString exportFormat = mPlugins[mFormat]->GetFormat(mSubFormat);
@ -783,7 +783,7 @@ bool Exporter::CheckMix()
}
else
{
if (exportedChannels == -1)
if (exportedChannels < 0)
exportedChannels = mPlugins[mFormat]->GetMaxChannels(mSubFormat);
ExportMixerDialog md(mProject->GetTracks(),
@ -1225,13 +1225,13 @@ BEGIN_EVENT_TABLE( ExportMixerDialog, wxDialogWrapper )
END_EVENT_TABLE()
ExportMixerDialog::ExportMixerDialog( const TrackList *tracks, bool selectedOnly,
int maxNumChannels, wxWindow *parent, wxWindowID id, const wxString &title,
unsigned maxNumChannels, wxWindow *parent, wxWindowID id, const wxString &title,
const wxPoint &position, const wxSize& size, long style ) :
wxDialogWrapper( parent, id, title, position, size, style | wxRESIZE_BORDER )
{
SetName(GetTitle());
int numTracks = 0;
unsigned numTracks = 0;
TrackListConstIterator iter( tracks );
for( const Track *t = iter.First(); t; t = iter.Next() )

View File

@ -44,7 +44,7 @@ class AUDACITY_DLL_API FormatInfo
// wxString mExtension;
wxArrayString mExtensions;
wxString mMask;
int mMaxChannels;
unsigned mMaxChannels;
bool mCanMetaData;
};
@ -66,7 +66,7 @@ public:
void AddExtension(const wxString &extension,int index);
void SetExtensions(const wxArrayString & extensions, int index);
void SetMask(const wxString & mask, int index);
void SetMaxChannels(int maxchannels, int index);
void SetMaxChannels(unsigned maxchannels, unsigned index);
void SetCanMetaData(bool canmetadata, int index);
virtual int GetFormatCount();
@ -79,7 +79,7 @@ public:
* @param index the sub-format for which the extension is required */
virtual wxArrayString GetExtensions(int index = 0);
virtual wxString GetMask(int index);
virtual int GetMaxChannels(int index);
virtual unsigned GetMaxChannels(int index);
virtual bool GetCanMetaData(int index);
virtual bool IsExtension(const wxString & ext, int index);
@ -109,7 +109,7 @@ public:
* respectively.
*/
virtual int Export(AudacityProject *project,
int channels,
unsigned channels,
const wxString &fName,
bool selectedOnly,
double t0,
@ -122,7 +122,7 @@ protected:
std::unique_ptr<Mixer> CreateMixer(const WaveTrackConstArray &inputTracks,
const TimeTrack *timeTrack,
double startTime, double stopTime,
int numOutChannels, int outBufferSize, bool outInterleaved,
unsigned numOutChannels, int outBufferSize, bool outInterleaved,
double outRate, sampleFormat outFormat,
bool highQuality = true, MixerSpec *mixerSpec = NULL);
@ -148,7 +148,7 @@ public:
bool Process(AudacityProject *project, bool selectedOnly,
double t0, double t1);
bool Process(AudacityProject *project, int numChannels,
bool Process(AudacityProject *project, unsigned numChannels,
const wxChar *type, const wxString & filename,
bool selectedOnly, double t0, double t1);
@ -201,10 +201,10 @@ private:
int mFormat;
int mSubFormat;
int mNumSelected;
int mNumLeft;
int mNumRight;
int mNumMono;
int mChannels;
unsigned mNumLeft;
unsigned mNumRight;
unsigned mNumMono;
unsigned mChannels;
bool mSelectedOnly;
wxSimplebook *mBook;
@ -252,7 +252,7 @@ class ExportMixerDialog final : public wxDialogWrapper
{
public:
// constructors and destructors
ExportMixerDialog( const TrackList * tracks, bool selectedOnly, int maxNumChannels,
ExportMixerDialog( const TrackList * tracks, bool selectedOnly, unsigned maxNumChannels,
wxWindow *parent, wxWindowID id, const wxString &title,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,

View File

@ -284,7 +284,7 @@ public:
wxWindow *OptionsCreate(wxWindow *parent, int format);
int Export(AudacityProject *project,
int channels,
unsigned channels,
const wxString &fName,
bool selectedOnly,
double t0,
@ -306,7 +306,7 @@ ExportCL::ExportCL()
}
int ExportCL::Export(AudacityProject *project,
int channels,
unsigned channels,
const wxString &fName,
bool selectionOnly,
double t0,

View File

@ -141,7 +141,7 @@ public:
///\param subformat index of export type
///\return true if export succeded
int Export(AudacityProject *project,
int channels,
unsigned channels,
const wxString &fName,
bool selectedOnly,
double t0,
@ -162,7 +162,7 @@ private:
int mSubFormat{};
int mBitRate{};
int mSampleRate{};
int mChannels{};
unsigned mChannels{};
bool mSupportsUTF8{};
// Smart pointer fields, their order is the reverse in which they are reset in Finalize():
@ -824,7 +824,7 @@ bool ExportFFmpeg::EncodeAudioFrame(int16_t *pFrame, int frameSize)
int ExportFFmpeg::Export(AudacityProject *project,
int channels, const wxString &fName,
unsigned channels, const wxString &fName,
bool selectionOnly, double t0, double t1, MixerSpec *mixerSpec, const Tags *metadata, int subformat)
{
if (!CheckFFmpegPresence())

View File

@ -41,7 +41,7 @@ struct ExposedFormat
const wxChar *name; //!< format name (internal, should be unique; if not - export dialog may show unusual behaviour)
const wxChar *extension; //!< default extension for this format. More extensions may be added later via AddExtension.
const wxChar *shortname; //!< used to guess the format
int maxchannels; //!< how much channels this format could handle
unsigned maxchannels; //!< how many channels this format could handle
int canmetadata; //!< !=0 if format supports metadata, -1 any avformat version, otherwise version support added
bool canutf8; //!< true if format supports metadata in UTF-8, false otherwise
const wxChar *description; //!< format description (will be shown in export dialog)

View File

@ -183,7 +183,7 @@ public:
wxWindow *OptionsCreate(wxWindow *parent, int format);
int Export(AudacityProject *project,
int channels,
unsigned channels,
const wxString &fName,
bool selectedOnly,
double t0,
@ -213,7 +213,7 @@ ExportFLAC::ExportFLAC()
}
int ExportFLAC::Export(AudacityProject *project,
int numChannels,
unsigned numChannels,
const wxString &fName,
bool selectionOnly,
double t0,

View File

@ -174,7 +174,7 @@ public:
wxWindow *OptionsCreate(wxWindow *parent, int format);
int Export(AudacityProject *project,
int channels,
unsigned channels,
const wxString &fName,
bool selectedOnly,
double t0,
@ -204,7 +204,7 @@ ExportMP2::ExportMP2()
}
int ExportMP2::Export(AudacityProject *project,
int channels, const wxString &fName,
unsigned channels, const wxString &fName,
bool selectionOnly, double t0, double t1, MixerSpec *mixerSpec, const Tags *metadata,
int WXUNUSED(subformat))
{

View File

@ -836,7 +836,7 @@ public:
wxString GetLibraryTypeString();
/* returns the number of samples PER CHANNEL to send for each call to EncodeBuffer */
int InitializeStream(int channels, int sampleRate);
int InitializeStream(unsigned channels, int sampleRate);
/* In bytes. must be called AFTER InitializeStream */
int GetOutBufferSize();
@ -1210,7 +1210,7 @@ wxString MP3Exporter::GetLibraryVersion()
return wxString::Format(wxT("LAME %hs"), get_lame_version());
}
int MP3Exporter::InitializeStream(int channels, int sampleRate)
int MP3Exporter::InitializeStream(unsigned channels, int sampleRate)
{
#ifndef DISABLE_DYNAMIC_LOADING_LAME
if (!mLibraryLoaded) {
@ -1588,7 +1588,7 @@ public:
wxWindow *OptionsCreate(wxWindow *parent, int format);
int Export(AudacityProject *project,
int channels,
unsigned channels,
const wxString &fName,
bool selectedOnly,
double t0,
@ -1648,7 +1648,7 @@ int ExportMP3::SetNumExportChannels()
int ExportMP3::Export(AudacityProject *project,
int channels,
unsigned channels,
const wxString &fName,
bool selectionOnly,
double t0,

View File

@ -643,7 +643,7 @@ int ExportMultiple::ExportMultipleByLabel(bool byName,
}
// Figure out how many channels we should export.
int channels = mTracks->GetNumExportChannels(false);
auto channels = mTracks->GetNumExportChannels(false);
wxArrayString otherNames; // keep track of file names we will use, so we
// don't duplicate them
@ -932,7 +932,7 @@ int ExportMultiple::ExportMultipleByTrack(bool byName,
return ok ;
}
int ExportMultiple::DoExport(int channels,
int ExportMultiple::DoExport(unsigned channels,
const wxFileName &inName,
bool selectedOnly,
double t0,

View File

@ -73,7 +73,7 @@ private:
* @param t1 End time for export
* @param tags Metadata to include in the file (if possible).
*/
int DoExport(int channels,
int DoExport(unsigned channels,
const wxFileName &name,
bool selectedOnly,
double t0,
@ -196,7 +196,7 @@ private:
wxFileName destfile; /**< The file to export to */
double t0; /**< Start time for the export */
double t1; /**< End time for the export */
int channels; /**< Number of channels for ExportMultipleByTrack */
unsigned channels; /**< Number of channels for ExportMultipleByTrack */
}; // end of ExportKit declaration
/* we are going to want an set of these kits, and don't know how many until
* runtime. I would dearly like to use a std::vector, but it seems that

View File

@ -133,7 +133,7 @@ public:
wxWindow *OptionsCreate(wxWindow *parent, int format) override;
int Export(AudacityProject *project,
int channels,
unsigned channels,
const wxString &fName,
bool selectedOnly,
double t0,
@ -159,7 +159,7 @@ ExportOGG::ExportOGG()
}
int ExportOGG::Export(AudacityProject *project,
int numChannels,
unsigned numChannels,
const wxString &fName,
bool selectionOnly,
double t0,

View File

@ -314,7 +314,7 @@ public:
wxWindow *OptionsCreate(wxWindow *parent, int format);
int Export(AudacityProject *project,
int channels,
unsigned channels,
const wxString &fName,
bool selectedOnly,
double t0,
@ -351,7 +351,8 @@ ExportPCM::ExportPCM()
format = AddFormat() - 1;
si.format = kFormats[i].format;
for (si.channels = 1; sf_format_check(&si); si.channels++){};
for (si.channels = 1; sf_format_check(&si); si.channels++)
;
wxString ext = sf_header_extension(si.format);
SetFormat(kFormats[i].name, format);
@ -384,7 +385,7 @@ ExportPCM::ExportPCM()
* file type, or giving the user full control over libsndfile.
*/
int ExportPCM::Export(AudacityProject *project,
int numChannels,
unsigned numChannels,
const wxString &fName,
bool selectionOnly,
double t0,
@ -476,6 +477,7 @@ int ExportPCM::Export(AudacityProject *project,
const WaveTrackConstArray waveTracks =
tracks->GetWaveTrackConstArray(selectionOnly, false);
{
wxASSERT(info.channels >= 0);
auto mixer = CreateMixer(waveTracks,
tracks->GetTimeTrack(),
t0, t1,

View File

@ -151,7 +151,7 @@ int FormatClassifier::GetResultFormatLibSndfile()
return format;
}
int FormatClassifier::GetResultChannels()
unsigned FormatClassifier::GetResultChannels()
{
return mResultChannels;
}

View File

@ -90,7 +90,7 @@ private:
float* mStereoFeat;
FormatClassT mResultFormat;
int mResultChannels;
unsigned mResultChannels { 0 };
public:
FormatClassifier(const char* filename);
@ -98,7 +98,7 @@ public:
FormatClassT GetResultFormat();
int GetResultFormatLibSndfile();
int GetResultChannels();
unsigned GetResultChannels();
private:
void Run();
void ReadSignal(FormatClassT format, size_t stride);

View File

@ -130,7 +130,7 @@ struct GStreamContext
GstElement *mSink{}; // Application sink
bool mUse{}; // True if this stream should be imported
TrackHolders mChannels; // Array of WaveTrack pointers, one for each channel
gint mNumChannels{}; // Number of channels
unsigned mNumChannels{}; // Number of channels
gdouble mSampleRate{}; // Sample rate
GstString mType; // Audio type
sampleFormat mFmt{ floatSample }; // Sample format
@ -762,7 +762,7 @@ GStreamerImportFileHandle::OnNewSample(GStreamContext *c, GstSample *sample)
// Allocate the track array
c->mChannels.resize(c->mNumChannels);
if (gint(c->mChannels.size()) != c->mNumChannels)
if (c->mChannels.size() != c->mNumChannels)
{
WARN(mPipeline.get(), ("OnNewSample: unable to allocate track array"));
return;
@ -811,7 +811,7 @@ GStreamerImportFileHandle::OnNewSample(GStreamContext *c, GstSample *sample)
});
// Cache a few items
int nChannels = c->mNumChannels;
auto nChannels = c->mNumChannels;
sampleFormat fmt = c->mFmt;
samplePtr data = (samplePtr) info.data;
sampleCount samples = info.size / nChannels / SAMPLE_SIZE(fmt);
@ -1127,11 +1127,11 @@ GStreamerImportFileHandle::Import(TrackFactory *trackFactory,
return updateResult;
}
// Grah the streams lock
// Grab the streams lock
g_mutex_locker locker{ mStreamsLock };
// Count the total number of tracks collected
int outNumTracks = 0;
unsigned outNumTracks = 0;
for (guint s = 0; s < mStreams.size(); s++)
{
GStreamContext *c = mStreams[s].get();

View File

@ -98,7 +98,7 @@ struct private_data {
TrackFactory *trackFactory;
TrackHolders channels;
ProgressDialog *progress;
int numChannels;
unsigned numChannels;
int updateResult;
bool id3checked;
};
@ -455,12 +455,12 @@ enum mad_flow output_cb(void *_data,
struct mad_header const * WXUNUSED(header),
struct mad_pcm *pcm)
{
int channels, samplerate;
int samplerate;
struct private_data *data = (struct private_data *)_data;
int smpl;
samplerate= pcm->samplerate;
channels = pcm->channels;
auto channels = pcm->channels;
const auto samples = pcm->length;
/* If this is the first run, we need to create the WaveTracks that

View File

@ -109,7 +109,7 @@ public:
private:
SFFile mFile;
SF_INFO mInfo;
const SF_INFO mInfo;
sampleFormat mFormat;
};
@ -194,6 +194,8 @@ PCMImportFileHandle::PCMImportFileHandle(wxString name,
mFile(std::move(file)),
mInfo(info)
{
wxASSERT(info.channels >= 0);
//
// Figure out the format to use.
//
@ -432,6 +434,8 @@ int PCMImportFileHandle::Import(TrackFactory *trackFactory,
// PRL: guard against excessive memory buffer allocation in case of many channels
using type = decltype(maxBlockSize);
if (mInfo.channels < 1)
return eProgressFailed;
auto maxBlock = std::min(maxBlockSize,
std::numeric_limits<type>::max() /
(mInfo.channels * SAMPLE_SIZE(mFormat))
@ -440,6 +444,7 @@ int PCMImportFileHandle::Import(TrackFactory *trackFactory,
return eProgressFailed;
SampleBuffer srcbuffer;
wxASSERT(mInfo.channels >= 0);
while (NULL == srcbuffer.Allocate(maxBlock * mInfo.channels, mFormat).ptr())
{
maxBlock >>= 1;

View File

@ -240,7 +240,6 @@ int QTImportFileHandle::Import(TrackFactory *trackFactory,
UInt32 quality = kQTAudioRenderQuality_Max;
AudioStreamBasicDescription desc;
UInt32 maxSampleSize;
UInt32 numchan;
UInt32 bufsize;
bool res = false;
@ -296,7 +295,7 @@ int QTImportFileHandle::Import(TrackFactory *trackFactory,
break;
}
numchan = desc.mChannelsPerFrame;
auto numchan = desc.mChannelsPerFrame;
bufsize = 5 * desc.mSampleRate;
// determine sample format

View File

@ -50,7 +50,7 @@ and sample size to help you importing data of an unknown format.
#include <wx/textctrl.h>
#include <wx/timer.h>
#include "RawAudioGuess.h"
// #include "RawAudioGuess.h"
#include "MultiFormatReader.h"
#include "SpecPowerMeter.h"
#include "FormatClassifier.h"
@ -61,7 +61,7 @@ class ImportRawDialog final : public wxDialogWrapper {
public:
ImportRawDialog(wxWindow * parent,
int encoding, int channels,
int encoding, unsigned channels,
int offset, double rate);
~ImportRawDialog();
@ -72,7 +72,7 @@ class ImportRawDialog final : public wxDialogWrapper {
// in and out
int mEncoding;
int mChannels;
unsigned mChannels;
int mOffset;
double mRate;
double mPercent;
@ -109,7 +109,7 @@ void ImportRaw(wxWindow *parent, const wxString &fileName,
SF_INFO sndInfo;
int result;
int numChannels = 0;
unsigned numChannels = 0;
try {
// Yes, FormatClassifier currently handles filenames in UTF8 format only, that's
@ -131,6 +131,7 @@ void ImportRaw(wxWindow *parent, const wxString &fileName,
offset = 0;
}
numChannels = std::max(1u, numChannels);
ImportRawDialog dlog(parent, encoding, numChannels, (int)offset, rate);
dlog.ShowModal();
if (!dlog.GetReturnCode())
@ -197,7 +198,7 @@ void ImportRaw(wxWindow *parent, const wxString &fileName,
channels.resize(numChannels);
auto iter = channels.begin();
for (int c = 0; c < numChannels; ++iter, ++c) {
for (decltype(numChannels) c = 0; c < numChannels; ++iter, ++c) {
const auto channel =
(*iter = trackFactory->NewWaveTrack(format, rate)).get();
@ -261,7 +262,7 @@ void ImportRaw(wxWindow *parent, const wxString &fileName,
if (block) {
auto iter = channels.begin();
for(int c=0; c<numChannels; ++iter, ++c) {
for(decltype(numChannels) c = 0; c < numChannels; ++iter, ++c) {
if (format==int16Sample) {
for(decltype(block) j=0; j<block; j++)
((short *)buffer.ptr())[j] =
@ -313,7 +314,7 @@ BEGIN_EVENT_TABLE(ImportRawDialog, wxDialogWrapper)
END_EVENT_TABLE()
ImportRawDialog::ImportRawDialog(wxWindow * parent,
int encoding, int channels,
int encoding, unsigned channels,
int offset, double rate)
: wxDialogWrapper(parent, wxID_ANY, _("Import Raw Data"),
wxDefaultPosition, wxDefaultSize,
@ -323,6 +324,8 @@ ImportRawDialog::ImportRawDialog(wxWindow * parent,
mOffset(offset),
mRate(rate)
{
wxASSERT(channels >= 1);
SetName(GetTitle());
ShuttleGui S(this, eIsCreating);

View File

@ -287,7 +287,7 @@ static void Extract(bool bits16,
}
static int GuessFloatFormats(int numTests, char **rawData, int dataSize,
int *out_offset, int *out_channels)
int *out_offset, unsigned *out_channels)
{
int format;
int bestOffset = 0;
@ -521,7 +521,7 @@ static int GuessFloatFormats(int numTests, char **rawData, int dataSize,
return format;
}
static int Guess8Bit(int numTests, char **rawData, int dataSize, int *out_channels)
static int Guess8Bit(int numTests, char **rawData, int dataSize, unsigned *out_channels)
{
bool guessSigned = false;
bool guessStereo = false;
@ -681,7 +681,7 @@ static int Guess8Bit(int numTests, char **rawData, int dataSize, int *out_channe
static int Guess16Bit(int numTests, char **rawData,
int dataSize, bool evenMSB,
int *out_offset, int *out_channels)
int *out_offset, unsigned *out_channels)
{
int format;
bool guessSigned = false;
@ -959,7 +959,7 @@ static int Guess16Bit(int numTests, char **rawData,
}
static int GuessIntFormats(int numTests, char **rawData, int dataSize,
int *out_offset, int *out_channels)
int *out_offset, unsigned *out_channels)
{
int format = SF_FORMAT_RAW;
bool guess16bit = false;
@ -1045,7 +1045,7 @@ static int GuessIntFormats(int numTests, char **rawData, int dataSize,
}
int RawAudioGuess(const wxString &in_fname,
int *out_offset, int *out_channels)
int *out_offset, unsigned *out_channels)
{
const int numTests = 11;
size_t headerSkipSize = 64;

View File

@ -25,4 +25,4 @@
SF_FORMAT value
*/
int RawAudioGuess(const wxString &in_fname,
int *out_offset, int *out_channels);
int *out_offset, unsigned *out_channels);

View File

@ -49,7 +49,7 @@ struct FFMpegDecodeCache
uint8_t* samplePtr{};//interleaved samples
sampleCount start;
sampleCount len;
int numChannels;
unsigned numChannels;
AVSampleFormat samplefmt; // input (from libav) sample format
};
@ -396,6 +396,7 @@ int ODFFmpegDecoder::Decode(SampleBuffer & data, sampleFormat & format, sampleCo
//printf("skipping/zeroing %i samples. - now:%llu (%f), last:%llu, lastlen:%llu, start %llu, len %llu\n",amt,actualDecodeStart, actualDecodeStartdouble, mCurrentPos, mCurrentLen, start, len);
//put it in the cache so the other channels can use it.
// wxASSERT(sc->m_stream->codec->channels > 0);
cache->numChannels = sc->m_stream->codec->channels;
cache->len = amt;
cache->start=start;
@ -506,7 +507,7 @@ int ODFFmpegDecoder::FillDataFromCache(samplePtr & data, sampleFormat outFormat,
if(start<mDecodeCache[i]->start && start+len > mDecodeCache[i]->start+mDecodeCache[i]->len)
continue;
int nChannels = mDecodeCache[i]->numChannels;
auto nChannels = mDecodeCache[i]->numChannels;
auto samplesHit = (
FFMIN(start+len,mDecodeCache[i]->start+mDecodeCache[i]->len)
- FFMAX(mDecodeCache[i]->start,start)
@ -602,6 +603,7 @@ int ODFFmpegDecoder::DecodeFrame(streamContext *sc, bool flushing)
//However if other ODDecode tasks need this, we should do a NEW class for caching.
auto cache = make_movable<FFMpegDecodeCache>();
//len is number of samples per channel
// wxASSERT(sc->m_stream->codec->channels > 0);
cache->numChannels = sc->m_stream->codec->channels;
cache->len = (sc->m_decodedAudioSamplesValidSiz / sc->m_samplesize) / cache->numChannels;

View File

@ -896,11 +896,11 @@ static float ToDB(float v, float range)
return ClipZeroToOne((db + range) / range);
}
void Meter::UpdateDisplay(int numChannels, int numFrames, float *sampleData)
void Meter::UpdateDisplay(unsigned numChannels, int numFrames, float *sampleData)
{
int i, j;
float *sptr = sampleData;
int num = intmin(numChannels, mNumBars);
auto num = std::min(numChannels, mNumBars);
MeterUpdateMsg msg;
memset(&msg, 0, sizeof(msg));

View File

@ -153,7 +153,7 @@ class Meter final : public wxPanelWrapper
*
* The second overload is for ease of use in MixerBoard.
*/
void UpdateDisplay(int numChannels,
void UpdateDisplay(unsigned numChannels,
int numFrames, float *sampleData);
// Vaughan, 2010-11-29: This not currently used. See comments in MixerTrackCluster::UpdateMeter().
@ -256,7 +256,7 @@ class Meter final : public wxPanelWrapper
bool mActive;
int mNumBars;
unsigned mNumBars;
MeterBar mBar[kMaxMeterBars];
bool mLayoutValid;