diff --git a/extras/Demo/Source/Demos/AudioLatencyDemo.cpp b/extras/Demo/Source/Demos/AudioLatencyDemo.cpp index f29694e751..f16ce79c07 100644 --- a/extras/Demo/Source/Demos/AudioLatencyDemo.cpp +++ b/extras/Demo/Source/Demos/AudioLatencyDemo.cpp @@ -32,9 +32,7 @@ class LatencyTester : public AudioIODeviceCallback, { public: LatencyTester (TextEditor& resultsBox_) - : testSound (1, 1), - recordedSound (1, 1), - playingSampleNum (0), + : playingSampleNum (0), recordedSampleNum (-1), sampleRate (0), testIsRunning (false), diff --git a/modules/juce_audio_basics/buffers/juce_AudioSampleBuffer.cpp b/modules/juce_audio_basics/buffers/juce_AudioSampleBuffer.cpp index 3addc5a193..72d7f0d93a 100644 --- a/modules/juce_audio_basics/buffers/juce_AudioSampleBuffer.cpp +++ b/modules/juce_audio_basics/buffers/juce_AudioSampleBuffer.cpp @@ -22,13 +22,20 @@ ============================================================================== */ +AudioSampleBuffer::AudioSampleBuffer() noexcept + : numChannels (0), size (0), allocatedBytes (0), + channels (static_cast (preallocatedChannelSpace)), + isClear (false) +{ +} + AudioSampleBuffer::AudioSampleBuffer (const int numChans, const int numSamples) noexcept : numChannels (numChans), size (numSamples) { jassert (numSamples >= 0); - jassert (numChans > 0); + jassert (numChans >= 0); allocateData(); } @@ -63,7 +70,7 @@ void AudioSampleBuffer::allocateData() const size_t channelListSize = sizeof (float*) * (size_t) (numChannels + 1); allocatedBytes = (size_t) numChannels * (size_t) size * sizeof (float) + channelListSize + 32; allocatedData.malloc (allocatedBytes); - channels = reinterpret_cast (allocatedData.getData()); + channels = reinterpret_cast (allocatedData.getData()); float* chan = (float*) (allocatedData + channelListSize); for (int i = 0; i < numChannels; ++i) @@ -83,7 +90,8 @@ AudioSampleBuffer::AudioSampleBuffer (float* const* dataToReferTo, size (numSamples), allocatedBytes (0) { - jassert (numChans > 0); + jassert (dataToReferTo != nullptr); + jassert (numChans >= 0); allocateChannels (dataToReferTo, 0); } @@ -96,7 +104,8 @@ AudioSampleBuffer::AudioSampleBuffer (float* const* dataToReferTo, allocatedBytes (0), isClear (false) { - jassert (numChans > 0); + jassert (dataToReferTo != nullptr); + jassert (numChans >= 0); allocateChannels (dataToReferTo, startSample); } @@ -104,7 +113,8 @@ void AudioSampleBuffer::setDataToReferTo (float** dataToReferTo, const int newNumChannels, const int newNumSamples) noexcept { - jassert (newNumChannels > 0); + jassert (dataToReferTo != nullptr); + jassert (newNumChannels >= 0); allocatedBytes = 0; allocatedData.free(); @@ -121,12 +131,12 @@ void AudioSampleBuffer::allocateChannels (float* const* const dataToReferTo, int // (try to avoid doing a malloc here, as that'll blow up things like Pro-Tools) if (numChannels < (int) numElementsInArray (preallocatedChannelSpace)) { - channels = static_cast (preallocatedChannelSpace); + channels = static_cast (preallocatedChannelSpace); } else { allocatedData.malloc ((size_t) numChannels + 1, sizeof (float*)); - channels = reinterpret_cast (allocatedData.getData()); + channels = reinterpret_cast (allocatedData.getData()); } for (int i = 0; i < numChannels; ++i) @@ -171,7 +181,7 @@ void AudioSampleBuffer::setSize (const int newNumChannels, const bool clearExtraSpace, const bool avoidReallocating) noexcept { - jassert (newNumChannels > 0); + jassert (newNumChannels >= 0); jassert (newNumSamples >= 0); if (newNumSamples != size || newNumChannels != numChannels) diff --git a/modules/juce_audio_basics/buffers/juce_AudioSampleBuffer.h b/modules/juce_audio_basics/buffers/juce_AudioSampleBuffer.h index 2674ad048c..aef8850d91 100644 --- a/modules/juce_audio_basics/buffers/juce_AudioSampleBuffer.h +++ b/modules/juce_audio_basics/buffers/juce_AudioSampleBuffer.h @@ -34,6 +34,10 @@ class JUCE_API AudioSampleBuffer { public: + //============================================================================== + /** Creates an empty buffer with 0 channels and 0 length. */ + AudioSampleBuffer() noexcept; + //============================================================================== /** Creates a buffer with a specified number of channels and samples. @@ -93,12 +97,12 @@ public: using an external data buffer, in which case boths buffers will just point to the same shared block of data. */ - AudioSampleBuffer (const AudioSampleBuffer& other) noexcept; + AudioSampleBuffer (const AudioSampleBuffer&) noexcept; /** Copies another buffer onto this one. This buffer's size will be changed to that of the other buffer. */ - AudioSampleBuffer& operator= (const AudioSampleBuffer& other) noexcept; + AudioSampleBuffer& operator= (const AudioSampleBuffer&) noexcept; /** Destructor. This will free any memory allocated by the buffer. diff --git a/modules/juce_audio_basics/sources/juce_BufferingAudioSource.cpp b/modules/juce_audio_basics/sources/juce_BufferingAudioSource.cpp index 827cd7be5e..21dc173a60 100644 --- a/modules/juce_audio_basics/sources/juce_BufferingAudioSource.cpp +++ b/modules/juce_audio_basics/sources/juce_BufferingAudioSource.cpp @@ -31,7 +31,6 @@ BufferingAudioSource::BufferingAudioSource (PositionableAudioSource* s, backgroundThread (thread), numberOfSamplesToBuffer (jmax (1024, bufferSizeSamples)), numberOfChannels (numChannels), - buffer (numChannels, 0), bufferValidStart (0), bufferValidEnd (0), nextPlayPos (0), diff --git a/modules/juce_audio_basics/sources/juce_ChannelRemappingAudioSource.cpp b/modules/juce_audio_basics/sources/juce_ChannelRemappingAudioSource.cpp index af408b10b6..7e0a58cb46 100644 --- a/modules/juce_audio_basics/sources/juce_ChannelRemappingAudioSource.cpp +++ b/modules/juce_audio_basics/sources/juce_ChannelRemappingAudioSource.cpp @@ -25,8 +25,7 @@ ChannelRemappingAudioSource::ChannelRemappingAudioSource (AudioSource* const source_, const bool deleteSourceWhenDeleted) : source (source_, deleteSourceWhenDeleted), - requiredNumberOfChannels (2), - buffer (2, 16) + requiredNumberOfChannels (2) { remappedInfo.buffer = &buffer; remappedInfo.startSample = 0; diff --git a/modules/juce_audio_basics/sources/juce_MixerAudioSource.cpp b/modules/juce_audio_basics/sources/juce_MixerAudioSource.cpp index f5a2f8fb05..60ae1919fe 100644 --- a/modules/juce_audio_basics/sources/juce_MixerAudioSource.cpp +++ b/modules/juce_audio_basics/sources/juce_MixerAudioSource.cpp @@ -23,9 +23,7 @@ */ MixerAudioSource::MixerAudioSource() - : tempBuffer (2, 0), - currentSampleRate (0.0), - bufferSizeExpected (0) + : currentSampleRate (0.0), bufferSizeExpected (0) { } diff --git a/modules/juce_audio_basics/sources/juce_ResamplingAudioSource.cpp b/modules/juce_audio_basics/sources/juce_ResamplingAudioSource.cpp index a48ed43e1e..52fc7302e8 100644 --- a/modules/juce_audio_basics/sources/juce_ResamplingAudioSource.cpp +++ b/modules/juce_audio_basics/sources/juce_ResamplingAudioSource.cpp @@ -28,14 +28,12 @@ ResamplingAudioSource::ResamplingAudioSource (AudioSource* const inputSource, : input (inputSource, deleteInputWhenDeleted), ratio (1.0), lastRatio (1.0), - buffer (numChannels_, 0), bufferPos (0), sampsInBuffer (0), subSampleOffset (0), numChannels (numChannels_) { jassert (input != nullptr); - zeromem (coefficients, sizeof (coefficients)); } diff --git a/modules/juce_audio_devices/audio_io/juce_AudioDeviceManager.cpp b/modules/juce_audio_devices/audio_io/juce_AudioDeviceManager.cpp index 8ab2096a38..e3584d9c85 100644 --- a/modules/juce_audio_devices/audio_io/juce_AudioDeviceManager.cpp +++ b/modules/juce_audio_devices/audio_io/juce_AudioDeviceManager.cpp @@ -95,7 +95,6 @@ AudioDeviceManager::AudioDeviceManager() useInputNames (false), inputLevel (0), testSoundPosition (0), - tempBuffer (2, 2), cpuUsageMs (0), timeToCpuScale (0) { diff --git a/modules/juce_audio_devices/native/juce_mac_CoreAudio.cpp b/modules/juce_audio_devices/native/juce_mac_CoreAudio.cpp index 9fb77ddb24..625f1b8083 100644 --- a/modules/juce_audio_devices/native/juce_mac_CoreAudio.cpp +++ b/modules/juce_audio_devices/native/juce_mac_CoreAudio.cpp @@ -1026,8 +1026,7 @@ public: AudioIODeviceCombiner (const String& deviceName) : AudioIODevice (deviceName, "CoreAudio"), Thread (deviceName), callback (nullptr), - currentSampleRate (0), currentBufferSize (0), active (false), - fifos (1, 1) + currentSampleRate (0), currentBufferSize (0), active (false) { } diff --git a/modules/juce_audio_devices/native/juce_win32_DirectSound.cpp b/modules/juce_audio_devices/native/juce_win32_DirectSound.cpp index d04902b628..9c43a1da08 100644 --- a/modules/juce_audio_devices/native/juce_win32_DirectSound.cpp +++ b/modules/juce_audio_devices/native/juce_win32_DirectSound.cpp @@ -731,8 +731,6 @@ public: isStarted (false), bufferSizeSamples (0), sampleRate (0.0), - inputBuffers (1, 1), - outputBuffers (1, 1), callback (nullptr) { if (outputDeviceIndex_ >= 0) @@ -871,8 +869,8 @@ private: bool isStarted; String lastError; - OwnedArray inChans; - OwnedArray outChans; + OwnedArray inChans; + OwnedArray outChans; WaitableEvent startEvent; int bufferSizeSamples; diff --git a/modules/juce_audio_devices/sources/juce_AudioSourcePlayer.cpp b/modules/juce_audio_devices/sources/juce_AudioSourcePlayer.cpp index 45b2a3ad6c..c351795338 100644 --- a/modules/juce_audio_devices/sources/juce_AudioSourcePlayer.cpp +++ b/modules/juce_audio_devices/sources/juce_AudioSourcePlayer.cpp @@ -26,7 +26,6 @@ AudioSourcePlayer::AudioSourcePlayer() : source (nullptr), sampleRate (0), bufferSize (0), - tempBuffer (2, 8), lastGain (1.0f), gain (1.0f) { diff --git a/modules/juce_audio_formats/codecs/juce_FlacAudioFormat.cpp b/modules/juce_audio_formats/codecs/juce_FlacAudioFormat.cpp index 99c9fe105c..d9957565ef 100644 --- a/modules/juce_audio_formats/codecs/juce_FlacAudioFormat.cpp +++ b/modules/juce_audio_formats/codecs/juce_FlacAudioFormat.cpp @@ -104,7 +104,6 @@ class FlacReader : public AudioFormatReader public: FlacReader (InputStream* const in) : AudioFormatReader (in, flacFormatName), - reservoir (2, 0), reservoirStart (0), samplesInReservoir (0), scanningForLength (false) diff --git a/modules/juce_audio_formats/codecs/juce_OggVorbisAudioFormat.cpp b/modules/juce_audio_formats/codecs/juce_OggVorbisAudioFormat.cpp index e6303dc818..9d9ace156d 100644 --- a/modules/juce_audio_formats/codecs/juce_OggVorbisAudioFormat.cpp +++ b/modules/juce_audio_formats/codecs/juce_OggVorbisAudioFormat.cpp @@ -106,7 +106,6 @@ class OggReader : public AudioFormatReader public: OggReader (InputStream* const inp) : AudioFormatReader (inp, oggFormatName), - reservoir (2, 4096), reservoirStart (0), samplesInReservoir (0) { @@ -140,8 +139,7 @@ public: bitsPerSample = 16; sampleRate = info->rate; - reservoir.setSize ((int) numChannels, - (int) jmin (lengthInSamples, (int64) reservoir.getNumSamples())); + reservoir.setSize ((int) numChannels, (int) jmin (lengthInSamples, (int64) 4096)); } } diff --git a/modules/juce_audio_processors/processors/juce_AudioProcessorGraph.cpp b/modules/juce_audio_processors/processors/juce_AudioProcessorGraph.cpp index 0dd5a14fac..9ca46d2f7f 100644 --- a/modules/juce_audio_processors/processors/juce_AudioProcessorGraph.cpp +++ b/modules/juce_audio_processors/processors/juce_AudioProcessorGraph.cpp @@ -923,9 +923,7 @@ void AudioProcessorGraph::Node::setParentGraph (AudioProcessorGraph* const graph //============================================================================== AudioProcessorGraph::AudioProcessorGraph() : lastNodeId (0), - renderingBuffers (1, 1), currentAudioInputBuffer (nullptr), - currentAudioOutputBuffer (1, 1), currentMidiInputBuffer (nullptr) { } diff --git a/modules/juce_audio_utils/players/juce_AudioProcessorPlayer.cpp b/modules/juce_audio_utils/players/juce_AudioProcessorPlayer.cpp index 649406fa9d..721cf01464 100644 --- a/modules/juce_audio_utils/players/juce_AudioProcessorPlayer.cpp +++ b/modules/juce_audio_utils/players/juce_AudioProcessorPlayer.cpp @@ -28,8 +28,7 @@ AudioProcessorPlayer::AudioProcessorPlayer() blockSize (0), isPrepared (false), numInputChans (0), - numOutputChans (0), - tempBuffer (1, 1) + numOutputChans (0) { }