Skip to content

Commit

Permalink
Type simplifications and explicit casts
Browse files Browse the repository at this point in the history
  • Loading branch information
jackburton79 committed Feb 7, 2024
1 parent 7c9197d commit 3442bfa
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions audio/SoundEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ void
SoundEngine::MixAudio(void *castToThis, Uint8 *stream, int numBytes)
{
SoundEngine* engine = reinterpret_cast<SoundEngine*>(castToThis);
engine->Buffer()->ConsumeSamples((uint8*)stream, (uint16)numBytes);
engine->Buffer()->ConsumeSamples(reinterpret_cast<uint8*>(stream), static_cast<uint32>(numBytes));
}


Expand All @@ -169,7 +169,7 @@ SoundBuffer::SoundBuffer(bool stereo, bool bit16, uint16 sampleRate, uint32 buff
fBufferPos(0),
fConsumedPos(0)
{
fData = (uint8*)calloc(1, bufferLen);
fData = reinterpret_cast<uint8*>(calloc(1, bufferLen));
}


Expand Down Expand Up @@ -222,7 +222,7 @@ SoundBuffer::AddSample(sint16 sample)


uint16
SoundBuffer::ConsumeSamples(uint8* destBuffer, uint16 numSamples)
SoundBuffer::ConsumeSamples(uint8* destBuffer, uint32 numSamples)
{
uint32 numRequested = (uint32)numSamples;
uint32 numAvailable = std::min(numRequested, AvailableData());
Expand Down
2 changes: 1 addition & 1 deletion audio/SoundEngine.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class SoundBuffer {
uint16 SampleRate() const;
uint8* Data();

uint16 ConsumeSamples(uint8* destBuffer, uint16 numSamples);
uint16 ConsumeSamples(uint8* destBuffer, uint32 numSamples);
void AddSample(sint16 sample);

uint32 AvailableData() const;
Expand Down

0 comments on commit 3442bfa

Please sign in to comment.