diff --git a/src/common/AudioQueue.cxx b/src/common/AudioQueue.cxx index 6075e9a33..3e5f1e0fc 100644 --- a/src/common/AudioQueue.cxx +++ b/src/common/AudioQueue.cxx @@ -93,7 +93,7 @@ Int16* AudioQueue::enqueue(Int16* fragment) if (!myFirstFragmentForEnqueue) throw runtime_error("enqueue called empty"); newFragment = myFirstFragmentForEnqueue; - myFirstFragmentForEnqueue = 0; + myFirstFragmentForEnqueue = nullptr; return newFragment; } @@ -115,13 +115,13 @@ Int16* AudioQueue::dequeue(Int16* fragment) { lock_guard guard(myMutex); - if (mySize == 0) return 0; + if (mySize == 0) return nullptr; if (!fragment) { if (!myFirstFragmentForDequeue) throw runtime_error("dequeue called empty"); fragment = myFirstFragmentForDequeue; - myFirstFragmentForDequeue = 0; + myFirstFragmentForDequeue = nullptr; } Int16* nextFragment = myFragmentQueue.at(myNextFragment); diff --git a/src/common/AudioQueue.hxx b/src/common/AudioQueue.hxx index 66901ac09..7d64c010b 100644 --- a/src/common/AudioQueue.hxx +++ b/src/common/AudioQueue.hxx @@ -23,16 +23,16 @@ #include "bspf.hxx" /** - This class implements a an audio queue that acts both like a ring buffer - and a pool of audio fragments. The TIA emulation core fills a fragment - with samples and then returns it to the queue, receiving a new fragment - in return. The sound driver removes fragments for playback from the - queue and returns the used fragment in this process. + This class implements a an audio queue that acts both like a ring buffer + and a pool of audio fragments. The TIA emulation core fills a fragment + with samples and then returns it to the queue, receiving a new fragment + in return. The sound driver removes fragments for playback from the + queue and returns the used fragment in this process. - The queue needs to be threadsafe as the (SDL) audio driver runs on a - separate thread. Samples are stored as signed 16 bit integers - (platform endian). - */ + The queue needs to be threadsafe as the (SDL) audio driver runs on a + separate thread. Samples are stored as signed 16 bit integers + (platform endian). +*/ class AudioQueue { public: @@ -40,10 +40,10 @@ class AudioQueue /** Create a new AudioQueue. - @param fragmentSize The size (in stereo / mono samples) of each fragment - @param capacaity The number of fragments that can be queued before wrapping. - @param isStereo Whether samples are stereo or mono. - @param sampleRate The sample rate. This is not used, but can be queried. + @param fragmentSize The size (in stereo / mono samples) of each fragment + @param capacity The number of fragments that can be queued before wrapping. + @param isStereo Whether samples are stereo or mono. + @param sampleRate The sample rate. This is not used, but can be queried. */ AudioQueue(uInt32 fragmentSize, uInt32 capacity, bool isStereo, uInt16 sampleRate); @@ -83,17 +83,17 @@ class AudioQueue @param fragment The returned fragment. This must be empty on the first call (when there is nothing to return) */ - Int16* enqueue(Int16* fragment = 0); + Int16* enqueue(Int16* fragment = nullptr); /** - Dequeue a fragment for playback and return the played fragment. This may - return 0 if there is no queued fragment to return (in this case, the returned - fragment is not enqueued and must be passed in the next invocation). + Dequeue a fragment for playback and return the played fragment. This may + return 0 if there is no queued fragment to return (in this case, the returned + fragment is not enqueued and must be passed in the next invocation). - @param fragment The returned fragment. This must be empty on the first call (when - there is nothing to return). + @param fragment The returned fragment. This must be empty on the first call (when + there is nothing to return). */ - Int16* dequeue(Int16* fragment = 0); + Int16* dequeue(Int16* fragment = nullptr); /** Return the currently playing fragment without drawing a new one. This is called diff --git a/src/common/SoundSDL2.cxx b/src/common/SoundSDL2.cxx index 2f42f5f85..a7f87caf9 100644 --- a/src/common/SoundSDL2.cxx +++ b/src/common/SoundSDL2.cxx @@ -39,8 +39,7 @@ SoundSDL2::SoundSDL2(OSystem& osystem) myIsInitializedFlag(false), myVolume(100), myVolumeFactor(0xffff), - myAudioQueue(0), - myCurrentFragment(0) + myCurrentFragment(nullptr) { myOSystem.logMessage("SoundSDL2::SoundSDL2 started ...", 2); @@ -99,13 +98,14 @@ void SoundSDL2::setEnabled(bool state) myOSystem.settings().setValue("sound", state); myOSystem.logMessage(state ? "SoundSDL2::setEnabled(true)" : - "SoundSDL2::setEnabled(false)", 2); + "SoundSDL2::setEnabled(false)", 2); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void SoundSDL2::open(shared_ptr audioQueue, EmulationTiming* emulationTiming) +void SoundSDL2::open(shared_ptr audioQueue, + EmulationTiming* emulationTiming) { - this->emulationTiming = emulationTiming; + myEmulationTiming = emulationTiming; myOSystem.logMessage("SoundSDL2::open started ...", 2); mute(true); @@ -118,7 +118,7 @@ void SoundSDL2::open(shared_ptr audioQueue, EmulationTiming* emulati myAudioQueue = audioQueue; myUnderrun = true; - myCurrentFragment = 0; + myCurrentFragment = nullptr; // Adjust volume to that defined in settings setVolume(myOSystem.settings().getInt("volume")); @@ -149,8 +149,8 @@ void SoundSDL2::close() mute(true); if (myAudioQueue) myAudioQueue->closeSink(myCurrentFragment); - myAudioQueue = 0; - myCurrentFragment = 0; + myAudioQueue.reset(); + myCurrentFragment = nullptr; myOSystem.logMessage("SoundSDL2::close", 2); @@ -167,7 +167,8 @@ void SoundSDL2::mute(bool state) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void SoundSDL2::reset() -{} +{ +} // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void SoundSDL2::setVolume(Int32 percent) @@ -233,14 +234,15 @@ void SoundSDL2::processFragment(float* stream, uInt32 length) void SoundSDL2::initResampler() { Resampler::NextFragmentCallback nextFragmentCallback = [this] () -> Int16* { - Int16* nextFragment = 0; + Int16* nextFragment = nullptr; if (myUnderrun) - nextFragment = myAudioQueue->size() > emulationTiming->prebufferFragmentCount() ? myAudioQueue->dequeue(myCurrentFragment) : 0; + nextFragment = myAudioQueue->size() > myEmulationTiming->prebufferFragmentCount() ? + myAudioQueue->dequeue(myCurrentFragment) : nullptr; else nextFragment = myAudioQueue->dequeue(myCurrentFragment); - myUnderrun = nextFragment == 0; + myUnderrun = nextFragment == nullptr; if (nextFragment) myCurrentFragment = nextFragment; return nextFragment; diff --git a/src/common/SoundSDL2.hxx b/src/common/SoundSDL2.hxx index 9b4922ade..38156f79a 100644 --- a/src/common/SoundSDL2.hxx +++ b/src/common/SoundSDL2.hxx @@ -33,7 +33,7 @@ class EmulationTiming; /** This class implements the sound API for SDL. - @author Stephen Anthony and Bradford W. Mott + @author Stephen Anthony and Christian Speckner (DirtyHairy) */ class SoundSDL2 : public Sound { @@ -130,7 +130,7 @@ class SoundSDL2 : public Sound shared_ptr myAudioQueue; - EmulationTiming* emulationTiming; + EmulationTiming* myEmulationTiming; Int16* myCurrentFragment; bool myUnderrun; diff --git a/src/common/audio/LanczosResampler.cxx b/src/common/audio/LanczosResampler.cxx index 07ee8b064..0bce3e1ac 100644 --- a/src/common/audio/LanczosResampler.cxx +++ b/src/common/audio/LanczosResampler.cxx @@ -75,10 +75,10 @@ LanczosResampler::LanczosResampler( myKernelSize(2 * kernelParameter), myCurrentKernelIndex(0), myKernelParameter(kernelParameter), - myBuffer(0), - myBufferL(0), - myBufferR(0), - myCurrentFragment(0), + myBuffer(nullptr), + myBufferL(nullptr), + myBufferR(nullptr), + myCurrentFragment(nullptr), myFragmentIndex(0), myIsUnderrun(true), myTimeIndex(0) diff --git a/src/common/audio/LanczosResampler.hxx b/src/common/audio/LanczosResampler.hxx index 07b5956ef..2ea5a6c04 100644 --- a/src/common/audio/LanczosResampler.hxx +++ b/src/common/audio/LanczosResampler.hxx @@ -22,7 +22,8 @@ #include "Resampler.hxx" #include "ConvolutionBuffer.hxx" -class LanczosResampler : public Resampler { +class LanczosResampler : public Resampler +{ public: LanczosResampler( Resampler::Format formatFrom, diff --git a/src/common/audio/Resampler.hxx b/src/common/audio/Resampler.hxx index 9fb7a8611..cd39818e4 100644 --- a/src/common/audio/Resampler.hxx +++ b/src/common/audio/Resampler.hxx @@ -30,10 +30,10 @@ class Resampler { class Format { public: - Format(uInt32 sampleRate, uInt32 fragmentSize, bool stereo) : - sampleRate(sampleRate), - fragmentSize(fragmentSize), - stereo(stereo) + Format(uInt32 f_sampleRate, uInt32 f_fragmentSize, bool f_stereo) : + sampleRate(f_sampleRate), + fragmentSize(f_fragmentSize), + stereo(f_stereo) {} public: diff --git a/src/common/audio/SimpleResampler.cxx b/src/common/audio/SimpleResampler.cxx index 6785886d8..5e7b4ce65 100644 --- a/src/common/audio/SimpleResampler.cxx +++ b/src/common/audio/SimpleResampler.cxx @@ -22,13 +22,13 @@ SimpleResampler::SimpleResampler( Resampler::Format formatFrom, Resampler::Format formatTo, Resampler::NextFragmentCallback nextFragmentCallback) -: - Resampler(formatFrom, formatTo, nextFragmentCallback), - myCurrentFragment(0), - myTimeIndex(0), - myFragmentIndex(0), - myIsUnderrun(true) -{} + : Resampler(formatFrom, formatTo, nextFragmentCallback), + myCurrentFragment(nullptr), + myTimeIndex(0), + myFragmentIndex(0), + myIsUnderrun(true) +{ +} // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void SimpleResampler::fillFragment(float* fragment, uInt32 length) diff --git a/src/common/audio/SimpleResampler.hxx b/src/common/audio/SimpleResampler.hxx index 8495ba7a7..92de9e05f 100644 --- a/src/common/audio/SimpleResampler.hxx +++ b/src/common/audio/SimpleResampler.hxx @@ -21,7 +21,8 @@ #include "bspf.hxx" #include "Resampler.hxx" -class SimpleResampler : public Resampler { +class SimpleResampler : public Resampler +{ public: SimpleResampler( Resampler::Format formatFrom, diff --git a/src/emucore/M6502.hxx b/src/emucore/M6502.hxx index 5b96c7342..2dad3de57 100644 --- a/src/emucore/M6502.hxx +++ b/src/emucore/M6502.hxx @@ -110,7 +110,7 @@ class M6502 : public Serializable is executed, someone stops execution, or an error occurs. Answers true iff execution stops normally. - @param number Indicates the number of cycles to execute. Not that the actual + @param cycles Indicates the number of cycles to execute. Not that the actual granularity of the CPU is instructions, so this is only accurate up to a couple of cycles @return true iff execution stops normally diff --git a/src/emucore/tia/Audio.cxx b/src/emucore/tia/Audio.cxx index 19e06ac2f..74658f8c5 100644 --- a/src/emucore/tia/Audio.cxx +++ b/src/emucore/tia/Audio.cxx @@ -35,8 +35,8 @@ namespace { // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Audio::Audio() - : myAudioQueue(0), - myCurrentFragment(0) + : myAudioQueue(nullptr), + myCurrentFragment(nullptr) { for (uInt8 i = 0; i <= 0x1e; i++) myMixingTableSum[i] = mixingTableEntry(i, 0x1e); for (uInt8 i = 0; i <= 0x0f; i++) myMixingTableIndividual[i] = mixingTableEntry(i, 0x0f); @@ -65,7 +65,8 @@ void Audio::setAudioQueue(shared_ptr queue) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void Audio::tick() -{ switch (myCounter) { +{ + switch (myCounter) { case 9: case 81: myChannel0.phase0();