-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
1,511 additions
and
1,020 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#pragma once | ||
|
||
#include <variant> | ||
|
||
#include "SteamAudioLib.h" | ||
#include "ObjectPtr.hpp" | ||
#include "Simulator.hpp" | ||
#include "Scene.hpp" | ||
|
||
namespace MetaAudio { | ||
namespace SteamAudio { | ||
class Context final : public ObjectPtr<IPLContext> { | ||
public: | ||
static std::variant<Context, IPLerror> Create(IPLContextSettings& settings); | ||
constexpr Context(nullptr_t) noexcept : ObjectPtr(nullptr) {} | ||
Context(IPLContext ptr) : ObjectPtr(ptr) {}; | ||
|
||
std::variant<Simulator, IPLerror> CreateSimulator(IPLSimulationSettings& simulationSettings); | ||
std::variant<Scene, IPLerror> CreateScene(IPLSceneSettings& sceneSettings); | ||
|
||
protected: | ||
// Inherited via ObjectPtr | ||
void retain(IPLContext handle) override; | ||
void release(IPLContext handle) override; | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
#pragma once | ||
|
||
#include <stdexcept> | ||
|
||
#include "SteamAudioLib.h" | ||
|
||
namespace MetaAudio { | ||
namespace SteamAudio { | ||
template<class HANDLE> | ||
class ObjectPtr { | ||
public: | ||
constexpr ObjectPtr(nullptr_t) noexcept {} | ||
virtual ~ObjectPtr() { | ||
if (m_handle != nullptr) { | ||
release(m_handle); | ||
} | ||
} | ||
|
||
ObjectPtr(const ObjectPtr& other) : ObjectPtr(other.m_handle) { | ||
if (m_handle != nullptr) { | ||
retain(m_handle); | ||
} | ||
} | ||
ObjectPtr& operator=(const ObjectPtr& other) { | ||
if (this == &other) { | ||
return *this; | ||
} | ||
|
||
if (this->m_handle == other.m_handle) { | ||
return *this; | ||
} | ||
retain(other.m_handle); | ||
release(this->m_handle); | ||
this->m_handle = other.m_handle; | ||
return *this; | ||
} | ||
|
||
ObjectPtr(ObjectPtr&& other) : m_handle(std::exchange(other.m_handle, nullptr)) noexcept {} | ||
ObjectPtr& operator=(ObjectPtr&& other) noexcept { | ||
std::swap(m_handle, other.m_handle); | ||
return *this; | ||
} | ||
|
||
bool operator==(ObjectPtr const& other) { | ||
return this->m_handle == other.m_handle; | ||
} | ||
|
||
bool operator!=(ObjectPtr const& other) { | ||
return this->m_handle != other.m_handle; | ||
} | ||
|
||
protected: | ||
virtual void retain(HANDLE handle) { | ||
throw std::logic_error("retain not implemented"); | ||
} | ||
virtual void release(HANDLE handle) { | ||
throw std::logic_error("release not implemented"); | ||
} | ||
HANDLE m_handle = nullptr; | ||
ObjectPtr(HANDLE handle) : m_handle(handle) {} | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#pragma once | ||
|
||
#include <variant> | ||
|
||
#include "SteamAudioLib.h" | ||
#include "ObjectPtr.hpp" | ||
#include "StaticMesh.hpp" | ||
|
||
namespace MetaAudio { | ||
namespace SteamAudio { | ||
class Simulator; | ||
|
||
class Scene final : public ObjectPtr<IPLScene> { | ||
friend class Simulator; | ||
public: | ||
//constexpr Scene() : ObjectPtr() {}; | ||
constexpr Scene(nullptr_t) noexcept : ObjectPtr(nullptr) {} | ||
Scene(IPLScene ptr) : ObjectPtr(ptr) {}; | ||
std::variant<StaticMesh, IPLerror> StaticMeshCreate(IPLStaticMeshSettings& staticMeshSettings); | ||
void StaticMeshAdd(const StaticMesh& staticMesh); | ||
|
||
void Commit(); | ||
|
||
protected: | ||
// Inherited via ObjectPtr | ||
void retain(IPLScene handle) override; | ||
void release(IPLScene handle) override; | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#pragma once | ||
|
||
#include <variant> | ||
|
||
#include "SteamAudioLib.h" | ||
#include "ObjectPtr.hpp" | ||
#include "Scene.hpp" | ||
#include "Source.hpp" | ||
|
||
namespace MetaAudio { | ||
namespace SteamAudio { | ||
class Simulator final : public ObjectPtr<IPLSimulator> { | ||
public: | ||
//constexpr Simulator() : ObjectPtr() {}; | ||
constexpr Simulator(nullptr_t) noexcept : ObjectPtr(nullptr) {} | ||
Simulator(IPLSimulator ptr) : ObjectPtr(ptr) {}; | ||
std::variant<Source, IPLerror> SourceCreate(IPLSourceSettings& sourceSettings); | ||
void SourceRemove(const Source& source); | ||
void SetScene(const Scene& scene); | ||
void SourceAdd(const Source& source); | ||
void Commit(); | ||
|
||
void SetSharedInputs(IPLSimulationFlags flags, IPLSimulationSharedInputs& inputs); | ||
void RunDirect(); | ||
|
||
protected: | ||
// Inherited via ObjectPtr | ||
void retain(IPLSimulator handle) override; | ||
void release(IPLSimulator handle) override; | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#pragma once | ||
|
||
#include <variant> | ||
|
||
#include "SteamAudioLib.h" | ||
#include "ObjectPtr.hpp" | ||
|
||
namespace MetaAudio { | ||
namespace SteamAudio { | ||
class Simulator; | ||
|
||
class Source final : public ObjectPtr<IPLSource> { | ||
friend class Simulator; | ||
public: | ||
constexpr Source(nullptr_t) noexcept : ObjectPtr(nullptr) {} | ||
Source(IPLSource ptr) : ObjectPtr(ptr) {}; | ||
void SetInputs(IPLSimulationFlags flags, IPLSimulationInputs& inputs); | ||
IPLSimulationOutputs GetOutputs(IPLSimulationFlags flags); | ||
|
||
protected: | ||
// Inherited via ObjectPtr | ||
void retain(IPLSource handle) override; | ||
void release(IPLSource handle) override; | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#pragma once | ||
|
||
#include <variant> | ||
|
||
#include "SteamAudioLib.h" | ||
#include "ObjectPtr.hpp" | ||
|
||
namespace MetaAudio { | ||
namespace SteamAudio { | ||
class Scene; | ||
|
||
class StaticMesh final : public ObjectPtr<IPLStaticMesh> { | ||
friend class Scene; | ||
public: | ||
//constexpr StaticMesh() : ObjectPtr() {}; | ||
constexpr StaticMesh(nullptr_t) noexcept : ObjectPtr(nullptr) {} | ||
StaticMesh(IPLStaticMesh ptr) : ObjectPtr(ptr) {}; | ||
|
||
protected: | ||
// Inherited via ObjectPtr | ||
void retain(IPLStaticMesh handle) override; | ||
void release(IPLStaticMesh handle) override; | ||
}; | ||
} | ||
} |
Oops, something went wrong.