Browse Source

Converted the BitArray class into "BigInteger", replacing its clunky old arithmetic methods with a proper set of arithmetic operators so it can be used like an int. All the bit-access methods are still there, and there's a typedef of BitArray -> BigInteger to allow most old code to still work. (You might need to change calls to isEmpty() to isZero() though). Also fixed a bug in MidiBuffer.

tags/2021-05-28
Julian Storer 15 years ago
parent
commit
8b8316038b
38 changed files with 1474 additions and 1452 deletions
  1. +13
    -11
      extras/Jucer (experimental)/Source/model/jucer_ProjectExport_MSVC.h
  2. +568
    -562
      juce_amalgamated.cpp
  3. +121
    -98
      juce_amalgamated.h
  4. +1
    -1
      src/audio/audio_sources/juce_MixerAudioSource.cpp
  5. +1
    -1
      src/audio/audio_sources/juce_MixerAudioSource.h
  6. +4
    -4
      src/audio/devices/juce_AudioDeviceManager.h
  7. +6
    -6
      src/audio/devices/juce_AudioIODevice.h
  8. +2
    -2
      src/audio/midi/juce_MidiBuffer.cpp
  9. +2
    -2
      src/audio/plugins/juce_AudioPluginFormatManager.cpp
  10. +1
    -1
      src/audio/processors/juce_AudioProcessor.h
  11. +1
    -1
      src/audio/synthesisers/juce_Sampler.cpp
  12. +2
    -2
      src/audio/synthesisers/juce_Sampler.h
  13. +3
    -3
      src/containers/juce_Array.h
  14. +402
    -357
      src/containers/juce_BitArray.cpp
  15. +155
    -171
      src/containers/juce_BitArray.h
  16. +2
    -2
      src/containers/juce_OwnedArray.h
  17. +1
    -1
      src/containers/juce_ReferenceCountedArray.h
  18. +3
    -3
      src/containers/juce_SparseSet.h
  19. +4
    -4
      src/core/juce_Random.cpp
  20. +4
    -4
      src/core/juce_Random.h
  21. +1
    -1
      src/core/juce_StandardHeader.h
  22. +72
    -87
      src/cryptography/juce_Primes.cpp
  23. +6
    -7
      src/cryptography/juce_Primes.h
  24. +27
    -49
      src/cryptography/juce_RSAKey.cpp
  25. +8
    -8
      src/cryptography/juce_RSAKey.h
  26. +1
    -1
      src/gui/components/controls/juce_TableListBox.cpp
  27. +1
    -1
      src/gui/components/controls/juce_TreeView.cpp
  28. +3
    -3
      src/gui/components/filebrowser/juce_FileBrowserComponent.cpp
  29. +1
    -1
      src/gui/components/filebrowser/juce_FileBrowserComponent.h
  30. +4
    -4
      src/gui/components/special/juce_AudioDeviceSelectorComponent.cpp
  31. +1
    -1
      src/gui/components/special/juce_MidiKeyboardComponent.h
  32. +7
    -7
      src/native/linux/juce_linux_Audio.cpp
  33. +9
    -9
      src/native/linux/juce_linux_JackAudio.cpp
  34. +5
    -5
      src/native/mac/juce_iphone_Audio.cpp
  35. +10
    -10
      src/native/mac/juce_mac_CoreAudio.cpp
  36. +6
    -6
      src/native/windows/juce_win32_ASIO.cpp
  37. +9
    -9
      src/native/windows/juce_win32_DirectSound.cpp
  38. +7
    -7
      src/native/windows/juce_win32_WASAPI.cpp

+ 13
- 11
extras/Jucer (experimental)/Source/model/jucer_ProjectExport_MSVC.h View File

