1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-10-24 23:33:50 +02:00

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

@@ -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;