mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-21 22:13:07 +01:00
Add new audio objects for loading sounds
This commit is contained in:
46
src/openrct2/object/AudioObject.cpp
Normal file
46
src/openrct2/object/AudioObject.cpp
Normal file
@@ -0,0 +1,46 @@
|
||||
/*****************************************************************************
|
||||
* Copyright (c) 2014-2022 OpenRCT2 developers
|
||||
*
|
||||
* For a complete list of all authors, please refer to contributors.md
|
||||
* Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2
|
||||
*
|
||||
* OpenRCT2 is licensed under the GNU General Public License version 3.
|
||||
*****************************************************************************/
|
||||
|
||||
#include "AudioObject.h"
|
||||
|
||||
#include "../Context.h"
|
||||
#include "../PlatformEnvironment.h"
|
||||
#include "../audio/AudioContext.h"
|
||||
#include "../core/Json.hpp"
|
||||
#include "../core/Path.hpp"
|
||||
|
||||
using namespace OpenRCT2;
|
||||
using namespace OpenRCT2::Audio;
|
||||
|
||||
void AudioObject::Load()
|
||||
{
|
||||
_sampleTable.Load();
|
||||
}
|
||||
|
||||
void AudioObject::Unload()
|
||||
{
|
||||
_sampleTable.Unload();
|
||||
}
|
||||
|
||||
void AudioObject::ReadJson(IReadObjectContext* context, json_t& root)
|
||||
{
|
||||
Guard::Assert(root.is_object(), "BannerObject::ReadJson expects parameter root to be object");
|
||||
_sampleTable.ReadFromJson(context, root);
|
||||
PopulateTablesFromJson(context, root);
|
||||
}
|
||||
|
||||
IAudioSource* AudioObject::GetSample(uint32_t index) const
|
||||
{
|
||||
return _sampleTable.GetSample(index);
|
||||
}
|
||||
|
||||
int32_t AudioObject::GetSampleModifier(uint32_t index) const
|
||||
{
|
||||
return _sampleTable.GetSampleModifier(index);
|
||||
}
|
||||
Reference in New Issue
Block a user