@@ -626,7 +626,7 @@ private:
void writeVC6Project (OutputStream& out)
{
String defaultConfig (createConfigNameVC6 (project.getConfiguration (0)));
const String defaultConfigName (createConfigNameVC6 (project.getConfiguration (0)));
const bool isDLL = project.isAudioPlugin() || project.isBrowserPlugin();
String targetType, targetCode;
@@ -641,7 +641,7 @@ private:
<< "# Microsoft Developer Studio Generated Build File, Format Version 6.00" << newLine
<< "# ** DO NOT EDIT **" << newLine
<< "# TARGTYPE " << targetType << " " << targetCode << newLine
<< "CFG=" << defaultConfig << newLine
<< "CFG=" << defaultConfigName << newLine
<< "!MESSAGE This is not a valid makefile. To build this project using NMAKE," << newLine
<< "!MESSAGE use the Export Makefile command and run" << newLine
<< "!MESSAGE " << newLine
@@ -650,7 +650,7 @@ private:
<< "!MESSAGE You can specify a configuration when running NMAKE" << newLine
<< "!MESSAGE by defining the macro CFG on the command line. For example:" << newLine
<< "!MESSAGE " << newLine
<< "!MESSAGE NMAKE /f \"" << project.getProjectName() << ".mak\" CFG=\"" << defaultConfig << '"' << newLine
<< "!MESSAGE NMAKE /f \"" << project.getProjectName() << ".mak\" CFG=\"" << defaultConfigName << '"' << newLine
<< "!MESSAGE " << newLine
<< "!MESSAGE Possible choices for configuration are:" << newLine
<< "!MESSAGE " << newLine;
@@ -676,29 +676,31 @@ private:
const String configName (createConfigNameVC6 (config));
targetList << "# Name \"" << configName << '"' << newLine;
const String outFile (windowsStylePath (getConfigTargetPath(config) + "/" + config.getTargetBinaryName().toString() + getTargetBinarySuffix()));
const String binariesPath (getConfigTargetPath (config));
const String targetBinary (windowsStylePath (binariesPath + "/" + config.getTargetBinaryName().toString() + getTargetBinarySuffix()));
const String optimisationFlag (((int) config.getOptimisationLevel().getValue() <= 1) ? "Od" : (config.getOptimisationLevel() == 2 ? "O2" : "O3"));
const String defines (getPreprocessorDefs (config, " /D "));
const bool isDebug = (bool) config.isDebug().getValue();
const String extraDebugFlags (isDebug ? "/Gm /ZI /GZ" : "");
const String includes (getHeaderSearchPaths (config).joinIntoString (" /I "));
out << (i == 0 ? "!IF" : "!ELSEIF") << " \"$(CFG)\" == \"" << configName << '"' << newLine
<< "# PROP BASE Use_MFC 0" << newLine
<< "# PROP BASE Use_Debug_Libraries " << (isDebug ? "1" : "0") << newLine
<< "# PROP BASE Output_Dir \"" << getConfigTargetPath (config) << '"' << newLine
<< "# PROP BASE Output_Dir \"" << binariesPath << '"' << newLine
<< "# PROP BASE Intermediate_Dir \"" << getIntermediatesPath (config) << '"' << newLine
<< "# PROP BASE Target_Dir \"\"" << newLine
<< "# PROP Use_MFC 0" << newLine
<< "# PROP Use_Debug_Libraries " << (isDebug ? "1" : "0") << newLine
<< "# PROP Output_Dir \"" << getConfigTargetPath (config) << '"' << newLine
<< "# PROP Output_Dir \"" << binariesPath << '"' << newLine
<< "# PROP Intermediate_Dir \"" << getIntermediatesPath (config) << '"' << newLine
<< "# PROP Ignore_Export_Lib 0" << newLine
<< "# PROP Target_Dir \"\"" << newLine
<< "# ADD BASE CPP /nologo /W3 /GX /" << optimisationFlag << " /D " << defines
<< " /YX /FD /c " << extraDebugFlags << " /Zm1024" << newLine
<< "# ADD CPP /nologo " << (isDebug ? "/MTd" : "/MT") << " /W3 /GR /GX /" << optimisationFlag
<< " /I " << includes << " /D " << defines << " /D \"_UNICODE\" /D \"UNICODE\" /FD /c " << extraDebugFlags << " /Zm1024" << newLine;
<< " /I " << getHeaderSearchPaths (config).joinIntoString (" /I ")
<< " /D " << defines << " /D \"_UNICODE\" /D \"UNICODE\" /FD /c " << extraDebugFlags
<< " /Zm1024" << newLine;
if (! isDebug)
out << "# SUBTRACT CPP /YX" << newLine;
@@ -707,7 +709,7 @@ private:
out << "# ADD BASE MTL /nologo /D " << defines << " /mktyplib203 /win32" << newLine
<< "# ADD MTL /nologo /D " << defines << " /mktyplib203 /win32" << newLine;
out << "# ADD BASE RSC /l 0x40c /d " << defines << newLine
out << "# ADD BASE RSC /l 0x40c /d " << defines << newLine
<< "# ADD RSC /l 0x40c /d " << defines << newLine
<< "BSC32=bscmake.exe" << newLine
<< "# ADD BASE BSC32 /nologo" << newLine
@@ -717,7 +719,7 @@ private:
{
out << "LIB32=link.exe -lib" << newLine
<< "# ADD BASE LIB32 /nologo" << newLine
<< "# ADD LIB32 /nologo /out:\"" << outFile << '"' << newLine;
<< "# ADD LIB32 /nologo /out:\"" << targetBinary << '"' << newLine;
}
else
{
@@ -726,7 +728,7 @@ private:
<< "# ADD LINK32 \"C:\\Program Files\\Microsoft Visual Studio\\VC98\\LIB\\shell32.lib\" " // This is avoid debug information corruption when mixing Platform SDK
<< "kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib "
<< (isDebug ? " /debug" : "")
<< " /nologo /machine:I386 /out:\"" << outFile << "\" "
<< " /nologo /machine:I386 /out:\"" << targetBinary << "\" "
<< (isDLL ? "/dll" : (project.isCommandLineApp() ? "/subsystem:console"
: "/subsystem:windows")) << newLine;
}


+ 568
- 562
juce_amalgamated.cpp
File diff suppressed because it is too large
View File


+ 121
- 98
juce_amalgamated.h View File

@@ -43,7 +43,7 @@

#define JUCE_MAJOR_VERSION 1
#define JUCE_MINOR_VERSION 51
#define JUCE_BUILDNUMBER 10
#define JUCE_BUILDNUMBER 11

#define JUCE_VERSION ((JUCE_MAJOR_VERSION << 16) + (JUCE_MINOR_VERSION << 8) + JUCE_BUILDNUMBER)

@@ -2050,7 +2050,7 @@ public:
while (e != end)
{
if (elementToLookFor == *e)
return (int) (e - data.elements.getData());
return static_cast <int> (e - data.elements.getData());

++e;
}
@@ -2310,7 +2310,7 @@ public:
{
if (valueToRemove == *e)
{
remove ((int) (e - data.elements.getData()));
remove (static_cast <int> (e - data.elements.getData()));
break;
}

@@ -2326,7 +2326,7 @@ public:

if (endIndex > startIndex)
{
ElementType* e = data.elements + startIndex;
ElementType* const e = data.elements + startIndex;

numberToRemove = endIndex - startIndex;
for (int i = 0; i < numberToRemove; ++i)
@@ -2495,82 +2495,109 @@ private:

class MemoryBlock;

class JUCE_API BitArray
class JUCE_API BigInteger
{
public:

BitArray() throw();
BigInteger();

BitArray (const unsigned int value) throw();
BigInteger (unsigned int value);

BitArray (const int value) throw();
BigInteger (int value);

BitArray (int64 value) throw();
BigInteger (int64 value);

BitArray (const BitArray& other) throw();
BigInteger (const BigInteger& other);

~BitArray() throw();
~BigInteger();

BitArray& operator= (const BitArray& other) throw();
BigInteger& operator= (const BigInteger& other);

bool operator== (const BitArray& other) const throw();
bool operator!= (const BitArray& other) const throw();
void swapWith (BigInteger& other) throw();

void clear() throw();

void clearBit (const int bitNumber) throw();

void setBit (const int bitNumber) throw();

void setBit (const int bitNumber,
const bool shouldBeSet) throw();

void setRange (int startBit,
int numBits,
const bool shouldBeSet) throw();

void insertBit (const int bitNumber,
const bool shouldBeSet) throw();

bool operator[] (const int bit) const throw();
bool operator[] (int bit) const throw();

bool isEmpty() const throw();
bool isZero() const throw();

const BitArray getBitRange (int startBit, int numBits) const throw();
bool isOne() const throw();

int getBitRangeAsInt (int startBit, int numBits) const throw();
int toInteger() const throw();

void setBitRangeAsInt (int startBit, int numBits,
unsigned int valueToSet) throw();
void clear();

void orWith (const BitArray& other) throw();
void clearBit (int bitNumber) throw();

void andWith (const BitArray& other) throw();
void setBit (int bitNumber);

void xorWith (const BitArray& other) throw();
void setBit (int bitNumber, bool shouldBeSet);

void add (const BitArray& other) throw();
void setRange (int startBit, int numBits, bool shouldBeSet);

void subtract (const BitArray& other) throw();
void insertBit (int bitNumber, bool shouldBeSet);

void multiplyBy (const BitArray& other) throw();
const BigInteger getBitRange (int startBit, int numBits) const;

void divideBy (const BitArray& divisor, BitArray& remainder) throw();
int getBitRangeAsInt (int startBit, int numBits) const throw();

const BitArray findGreatestCommonDivisor (BitArray other) const throw();
void setBitRangeAsInt (int startBit, int numBits, unsigned int valueToSet);

void modulo (const BitArray& divisor) throw();
void shiftBits (int howManyBitsLeft, int startBit);

void exponentModulo (const BitArray& exponent, const BitArray& modulus) throw();
int countNumberOfSetBits() const throw();

void inverseModulo (const BitArray& modulus) throw();
int findNextSetBit (int startIndex = 0) const throw();

void shiftBits (int howManyBitsLeft,
int startBit = 0) throw();
int findNextClearBit (int startIndex = 0) const throw();

int compare (const BitArray& other) const throw();
int getHighestBit() const throw();

int compareAbsolute (const BitArray& other) const throw();
// All the standard arithmetic ops...

BigInteger& operator+= (const BigInteger& other);
BigInteger& operator-= (const BigInteger& other);
BigInteger& operator*= (const BigInteger& other);
BigInteger& operator/= (const BigInteger& other);
BigInteger& operator|= (const BigInteger& other);
BigInteger& operator&= (const BigInteger& other);
BigInteger& operator^= (const BigInteger& other);
BigInteger& operator%= (const BigInteger& other);
BigInteger& operator<<= (int numBitsToShift);
BigInteger& operator>>= (int numBitsToShift);
BigInteger& operator++();
BigInteger& operator--();
const BigInteger operator++ (int);
const BigInteger operator-- (int);

const BigInteger operator-() const;
const BigInteger operator+ (const BigInteger& other) const;
const BigInteger operator- (const BigInteger& other) const;
const BigInteger operator* (const BigInteger& other) const;
const BigInteger operator/ (const BigInteger& other) const;
const BigInteger operator| (const BigInteger& other) const;
const BigInteger operator& (const BigInteger& other) const;
const BigInteger operator^ (const BigInteger& other) const;
const BigInteger operator% (const BigInteger& other) const;
const BigInteger operator<< (int numBitsToShift) const;
const BigInteger operator>> (int numBitsToShift) const;

bool operator== (const BigInteger& other) const throw();
bool operator!= (const BigInteger& other) const throw();
bool operator< (const BigInteger& other) const throw();
bool operator<= (const BigInteger& other) const throw();
bool operator> (const BigInteger& other) const throw();
bool operator>= (const BigInteger& other) const throw();

int compare (const BigInteger& other) const throw();

int compareAbsolute (const BigInteger& other) const throw();

void divideBy (const BigInteger& divisor, BigInteger& remainder);

const BigInteger findGreatestCommonDivisor (BigInteger other) const;

void exponentModulo (const BigInteger& exponent, const BigInteger& modulus);

void inverseModulo (const BigInteger& modulus);

bool isNegative() const throw();

@@ -2578,32 +2605,29 @@ public:

void negate() throw();

int countNumberOfSetBits() const throw();

int findNextSetBit (int startIndex = 0) const throw();

int findNextClearBit (int startIndex = 0) const throw();

int getHighestBit() const throw();

const String toString (const int base, const int minimumNumCharacters = 1) const throw();
const String toString (int base, int minimumNumCharacters = 1) const;

void parseString (const String& text,
const int base) throw();
void parseString (const String& text, int base);

const MemoryBlock toMemoryBlock() const throw();
const MemoryBlock toMemoryBlock() const;

void loadFromMemoryBlock (const MemoryBlock& data) throw();
void loadFromMemoryBlock (const MemoryBlock& data);

juce_UseDebuggingNewOperator

private:
void ensureSize (const int numVals) throw();
HeapBlock <unsigned int> values;
int numValues, highestBit;
bool negative;

void ensureSize (int numVals);
static const BigInteger simpleGCD (BigInteger* m, BigInteger* n);
};

OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, const BigInteger& value);

typedef BigInteger BitArray;

#endif // __JUCE_BITARRAY_JUCEHEADER__
/*** End of inlined file: juce_BitArray.h ***/

@@ -3470,7 +3494,7 @@ public:
while (e != end)
{
if (objectToLookFor == *e)
return (int) (e - data.elements.getData());
return static_cast <int> (e - data.elements.getData());

++e;
}
@@ -3666,7 +3690,7 @@ public:
{
if (objectToRemove == *e)
{
remove ((int) (e - data.elements.getData()), deleteObject);
remove (static_cast <int> (e - data.elements.getData()), deleteObject);
break;
}

@@ -4947,7 +4971,7 @@ public:
while (e != end)
{
if (objectToLookFor == *e)
return (int) (e - data.elements.getData());
return static_cast <int> (e - data.elements.getData());

++e;
}
@@ -7067,9 +7091,9 @@ public:

bool nextBool() throw();

const BitArray nextLargeNumber (const BitArray& maximumValue) throw();
const BigInteger nextLargeNumber (const BigInteger& maximumValue);

void fillBitsRandomly (BitArray& arrayToChange, int startBit, int numBits) throw();
void fillBitsRandomly (BigInteger& arrayToChange, int startBit, int numBits);

static Random& getSystemRandom() throw();

@@ -7503,13 +7527,12 @@ class JUCE_API Primes
{
public:

static const BitArray createProbablePrime (int bitLength,
int certainty,
const int* randomSeeds = 0,
int numRandomSeeds = 0) throw();
static const BigInteger createProbablePrime (int bitLength,
int certainty,
const int* randomSeeds = 0,
int numRandomSeeds = 0);

static bool isProbablyPrime (const BitArray& number,
int certainty) throw();
static bool isProbablyPrime (const BigInteger& number, int certainty);
};

#endif // __JUCE_PRIMES_JUCEHEADER__
@@ -7527,26 +7550,26 @@ class JUCE_API RSAKey
{
public:

RSAKey() throw();
RSAKey();

RSAKey (const String& stringRepresentation) throw();
RSAKey (const String& stringRepresentation);

~RSAKey() throw();
~RSAKey();

const String toString() const throw();
const String toString() const;

bool applyToValue (BitArray& value) const throw();
bool applyToValue (BigInteger& value) const;

static void createKeyPair (RSAKey& publicKey,
RSAKey& privateKey,
const int numBits,
int numBits,
const int* randomSeeds = 0,
const int numRandomSeeds = 0) throw();
int numRandomSeeds = 0);

juce_UseDebuggingNewOperator

protected:
BitArray part1, part2;
BigInteger part1, part2;
};

#endif // __JUCE_RSAKEY_JUCEHEADER__
@@ -14595,8 +14618,8 @@ public:

virtual int getDefaultBufferSize() = 0;

virtual const String open (const BitArray& inputChannels,
const BitArray& outputChannels,
virtual const String open (const BigInteger& inputChannels,
const BigInteger& outputChannels,
double sampleRate,
int bufferSizeSamples) = 0;

@@ -14618,9 +14641,9 @@ public:

virtual int getCurrentBitDepth() = 0;

virtual const BitArray getActiveOutputChannels() const = 0;
virtual const BigInteger getActiveOutputChannels() const = 0;

virtual const BitArray getActiveInputChannels() const = 0;
virtual const BigInteger getActiveInputChannels() const = 0;

virtual int getOutputLatencyInSamples() = 0;

@@ -15068,7 +15091,7 @@ public:
private:

VoidArray inputs;
BitArray inputsToDelete;
BigInteger inputsToDelete;
CriticalSection lock;
AudioSampleBuffer tempBuffer;
double currentSampleRate;
@@ -17013,11 +17036,11 @@ public:

int bufferSize;

BitArray inputChannels;
BigInteger inputChannels;

bool useDefaultInputChannels;

BitArray outputChannels;
BigInteger outputChannels;

bool useDefaultOutputChannels;
};
@@ -17094,7 +17117,7 @@ private:
SortedSet <AudioIODeviceCallback*> callbacks;
int numInputChansNeeded, numOutputChansNeeded;
String currentDeviceType;
BitArray inputChannels, outputChannels;
BigInteger inputChannels, outputChannels;
ScopedPointer <XmlElement> lastExplicitSettings;
mutable bool listNeedsScanning;
bool useInputNames;
@@ -17147,7 +17170,7 @@ private:
void handleIncomingMidiMessageInt (MidiInput* source, const MidiMessage& message);

const String restartDevice (int blockSizeToUse, double sampleRateToUse,
const BitArray& ins, const BitArray& outs);
const BigInteger& ins, const BigInteger& outs);
void stopDevice();

void updateXml();
@@ -17810,7 +17833,7 @@ private:
CriticalSection callbackLock, listenerLock;

#ifdef JUCE_DEBUG
BitArray changingParams;
BigInteger changingParams;
#endif

AudioProcessor (const AudioProcessor&);
@@ -19299,7 +19322,7 @@ public:

SamplerSound (const String& name,
AudioFormatReader& source,
const BitArray& midiNotes,
const BigInteger& midiNotes,
const int midiNoteForNormalPitch,
const double attackTimeSecs,
const double releaseTimeSecs,
@@ -19322,7 +19345,7 @@ private:
String name;
ScopedPointer <AudioSampleBuffer> data;
double sourceSampleRate;
BitArray midiNotes;
BigInteger midiNotes;
int length, attackSamples, releaseSamples;
int midiRootNote;
};
@@ -22459,7 +22482,7 @@ public:
juce_UseDebuggingNewOperator

protected:
virtual const BitArray getRoots (StringArray& rootNames, StringArray& rootPaths);
virtual const BigInteger getRoots (StringArray& rootNames, StringArray& rootPaths);

private:

@@ -26584,7 +26607,7 @@ private:
int midiChannel, midiInChannelMask;
float velocity;
int noteUnderMouse, mouseDownNote;
BitArray keysPressed, keysCurrentlyDrawnDown;
BigInteger keysPressed, keysCurrentlyDrawnDown;

int rangeStart, rangeEnd, firstKey;
bool canScroll, mouseDragging, useMousePositionForVelocity;


+ 1
- 1
src/audio/audio_sources/juce_MixerAudioSource.cpp View File

@@ -99,7 +99,7 @@ void MixerAudioSource::removeInputSource (AudioSource* input, const bool deleteI
void MixerAudioSource::removeAllInputs()
{
VoidArray inputsCopy;
BitArray inputsToDeleteCopy;
BigInteger inputsToDeleteCopy;
{
const ScopedLock sl (lock);


+ 1
- 1
src/audio/audio_sources/juce_MixerAudioSource.h View File

@@ -112,7 +112,7 @@ public:
private:
//==============================================================================
VoidArray inputs;
BitArray inputsToDelete;
BigInteger inputsToDelete;
CriticalSection lock;
AudioSampleBuffer tempBuffer;
double currentSampleRate;


+ 4
- 4
src/audio/devices/juce_AudioDeviceManager.h View File

@@ -124,7 +124,7 @@ public:
The bits that are set in this array indicate the channels of the
input device that are active.
*/
BitArray inputChannels;
BigInteger inputChannels;
/** If this is true, it indicates that the inputChannels array
should be ignored, and instead, the device's default channels
@@ -136,7 +136,7 @@ public:
The bits that are set in this array indicate the channels of the
input device that are active.
*/
BitArray outputChannels;
BigInteger outputChannels;
/** If this is true, it indicates that the outputChannels array
should be ignored, and instead, the device's default channels
@@ -426,7 +426,7 @@ private:
SortedSet <AudioIODeviceCallback*> callbacks;
int numInputChansNeeded, numOutputChansNeeded;
String currentDeviceType;
BitArray inputChannels, outputChannels;
BigInteger inputChannels, outputChannels;
ScopedPointer <XmlElement> lastExplicitSettings;
mutable bool listNeedsScanning;
bool useInputNames;
@@ -480,7 +480,7 @@ private:
void handleIncomingMidiMessageInt (MidiInput* source, const MidiMessage& message);
const String restartDevice (int blockSizeToUse, double sampleRateToUse,
const BitArray& ins, const BitArray& outs);
const BigInteger& ins, const BigInteger& outs);
void stopDevice();
void updateXml();


+ 6
- 6
src/audio/devices/juce_AudioIODevice.h View File

@@ -203,9 +203,9 @@ public:
//==============================================================================
/** Tries to open the device ready to play.
@param inputChannels a BitArray in which a set bit indicates that the corresponding
@param inputChannels a BigInteger in which a set bit indicates that the corresponding
input channel should be enabled
@param outputChannels a BitArray in which a set bit indicates that the corresponding
@param outputChannels a BigInteger in which a set bit indicates that the corresponding
output channel should be enabled
@param sampleRate the sample rate to try to use - to find out which rates are
available, see getNumSampleRates() and getSampleRate()
@@ -215,8 +215,8 @@ public:
opening the device
@see close
*/
virtual const String open (const BitArray& inputChannels,
const BitArray& outputChannels,
virtual const String open (const BigInteger& inputChannels,
const BigInteger& outputChannels,
double sampleRate,
int bufferSizeSamples) = 0;
@@ -279,13 +279,13 @@ public:
enabled.
@see getOutputChannelNames
*/
virtual const BitArray getActiveOutputChannels() const = 0;
virtual const BigInteger getActiveOutputChannels() const = 0;
/** Returns a mask showing which of the available input channels are currently
enabled.
@see getInputChannelNames
*/
virtual const BitArray getActiveInputChannels() const = 0;
virtual const BigInteger getActiveInputChannels() const = 0;
/** Returns the device's output latency.


+ 2
- 2
src/audio/midi/juce_MidiBuffer.cpp View File

@@ -79,7 +79,7 @@ void MidiBuffer::clear (const int startSample,
if (end > start)
{
const size_t bytesToMove = (size_t) (bytesUsed - (end - getData()));
const int bytesToMove = bytesUsed - (int) (end - getData());
if (bytesToMove > 0)
memmove (start, end, bytesToMove);
@@ -137,7 +137,7 @@ void MidiBuffer::addEvent (const uint8* const newData,
data.ensureSize ((spaceNeeded + spaceNeeded / 2 + 8) & ~7);
uint8* d = findEventAfter (getData(), sampleNumber);
const size_t bytesToMove = (size_t) (bytesUsed - (d - getData()));
const int bytesToMove = bytesUsed - (int) (d - getData());
if (bytesToMove > 0)
memmove (d + numBytes + 6,


+ 2
- 2
src/audio/plugins/juce_AudioPluginFormatManager.cpp View File

@@ -56,7 +56,7 @@ void AudioPluginFormatManager::addDefaultFormats()
// you should only call this method once!
for (int i = formats.size(); --i >= 0;)
{
#if JUCE_PLUGINHOST_VST
#if JUCE_PLUGINHOST_VST && ! (JUCE_MAC && JUCE_64BIT)
jassert (dynamic_cast <VSTPluginFormat*> (formats[i]) == 0);
#endif
@@ -78,7 +78,7 @@ void AudioPluginFormatManager::addDefaultFormats()
formats.add (new AudioUnitPluginFormat());
#endif
#if JUCE_PLUGINHOST_VST
#if JUCE_PLUGINHOST_VST && ! (JUCE_MAC && JUCE_64BIT)
formats.add (new VSTPluginFormat());
#endif


+ 1
- 1
src/audio/processors/juce_AudioProcessor.h View File

@@ -579,7 +579,7 @@ private:
CriticalSection callbackLock, listenerLock;
#ifdef JUCE_DEBUG
BitArray changingParams;
BigInteger changingParams;
#endif
AudioProcessor (const AudioProcessor&);


+ 1
- 1
src/audio/synthesisers/juce_Sampler.cpp View File

@@ -34,7 +34,7 @@ BEGIN_JUCE_NAMESPACE
//==============================================================================
SamplerSound::SamplerSound (const String& name_,
AudioFormatReader& source,
const BitArray& midiNotes_,
const BigInteger& midiNotes_,
const int midiNoteForNormalPitch,
const double attackTimeSecs,
const double releaseTimeSecs,


+ 2
- 2
src/audio/synthesisers/juce_Sampler.h View File

@@ -66,7 +66,7 @@ public:
*/
SamplerSound (const String& name,
AudioFormatReader& source,
const BitArray& midiNotes,
const BigInteger& midiNotes,
const int midiNoteForNormalPitch,
const double attackTimeSecs,
const double releaseTimeSecs,
@@ -99,7 +99,7 @@ private:
String name;
ScopedPointer <AudioSampleBuffer> data;
double sourceSampleRate;
BitArray midiNotes;
BigInteger midiNotes;
int length, attackSamples, releaseSamples;
int midiRootNote;
};


+ 3
- 3
src/containers/juce_Array.h View File

@@ -288,7 +288,7 @@ public:
while (e != end)
{
if (elementToLookFor == *e)
return (int) (e - data.elements.getData());
return static_cast <int> (e - data.elements.getData());
++e;
}
@@ -683,7 +683,7 @@ public:
{
if (valueToRemove == *e)
{
remove ((int) (e - data.elements.getData()));
remove (static_cast <int> (e - data.elements.getData()));
break;
}
@@ -711,7 +711,7 @@ public:
if (endIndex > startIndex)
{
ElementType* e = data.elements + startIndex;
ElementType* const e = data.elements + startIndex;
numberToRemove = endIndex - startIndex;
for (int i = 0; i < numberToRemove; ++i)


+ 402
- 357
src/containers/juce_BitArray.cpp
File diff suppressed because it is too large
View File


+ 155
- 171
src/containers/juce_BitArray.h View File

@@ -27,77 +27,89 @@
#define __JUCE_BITARRAY_JUCEHEADER__
#include "../text/juce_String.h"
#include "juce_Array.h"
#include "juce_HeapBlock.h"
class MemoryBlock;
//==============================================================================
/**
An array of on/off bits, also usable to store large binary integers.
An arbitrarily large integer class.
A BitArray acts like an arbitrarily large integer whose bits can be set or
cleared, and some basic mathematical operations can be done on the number as
a whole.
A BigInteger can be used in a similar way to a normal integer, but has no size
limit (except for memory and performance constraints).
Negative values are possible, but the value isn't stored as 2s-complement, so
be careful if you use negative values and look at the values of individual bits.
*/
class JUCE_API BitArray
class JUCE_API BigInteger
{
public:
//==============================================================================
/** Creates an empty BitArray */
BitArray() throw();
/** Creates an empty BigInteger */
BigInteger();
/** Creates a BitArray containing an integer value in its low bits.
/** Creates a BigInteger containing an integer value in its low bits.
The low 32 bits of the array are initialised with this value.
The low 32 bits of the number are initialised with this value.
*/
BitArray (const unsigned int value) throw();
BigInteger (unsigned int value);
/** Creates a BitArray containing an integer value in its low bits.
/** Creates a BigInteger containing an integer value in its low bits.
The low 32 bits of the array are initialised with the absolute value
The low 32 bits of the number are initialised with the absolute value
passed in, and its sign is set to reflect the sign of the number.
*/
BitArray (const int value) throw();
BigInteger (int value);
/** Creates a BitArray containing an integer value in its low bits.
/** Creates a BigInteger containing an integer value in its low bits.
The low 64 bits of the array are initialised with the absolute value
The low 64 bits of the number are initialised with the absolute value
passed in, and its sign is set to reflect the sign of the number.
*/
BitArray (int64 value) throw();
BigInteger (int64 value);
/** Creates a copy of another BitArray. */
BitArray (const BitArray& other) throw();
/** Creates a copy of another BigInteger. */
BigInteger (const BigInteger& other);
/** Destructor. */
~BitArray() throw();
~BigInteger();
//==============================================================================
/** Copies another BitArray onto this one. */
BitArray& operator= (const BitArray& other) throw();
/** Copies another BigInteger onto this one. */
BigInteger& operator= (const BigInteger& other);
/** Two arrays are the same if the same bits are set. */
bool operator== (const BitArray& other) const throw();
/** Two arrays are the same if the same bits are set. */
bool operator!= (const BitArray& other) const throw();
/** Swaps the internal contents of this with another object. */
void swapWith (BigInteger& other) throw();
//==============================================================================
/** Clears all bits in the BitArray to 0. */
void clear() throw();
/** Returns the value of a specified bit in the number.
If the index is out-of-range, the result will be false.
*/
bool operator[] (int bit) const throw();
/** Clears a particular bit in the array. */
void clearBit (const int bitNumber) throw();
/** Returns true if no bits are set. */
bool isZero() const throw();
/** Sets a specified bit to 1.
/** Returns true if the value is 1. */
bool isOne() const throw();
If the bit number is high, this will grow the array to accomodate it.
/** Attempts to get the lowest bits of the value as an integer.
If the value is bigger than the integer limits, this will return only the lower bits.
*/
void setBit (const int bitNumber) throw();
int toInteger() const throw();
//==============================================================================
/** Resets the value to 0. */
void clear();
/** Clears a particular bit in the number. */
void clearBit (int bitNumber) throw();
/** Sets a specified bit to 1. */
void setBit (int bitNumber);
/** Sets or clears a specified bit. */
void setBit (const int bitNumber,
const bool shouldBeSet) throw();
void setBit (int bitNumber, bool shouldBeSet);
/** Sets a range of bits to be either on or off.
@@ -105,32 +117,19 @@ public:
@param numBits the number of bits to change
@param shouldBeSet whether to turn these bits on or off
*/
void setRange (int startBit,
int numBits,
const bool shouldBeSet) throw();
void setRange (int startBit, int numBits, bool shouldBeSet);
/** Inserts a bit an a given position, shifting up any bits above it. */
void insertBit (const int bitNumber,
const bool shouldBeSet) throw();
/** Returns the value of a specified bit in the array.
void insertBit (int bitNumber, bool shouldBeSet);
If the index is out-of-range, the result will be false.
*/
bool operator[] (const int bit) const throw();
/** Returns true if no bits are set. */
bool isEmpty() const throw();
//==============================================================================
/** Returns a range of bits in the array as a new BitArray.
/** Returns a range of bits as a new BigInteger.
e.g. getBitRangeAsInt (0, 64) would return the lowest 64 bits.
@see getBitRangeAsInt
*/
const BitArray getBitRange (int startBit, int numBits) const throw();
const BigInteger getBitRange (int startBit, int numBits) const;
/** Returns a range of bits in the array as an integer value.
/** Returns a range of bits as an integer value.
e.g. getBitRangeAsInt (0, 32) would return the lowest 32 bits.
@@ -139,206 +138,191 @@ public:
*/
int getBitRangeAsInt (int startBit, int numBits) const throw();
/** Sets a range of bits in the array based on an integer value.
/** Sets a range of bits to an integer value.
Copies the given integer into the array, starting at startBit,
and only using up to numBits of the available bits.
Copies the given integer onto a range of bits, starting at startBit,
and using up to numBits of the available bits.
*/
void setBitRangeAsInt (int startBit, int numBits,
unsigned int valueToSet) throw();
void setBitRangeAsInt (int startBit, int numBits, unsigned int valueToSet);
//==============================================================================
/** Performs a bitwise OR with another BitArray.
/** Shifts a section of bits left or right.
The result ends up in this array.
@param howManyBitsLeft how far to move the bits (+ve numbers shift it left, -ve numbers shift it right).
@param startBit the first bit to affect - if this is > 0, only bits above that index will be affected.
*/
void orWith (const BitArray& other) throw();
void shiftBits (int howManyBitsLeft, int startBit);
/** Performs a bitwise AND with another BitArray.
/** Returns the total number of set bits in the value. */
int countNumberOfSetBits() const throw();
The result ends up in this array.
/** Looks for the index of the next set bit after a given starting point.
This searches from startIndex (inclusive) upwards for the first set bit,
and returns its index. If no set bits are found, it returns -1.
*/
void andWith (const BitArray& other) throw();
int findNextSetBit (int startIndex = 0) const throw();
/** Performs a bitwise XOR with another BitArray.
/** Looks for the index of the next clear bit after a given starting point.
The result ends up in this array.
This searches from startIndex (inclusive) upwards for the first clear bit,
and returns its index.
*/
void xorWith (const BitArray& other) throw();
/** Adds another BitArray's value to this one.
int findNextClearBit (int startIndex = 0) const throw();
Treating the two arrays as large positive integers, this
adds them up and puts the result in this array.
/** Returns the index of the highest set bit in the number.
If the value is zero, this will return -1.
*/
void add (const BitArray& other) throw();
int getHighestBit() const throw();
/** Subtracts another BitArray's value from this one.
//==============================================================================
// All the standard arithmetic ops...
BigInteger& operator+= (const BigInteger& other);
BigInteger& operator-= (const BigInteger& other);
BigInteger& operator*= (const BigInteger& other);
BigInteger& operator/= (const BigInteger& other);
BigInteger& operator|= (const BigInteger& other);
BigInteger& operator&= (const BigInteger& other);
BigInteger& operator^= (const BigInteger& other);
BigInteger& operator%= (const BigInteger& other);
BigInteger& operator<<= (int numBitsToShift);
BigInteger& operator>>= (int numBitsToShift);
BigInteger& operator++();
BigInteger& operator--();
const BigInteger operator++ (int);
const BigInteger operator-- (int);
const BigInteger operator-() const;
const BigInteger operator+ (const BigInteger& other) const;
const BigInteger operator- (const BigInteger& other) const;
const BigInteger operator* (const BigInteger& other) const;
const BigInteger operator/ (const BigInteger& other) const;
const BigInteger operator| (const BigInteger& other) const;
const BigInteger operator& (const BigInteger& other) const;
const BigInteger operator^ (const BigInteger& other) const;
const BigInteger operator% (const BigInteger& other) const;
const BigInteger operator<< (int numBitsToShift) const;
const BigInteger operator>> (int numBitsToShift) const;
bool operator== (const BigInteger& other) const throw();
bool operator!= (const BigInteger& other) const throw();
bool operator< (const BigInteger& other) const throw();
bool operator<= (const BigInteger& other) const throw();
bool operator> (const BigInteger& other) const throw();
bool operator>= (const BigInteger& other) const throw();
Treating the two arrays as large positive integers, this
subtracts them and puts the result in this array.
//==============================================================================
/** Does a signed comparison of two BigIntegers.
Note that if the result should be negative, this won't be
handled correctly.
Return values are:
- 0 if the numbers are the same
- < 0 if this number is smaller than the other
- > 0 if this number is bigger than the other
*/
void subtract (const BitArray& other) throw();
int compare (const BigInteger& other) const throw();
/** Multiplies another BitArray's value with this one.
/** Compares the magnitudes of two BigIntegers, ignoring their signs.
Treating the two arrays as large positive integers, this
multiplies them and puts the result in this array.
Return values are:
- 0 if the numbers are the same
- < 0 if this number is smaller than the other
- > 0 if this number is bigger than the other
*/
void multiplyBy (const BitArray& other) throw();
int compareAbsolute (const BigInteger& other) const throw();
/** Divides another BitArray's value into this one and also produces a remainder.
/** Divides this value by another one and returns the remainder.
Treating the two arrays as large positive integers, this
divides this value by the other, leaving the quotient in this
array, and the remainder is copied into the other BitArray passed in.
This number is divided by other, leaving the quotient in this number,
with the remainder being copied to the other BigInteger passed in.
*/
void divideBy (const BitArray& divisor, BitArray& remainder) throw();
/** Returns the largest value that will divide both this value and the one
passed-in.
*/
const BitArray findGreatestCommonDivisor (BitArray other) const throw();
/** Performs a modulo operation on this value.
void divideBy (const BigInteger& divisor, BigInteger& remainder);
The result is stored in this value.
/** Returns the largest value that will divide both this value and the one passed-in.
*/
void modulo (const BitArray& divisor) throw();
const BigInteger findGreatestCommonDivisor (BigInteger other) const;
/** Performs a combined exponent and modulo operation.
This BitArray's value becomes (this ^ exponent) % modulus.
This BigInteger's value becomes (this ^ exponent) % modulus.
*/
void exponentModulo (const BitArray& exponent, const BitArray& modulus) throw();
void exponentModulo (const BigInteger& exponent, const BigInteger& modulus);
/** Performs an inverse modulo on the value.
i.e. the result is (this ^ -1) mod (modulus).
*/
void inverseModulo (const BitArray& modulus) throw();
/** Shifts a section of bits left or right.
@param howManyBitsLeft how far to move the bits (+ve numbers shift it left, -ve numbers shift it right).
@param startBit the first bit to affect - if this is > 0, only bits above that index will be affected.
*/
void shiftBits (int howManyBitsLeft,
int startBit = 0) throw();
/** Does a signed comparison of two BitArrays.
Return values are:
- 0 if the numbers are the same
- < 0 if this number is smaller than the other
- > 0 if this number is bigger than the other
*/
int compare (const BitArray& other) const throw();
/** Compares the magnitudes of two BitArrays, ignoring their signs.
Return values are:
- 0 if the numbers are the same
- < 0 if this number is smaller than the other
- > 0 if this number is bigger than the other
*/
int compareAbsolute (const BitArray& other) const throw();
void inverseModulo (const BigInteger& modulus);
//==============================================================================
/** Returns true if the value is less than zero.
@see setNegative, negate
*/
bool isNegative() const throw();
/** Changes the sign of the number to be positive or negative.
@see isNegative, negate
*/
void setNegative (const bool shouldBeNegative) throw();
/** Inverts the sign of the number.
@see isNegative, setNegative
*/
void negate() throw();
//==============================================================================
/** Counts the total number of set bits in the array. */
int countNumberOfSetBits() const throw();
/** Looks for the index of the next set bit after a given starting point.
searches from startIndex (inclusive) upwards for the first set bit,
and returns its index.
If no set bits are found, it returns -1.
*/
int findNextSetBit (int startIndex = 0) const throw();
/** Looks for the index of the next clear bit after a given starting point.
searches from startIndex (inclusive) upwards for the first clear bit,
and returns its index.
*/
int findNextClearBit (int startIndex = 0) const throw();
/** Returns the index of the highest set bit in the array.
If the array is empty, this will return -1.
*/
int getHighestBit() const throw();
//==============================================================================
/** Converts the array to a number string.
/** Converts the number to a string.
Specify a base such as 2 (binary), 8 (octal), 10 (decimal), 16 (hex).
If minuimumNumCharacters is greater than 0, the returned string will be
If minimumNumCharacters is greater than 0, the returned string will be
padded with leading zeros to reach at least that length.
*/
const String toString (const int base, const int minimumNumCharacters = 1) const throw();
/** Converts a number string to an array.
const String toString (int base, int minimumNumCharacters = 1) const;
Any non-valid characters will be ignored.
/** Reads the numeric value from a string.
Specify a base such as 2 (binary), 8 (octal), 10 (decimal), 16 (hex).
Any invalid characters will be ignored.
*/
void parseString (const String& text,
const int base) throw();
void parseString (const String& text, int base);
//==============================================================================
/** Turns the array into a block of binary data.
/** Turns the number into a block of binary data.
The data is arranged as little-endian, so the first byte of data is the low 8 bits
of the array, and so on.
of the number, and so on.
@see loadFromMemoryBlock
*/
const MemoryBlock toMemoryBlock() const throw();
const MemoryBlock toMemoryBlock() const;
/** Copies a block of raw data onto this array.
/** Converts a block of raw data into a number.
The data is arranged as little-endian, so the first byte of data is the low 8 bits
of the array, and so on.
of the number, and so on.
@see toMemoryBlock
*/
void loadFromMemoryBlock (const MemoryBlock& data) throw();
void loadFromMemoryBlock (const MemoryBlock& data);
//==============================================================================
juce_UseDebuggingNewOperator
private:
void ensureSize (const int numVals) throw();
HeapBlock <unsigned int> values;
int numValues, highestBit;
bool negative;
void ensureSize (int numVals);
static const BigInteger simpleGCD (BigInteger* m, BigInteger* n);
};
/** Writes a BigInteger to an OutputStream as a UTF8 decimal string. */
OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, const BigInteger& value);
//==============================================================================
/** For backwards compatibility, BitArray is defined to be an alias for BigInteger.
*/
typedef BigInteger BitArray;
#endif // __JUCE_BITARRAY_JUCEHEADER__

+ 2
- 2
src/containers/juce_OwnedArray.h View File

@@ -165,7 +165,7 @@ public:
while (e != end)
{
if (objectToLookFor == *e)
return (int) (e - data.elements.getData());
return static_cast <int> (e - data.elements.getData());
++e;
}
@@ -466,7 +466,7 @@ public:
{
if (objectToRemove == *e)
{
remove ((int) (e - data.elements.getData()), deleteObject);
remove (static_cast <int> (e - data.elements.getData()), deleteObject);
break;
}


+ 1
- 1
src/containers/juce_ReferenceCountedArray.h View File

@@ -184,7 +184,7 @@ public:
while (e != end)
{
if (objectToLookFor == *e)
return (int) (e - data.elements.getData());
return static_cast <int> (e - data.elements.getData());
++e;
}


+ 3
- 3
src/containers/juce_SparseSet.h View File

@@ -34,9 +34,9 @@
/**
Holds a set of primitive values, storing them as a set of ranges.
This container acts like a simple BitArray, but can efficiently hold large
continguous ranges of values. It's quite a specialised class, mostly useful
for things like keeping the set of selected rows in a listbox.
This container acts like an array, but can efficiently hold large continguous
ranges of values. It's quite a specialised class, mostly useful for things
like keeping the set of selected rows in a listbox.
The type used as a template paramter must be an integer type, such as int, short,
int64, etc.


+ 4
- 4
src/core/juce_Random.cpp View File

@@ -94,20 +94,20 @@ double Random::nextDouble() throw()
return static_cast <uint32> (nextInt()) / (double) 0xffffffff;
}
const BitArray Random::nextLargeNumber (const BitArray& maximumValue) throw()
const BigInteger Random::nextLargeNumber (const BigInteger& maximumValue)
{
BitArray n;
BigInteger n;
do
{
fillBitsRandomly (n, 0, maximumValue.getHighestBit() + 1);
}
while (n.compare (maximumValue) >= 0);
while (n >= maximumValue);
return n;
}
void Random::fillBitsRandomly (BitArray& arrayToChange, int startBit, int numBits) throw()
void Random::fillBitsRandomly (BigInteger& arrayToChange, int startBit, int numBits)
{
arrayToChange.setBit (startBit + numBits - 1, true); // to force the array to pre-allocate space


+ 4
- 4
src/core/juce_Random.h View File

@@ -84,14 +84,14 @@ public:
*/
bool nextBool() throw();
/** Returns a BitArray containing a random number.
/** Returns a BigInteger containing a random number.
@returns a random value in the range 0 to (maximumValue - 1).
*/
const BitArray nextLargeNumber (const BitArray& maximumValue) throw();
const BigInteger nextLargeNumber (const BigInteger& maximumValue);
/** Sets a range of bits in a BitArray to random values. */
void fillBitsRandomly (BitArray& arrayToChange, int startBit, int numBits) throw();
/** Sets a range of bits in a BigInteger to random values. */
void fillBitsRandomly (BigInteger& arrayToChange, int startBit, int numBits);
//==============================================================================
/** To avoid the overhead of having to create a new Random object whenever


+ 1
- 1
src/core/juce_StandardHeader.h View File

@@ -33,7 +33,7 @@
*/
#define JUCE_MAJOR_VERSION 1
#define JUCE_MINOR_VERSION 51
#define JUCE_BUILDNUMBER 10
#define JUCE_BUILDNUMBER 11
/** Current Juce version number.


+ 72
- 87
src/cryptography/juce_Primes.cpp View File

@@ -35,7 +35,7 @@ BEGIN_JUCE_NAMESPACE
//==============================================================================
namespace PrimesHelpers
{
static void createSmallSieve (const int numBits, BitArray& result) throw()
static void createSmallSieve (const int numBits, BigInteger& result)
{
result.setBit (numBits);
result.clearBit (numBits); // to enlarge the array
@@ -53,11 +53,8 @@ namespace PrimesHelpers
while (n <= (numBits >> 1));
}
static void bigSieve (const BitArray& base,
const int numBits,
BitArray& result,
const BitArray& smallSieve,
const int smallSieveSize) throw()
static void bigSieve (const BigInteger& base, const int numBits, BigInteger& result,
const BigInteger& smallSieve, const int smallSieveSize)
{
jassert (! base[0]); // must be even!
@@ -70,13 +67,12 @@ namespace PrimesHelpers
{
const int prime = (index << 1) + 1;
BitArray r (base);
BitArray remainder;
BigInteger r (base), remainder;
r.divideBy (prime, remainder);
int i = prime - remainder.getBitRangeAsInt (0, 32);
if (r.isEmpty())
if (r.isZero())
i += prime;
if ((i & 1) == 0)
@@ -95,18 +91,14 @@ namespace PrimesHelpers
while (index < smallSieveSize);
}
static bool findCandidate (const BitArray& base,
const BitArray& sieve,
const int numBits,
BitArray& result,
const int certainty) throw()
static bool findCandidate (const BigInteger& base, const BigInteger& sieve,
const int numBits, BigInteger& result, const int certainty)
{
for (int i = 0; i < numBits; ++i)
{
if (! sieve[i])
{
result = base;
result.add (BitArray ((unsigned int) ((i << 1) + 1)));
result = base + (unsigned int) ((i << 1) + 1);
if (Primes::isProbablyPrime (result, certainty))
return true;
@@ -115,13 +107,63 @@ namespace PrimesHelpers
return false;
}
static bool passesMillerRabin (const BigInteger& n, int iterations)
{
const BigInteger one (1), two (2);
const BigInteger nMinusOne (n - one);
BigInteger d (nMinusOne);
const int s = d.findNextSetBit (0);
d >>= s;
BigInteger smallPrimes;
int numBitsInSmallPrimes = 0;
for (;;)
{
numBitsInSmallPrimes += 256;
createSmallSieve (numBitsInSmallPrimes, smallPrimes);
const int numPrimesFound = numBitsInSmallPrimes - smallPrimes.countNumberOfSetBits();
if (numPrimesFound > iterations + 1)
break;
}
int smallPrime = 2;
while (--iterations >= 0)
{
smallPrime = smallPrimes.findNextClearBit (smallPrime + 1);
BigInteger r (smallPrime);
r.exponentModulo (d, n);
if (r != one && r != nMinusOne)
{
for (int j = 0; j < s; ++j)
{
r.exponentModulo (two, n);
if (r == nMinusOne)
break;
}
if (r != nMinusOne)
return false;
}
}
return true;
}
}
//==============================================================================
const BitArray Primes::createProbablePrime (const int bitLength,
const int certainty,
const int* randomSeeds,
int numRandomSeeds) throw()
const BigInteger Primes::createProbablePrime (const int bitLength,
const int certainty,
const int* randomSeeds,
int numRandomSeeds)
{
using namespace PrimesHelpers;
int defaultSeeds [16];
@@ -141,20 +183,20 @@ const BitArray Primes::createProbablePrime (const int bitLength,
}
}
BitArray smallSieve;
BigInteger smallSieve;
const int smallSieveSize = 15000;
createSmallSieve (smallSieveSize, smallSieve);
BitArray p;
BigInteger p;
for (int i = numRandomSeeds; --i >= 0;)
{
BitArray p2;
BigInteger p2;
Random r (randomSeeds[i]);
r.fillBitsRandomly (p2, 0, bitLength);
p.xorWith (p2);
p ^= p2;
}
p.setBit (bitLength - 1);
@@ -164,81 +206,26 @@ const BitArray Primes::createProbablePrime (const int bitLength,
while (p.getHighestBit() < bitLength)
{
p.add (2 * searchLen);
p += 2 * searchLen;
BitArray sieve;
BigInteger sieve;
bigSieve (p, searchLen, sieve,
smallSieve, smallSieveSize);
BitArray candidate;
BigInteger candidate;
if (findCandidate (p, sieve, searchLen, candidate, certainty))
return candidate;
}
jassertfalse
return BitArray();
return BigInteger();
}
static bool passesMillerRabin (const BitArray& n, int iterations) throw()
bool Primes::isProbablyPrime (const BigInteger& number, const int certainty)
{
using namespace PrimesHelpers;
const BitArray one (1);
const BitArray two (2);
BitArray nMinusOne (n);
nMinusOne.subtract (one);
BitArray d (nMinusOne);
const int s = d.findNextSetBit (0);
d.shiftBits (-s);
BitArray smallPrimes;
int numBitsInSmallPrimes = 0;
for (;;)
{
numBitsInSmallPrimes += 256;
createSmallSieve (numBitsInSmallPrimes, smallPrimes);
const int numPrimesFound = numBitsInSmallPrimes - smallPrimes.countNumberOfSetBits();
if (numPrimesFound > iterations + 1)
break;
}
int smallPrime = 2;
while (--iterations >= 0)
{
smallPrime = smallPrimes.findNextClearBit (smallPrime + 1);
BitArray r (smallPrime);
//r.createRandomNumber (nMinusOne);
r.exponentModulo (d, n);
if (! (r == one || r == nMinusOne))
{
for (int j = 0; j < s; ++j)
{
r.exponentModulo (two, n);
if (r == nMinusOne)
break;
}
if (r != nMinusOne)
return false;
}
}
return true;
}
bool Primes::isProbablyPrime (const BitArray& number,
const int certainty) throw()
{
if (! number[0])
return false;
@@ -254,9 +241,7 @@ bool Primes::isProbablyPrime (const BitArray& number,
}
else
{
const BitArray screen (2 * 3 * 5 * 7 * 11 * 13 * 17 * 19 * 23);
if (number.findGreatestCommonDivisor (screen) != BitArray (1))
if (number.findGreatestCommonDivisor (2 * 3 * 5 * 7 * 11 * 13 * 17 * 19 * 23) != 1)
return false;
return passesMillerRabin (number, certainty);


+ 6
- 7
src/cryptography/juce_Primes.h View File

@@ -35,7 +35,7 @@
This class contains static methods for generating and testing prime numbers.
@see BitArray
@see BigInteger
*/
class JUCE_API Primes
{
@@ -50,10 +50,10 @@ public:
which to seed the random number generation, improving the security of the
keys generated.
*/
static const BitArray createProbablePrime (int bitLength,
int certainty,
const int* randomSeeds = 0,
int numRandomSeeds = 0) throw();
static const BigInteger createProbablePrime (int bitLength,
int certainty,
const int* randomSeeds = 0,
int numRandomSeeds = 0);
/** Tests a number to see if it's prime.
@@ -63,8 +63,7 @@ public:
The certainty parameter specifies how many iterations to use when testing - a
safe value might be anything over about 20-30.
*/
static bool isProbablyPrime (const BitArray& number,
int certainty) throw();
static bool isProbablyPrime (const BigInteger& number, int certainty);
};


+ 27
- 49
src/cryptography/juce_RSAKey.cpp View File

@@ -33,11 +33,11 @@ BEGIN_JUCE_NAMESPACE
//==============================================================================
RSAKey::RSAKey() throw()
RSAKey::RSAKey()
{
}
RSAKey::RSAKey (const String& s) throw()
RSAKey::RSAKey (const String& s)
{
if (s.containsChar (T(',')))
{
@@ -51,97 +51,75 @@ RSAKey::RSAKey (const String& s) throw()
}
}
RSAKey::~RSAKey() throw()
RSAKey::~RSAKey()
{
}
const String RSAKey::toString() const throw()
const String RSAKey::toString() const
{
return part1.toString (16) + T(",") + part2.toString (16);
return part1.toString (16) + "," + part2.toString (16);
}
bool RSAKey::applyToValue (BitArray& value) const throw()
bool RSAKey::applyToValue (BigInteger& value) const
{
if (part1.isEmpty() || part2.isEmpty()
|| value.compare (0) <= 0)
if (part1.isZero() || part2.isZero() || value <= 0)
{
jassertfalse // using an uninitialised key
value.clear();
return false;
}
BitArray result;
BigInteger result;
while (! value.isEmpty())
while (! value.isZero())
{
result.multiplyBy (part2);
result *= part2;
BitArray remainder;
BigInteger remainder;
value.divideBy (part2, remainder);
remainder.exponentModulo (part1, part2);
result.add (remainder);
result += remainder;
}
value = result;
value.swapWith (result);
return true;
}
static const BitArray findBestCommonDivisor (const BitArray& p,
const BitArray& q) throw()
static const BigInteger findBestCommonDivisor (const BigInteger& p, const BigInteger& q)
{
const BitArray one (1);
// try 3, 5, 9, 17, etc first because these only contain 2 bits and so
// are fast to divide + multiply
for (int i = 2; i <= 65536; i *= 2)
{
const BitArray e (1 + i);
const BigInteger e (1 + i);
if (e.findGreatestCommonDivisor (p) == one
&& e.findGreatestCommonDivisor (q) == one)
{
if (e.findGreatestCommonDivisor (p).isOne() && e.findGreatestCommonDivisor (q).isOne())
return e;
}
}
BitArray e (4);
BigInteger e (4);
while (! (e.findGreatestCommonDivisor (p) == one
&& e.findGreatestCommonDivisor (q) == one))
{
e.add (one);
}
while (! (e.findGreatestCommonDivisor (p).isOne() && e.findGreatestCommonDivisor (q).isOne()))
++e;
return e;
}
void RSAKey::createKeyPair (RSAKey& publicKey,
RSAKey& privateKey,
const int numBits,
const int* randomSeeds,
const int numRandomSeeds) throw()
void RSAKey::createKeyPair (RSAKey& publicKey, RSAKey& privateKey,
const int numBits, const int* randomSeeds, const int numRandomSeeds)
{
jassert (numBits > 16); // not much point using less than this..
BitArray p (Primes::createProbablePrime (numBits / 2, 30, randomSeeds, numRandomSeeds));
BitArray q (Primes::createProbablePrime (numBits - numBits / 2, 30, randomSeeds, numRandomSeeds));
BitArray n (p);
n.multiplyBy (q); // n = pq
const BitArray one (1);
p.subtract (one);
q.subtract (one);
BitArray m (p);
m.multiplyBy (q); // m = (p - 1)(q - 1)
BigInteger p (Primes::createProbablePrime (numBits / 2, 30, randomSeeds, numRandomSeeds));
BigInteger q (Primes::createProbablePrime (numBits - numBits / 2, 30, randomSeeds, numRandomSeeds));
const BitArray e (findBestCommonDivisor (p, q));
const BigInteger n (p * q);
const BigInteger m (--p * --q);
const BigInteger e (findBestCommonDivisor (p, q));
BitArray d (e);
BigInteger d (e);
d.inverseModulo (m);
publicKey.part1 = e;


+ 8
- 8
src/cryptography/juce_RSAKey.h View File

@@ -44,23 +44,23 @@ public:
Initialise a pair of objects for use with the createKeyPair() method.
*/
RSAKey() throw();
RSAKey();
/** Loads a key from an encoded string representation.
This reloads a key from a string created by the toString() method.
*/
RSAKey (const String& stringRepresentation) throw();
RSAKey (const String& stringRepresentation);
/** Destructor. */
~RSAKey() throw();
~RSAKey();
//==============================================================================
/** Turns the key into a string representation.
This can be reloaded using the constructor that takes a string.
*/
const String toString() const throw();
const String toString() const;
//==============================================================================
/** Encodes or decodes a value.
@@ -76,7 +76,7 @@ public:
happily do its job and return true, but the result won't be what you were expecting.
It's your responsibility to check that the result is what you wanted.
*/
bool applyToValue (BitArray& value) const throw();
bool applyToValue (BigInteger& value) const;
//==============================================================================
/** Creates a public/private key-pair.
@@ -93,16 +93,16 @@ public:
*/
static void createKeyPair (RSAKey& publicKey,
RSAKey& privateKey,
const int numBits,
int numBits,
const int* randomSeeds = 0,
const int numRandomSeeds = 0) throw();
int numRandomSeeds = 0);
//==============================================================================
juce_UseDebuggingNewOperator
protected:
BitArray part1, part2;
BigInteger part1, part2;
};


+ 1
- 1
src/gui/components/controls/juce_TableListBox.cpp View File

@@ -243,7 +243,7 @@ private:
TableListBox& owner;
int row;
bool isSelected, isDragging, selectRowOnMouseUp;
BitArray columnsWithComponents;
BigInteger columnsWithComponents;
Component* findChildComponentForColumn (const int columnId) const
{


+ 1
- 1
src/gui/components/controls/juce_TreeView.cpp View File

@@ -192,7 +192,7 @@ public:
const int visibleTop = -getY();
const int visibleBottom = visibleTop + getParentHeight();
BitArray itemsToKeep;
BigInteger itemsToKeep;
TreeViewItem* item = owner->rootItem;
int y = (item != 0 && !owner->rootItemVisible) ? -item->itemHeight : 0;


+ 3
- 3
src/gui/components/filebrowser/juce_FileBrowserComponent.cpp View File

@@ -101,7 +101,7 @@ FileBrowserComponent::FileBrowserComponent (int flags_,
currentPathBox->setEditableText (true);
StringArray rootNames, rootPaths;
const BitArray separators (getRoots (rootNames, rootPaths));
const BigInteger separators (getRoots (rootNames, rootPaths));
for (int i = 0; i < rootNames.size(); ++i)
{
@@ -457,9 +457,9 @@ void FileBrowserComponent::comboBoxChanged (ComboBox*)
}
}
const BitArray FileBrowserComponent::getRoots (StringArray& rootNames, StringArray& rootPaths)
const BigInteger FileBrowserComponent::getRoots (StringArray& rootNames, StringArray& rootPaths)
{
BitArray separators;
BigInteger separators;
#if JUCE_WINDOWS
Array<File> roots;


+ 1
- 1
src/gui/components/filebrowser/juce_FileBrowserComponent.h View File

@@ -203,7 +203,7 @@ public:
juce_UseDebuggingNewOperator
protected:
virtual const BitArray getRoots (StringArray& rootNames, StringArray& rootPaths);
virtual const BigInteger getRoots (StringArray& rootNames, StringArray& rootPaths);
private:
//==============================================================================


+ 4
- 4
src/gui/components/special/juce_AudioDeviceSelectorComponent.cpp View File

@@ -856,9 +856,9 @@ public:
if (setup.useStereoPairs)
{
BitArray bits;
BitArray& original = (type == audioInputType ? config.inputChannels
: config.outputChannels);
BigInteger bits;
BigInteger& original = (type == audioInputType ? config.inputChannels
: config.outputChannels);
int i;
for (i = 0; i < 256; i += 2)
@@ -901,7 +901,7 @@ public:
}
}
static void flipBit (BitArray& chans, int index, int minNumber, int maxNumber)
static void flipBit (BigInteger& chans, int index, int minNumber, int maxNumber)
{
const int numActive = chans.countNumberOfSetBits();


+ 1
- 1
src/gui/components/special/juce_MidiKeyboardComponent.h View File

@@ -392,7 +392,7 @@ private:
int midiChannel, midiInChannelMask;
float velocity;
int noteUnderMouse, mouseDownNote;
BitArray keysPressed, keysCurrentlyDrawnDown;
BigInteger keysPressed, keysCurrentlyDrawnDown;
int rangeStart, rangeEnd, firstKey;
bool canScroll, mouseDragging, useMousePositionForVelocity;


+ 7
- 7
src/native/linux/juce_linux_Audio.cpp View File

@@ -362,8 +362,8 @@ public:
close();
}
void open (BitArray inputChannels,
BitArray outputChannels,
void open (BigInteger inputChannels,
BigInteger outputChannels,
const double sampleRate_,
const int bufferSize_)
{
@@ -581,7 +581,7 @@ public:
String error;
double sampleRate;
int bufferSize;
BitArray currentInputChans, currentOutputChans;
BigInteger currentInputChans, currentOutputChans;
Array <int> sampleRates;
StringArray channelNamesOut, channelNamesIn;
@@ -704,8 +704,8 @@ public:
return 512;
}
const String open (const BitArray& inputChannels,
const BitArray& outputChannels,
const String open (const BigInteger& inputChannels,
const BigInteger& outputChannels,
double sampleRate,
int bufferSizeSamples)
{
@@ -760,12 +760,12 @@ public:
return internal->getBitDepth();
}
const BitArray getActiveOutputChannels() const
const BigInteger getActiveOutputChannels() const
{
return internal->currentOutputChans;
}
const BitArray getActiveInputChannels() const
const BigInteger getActiveInputChannels() const
{
return internal->currentInputChans;
}


+ 9
- 9
src/native/linux/juce_linux_JackAudio.cpp View File

@@ -211,7 +211,7 @@ public:
int getBufferSizeSamples (int index) { return getDefaultBufferSize(); }
int getDefaultBufferSize() { return client != 0 ? JUCE_NAMESPACE::jack_get_buffer_size (client) : 0; }
const String open (const BitArray& inputChannels, const BitArray& outputChannels,
const String open (const BigInteger& inputChannels, const BigInteger& outputChannels,
double sampleRate, int bufferSizeSamples)
{
if (client == 0)
@@ -228,13 +228,13 @@ public:
JUCE_NAMESPACE::jack_activate (client);
isOpen_ = true;
if (! inputChannels.isEmpty())
if (! inputChannels.isZero())
{
const char** const ports = JUCE_NAMESPACE::jack_get_ports (client, 0, 0, /* JackPortIsPhysical | */ JackPortIsOutput);
if (ports != 0)
{
const int numInputChannels = inputChannels.getHighestBit () + 1;
const int numInputChannels = inputChannels.getHighestBit() + 1;
for (int i = 0; i < numInputChannels; ++i)
{
@@ -252,13 +252,13 @@ public:
}
}
if (! outputChannels.isEmpty())
if (! outputChannels.isZero())
{
const char** const ports = JUCE_NAMESPACE::jack_get_ports (client, 0, 0, /* JackPortIsPhysical | */ JackPortIsInput);
if (ports != 0)
{
const int numOutputChannels = outputChannels.getHighestBit () + 1;
const int numOutputChannels = outputChannels.getHighestBit() + 1;
for (int i = 0; i < numOutputChannels; ++i)
{
@@ -324,9 +324,9 @@ public:
int getCurrentBitDepth() { return 32; }
const String getLastError() { return lastError; }
const BitArray getActiveOutputChannels() const
const BigInteger getActiveOutputChannels() const
{
BitArray outputBits;
BigInteger outputBits;
for (int i = 0; i < outputPorts.size(); i++)
if (JUCE_NAMESPACE::jack_port_connected ((jack_port_t*) outputPorts [i]))
@@ -335,9 +335,9 @@ public:
return outputBits;
}
const BitArray getActiveInputChannels() const
const BigInteger getActiveInputChannels() const
{
BitArray inputBits;
BigInteger inputBits;
for (int i = 0; i < inputPorts.size(); i++)
if (JUCE_NAMESPACE::jack_port_connected ((jack_port_t*) inputPorts [i]))


+ 5
- 5
src/native/mac/juce_iphone_Audio.cpp View File

@@ -98,8 +98,8 @@ public:
return 1024;
}
const String open (const BitArray& inputChannels,
const BitArray& outputChannels,
const String open (const BigInteger& inputChannels,
const BigInteger& outputChannels,
double sampleRate,
int bufferSize)
{
@@ -178,12 +178,12 @@ public:
return 16;
}
const BitArray getActiveOutputChannels() const
const BigInteger getActiveOutputChannels() const
{
return activeOutputChans;
}
const BitArray getActiveInputChannels() const
const BigInteger getActiveInputChannels() const
{
return activeInputChans;
}
@@ -251,7 +251,7 @@ private:
AudioUnit audioUnit;
UInt32 audioInputIsAvailable;
AudioIODeviceCallback* callback;
BitArray activeOutputChans, activeInputChans;
BigInteger activeOutputChans, activeInputChans;
AudioSampleBuffer floatData;
float* inputChannels[3];


+ 10
- 10
src/native/mac/juce_mac_CoreAudio.cpp View File

@@ -421,8 +421,8 @@ public:
}
//==============================================================================
const String reopen (const BitArray& inputChannels,
const BitArray& outputChannels,
const String reopen (const BigInteger& inputChannels,
const BigInteger& outputChannels,
double newSampleRate,
int bufferSizeSamples)
{
@@ -761,7 +761,7 @@ public:
juce_UseDebuggingNewOperator
int inputLatency, outputLatency;
BitArray activeInputChans, activeOutputChans;
BigInteger activeInputChans, activeOutputChans;
StringArray inChanNames, outChanNames;
Array <double> sampleRates;
Array <int> bufferSizes;
@@ -960,8 +960,8 @@ public:
return 512;
}
const String open (const BitArray& inputChannels,
const BitArray& outputChannels,
const String open (const BigInteger& inputChannels,
const BigInteger& outputChannels,
double sampleRate,
int bufferSizeSamples)
{
@@ -1001,21 +1001,21 @@ public:
return 32; // no way to find out, so just assume it's high..
}
const BitArray getActiveOutputChannels() const
const BigInteger getActiveOutputChannels() const
{
return internal != 0 ? internal->activeOutputChans : BitArray();
return internal != 0 ? internal->activeOutputChans : BigInteger();
}
const BitArray getActiveInputChannels() const
const BigInteger getActiveInputChannels() const
{
BitArray chans;
BigInteger chans;
if (internal != 0)
{
chans = internal->activeInputChans;
if (internal->inputDevice != 0)
chans.orWith (internal->inputDevice->activeInputChans);
chans |= internal->inputDevice->activeInputChans;
}
return chans;


+ 6
- 6
src/native/windows/juce_win32_ASIO.cpp View File

@@ -186,8 +186,8 @@ public:
return preferredSize;
}
const String open (const BitArray& inputChannels,
const BitArray& outputChannels,
const String open (const BigInteger& inputChannels,
const BigInteger& outputChannels,
double sr,
int bufferSizeSamples)
{
@@ -653,12 +653,12 @@ public:
return currentSampleRate;
}
const BitArray getActiveOutputChannels() const
const BigInteger getActiveOutputChannels() const
{
return currentChansOut;
}
const BitArray getActiveInputChannels() const
const BigInteger getActiveInputChannels() const
{
return currentChansIn;
}
@@ -781,7 +781,7 @@ public:
AudioIODeviceCallback* const oldCallback = currentCallback;
close();
open (BitArray (currentChansIn), BitArray (currentChansOut),
open (BigInteger (currentChansIn), BigInteger (currentChansOut),
currentSampleRate, currentBlockSizeSamples);
if (oldCallback != 0)
@@ -817,7 +817,7 @@ private:
int volatile currentBlockSizeSamples;
int volatile currentBitDepth;
double volatile currentSampleRate;
BitArray currentChansOut, currentChansIn;
BigInteger currentChansOut, currentChansIn;
AudioIODeviceCallback* volatile currentCallback;
CriticalSection callbackLock;


+ 9
- 9
src/native/windows/juce_win32_DirectSound.cpp View File

@@ -1030,8 +1030,8 @@ public:
return 2560;
}
const String open (const BitArray& inputChannels,
const BitArray& outputChannels,
const String open (const BigInteger& inputChannels,
const BigInteger& outputChannels,
double sampleRate,
int bufferSizeSamples)
{
@@ -1083,12 +1083,12 @@ public:
return bits;
}
const BitArray getActiveOutputChannels() const
const BigInteger getActiveOutputChannels() const
{
return enabledOutputs;
}
const BitArray getActiveInputChannels() const
const BigInteger getActiveInputChannels() const
{
return enabledInputs;
}
@@ -1167,7 +1167,7 @@ private:
int volatile totalSamplesOut;
int64 volatile lastBlockTime;
double sampleRate;
BitArray enabledInputs, enabledOutputs;
BigInteger enabledInputs, enabledOutputs;
HeapBlock <float*> inputBuffers, outputBuffers;
AudioIODeviceCallback* callback;
@@ -1176,8 +1176,8 @@ private:
DSoundAudioIODevice (const DSoundAudioIODevice&);
DSoundAudioIODevice& operator= (const DSoundAudioIODevice&);
const String openDevice (const BitArray& inputChannels,
const BitArray& outputChannels,
const String openDevice (const BigInteger& inputChannels,
const BigInteger& outputChannels,
double sampleRate_,
int bufferSizeSamples_);
@@ -1497,8 +1497,8 @@ private:
};
//==============================================================================
const String DSoundAudioIODevice::openDevice (const BitArray& inputChannels,
const BitArray& outputChannels,
const String DSoundAudioIODevice::openDevice (const BigInteger& inputChannels,
const BigInteger& outputChannels,
double sampleRate_,
int bufferSizeSamples_)
{


+ 7
- 7
src/native/windows/juce_win32_WASAPI.cpp View File

@@ -182,7 +182,7 @@ public:
bool isOk() const throw() { return defaultBufferSize > 0 && defaultSampleRate > 0; }
bool openClient (const double newSampleRate, const BitArray& newChannels)
bool openClient (const double newSampleRate, const BigInteger& newChannels)
{
sampleRate = newSampleRate;
channels = newChannels;
@@ -232,7 +232,7 @@ public:
const bool useExclusiveMode;
Array <double> rates;
HANDLE clientEvent;
BitArray channels;
BigInteger channels;
AudioDataConverters::DataFormat dataFormat;
Array <int> channelMaps;
UINT32 actualBufferSize;
@@ -338,7 +338,7 @@ public:
close();
}
bool open (const double newSampleRate, const BitArray& newChannels)
bool open (const double newSampleRate, const BigInteger& newChannels)
{
reservoirSize = 0;
reservoirCapacity = 16384;
@@ -483,7 +483,7 @@ public:
close();
}
bool open (const double newSampleRate, const BitArray& newChannels)
bool open (const double newSampleRate, const BigInteger& newChannels)
{
return openClient (newSampleRate, newChannels)
&& (numChannels == 0 || OK (client->GetService (__uuidof (IAudioRenderClient), (void**) &renderClient)));
@@ -674,12 +674,12 @@ public:
int getCurrentBitDepth() { return 32; }
int getOutputLatencyInSamples() { return latencyOut; }
int getInputLatencyInSamples() { return latencyIn; }
const BitArray getActiveOutputChannels() const { return outputDevice != 0 ? outputDevice->channels : BitArray(); }
const BitArray getActiveInputChannels() const { return inputDevice != 0 ? inputDevice->channels : BitArray(); }
const BigInteger getActiveOutputChannels() const { return outputDevice != 0 ? outputDevice->channels : BigInteger(); }
const BigInteger getActiveInputChannels() const { return inputDevice != 0 ? inputDevice->channels : BigInteger(); }
const String getLastError() { return lastError; }
const String open (const BitArray& inputChannels, const BitArray& outputChannels,
const String open (const BigInteger& inputChannels, const BigInteger& outputChannels,
double sampleRate, int bufferSizeSamples)
{
close();


Loading…
Cancel
Save