diff options
author | Chris Robinson <[email protected]> | 2019-09-14 16:55:28 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2019-09-14 18:35:23 -0700 |
commit | 2c348cecb68bd3a71d388547d6b3330f9cebbfad (patch) | |
tree | 445e6387a7356da79c93db166ca8da057a0a0cfc /alc/backends | |
parent | 1c45b1791b784fb9b70e8c6ce8a1ea158e9004ff (diff) |
Fix some more implicit conversions noted by GCC
Diffstat (limited to 'alc/backends')
-rw-r--r-- | alc/backends/alsa.cpp | 2 | ||||
-rw-r--r-- | alc/backends/coreaudio.cpp | 17 | ||||
-rw-r--r-- | alc/backends/opensl.cpp | 6 | ||||
-rw-r--r-- | alc/backends/pulseaudio.cpp | 2 |
4 files changed, 14 insertions, 13 deletions
diff --git a/alc/backends/alsa.cpp b/alc/backends/alsa.cpp index cd85afaf..b797c768 100644 --- a/alc/backends/alsa.cpp +++ b/alc/backends/alsa.cpp @@ -1112,7 +1112,7 @@ ALCenum AlsaCapture::captureSamples(ALCvoid *buffer, ALCuint samples) } buffer = static_cast<al::byte*>(buffer) + amt; - samples -= amt; + samples -= static_cast<ALCuint>(amt); } if(samples > 0) std::fill_n(static_cast<al::byte*>(buffer), snd_pcm_frames_to_bytes(mPcmHandle, samples), diff --git a/alc/backends/coreaudio.cpp b/alc/backends/coreaudio.cpp index 39f6241a..99b06b7a 100644 --- a/alc/backends/coreaudio.cpp +++ b/alc/backends/coreaudio.cpp @@ -177,7 +177,7 @@ ALCboolean CoreAudioPlayback::reset() { mDevice->BufferSize = static_cast<ALuint>(uint64_t{mDevice->BufferSize} * streamFormat.mSampleRate / mDevice->Frequency); - mDevice->Frequency = streamFormat.mSampleRate; + mDevice->Frequency = static_cast<ALuint>(streamFormat.mSampleRate); } /* FIXME: How to tell what channels are what in the output device, and how @@ -357,7 +357,8 @@ OSStatus CoreAudioCapture::RecordProc(AudioUnitRenderActionFlags*, } audiobuf = { { 0 } }; auto rec_vec = mRing->getWriteVector(); - inNumberFrames = minz(inNumberFrames, rec_vec.first.len+rec_vec.second.len); + inNumberFrames = static_cast<UInt32>(minz(inNumberFrames, + rec_vec.first.len+rec_vec.second.len)); // Fill the ringbuffer's two segments with data from the input device if(rec_vec.first.len >= inNumberFrames) @@ -369,7 +370,7 @@ OSStatus CoreAudioCapture::RecordProc(AudioUnitRenderActionFlags*, } else { - const size_t remaining{inNumberFrames-rec_vec.first.len}; + const auto remaining = static_cast<ALuint>(inNumberFrames - rec_vec.first.len); audiobuf.list.mNumberBuffers = 2; audiobuf.list.mBuffers[0].mNumberChannels = mFormat.mChannelsPerFrame; audiobuf.list.mBuffers[0].mData = rec_vec.first.buf; @@ -594,7 +595,7 @@ ALCenum CoreAudioCapture::open(const ALCchar *name) // Set the AudioUnit output format frame count uint64_t FrameCount64{mDevice->UpdateSize}; - FrameCount64 = (FrameCount64*outputFormat.mSampleRate + mDevice->Frequency-1) / + FrameCount64 = static_cast<uint64_t>(FrameCount64*outputFormat.mSampleRate + mDevice->Frequency-1) / mDevice->Frequency; FrameCount64 += MAX_RESAMPLE_PADDING*2; if(FrameCount64 > std::numeric_limits<uint32_t>::max()/2) @@ -615,8 +616,8 @@ ALCenum CoreAudioCapture::open(const ALCchar *name) // Set up sample converter if needed if(outputFormat.mSampleRate != mDevice->Frequency) mConverter = CreateSampleConverter(mDevice->FmtType, mDevice->FmtType, - mFormat.mChannelsPerFrame, hardwareFormat.mSampleRate, mDevice->Frequency, - BSinc24Resampler); + mFormat.mChannelsPerFrame, static_cast<ALuint>(hardwareFormat.mSampleRate), + mDevice->Frequency, BSinc24Resampler); mRing = CreateRingBuffer(outputFrameCount, mFrameSize, false); if(!mRing) return ALC_INVALID_VALUE; @@ -671,8 +672,8 @@ ALCenum CoreAudioCapture::captureSamples(void *buffer, ALCuint samples) ALCuint CoreAudioCapture::availableSamples() { - if(!mConverter) return mRing->readSpace(); - return mConverter->availableOut(mRing->readSpace()); + if(!mConverter) return static_cast<ALCuint>(mRing->readSpace()); + return mConverter->availableOut(static_cast<ALCuint>(mRing->readSpace())); } } // namespace diff --git a/alc/backends/opensl.cpp b/alc/backends/opensl.cpp index 3ec2177f..06d5cd40 100644 --- a/alc/backends/opensl.cpp +++ b/alc/backends/opensl.cpp @@ -170,7 +170,7 @@ struct OpenSLPlayback final : public BackendBase { RingBufferPtr mRing{nullptr}; al::semaphore mSem; - ALsizei mFrameSize{0}; + ALuint mFrameSize{0}; std::atomic<bool> mKillNow{true}; std::thread mThread; @@ -630,7 +630,7 @@ struct OpenSLCapture final : public BackendBase { RingBufferPtr mRing{nullptr}; ALCuint mSplOffset{0u}; - ALsizei mFrameSize{0}; + ALuint mFrameSize{0}; DEF_NEWDEL(OpenSLCapture) }; @@ -851,7 +851,7 @@ void OpenSLCapture::stop() ALCenum OpenSLCapture::captureSamples(void *buffer, ALCuint samples) { - ALsizei chunk_size = mDevice->UpdateSize * mFrameSize; + ALuint chunk_size{mDevice->UpdateSize * mFrameSize}; SLAndroidSimpleBufferQueueItf bufferQueue; SLresult result; ALCuint i; diff --git a/alc/backends/pulseaudio.cpp b/alc/backends/pulseaudio.cpp index 08420748..30c13a69 100644 --- a/alc/backends/pulseaudio.cpp +++ b/alc/backends/pulseaudio.cpp @@ -1324,7 +1324,7 @@ ALCenum PulseCapture::captureSamples(ALCvoid *buffer, ALCuint samples) /* Capture is done in fragment-sized chunks, so we loop until we get all * that's available */ - mLastReadable -= dstbuf.size(); + mLastReadable -= static_cast<ALCuint>(dstbuf.size()); std::lock_guard<std::mutex> _{pulse_lock}; while(!dstbuf.empty()) { |