diff options
author | Chris Robinson <[email protected]> | 2019-08-25 18:09:14 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2019-08-25 18:09:14 -0700 |
commit | 4e72d7b3eccfb13055c55d2ccac8bf0db3be9ecb (patch) | |
tree | 9a8b0d0e532155e9bf0ee4b51a1aa7255c1d93a7 /alc | |
parent | 164626a7be1cd0a9b92d34b9bb7f5c891fe57fae (diff) |
Use al::byte for a couple more buffers
Diffstat (limited to 'alc')
-rw-r--r-- | alc/backends/alsa.cpp | 10 | ||||
-rw-r--r-- | alc/backends/wave.cpp | 12 |
2 files changed, 11 insertions, 11 deletions
diff --git a/alc/backends/alsa.cpp b/alc/backends/alsa.cpp index 64f9cf46..766ff167 100644 --- a/alc/backends/alsa.cpp +++ b/alc/backends/alsa.cpp @@ -403,7 +403,7 @@ struct AlsaPlayback final : public BackendBase { snd_pcm_t *mPcmHandle{nullptr}; - al::vector<char> mBuffer; + al::vector<al::byte> mBuffer; std::atomic<bool> mKillNow{true}; std::thread mThread; @@ -550,7 +550,7 @@ int AlsaPlayback::mixerNoMMapProc() } lock(); - char *WritePtr{mBuffer.data()}; + al::byte *WritePtr{mBuffer.data()}; avail = snd_pcm_bytes_to_frames(mPcmHandle, mBuffer.size()); aluMixData(mDevice, WritePtr, avail); while(avail > 0) @@ -874,7 +874,7 @@ struct AlsaCapture final : public BackendBase { snd_pcm_t *mPcmHandle{nullptr}; - al::vector<char> mBuffer; + al::vector<al::byte> mBuffer; bool mDoCapture{false}; RingBufferPtr mRing{nullptr}; @@ -1044,7 +1044,7 @@ void AlsaCapture::stop() { /* The ring buffer implicitly captures when checking availability. * Direct access needs to explicitly capture it into temp storage. */ - al::vector<char> temp(snd_pcm_frames_to_bytes(mPcmHandle, avail)); + auto temp = al::vector<al::byte>(snd_pcm_frames_to_bytes(mPcmHandle, avail)); captureSamples(temp.data(), avail); mBuffer = std::move(temp); } @@ -1106,7 +1106,7 @@ ALCenum AlsaCapture::captureSamples(ALCvoid *buffer, ALCuint samples) continue; } - buffer = static_cast<ALbyte*>(buffer) + amt; + buffer = static_cast<al::byte*>(buffer) + amt; samples -= amt; } if(samples > 0) diff --git a/alc/backends/wave.cpp b/alc/backends/wave.cpp index aa4130af..b16f711b 100644 --- a/alc/backends/wave.cpp +++ b/alc/backends/wave.cpp @@ -35,6 +35,7 @@ #include "AL/al.h" +#include "albyte.h" #include "alcmain.h" #include "alconfig.h" #include "almalloc.h" @@ -103,7 +104,7 @@ struct WaveBackend final : public BackendBase { FILE *mFile{nullptr}; long mDataStart{-1}; - al::vector<ALbyte> mBuffer; + al::vector<al::byte> mBuffer; std::atomic<bool> mKillNow{true}; std::thread mThread; @@ -151,13 +152,12 @@ int WaveBackend::mixerProc() if(!IS_LITTLE_ENDIAN) { const ALsizei bytesize{mDevice->bytesFromFmt()}; - ALsizei i; if(bytesize == 2) { ALushort *samples = reinterpret_cast<ALushort*>(mBuffer.data()); - const auto len = static_cast<ALsizei>(mBuffer.size() / 2); - for(i = 0;i < len;i++) + const size_t len{mBuffer.size() / 2}; + for(size_t i{0};i < len;i++) { ALushort samp = samples[i]; samples[i] = (samp>>8) | (samp<<8); @@ -166,8 +166,8 @@ int WaveBackend::mixerProc() else if(bytesize == 4) { ALuint *samples = reinterpret_cast<ALuint*>(mBuffer.data()); - const auto len = static_cast<ALsizei>(mBuffer.size() / 4); - for(i = 0;i < len;i++) + const size_t len{mBuffer.size() / 4}; + for(size_t i{0};i < len;i++) { ALuint samp = samples[i]; samples[i] = (samp>>24) | ((samp>>8)&0x0000ff00) | |