mirror of https://github.com/OpenRCT2/OpenRCT2.git
Apply code review changes, auto*
This commit is contained in:
parent
2effca59d1
commit
6465d42b57
|
@ -80,7 +80,7 @@ namespace OpenRCT2::Audio
|
||||||
|
|
||||||
IAudioSource* CreateStreamFromCSS(std::unique_ptr<IStream> stream, uint32_t index) override
|
IAudioSource* CreateStreamFromCSS(std::unique_ptr<IStream> stream, uint32_t index) override
|
||||||
{
|
{
|
||||||
auto rw = StreamToSDL2(std::move(stream));
|
auto* rw = StreamToSDL2(std::move(stream));
|
||||||
if (rw == nullptr)
|
if (rw == nullptr)
|
||||||
{
|
{
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@ -94,7 +94,7 @@ namespace OpenRCT2::Audio
|
||||||
{
|
{
|
||||||
constexpr size_t STREAM_MIN_SIZE = 2 * 1024 * 1024; // 2 MiB
|
constexpr size_t STREAM_MIN_SIZE = 2 * 1024 * 1024; // 2 MiB
|
||||||
auto loadIntoRAM = stream->GetLength() < STREAM_MIN_SIZE;
|
auto loadIntoRAM = stream->GetLength() < STREAM_MIN_SIZE;
|
||||||
auto rw = StreamToSDL2(std::move(stream));
|
auto* rw = StreamToSDL2(std::move(stream));
|
||||||
if (rw == nullptr)
|
if (rw == nullptr)
|
||||||
{
|
{
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@ -159,7 +159,7 @@ namespace OpenRCT2::Audio
|
||||||
|
|
||||||
static SDL_RWops* StreamToSDL2(std::unique_ptr<IStream> stream)
|
static SDL_RWops* StreamToSDL2(std::unique_ptr<IStream> stream)
|
||||||
{
|
{
|
||||||
auto rw = SDL_AllocRW();
|
auto* rw = SDL_AllocRW();
|
||||||
if (rw == nullptr)
|
if (rw == nullptr)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
*rw = {};
|
*rw = {};
|
||||||
|
@ -180,7 +180,7 @@ namespace OpenRCT2::Audio
|
||||||
return static_cast<Sint64>(ptr->GetLength());
|
return static_cast<Sint64>(ptr->GetLength());
|
||||||
};
|
};
|
||||||
rw->close = [](SDL_RWops* ctx) {
|
rw->close = [](SDL_RWops* ctx) {
|
||||||
auto ptr = static_cast<IStream*>(ctx->hidden.unknown.data1);
|
auto* ptr = static_cast<IStream*>(ctx->hidden.unknown.data1);
|
||||||
delete ptr;
|
delete ptr;
|
||||||
ctx->hidden.unknown.data1 = nullptr;
|
ctx->hidden.unknown.data1 = nullptr;
|
||||||
delete ctx;
|
delete ctx;
|
||||||
|
|
|
@ -38,7 +38,7 @@ void AudioMixer::Init(const char* device)
|
||||||
want.channels = 2;
|
want.channels = 2;
|
||||||
want.samples = 2048;
|
want.samples = 2048;
|
||||||
want.callback = [](void* arg, uint8_t* dst, int32_t length) -> void {
|
want.callback = [](void* arg, uint8_t* dst, int32_t length) -> void {
|
||||||
auto mixer = static_cast<AudioMixer*>(arg);
|
auto* mixer = static_cast<AudioMixer*>(arg);
|
||||||
mixer->GetNextAudioChunk(dst, static_cast<size_t>(length));
|
mixer->GetNextAudioChunk(dst, static_cast<size_t>(length));
|
||||||
mixer->RemoveReleasedSources();
|
mixer->RemoveReleasedSources();
|
||||||
};
|
};
|
||||||
|
@ -88,7 +88,7 @@ void AudioMixer::Unlock()
|
||||||
IAudioChannel* AudioMixer::Play(IAudioSource* source, int32_t loop, bool deleteondone)
|
IAudioChannel* AudioMixer::Play(IAudioSource* source, int32_t loop, bool deleteondone)
|
||||||
{
|
{
|
||||||
Lock();
|
Lock();
|
||||||
ISDLAudioChannel* channel = AudioChannel::Create();
|
auto* channel = AudioChannel::Create();
|
||||||
if (channel != nullptr)
|
if (channel != nullptr)
|
||||||
{
|
{
|
||||||
channel->Play(source, loop);
|
channel->Play(source, loop);
|
||||||
|
|
|
@ -90,7 +90,7 @@ namespace OpenRCT2::Audio
|
||||||
}
|
}
|
||||||
|
|
||||||
auto& objManager = GetContext()->GetObjectManager();
|
auto& objManager = GetContext()->GetObjectManager();
|
||||||
auto baseAudio = objManager.LoadObject(AudioObjectIdentifiers::Rct2Base);
|
auto* baseAudio = objManager.LoadObject(AudioObjectIdentifiers::Rct2Base);
|
||||||
if (baseAudio != nullptr)
|
if (baseAudio != nullptr)
|
||||||
{
|
{
|
||||||
_soundsAudioObjectEntryIndex = objManager.GetLoadedObjectEntryIndex(baseAudio);
|
_soundsAudioObjectEntryIndex = objManager.GetLoadedObjectEntryIndex(baseAudio);
|
||||||
|
@ -170,7 +170,7 @@ namespace OpenRCT2::Audio
|
||||||
AudioObject* GetBaseAudioObject()
|
AudioObject* GetBaseAudioObject()
|
||||||
{
|
{
|
||||||
auto& objManager = GetContext()->GetObjectManager();
|
auto& objManager = GetContext()->GetObjectManager();
|
||||||
auto baseAudioObject = static_cast<AudioObject*>(
|
auto* baseAudioObject = static_cast<AudioObject*>(
|
||||||
objManager.GetLoadedObject(ObjectType::Audio, _soundsAudioObjectEntryIndex));
|
objManager.GetLoadedObject(ObjectType::Audio, _soundsAudioObjectEntryIndex));
|
||||||
return baseAudioObject;
|
return baseAudioObject;
|
||||||
}
|
}
|
||||||
|
@ -194,7 +194,7 @@ namespace OpenRCT2::Audio
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Get sound from base object
|
// Get sound from base object
|
||||||
auto baseAudioObject = GetBaseAudioObject();
|
auto* baseAudioObject = GetBaseAudioObject();
|
||||||
if (baseAudioObject != nullptr)
|
if (baseAudioObject != nullptr)
|
||||||
{
|
{
|
||||||
auto params = GetParametersFromLocation(baseAudioObject, EnumValue(soundId), loc);
|
auto params = GetParametersFromLocation(baseAudioObject, EnumValue(soundId), loc);
|
||||||
|
@ -215,7 +215,7 @@ namespace OpenRCT2::Audio
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Get sound from base object
|
// Get sound from base object
|
||||||
auto baseAudioObject = GetBaseAudioObject();
|
auto* baseAudioObject = GetBaseAudioObject();
|
||||||
if (baseAudioObject != nullptr)
|
if (baseAudioObject != nullptr)
|
||||||
{
|
{
|
||||||
auto source = baseAudioObject->GetSample(EnumValue(soundId));
|
auto source = baseAudioObject->GetSample(EnumValue(soundId));
|
||||||
|
@ -259,7 +259,7 @@ namespace OpenRCT2::Audio
|
||||||
// Load title sequence audio object
|
// Load title sequence audio object
|
||||||
auto descriptor = GetTitleMusicDescriptor();
|
auto descriptor = GetTitleMusicDescriptor();
|
||||||
auto& objManager = GetContext()->GetObjectManager();
|
auto& objManager = GetContext()->GetObjectManager();
|
||||||
auto audioObject = static_cast<AudioObject*>(objManager.LoadObject(descriptor));
|
auto* audioObject = static_cast<AudioObject*>(objManager.LoadObject(descriptor));
|
||||||
if (audioObject != nullptr)
|
if (audioObject != nullptr)
|
||||||
{
|
{
|
||||||
_titleAudioObjectEntryIndex = objManager.GetLoadedObjectEntryIndex(audioObject);
|
_titleAudioObjectEntryIndex = objManager.GetLoadedObjectEntryIndex(audioObject);
|
||||||
|
@ -318,7 +318,7 @@ namespace OpenRCT2::Audio
|
||||||
if (_titleAudioObjectEntryIndex != OBJECT_ENTRY_INDEX_NULL)
|
if (_titleAudioObjectEntryIndex != OBJECT_ENTRY_INDEX_NULL)
|
||||||
{
|
{
|
||||||
auto& objManager = GetContext()->GetObjectManager();
|
auto& objManager = GetContext()->GetObjectManager();
|
||||||
auto obj = objManager.GetLoadedObject(ObjectType::Audio, _titleAudioObjectEntryIndex);
|
auto* obj = objManager.GetLoadedObject(ObjectType::Audio, _titleAudioObjectEntryIndex);
|
||||||
if (obj != nullptr)
|
if (obj != nullptr)
|
||||||
{
|
{
|
||||||
objManager.UnloadObjects({ obj->GetDescriptor() });
|
objManager.UnloadObjects({ obj->GetDescriptor() });
|
||||||
|
|
Loading…
Reference in New Issue