From 5aba7f90aaecb276e56e187b837a724bc881dff2 Mon Sep 17 00:00:00 2001 From: Dimitri Diakopoulos Date: Thu, 24 Dec 2015 14:24:17 -0600 Subject: [PATCH] consistency --- include/libnyquist/AudioDevice.h | 6 +++--- src/AudioDevice.cpp | 6 +++--- src/FlacDecoder.cpp | 10 +++++----- src/MusepackDecoder.cpp | 2 +- src/MusepackDependencies.c | 6 ------ src/OpusDependencies.c | 6 +++--- src/RiffUtils.cpp | 2 +- 7 files changed, 16 insertions(+), 22 deletions(-) diff --git a/include/libnyquist/AudioDevice.h b/include/libnyquist/AudioDevice.h index b1dca90..0327dd9 100644 --- a/include/libnyquist/AudioDevice.h +++ b/include/libnyquist/AudioDevice.h @@ -39,9 +39,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. namespace nqr { -const unsigned int FRAME_SIZE = 512; -const int CHANNELS = 2; -const int BUFFER_LENGTH = FRAME_SIZE * CHANNELS; +const uint32_t FRAME_SIZE = 512; +const int32_t CHANNELS = 2; +const int32_t BUFFER_LENGTH = FRAME_SIZE * CHANNELS; struct DeviceInfo { diff --git a/src/AudioDevice.cpp b/src/AudioDevice.cpp index a931d46..f37cd82 100644 --- a/src/AudioDevice.cpp +++ b/src/AudioDevice.cpp @@ -33,7 +33,7 @@ using namespace nqr; static RingBufferT buffer(BUFFER_LENGTH); -static int rt_callback(void * output_buffer, void * input_buffer, unsigned int num_bufferframes, double stream_time, RtAudioStreamStatus status, void * user_data) +static int rt_callback(void * output_buffer, void * input_buffer, uint32_t num_bufferframes, double stream_time, RtAudioStreamStatus status, void * user_data) { if (status) std::cerr << "[rtaudio] Buffer over or underflow" << std::endl; @@ -73,11 +73,11 @@ void AudioDevice::ListAudioDevices() std::unique_ptr tempDevice(new RtAudio); RtAudio::DeviceInfo info; - unsigned int devices = tempDevice->getDeviceCount(); + uint32_t devices = tempDevice->getDeviceCount(); std::cout << "[rtaudio] Found: " << devices << " device(s)\n"; - for (unsigned int i = 0; i < devices; ++i) + for (uint32_t i = 0; i < devices; ++i) { info = tempDevice->getDeviceInfo(i); std::cout << "\tDevice: " << i << " - " << info.name << std::endl; diff --git a/src/FlacDecoder.cpp b/src/FlacDecoder.cpp index f626154..e23c95c 100644 --- a/src/FlacDecoder.cpp +++ b/src/FlacDecoder.cpp @@ -36,7 +36,7 @@ class FlacDecoderInternal public: - // N.B.: FLAC is a big-endian format. All values are unsigned. + // FLAC is a big-endian format. All values are unsigned. FlacDecoderInternal(AudioData * d, std::string filepath) : d(d) { @@ -118,7 +118,7 @@ public: // libflab callbacks // /////////////////////// - static FLAC__StreamDecoderWriteStatus s_writeCallback(const FLAC__StreamDecoder*, const FLAC__Frame* frame, const FLAC__int32* const buffer[], void* userPtr) + static FLAC__StreamDecoderWriteStatus s_writeCallback(const FLAC__StreamDecoder *, const FLAC__Frame* frame, const FLAC__int32 * const buffer[], void * userPtr) { FlacDecoderInternal * decoder = reinterpret_cast(userPtr); @@ -126,7 +126,7 @@ public: auto dataPtr = decoder->internalBuffer.data(); - for(unsigned int i = 0; i < frame->header.blocksize; i++) + for (uint32_t i = 0; i < frame->header.blocksize; i++) { for(int j = 0; j < decoder->d->channelCount; j++) { @@ -138,12 +138,12 @@ public: return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE; } - static void s_metadataCallback (const FLAC__StreamDecoder*, const FLAC__StreamMetadata* metadata, void* userPtr) + static void s_metadataCallback (const FLAC__StreamDecoder *, const FLAC__StreamMetadata * metadata, void * userPtr) { static_cast(userPtr)->processMetadata(metadata->data.stream_info); } - static void s_errorCallback (const FLAC__StreamDecoder *, FLAC__StreamDecoderErrorStatus status, void*) + static void s_errorCallback (const FLAC__StreamDecoder *, FLAC__StreamDecoderErrorStatus status, void *) { std::cerr << "FLAC Decoder Error: " << FLAC__StreamDecoderErrorStatusString[status] << std::endl; } diff --git a/src/MusepackDecoder.cpp b/src/MusepackDecoder.cpp index 1a7e797..e99c5fa 100644 --- a/src/MusepackDecoder.cpp +++ b/src/MusepackDecoder.cpp @@ -134,7 +134,7 @@ public: size_t totalSamplesRead = 0; - while(MPC_TRUE) + while (true) { mpc_frame_info frame; diff --git a/src/MusepackDependencies.c b/src/MusepackDependencies.c index 22418f0..eef206c 100644 --- a/src/MusepackDependencies.c +++ b/src/MusepackDependencies.c @@ -36,12 +36,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #endif #include "musepack/libmpcdec/huffman.c" - -//#include "musepack/libmpcdec/mpc_decoder.c" -//#include "musepack/libmpcdec/mpc_reader.c" -//#include "musepack/libmpcdec/mpc_bits_reader.c" -//#include "musepack/libmpcdec/mpc_demux.c" - #include "musepack/libmpcdec/requant.c" #include "musepack/libmpcdec/streaminfo.c" #include "musepack/libmpcdec/synth_filter.c" diff --git a/src/OpusDependencies.c b/src/OpusDependencies.c index 708a07f..326f7bf 100644 --- a/src/OpusDependencies.c +++ b/src/OpusDependencies.c @@ -39,12 +39,12 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #undef HAVE_CONFIG_H -#define USE_ALLOCA 1 -#define OPUS_BUILD 1 +#define USE_ALLOCA 1 +#define OPUS_BUILD 1 /* Enable SSE functions, if compiled with SSE/SSE2 (note that AMD64 implies SSE2) */ #if defined(_M_X64) || (defined(_M_IX86_FP) && (_M_IX86_FP >= 1)) -#define __SSE__ 1 +#define __SSE__ 1 #endif ////////// diff --git a/src/RiffUtils.cpp b/src/RiffUtils.cpp index cc175cb..1e8f53c 100644 --- a/src/RiffUtils.cpp +++ b/src/RiffUtils.cpp @@ -59,7 +59,7 @@ WaveChunkHeader nqr::MakeWaveHeader(const EncoderParams param, const int sampleR header.channel_count = param.channelCount; header.sample_rate = sampleRate; header.data_rate = sampleRate * param.channelCount * (bitdepth / 8); - header.frame_size = param.channelCount * (bitdepth/ 8); + header.frame_size = param.channelCount * (bitdepth / 8); header.bit_depth = bitdepth; return header;