mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-31 03:00:05 +00:00
Added fake placeholder versions of the new c++0x 'noexcept' and 'nullptr' keywords, and altered the library classes to use these instead of 'throw()' and '0'. This shouldn't make any difference at all to existing code, but will enable better static checking with future c++0x compilers.
This commit is contained in:
parent
e0a38a30db
commit
f04309f44a
533 changed files with 13927 additions and 13931 deletions
|
|
@ -94,7 +94,7 @@ bool check (HRESULT hr)
|
|||
const String getDeviceID (IMMDevice* const device)
|
||||
{
|
||||
String s;
|
||||
WCHAR* deviceId = 0;
|
||||
WCHAR* deviceId = nullptr;
|
||||
|
||||
if (check (device->GetId (&deviceId)))
|
||||
{
|
||||
|
|
@ -115,12 +115,12 @@ EDataFlow getDataFlow (const ComSmartPtr<IMMDevice>& device)
|
|||
return flow;
|
||||
}
|
||||
|
||||
int refTimeToSamples (const REFERENCE_TIME& t, const double sampleRate) throw()
|
||||
int refTimeToSamples (const REFERENCE_TIME& t, const double sampleRate) noexcept
|
||||
{
|
||||
return roundDoubleToInt (sampleRate * ((double) t) * 0.0000001);
|
||||
}
|
||||
|
||||
void copyWavFormat (WAVEFORMATEXTENSIBLE& dest, const WAVEFORMATEX* const src) throw()
|
||||
void copyWavFormat (WAVEFORMATEXTENSIBLE& dest, const WAVEFORMATEX* const src) noexcept
|
||||
{
|
||||
memcpy (&dest, src, src->wFormatTag == WAVE_FORMAT_EXTENSIBLE ? sizeof (WAVEFORMATEXTENSIBLE)
|
||||
: sizeof (WAVEFORMATEX));
|
||||
|
|
@ -145,14 +145,14 @@ public:
|
|||
clientEvent = CreateEvent (0, false, false, _T("JuceWASAPI"));
|
||||
|
||||
ComSmartPtr <IAudioClient> tempClient (createClient());
|
||||
if (tempClient == 0)
|
||||
if (tempClient == nullptr)
|
||||
return;
|
||||
|
||||
REFERENCE_TIME defaultPeriod, minPeriod;
|
||||
if (! check (tempClient->GetDevicePeriod (&defaultPeriod, &minPeriod)))
|
||||
return;
|
||||
|
||||
WAVEFORMATEX* mixFormat = 0;
|
||||
WAVEFORMATEX* mixFormat = nullptr;
|
||||
if (! check (tempClient->GetMixFormat (&mixFormat)))
|
||||
return;
|
||||
|
||||
|
|
@ -185,11 +185,11 @@ public:
|
|||
|
||||
~WASAPIDeviceBase()
|
||||
{
|
||||
device = 0;
|
||||
device = nullptr;
|
||||
CloseHandle (clientEvent);
|
||||
}
|
||||
|
||||
bool isOk() const throw() { return defaultBufferSize > 0 && defaultSampleRate > 0; }
|
||||
bool isOk() const noexcept { return defaultBufferSize > 0 && defaultSampleRate > 0; }
|
||||
|
||||
bool openClient (const double newSampleRate, const BigInteger& newChannels)
|
||||
{
|
||||
|
|
@ -203,7 +203,7 @@ public:
|
|||
|
||||
client = createClient();
|
||||
|
||||
if (client != 0
|
||||
if (client != nullptr
|
||||
&& (tryInitialisingWithFormat (true, 4) || tryInitialisingWithFormat (false, 4)
|
||||
|| tryInitialisingWithFormat (false, 3) || tryInitialisingWithFormat (false, 2)))
|
||||
{
|
||||
|
|
@ -230,11 +230,11 @@ public:
|
|||
|
||||
void closeClient()
|
||||
{
|
||||
if (client != 0)
|
||||
if (client != nullptr)
|
||||
client->Stop();
|
||||
|
||||
deleteSessionEventCallback();
|
||||
client = 0;
|
||||
client = nullptr;
|
||||
ResetEvent (clientEvent);
|
||||
}
|
||||
|
||||
|
|
@ -297,7 +297,7 @@ private:
|
|||
client->GetService (__uuidof (IAudioSessionControl),
|
||||
(void**) audioSessionControl.resetAndGetPointerAddress());
|
||||
|
||||
if (audioSessionControl != 0)
|
||||
if (audioSessionControl != nullptr)
|
||||
{
|
||||
sessionEventCallback = new SessionEventCallback (*this);
|
||||
audioSessionControl->RegisterAudioSessionNotification (sessionEventCallback);
|
||||
|
|
@ -307,11 +307,11 @@ private:
|
|||
|
||||
void deleteSessionEventCallback()
|
||||
{
|
||||
if (audioSessionControl != 0 && sessionEventCallback != 0)
|
||||
if (audioSessionControl != nullptr && sessionEventCallback != nullptr)
|
||||
audioSessionControl->UnregisterAudioSessionNotification (sessionEventCallback);
|
||||
|
||||
audioSessionControl = 0;
|
||||
sessionEventCallback = 0;
|
||||
audioSessionControl = nullptr;
|
||||
sessionEventCallback = nullptr;
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
|
|
@ -319,7 +319,7 @@ private:
|
|||
{
|
||||
ComSmartPtr <IAudioClient> client;
|
||||
|
||||
if (device != 0)
|
||||
if (device != nullptr)
|
||||
{
|
||||
HRESULT hr = device->Activate (__uuidof (IAudioClient), CLSCTX_INPROC_SERVER, 0, (void**) client.resetAndGetPointerAddress());
|
||||
logFailure (hr);
|
||||
|
|
@ -360,7 +360,7 @@ private:
|
|||
default: break;
|
||||
}
|
||||
|
||||
WAVEFORMATEXTENSIBLE* nearestFormat = 0;
|
||||
WAVEFORMATEXTENSIBLE* nearestFormat = nullptr;
|
||||
|
||||
HRESULT hr = client->IsFormatSupported (useExclusiveMode ? AUDCLNT_SHAREMODE_EXCLUSIVE : AUDCLNT_SHAREMODE_SHARED,
|
||||
(WAVEFORMATEX*) &format, useExclusiveMode ? 0 : (WAVEFORMATEX**) &nearestFormat);
|
||||
|
|
@ -426,7 +426,7 @@ public:
|
|||
void close()
|
||||
{
|
||||
closeClient();
|
||||
captureClient = 0;
|
||||
captureClient = nullptr;
|
||||
reservoir.setSize (0);
|
||||
}
|
||||
|
||||
|
|
@ -539,7 +539,7 @@ public:
|
|||
void close()
|
||||
{
|
||||
closeClient();
|
||||
renderClient = 0;
|
||||
renderClient = nullptr;
|
||||
}
|
||||
|
||||
template <class DestType>
|
||||
|
|
@ -582,7 +582,7 @@ public:
|
|||
continue;
|
||||
}
|
||||
|
||||
uint8* outputData = 0;
|
||||
uint8* outputData = nullptr;
|
||||
if (check (renderClient->GetBuffer (samplesToDo, &outputData)))
|
||||
{
|
||||
for (int i = 0; i < numSrcBuffers; ++i)
|
||||
|
|
@ -621,7 +621,7 @@ public:
|
|||
isStarted (false),
|
||||
currentBufferSizeSamples (0),
|
||||
currentSampleRate (0),
|
||||
callback (0)
|
||||
callback (nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -639,9 +639,9 @@ public:
|
|||
|
||||
if (createDevices())
|
||||
{
|
||||
jassert (inputDevice != 0 || outputDevice != 0);
|
||||
jassert (inputDevice != nullptr || outputDevice != nullptr);
|
||||
|
||||
if (inputDevice != 0 && outputDevice != 0)
|
||||
if (inputDevice != nullptr && outputDevice != nullptr)
|
||||
{
|
||||
defaultSampleRate = jmin (inputDevice->defaultSampleRate, outputDevice->defaultSampleRate);
|
||||
minBufferSize = jmin (inputDevice->minBufferSize, outputDevice->minBufferSize);
|
||||
|
|
@ -651,8 +651,8 @@ public:
|
|||
}
|
||||
else
|
||||
{
|
||||
WASAPIDeviceBase* d = inputDevice != 0 ? static_cast<WASAPIDeviceBase*> (inputDevice)
|
||||
: static_cast<WASAPIDeviceBase*> (outputDevice);
|
||||
WASAPIDeviceBase* d = inputDevice != nullptr ? static_cast<WASAPIDeviceBase*> (inputDevice)
|
||||
: static_cast<WASAPIDeviceBase*> (outputDevice);
|
||||
defaultSampleRate = d->defaultSampleRate;
|
||||
minBufferSize = d->minBufferSize;
|
||||
defaultBufferSize = d->defaultBufferSize;
|
||||
|
|
@ -682,7 +682,7 @@ public:
|
|||
{
|
||||
StringArray outChannels;
|
||||
|
||||
if (outputDevice != 0)
|
||||
if (outputDevice != nullptr)
|
||||
for (int i = 1; i <= outputDevice->actualNumChannels; ++i)
|
||||
outChannels.add ("Output channel " + String (i));
|
||||
|
||||
|
|
@ -693,7 +693,7 @@ public:
|
|||
{
|
||||
StringArray inChannels;
|
||||
|
||||
if (inputDevice != 0)
|
||||
if (inputDevice != nullptr)
|
||||
for (int i = 1; i <= inputDevice->actualNumChannels; ++i)
|
||||
inChannels.add ("Input channel " + String (i));
|
||||
|
||||
|
|
@ -711,8 +711,8 @@ public:
|
|||
int getCurrentBitDepth() { return 32; }
|
||||
int getOutputLatencyInSamples() { return latencyOut; }
|
||||
int getInputLatencyInSamples() { return latencyIn; }
|
||||
const BigInteger getActiveOutputChannels() const { return outputDevice != 0 ? outputDevice->channels : BigInteger(); }
|
||||
const BigInteger getActiveInputChannels() const { return inputDevice != 0 ? inputDevice->channels : BigInteger(); }
|
||||
const BigInteger getActiveOutputChannels() const { return outputDevice != nullptr ? outputDevice->channels : BigInteger(); }
|
||||
const BigInteger getActiveInputChannels() const { return inputDevice != nullptr ? inputDevice->channels : BigInteger(); }
|
||||
const String getLastError() { return lastError; }
|
||||
|
||||
|
||||
|
|
@ -722,7 +722,7 @@ public:
|
|||
close();
|
||||
lastError = String::empty;
|
||||
|
||||
if (sampleRates.size() == 0 && inputDevice != 0 && outputDevice != 0)
|
||||
if (sampleRates.size() == 0 && inputDevice != nullptr && outputDevice != nullptr)
|
||||
{
|
||||
lastError = "The input and output devices don't share a common sample rate!";
|
||||
return lastError;
|
||||
|
|
@ -731,33 +731,33 @@ public:
|
|||
currentBufferSizeSamples = bufferSizeSamples <= 0 ? defaultBufferSize : jmax (bufferSizeSamples, minBufferSize);
|
||||
currentSampleRate = sampleRate > 0 ? sampleRate : defaultSampleRate;
|
||||
|
||||
if (inputDevice != 0 && ! inputDevice->open (currentSampleRate, inputChannels))
|
||||
if (inputDevice != nullptr && ! inputDevice->open (currentSampleRate, inputChannels))
|
||||
{
|
||||
lastError = "Couldn't open the input device!";
|
||||
return lastError;
|
||||
}
|
||||
|
||||
if (outputDevice != 0 && ! outputDevice->open (currentSampleRate, outputChannels))
|
||||
if (outputDevice != nullptr && ! outputDevice->open (currentSampleRate, outputChannels))
|
||||
{
|
||||
close();
|
||||
lastError = "Couldn't open the output device!";
|
||||
return lastError;
|
||||
}
|
||||
|
||||
if (inputDevice != 0) ResetEvent (inputDevice->clientEvent);
|
||||
if (outputDevice != 0) ResetEvent (outputDevice->clientEvent);
|
||||
if (inputDevice != nullptr) ResetEvent (inputDevice->clientEvent);
|
||||
if (outputDevice != nullptr) ResetEvent (outputDevice->clientEvent);
|
||||
|
||||
startThread (8);
|
||||
Thread::sleep (5);
|
||||
|
||||
if (inputDevice != 0 && inputDevice->client != 0)
|
||||
if (inputDevice != nullptr && inputDevice->client != nullptr)
|
||||
{
|
||||
latencyIn = inputDevice->latencySamples + inputDevice->actualBufferSize + inputDevice->minBufferSize;
|
||||
HRESULT hr = inputDevice->client->Start();
|
||||
logFailure (hr); //xxx handle this
|
||||
}
|
||||
|
||||
if (outputDevice != 0 && outputDevice->client != 0)
|
||||
if (outputDevice != nullptr && outputDevice->client != nullptr)
|
||||
{
|
||||
latencyOut = outputDevice->latencySamples + outputDevice->actualBufferSize + outputDevice->minBufferSize;
|
||||
HRESULT hr = outputDevice->client->Start();
|
||||
|
|
@ -773,13 +773,13 @@ public:
|
|||
stop();
|
||||
signalThreadShouldExit();
|
||||
|
||||
if (inputDevice != 0) SetEvent (inputDevice->clientEvent);
|
||||
if (outputDevice != 0) SetEvent (outputDevice->clientEvent);
|
||||
if (inputDevice != nullptr) SetEvent (inputDevice->clientEvent);
|
||||
if (outputDevice != nullptr) SetEvent (outputDevice->clientEvent);
|
||||
|
||||
stopThread (5000);
|
||||
|
||||
if (inputDevice != 0) inputDevice->close();
|
||||
if (outputDevice != 0) outputDevice->close();
|
||||
if (inputDevice != nullptr) inputDevice->close();
|
||||
if (outputDevice != nullptr) outputDevice->close();
|
||||
|
||||
isOpen_ = false;
|
||||
}
|
||||
|
|
@ -789,7 +789,7 @@ public:
|
|||
|
||||
void start (AudioIODeviceCallback* call)
|
||||
{
|
||||
if (isOpen_ && call != 0 && ! isStarted)
|
||||
if (isOpen_ && call != nullptr && ! isStarted)
|
||||
{
|
||||
if (! isThreadRunning())
|
||||
{
|
||||
|
|
@ -817,7 +817,7 @@ public:
|
|||
isStarted = false;
|
||||
}
|
||||
|
||||
if (callbackLocal != 0)
|
||||
if (callbackLocal != nullptr)
|
||||
callbackLocal->audioDeviceStopped();
|
||||
}
|
||||
}
|
||||
|
|
@ -855,7 +855,7 @@ public:
|
|||
|
||||
while (! threadShouldExit())
|
||||
{
|
||||
if (inputDevice != 0)
|
||||
if (inputDevice != nullptr)
|
||||
{
|
||||
inputDevice->copyBuffers (inputBuffers, numInputBuffers, bufferSize, *this);
|
||||
|
||||
|
|
@ -878,7 +878,7 @@ public:
|
|||
}
|
||||
JUCE_CATCH_EXCEPTION
|
||||
|
||||
if (outputDevice != 0)
|
||||
if (outputDevice != nullptr)
|
||||
{
|
||||
outputDevice->copyBuffers (const_cast <const float**> (outputBuffers), numOutputBuffers, bufferSize, *this);
|
||||
|
||||
|
|
@ -950,8 +950,8 @@ private:
|
|||
outputDevice = new WASAPIOutputDevice (device, useExclusiveMode);
|
||||
}
|
||||
|
||||
return (outputDeviceId.isEmpty() || (outputDevice != 0 && outputDevice->isOk()))
|
||||
&& (inputDeviceId.isEmpty() || (inputDevice != 0 && inputDevice->isOk()));
|
||||
return (outputDeviceId.isEmpty() || (outputDevice != nullptr && outputDevice->isOk()))
|
||||
&& (inputDeviceId.isEmpty() || (inputDevice != nullptr && inputDevice->isOk()));
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
|
|
@ -1065,8 +1065,8 @@ public:
|
|||
{
|
||||
jassert (hasScanned); // need to call scanForDevices() before doing this
|
||||
WASAPIAudioIODevice* const d = dynamic_cast <WASAPIAudioIODevice*> (device);
|
||||
return d == 0 ? -1 : (asInput ? inputDeviceIds.indexOf (d->inputDeviceId)
|
||||
: outputDeviceIds.indexOf (d->outputDeviceId));
|
||||
return d == nullptr ? -1 : (asInput ? inputDeviceIds.indexOf (d->inputDeviceId)
|
||||
: outputDeviceIds.indexOf (d->outputDeviceId));
|
||||
}
|
||||
|
||||
bool hasSeparateInputsAndOutputs() const { return true; }
|
||||
|
|
@ -1091,7 +1091,7 @@ public:
|
|||
useExclusiveMode);
|
||||
|
||||
if (! device->initialise())
|
||||
device = 0;
|
||||
device = nullptr;
|
||||
}
|
||||
|
||||
return device.release();
|
||||
|
|
@ -1108,11 +1108,11 @@ private:
|
|||
static const String getDefaultEndpoint (IMMDeviceEnumerator* const enumerator, const bool forCapture)
|
||||
{
|
||||
String s;
|
||||
IMMDevice* dev = 0;
|
||||
IMMDevice* dev = nullptr;
|
||||
if (check (enumerator->GetDefaultAudioEndpoint (forCapture ? eCapture : eRender,
|
||||
eMultimedia, &dev)))
|
||||
{
|
||||
WCHAR* deviceId = 0;
|
||||
WCHAR* deviceId = nullptr;
|
||||
if (check (dev->GetId (&deviceId)))
|
||||
{
|
||||
s = String (deviceId);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue