Make the buffer frequency unsigned

This commit is contained in:
Chris Robinson 2019-09-21 16:47:33 -07:00
parent 146afcbd70
commit 564c953e94
3 changed files with 6 additions and 7 deletions

View File

@ -463,7 +463,7 @@ void LoadData(ALCcontext *context, ALbuffer *ALBuf, ALsizei freq, ALuint size,
/* Can only preserve data with the same format and alignment. */ /* Can only preserve data with the same format and alignment. */
if UNLIKELY(ALBuf->mFmtChannels != DstChannels || ALBuf->OriginalType != SrcType) if UNLIKELY(ALBuf->mFmtChannels != DstChannels || ALBuf->OriginalType != SrcType)
SETERR_RETURN(context, AL_INVALID_VALUE,, "Preserving data of mismatched format"); 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"); 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->OriginalSize = size;
ALBuf->OriginalType = SrcType; ALBuf->OriginalType = SrcType;
ALBuf->Frequency = freq; ALBuf->Frequency = static_cast<ALuint>(freq);
ALBuf->mFmtChannels = DstChannels; ALBuf->mFmtChannels = DstChannels;
ALBuf->mFmtType = DstType; ALBuf->mFmtType = DstType;
ALBuf->Access = access; ALBuf->Access = access;
@ -1253,7 +1253,7 @@ START_API_FUNC
else switch(param) else switch(param)
{ {
case AL_FREQUENCY: case AL_FREQUENCY:
*value = albuf->Frequency; *value = static_cast<ALint>(albuf->Frequency);
break; break;
case AL_BITS: case AL_BITS:

View File

@ -68,7 +68,7 @@ inline ALuint FrameSizeFromFmt(FmtChannels chans, FmtType type)
struct ALbuffer { struct ALbuffer {
al::vector<al::byte,16> mData; al::vector<al::byte,16> mData;
ALsizei Frequency{0}; ALuint Frequency{0u};
ALbitfieldSOFT Access{0u}; ALbitfieldSOFT Access{0u};
ALuint SampleLen{0u}; ALuint SampleLen{0u};

View File

@ -267,8 +267,7 @@ ALdouble GetSourceSecOffset(ALsource *Source, ALCcontext *context, nanoseconds *
} }
assert(BufferFmt != nullptr); assert(BufferFmt != nullptr);
offset = static_cast<ALdouble>(readPos) / ALdouble{FRACTIONONE} / offset = static_cast<ALdouble>(readPos) / ALdouble{FRACTIONONE} / BufferFmt->Frequency;
static_cast<ALdouble>(BufferFmt->Frequency);
} }
return offset; return offset;
@ -2784,7 +2783,7 @@ START_API_FUNC
} }
ALbuffer *buffer{BufferList->mBuffer}; ALbuffer *buffer{BufferList->mBuffer};
voice->mFrequency = static_cast<ALuint>(buffer->Frequency); voice->mFrequency = buffer->Frequency;
voice->mFmtChannels = buffer->mFmtChannels; voice->mFmtChannels = buffer->mFmtChannels;
voice->mNumChannels = ChannelsFromFmt(buffer->mFmtChannels); voice->mNumChannels = ChannelsFromFmt(buffer->mFmtChannels);
voice->mSampleSize = BytesFromFmt(buffer->mFmtType); voice->mSampleSize = BytesFromFmt(buffer->mFmtType);