aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2019-09-21 16:47:33 -0700
committerChris Robinson <[email protected]>2019-09-21 16:47:33 -0700
commit564c953e9465855890149a2d1b4b51f1f644fd9b (patch)
treec57f4d1f9fcba4f60c3482ce8ea0922c67c17419
parent146afcbd7087e07dd9245ac503a9d7f93a45ec18 (diff)
Make the buffer frequency unsigned
-rw-r--r--al/buffer.cpp6
-rw-r--r--al/buffer.h2
-rw-r--r--al/source.cpp5
3 files changed, 6 insertions, 7 deletions
diff --git a/al/buffer.cpp b/al/buffer.cpp
index f1f792e9..c9e195d1 100644
--- a/al/buffer.cpp
+++ b/al/buffer.cpp
@@ -463,7 +463,7 @@ void LoadData(ALCcontext *context, ALbuffer *ALBuf, ALsizei freq, ALuint size,
/* Can only preserve data with the same format and alignment. */
if UNLIKELY(ALBuf->mFmtChannels != DstChannels || ALBuf->OriginalType != SrcType)
SETERR_RETURN(context, AL_INVALID_VALUE,, "Preserving data of mismatched format");
- if UNLIKELY(static_cast<ALuint>(ALBuf->OriginalAlign) != align)
+ if UNLIKELY(ALBuf->OriginalAlign != align)
SETERR_RETURN(context, AL_INVALID_VALUE,, "Preserving data of mismatched alignment");
}
@@ -539,7 +539,7 @@ void LoadData(ALCcontext *context, ALbuffer *ALBuf, ALsizei freq, ALuint size,
ALBuf->OriginalSize = size;
ALBuf->OriginalType = SrcType;
- ALBuf->Frequency = freq;
+ ALBuf->Frequency = static_cast<ALuint>(freq);
ALBuf->mFmtChannels = DstChannels;
ALBuf->mFmtType = DstType;
ALBuf->Access = access;
@@ -1253,7 +1253,7 @@ START_API_FUNC
else switch(param)
{
case AL_FREQUENCY:
- *value = albuf->Frequency;
+ *value = static_cast<ALint>(albuf->Frequency);
break;
case AL_BITS:
diff --git a/al/buffer.h b/al/buffer.h
index 70faf56e..d41eec5d 100644
--- a/al/buffer.h
+++ b/al/buffer.h
@@ -68,7 +68,7 @@ inline ALuint FrameSizeFromFmt(FmtChannels chans, FmtType type)
struct ALbuffer {
al::vector<al::byte,16> mData;
- ALsizei Frequency{0};
+ ALuint Frequency{0u};
ALbitfieldSOFT Access{0u};
ALuint SampleLen{0u};
diff --git a/al/source.cpp b/al/source.cpp
index f5550caf..7eda4fb6 100644
--- a/al/source.cpp
+++ b/al/source.cpp
@@ -267,8 +267,7 @@ ALdouble GetSourceSecOffset(ALsource *Source, ALCcontext *context, nanoseconds *
}
assert(BufferFmt != nullptr);
- offset = static_cast<ALdouble>(readPos) / ALdouble{FRACTIONONE} /
- static_cast<ALdouble>(BufferFmt->Frequency);
+ offset = static_cast<ALdouble>(readPos) / ALdouble{FRACTIONONE} / BufferFmt->Frequency;
}
return offset;
@@ -2784,7 +2783,7 @@ START_API_FUNC
}
ALbuffer *buffer{BufferList->mBuffer};
- voice->mFrequency = static_cast<ALuint>(buffer->Frequency);
+ voice->mFrequency = buffer->Frequency;
voice->mFmtChannels = buffer->mFmtChannels;
voice->mNumChannels = ChannelsFromFmt(buffer->mFmtChannels);
voice->mSampleSize = BytesFromFmt(buffer->mFmtType);