diff options
| author | Tillmann Karras <tilkax@gmail.com> | 2014-03-09 21:14:26 +0100 |
|---|---|---|
| committer | Tillmann Karras <tilkax@gmail.com> | 2014-03-09 21:14:26 +0100 |
| commit | d802d392811be44d34ae9cd23f616db93e54c50f (patch) | |
| tree | f9aa8831a0731ea246bd921d979f4bffa7f07bd0 /Source/Core/AudioCommon | |
| parent | f28116b7da6aac6069084596dc4dbf866bdebfd8 (diff) | |
clang-modernize -use-nullptr
and s/\bNULL\b/nullptr/g for *.cpp/h/mm files not compiled on my machine
Diffstat (limited to 'Source/Core/AudioCommon')
| -rw-r--r-- | Source/Core/AudioCommon/AOSoundStream.cpp | 4 | ||||
| -rw-r--r-- | Source/Core/AudioCommon/AlsaSoundStream.cpp | 6 | ||||
| -rw-r--r-- | Source/Core/AudioCommon/CoreAudioSoundStream.cpp | 4 | ||||
| -rw-r--r-- | Source/Core/AudioCommon/DPL2Decoder.cpp | 6 | ||||
| -rw-r--r-- | Source/Core/AudioCommon/DSoundStream.cpp | 8 | ||||
| -rw-r--r-- | Source/Core/AudioCommon/OpenALStream.cpp | 4 | ||||
| -rw-r--r-- | Source/Core/AudioCommon/OpenALStream.h | 2 | ||||
| -rw-r--r-- | Source/Core/AudioCommon/OpenSLESStream.cpp | 32 | ||||
| -rw-r--r-- | Source/Core/AudioCommon/OpenSLESStream.h | 4 | ||||
| -rw-r--r-- | Source/Core/AudioCommon/PulseAudioStream.cpp | 14 | ||||
| -rw-r--r-- | Source/Core/AudioCommon/WaveFile.cpp | 2 | ||||
| -rw-r--r-- | Source/Core/AudioCommon/XAudio2Stream.cpp | 2 | ||||
| -rw-r--r-- | Source/Core/AudioCommon/XAudio2_7Stream.cpp | 2 | ||||
| -rw-r--r-- | Source/Core/AudioCommon/aldlist.cpp | 20 |
14 files changed, 55 insertions, 55 deletions
diff --git a/Source/Core/AudioCommon/AOSoundStream.cpp b/Source/Core/AudioCommon/AOSoundStream.cpp index 4925d3aa52..20ec4261c2 100644 --- a/Source/Core/AudioCommon/AOSoundStream.cpp +++ b/Source/Core/AudioCommon/AOSoundStream.cpp @@ -22,7 +22,7 @@ void AOSound::SoundLoop() format.rate = m_mixer->GetSampleRate(); format.byte_format = AO_FMT_LITTLE; - device = ao_open_live(default_driver, &format, NULL /* no options */); + device = ao_open_live(default_driver, &format, nullptr /* no options */); if (!device) { PanicAlertT("AudioCommon: Error opening AO device.\n"); @@ -73,7 +73,7 @@ void AOSound::Stop() ao_shutdown(); - device = NULL; + device = nullptr; } } diff --git a/Source/Core/AudioCommon/AlsaSoundStream.cpp b/Source/Core/AudioCommon/AlsaSoundStream.cpp index a88fae0b65..ba4855400f 100644 --- a/Source/Core/AudioCommon/AlsaSoundStream.cpp +++ b/Source/Core/AudioCommon/AlsaSoundStream.cpp @@ -12,7 +12,7 @@ #define BUFFER_SIZE_MAX 8192 #define BUFFER_SIZE_BYTES (BUFFER_SIZE_MAX*2*2) -AlsaSound::AlsaSound(CMixer *mixer) : SoundStream(mixer), thread_data(0), handle(NULL), frames_to_deliver(FRAME_COUNT_MIN) +AlsaSound::AlsaSound(CMixer *mixer) : SoundStream(mixer), thread_data(0), handle(nullptr), frames_to_deliver(FRAME_COUNT_MIN) { mix_buffer = new u8[BUFFER_SIZE_BYTES]; } @@ -204,11 +204,11 @@ bool AlsaSound::AlsaInit() void AlsaSound::AlsaShutdown() { - if (handle != NULL) + if (handle != nullptr) { snd_pcm_drop(handle); snd_pcm_close(handle); - handle = NULL; + handle = nullptr; } } diff --git a/Source/Core/AudioCommon/CoreAudioSoundStream.cpp b/Source/Core/AudioCommon/CoreAudioSoundStream.cpp index a46edbb660..e311adc230 100644 --- a/Source/Core/AudioCommon/CoreAudioSoundStream.cpp +++ b/Source/Core/AudioCommon/CoreAudioSoundStream.cpp @@ -40,8 +40,8 @@ bool CoreAudioSound::Start() desc.componentFlags = 0; desc.componentFlagsMask = 0; desc.componentManufacturer = kAudioUnitManufacturer_Apple; - component = FindNextComponent(NULL, &desc); - if (component == NULL) { + component = FindNextComponent(nullptr, &desc); + if (component == nullptr) { ERROR_LOG(AUDIO, "error finding audio component"); return false; } diff --git a/Source/Core/AudioCommon/DPL2Decoder.cpp b/Source/Core/AudioCommon/DPL2Decoder.cpp index 418239fae4..29a5f73d14 100644 --- a/Source/Core/AudioCommon/DPL2Decoder.cpp +++ b/Source/Core/AudioCommon/DPL2Decoder.cpp @@ -123,7 +123,7 @@ float* design_fir(unsigned int *n, float* fc, float opt) float fc1; // Cutoff frequencies // Sanity check - if(*n==0) return NULL; + if(*n==0) return nullptr; MathUtil::Clamp(&fc[0],float(0.001),float(1)); float *w=(float*)calloc(sizeof(float),*n); @@ -188,7 +188,7 @@ void done(void) { free(filter_coefs_lfe); } - filter_coefs_lfe = NULL; + filter_coefs_lfe = nullptr; } float* calc_coefficients_125Hz_lowpass(int rate) @@ -378,5 +378,5 @@ void dpl2reset() { olddelay = -1; oldfreq = 0; - filter_coefs_lfe = NULL; + filter_coefs_lfe = nullptr; } diff --git a/Source/Core/AudioCommon/DSoundStream.cpp b/Source/Core/AudioCommon/DSoundStream.cpp index 76eb404665..742019a1b4 100644 --- a/Source/Core/AudioCommon/DSoundStream.cpp +++ b/Source/Core/AudioCommon/DSoundStream.cpp @@ -32,7 +32,7 @@ bool DSound::CreateBuffer() dsbdesc.lpwfxFormat = (WAVEFORMATEX *)&pcmwf; dsbdesc.guid3DAlgorithm = DS3DALG_DEFAULT; - HRESULT res = ds->CreateSoundBuffer(&dsbdesc, &dsBuffer, NULL); + HRESULT res = ds->CreateSoundBuffer(&dsbdesc, &dsBuffer, nullptr); if (SUCCEEDED(res)) { dsBuffer->SetCurrentPosition(0); @@ -43,7 +43,7 @@ bool DSound::CreateBuffer() { // Failed. PanicAlertT("Sound buffer creation failed: %08x", res); - dsBuffer = NULL; + dsBuffer = nullptr; return false; } } @@ -130,7 +130,7 @@ void DSound::SetVolume(int volume) // This is in "dBA attenuation" from 0 to -10000, logarithmic m_volume = (int)floor(log10((float)volume) * 5000.0f) - 10000; - if (dsBuffer != NULL) + if (dsBuffer != nullptr) dsBuffer->SetVolume(m_volume); } @@ -143,7 +143,7 @@ void DSound::Clear(bool mute) { m_muted = mute; - if (dsBuffer != NULL) + if (dsBuffer != nullptr) { if (m_muted) { diff --git a/Source/Core/AudioCommon/OpenALStream.cpp b/Source/Core/AudioCommon/OpenALStream.cpp index 99aebc6d05..38e57beca2 100644 --- a/Source/Core/AudioCommon/OpenALStream.cpp +++ b/Source/Core/AudioCommon/OpenALStream.cpp @@ -27,7 +27,7 @@ bool OpenALStream::Start() ALCdevice *pDevice = alcOpenDevice(defDevName); if (pDevice) { - ALCcontext *pContext = alcCreateContext(pDevice, NULL); + ALCcontext *pContext = alcCreateContext(pDevice, nullptr); if (pContext) { // Used to determine an appropriate period size (2x period = total buffer size) @@ -83,7 +83,7 @@ void OpenALStream::Stop() ALCcontext *pContext = alcGetCurrentContext(); ALCdevice *pDevice = alcGetContextsDevice(pContext); - alcMakeContextCurrent(NULL); + alcMakeContextCurrent(nullptr); alcDestroyContext(pContext); alcCloseDevice(pDevice); } diff --git a/Source/Core/AudioCommon/OpenALStream.h b/Source/Core/AudioCommon/OpenALStream.h index 5137ce3e43..fa394d70c0 100644 --- a/Source/Core/AudioCommon/OpenALStream.h +++ b/Source/Core/AudioCommon/OpenALStream.h @@ -44,7 +44,7 @@ class OpenALStream: public SoundStream { #if defined HAVE_OPENAL && HAVE_OPENAL public: - OpenALStream(CMixer *mixer, void *hWnd = NULL) + OpenALStream(CMixer *mixer, void *hWnd = nullptr) : SoundStream(mixer) , uiSource(0) {} diff --git a/Source/Core/AudioCommon/OpenSLESStream.cpp b/Source/Core/AudioCommon/OpenSLESStream.cpp index 847fcdffaa..a3fefebb4c 100644 --- a/Source/Core/AudioCommon/OpenSLESStream.cpp +++ b/Source/Core/AudioCommon/OpenSLESStream.cpp @@ -17,7 +17,7 @@ static SLEngineItf engineEngine; static SLObjectItf outputMixObject; // buffer queue player interfaces -static SLObjectItf bqPlayerObject = NULL; +static SLObjectItf bqPlayerObject = nullptr; static SLPlayItf bqPlayerPlay; static SLAndroidSimpleBufferQueueItf bqPlayerBufferQueue; static SLMuteSoloItf bqPlayerMuteSolo; @@ -32,7 +32,7 @@ static int curBuffer = 0; static void bqPlayerCallback(SLAndroidSimpleBufferQueueItf bq, void *context) { assert(bq == bqPlayerBufferQueue); - assert(NULL == context); + assert(nullptr == context); short *nextBuffer = buffer[curBuffer]; int nextSize = sizeof(buffer[0]); @@ -53,7 +53,7 @@ bool OpenSLESStream::Start() { SLresult result; // create engine - result = slCreateEngine(&engineObject, 0, NULL, 0, NULL, NULL); + result = slCreateEngine(&engineObject, 0, nullptr, 0, nullptr, nullptr); assert(SL_RESULT_SUCCESS == result); result = (*engineObject)->Realize(engineObject, SL_BOOLEAN_FALSE); assert(SL_RESULT_SUCCESS == result); @@ -79,7 +79,7 @@ bool OpenSLESStream::Start() // configure audio sink SLDataLocator_OutputMix loc_outmix = {SL_DATALOCATOR_OUTPUTMIX, outputMixObject}; - SLDataSink audioSnk = {&loc_outmix, NULL}; + SLDataSink audioSnk = {&loc_outmix, nullptr}; // create audio player const SLInterfaceID ids[2] = {SL_IID_BUFFERQUEUE, SL_IID_VOLUME}; @@ -94,7 +94,7 @@ bool OpenSLESStream::Start() result = (*bqPlayerObject)->GetInterface(bqPlayerObject, SL_IID_BUFFERQUEUE, &bqPlayerBufferQueue); assert(SL_RESULT_SUCCESS == result); - result = (*bqPlayerBufferQueue)->RegisterCallback(bqPlayerBufferQueue, bqPlayerCallback, NULL); + result = (*bqPlayerBufferQueue)->RegisterCallback(bqPlayerBufferQueue, bqPlayerCallback, nullptr); assert(SL_RESULT_SUCCESS == result); result = (*bqPlayerPlay)->SetPlayState(bqPlayerPlay, SL_PLAYSTATE_PLAYING); assert(SL_RESULT_SUCCESS == result); @@ -113,22 +113,22 @@ bool OpenSLESStream::Start() void OpenSLESStream::Stop() { - if (bqPlayerObject != NULL) { + if (bqPlayerObject != nullptr) { (*bqPlayerObject)->Destroy(bqPlayerObject); - bqPlayerObject = NULL; - bqPlayerPlay = NULL; - bqPlayerBufferQueue = NULL; - bqPlayerMuteSolo = NULL; - bqPlayerVolume = NULL; + bqPlayerObject = nullptr; + bqPlayerPlay = nullptr; + bqPlayerBufferQueue = nullptr; + bqPlayerMuteSolo = nullptr; + bqPlayerVolume = nullptr; } - if (outputMixObject != NULL) { + if (outputMixObject != nullptr) { (*outputMixObject)->Destroy(outputMixObject); - outputMixObject = NULL; + outputMixObject = nullptr; } - if (engineObject != NULL) { + if (engineObject != nullptr) { (*engineObject)->Destroy(engineObject); - engineObject = NULL; - engineEngine = NULL; + engineObject = nullptr; + engineEngine = nullptr; } } #endif diff --git a/Source/Core/AudioCommon/OpenSLESStream.h b/Source/Core/AudioCommon/OpenSLESStream.h index dcc94cd43b..ee81b30ff6 100644 --- a/Source/Core/AudioCommon/OpenSLESStream.h +++ b/Source/Core/AudioCommon/OpenSLESStream.h @@ -11,7 +11,7 @@ class OpenSLESStream : public SoundStream { #ifdef ANDROID public: - OpenSLESStream(CMixer *mixer, void *hWnd = NULL) + OpenSLESStream(CMixer *mixer, void *hWnd = nullptr) : SoundStream(mixer) {}; @@ -27,6 +27,6 @@ private: Common::Event soundSyncEvent; #else public: - OpenSLESStream(CMixer *mixer, void *hWnd = NULL): SoundStream(mixer) {} + OpenSLESStream(CMixer *mixer, void *hWnd = nullptr): SoundStream(mixer) {} #endif // HAVE_OPENSL }; diff --git a/Source/Core/AudioCommon/PulseAudioStream.cpp b/Source/Core/AudioCommon/PulseAudioStream.cpp index 647798c39f..bc5d0f3f5f 100644 --- a/Source/Core/AudioCommon/PulseAudioStream.cpp +++ b/Source/Core/AudioCommon/PulseAudioStream.cpp @@ -47,7 +47,7 @@ void PulseAudio::SoundLoop() if (PulseInit()) { while (m_run_thread.load() && m_pa_connected == 1 && m_pa_error >= 0) - m_pa_error = pa_mainloop_iterate(m_pa_ml, 1, NULL); + m_pa_error = pa_mainloop_iterate(m_pa_ml, 1, nullptr); if(m_pa_error < 0) ERROR_LOG(AUDIO, "PulseAudio error: %s", pa_strerror(m_pa_error)); @@ -66,12 +66,12 @@ bool PulseAudio::PulseInit() m_pa_ml = pa_mainloop_new(); m_pa_mlapi = pa_mainloop_get_api(m_pa_ml); m_pa_ctx = pa_context_new(m_pa_mlapi, "dolphin-emu"); - m_pa_error = pa_context_connect(m_pa_ctx, NULL, PA_CONTEXT_NOFLAGS, NULL); + m_pa_error = pa_context_connect(m_pa_ctx, nullptr, PA_CONTEXT_NOFLAGS, nullptr); pa_context_set_state_callback(m_pa_ctx, StateCallback, this); // wait until we're connected to the pulseaudio server while (m_pa_connected == 0 && m_pa_error >= 0) - m_pa_error = pa_mainloop_iterate(m_pa_ml, 1, NULL); + m_pa_error = pa_mainloop_iterate(m_pa_ml, 1, nullptr); if (m_pa_connected == 2 || m_pa_error < 0) { @@ -85,7 +85,7 @@ bool PulseAudio::PulseInit() ss.format = PA_SAMPLE_S16LE; ss.channels = 2; ss.rate = m_mixer->GetSampleRate(); - m_pa_s = pa_stream_new(m_pa_ctx, "Playback", &ss, NULL); + m_pa_s = pa_stream_new(m_pa_ctx, "Playback", &ss, nullptr); pa_stream_set_write_callback(m_pa_s, WriteCallback, this); pa_stream_set_underflow_callback(m_pa_s, UnderflowCallback, this); @@ -97,7 +97,7 @@ bool PulseAudio::PulseInit() m_pa_ba.prebuf = -1; // start as early as possible m_pa_ba.tlength = BUFFER_SIZE; // designed latency, only change this flag for low latency output pa_stream_flags flags = pa_stream_flags(PA_STREAM_INTERPOLATE_TIMING | PA_STREAM_ADJUST_LATENCY | PA_STREAM_AUTO_TIMING_UPDATE); - m_pa_error = pa_stream_connect_playback(m_pa_s, NULL, &m_pa_ba, flags, NULL, NULL); + m_pa_error = pa_stream_connect_playback(m_pa_s, nullptr, &m_pa_ba, flags, nullptr, nullptr); if (m_pa_error < 0) { ERROR_LOG(AUDIO, "PulseAudio failed to initialize: %s", pa_strerror(m_pa_error)); @@ -135,7 +135,7 @@ void PulseAudio::StateCallback(pa_context* c) void PulseAudio::UnderflowCallback(pa_stream* s) { m_pa_ba.tlength += BUFFER_SIZE; - pa_stream_set_buffer_attr(s, &m_pa_ba, NULL, NULL); + pa_stream_set_buffer_attr(s, &m_pa_ba, nullptr, nullptr); WARN_LOG(AUDIO, "pulseaudio underflow, new latency: %d bytes", m_pa_ba.tlength); } @@ -150,7 +150,7 @@ void PulseAudio::WriteCallback(pa_stream* s, size_t length) return; // error will be printed from main loop m_mixer->Mix((s16*) buffer, length / sizeof(s16) / CHANNEL_COUNT); - m_pa_error = pa_stream_write(s, buffer, length, NULL, 0, PA_SEEK_RELATIVE); + m_pa_error = pa_stream_write(s, buffer, length, nullptr, 0, PA_SEEK_RELATIVE); } // Callbacks that forward to internal methods (required because PulseAudio is a C API). diff --git a/Source/Core/AudioCommon/WaveFile.cpp b/Source/Core/AudioCommon/WaveFile.cpp index 776d0d6fa4..facf59a79a 100644 --- a/Source/Core/AudioCommon/WaveFile.cpp +++ b/Source/Core/AudioCommon/WaveFile.cpp @@ -11,7 +11,7 @@ enum {BUF_SIZE = 32*1024}; WaveFileWriter::WaveFileWriter(): skip_silence(false), audio_size(0), - conv_buffer(NULL) + conv_buffer(nullptr) { } diff --git a/Source/Core/AudioCommon/XAudio2Stream.cpp b/Source/Core/AudioCommon/XAudio2Stream.cpp index 117484ca80..d5964f0e0e 100644 --- a/Source/Core/AudioCommon/XAudio2Stream.cpp +++ b/Source/Core/AudioCommon/XAudio2Stream.cpp @@ -158,7 +158,7 @@ XAudio2::XAudio2(CMixer *mixer) : SoundStream(mixer) , m_mastering_voice(nullptr) , m_volume(1.0f) - , m_cleanup_com(SUCCEEDED(CoInitializeEx(NULL, COINIT_MULTITHREADED))) + , m_cleanup_com(SUCCEEDED(CoInitializeEx(nullptr, COINIT_MULTITHREADED))) { } diff --git a/Source/Core/AudioCommon/XAudio2_7Stream.cpp b/Source/Core/AudioCommon/XAudio2_7Stream.cpp index 3a98dc0e0a..ea2e43708d 100644 --- a/Source/Core/AudioCommon/XAudio2_7Stream.cpp +++ b/Source/Core/AudioCommon/XAudio2_7Stream.cpp @@ -159,7 +159,7 @@ XAudio2_7::XAudio2_7(CMixer *mixer) : SoundStream(mixer) , m_mastering_voice(nullptr) , m_volume(1.0f) - , m_cleanup_com(SUCCEEDED(CoInitializeEx(NULL, COINIT_MULTITHREADED))) + , m_cleanup_com(SUCCEEDED(CoInitializeEx(nullptr, COINIT_MULTITHREADED))) { } diff --git a/Source/Core/AudioCommon/aldlist.cpp b/Source/Core/AudioCommon/aldlist.cpp index d7c7a287c4..6e506d57c2 100644 --- a/Source/Core/AudioCommon/aldlist.cpp +++ b/Source/Core/AudioCommon/aldlist.cpp @@ -50,13 +50,13 @@ ALDeviceList::ALDeviceList() defaultDeviceIndex = 0; // grab function pointers for 1.0-API functions, and if successful proceed to enumerate all devices - //if (LoadOAL10Library(NULL, &ALFunction) == TRUE) { - if (alcIsExtensionPresent(NULL, "ALC_ENUMERATION_EXT")) + //if (LoadOAL10Library(nullptr, &ALFunction) == TRUE) { + if (alcIsExtensionPresent(nullptr, "ALC_ENUMERATION_EXT")) { - const char *devices = alcGetString(NULL, ALC_DEVICE_SPECIFIER); - const char *defaultDeviceName = alcGetString(NULL, ALC_DEFAULT_DEVICE_SPECIFIER); - // go through device list (each device terminated with a single NULL, list terminated with double NULL) - for (s32 index = 0; devices != NULL && strlen(devices) > 0; index++, devices += strlen(devices) + 1) + const char *devices = alcGetString(nullptr, ALC_DEVICE_SPECIFIER); + const char *defaultDeviceName = alcGetString(nullptr, ALC_DEFAULT_DEVICE_SPECIFIER); + // go through device list (each device terminated with a single nullptr, list terminated with double nullptr) + for (s32 index = 0; devices != nullptr && strlen(devices) > 0; index++, devices += strlen(devices) + 1) { if (strcmp(defaultDeviceName, devices) == 0) { @@ -65,7 +65,7 @@ ALDeviceList::ALDeviceList() ALCdevice *device = alcOpenDevice(devices); if (device) { - ALCcontext *context = alcCreateContext(device, NULL); + ALCcontext *context = alcCreateContext(device, nullptr); if (context) { alcMakeContextCurrent(context); @@ -79,7 +79,7 @@ ALDeviceList::ALDeviceList() bNewName = false; } } - if ((bNewName) && (actualDeviceName != NULL) && (strlen(actualDeviceName) > 0)) + if ((bNewName) && (actualDeviceName != nullptr) && (strlen(actualDeviceName) > 0)) { ALDeviceInfo.bSelected = true; ALDeviceInfo.strDeviceName = actualDeviceName; @@ -120,7 +120,7 @@ ALDeviceList::ALDeviceList() vDeviceInfo.push_back(ALDeviceInfo); } - alcMakeContextCurrent(NULL); + alcMakeContextCurrent(nullptr); alcDestroyContext(context); } alcCloseDevice(device); @@ -163,7 +163,7 @@ char * ALDeviceList::GetDeviceName(s32 index) if (index < GetNumDevices()) return (char *)vDeviceInfo[index].strDeviceName.c_str(); else - return NULL; + return nullptr; } /* |
