fix shing
Some checks failed
Main / 🧹 Lint / 📜 C++ (push) Has been cancelled
Main / 🛠 Build / 🍏 macOS Clang (Debug) (push) Has been cancelled
Main / 🛠 Build / 🐧 Linux GCC (Debug) (push) Has been cancelled
Main / 🛠 Build / 🪟 Windows MSVC (Debug) (push) Has been cancelled
Main / 🛠 Build / 🍏 macOS Clang (Release) (push) Has been cancelled
Main / 🛠 Build / 🐧 Linux GCC (Release) (push) Has been cancelled
Main / 🛠 Build / 🪟 Windows MSVC (Release) (push) Has been cancelled
Some checks failed
Main / 🧹 Lint / 📜 C++ (push) Has been cancelled
Main / 🛠 Build / 🍏 macOS Clang (Debug) (push) Has been cancelled
Main / 🛠 Build / 🐧 Linux GCC (Debug) (push) Has been cancelled
Main / 🛠 Build / 🪟 Windows MSVC (Debug) (push) Has been cancelled
Main / 🛠 Build / 🍏 macOS Clang (Release) (push) Has been cancelled
Main / 🛠 Build / 🐧 Linux GCC (Release) (push) Has been cancelled
Main / 🛠 Build / 🪟 Windows MSVC (Release) (push) Has been cancelled
This commit is contained in:
@@ -12,6 +12,8 @@ void initialize_steam_audio(ModuleInitializationLevel p_level) {
|
|||||||
if (p_level == MODULE_INITIALIZATION_LEVEL_SERVERS) {
|
if (p_level == MODULE_INITIALIZATION_LEVEL_SERVERS) {
|
||||||
GDREGISTER_CLASS(SteamAudioServer);
|
GDREGISTER_CLASS(SteamAudioServer);
|
||||||
srv = memnew(SteamAudioServer);
|
srv = memnew(SteamAudioServer);
|
||||||
|
Engine::get_singleton()->register_singleton("SteamAudioServer", srv);
|
||||||
|
srv->initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p_level == MODULE_INITIALIZATION_LEVEL_SCENE) {
|
if (p_level == MODULE_INITIALIZATION_LEVEL_SCENE) {
|
||||||
@@ -28,6 +30,7 @@ void initialize_steam_audio(ModuleInitializationLevel p_level) {
|
|||||||
void uninitialize_steam_audio(ModuleInitializationLevel p_level) {
|
void uninitialize_steam_audio(ModuleInitializationLevel p_level) {
|
||||||
if (p_level == MODULE_INITIALIZATION_LEVEL_SERVERS) {
|
if (p_level == MODULE_INITIALIZATION_LEVEL_SERVERS) {
|
||||||
memdelete(srv);
|
memdelete(srv);
|
||||||
|
srv = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,15 +38,15 @@ void SteamAudioListener::_notification(int p_what) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SteamAudioListener::update_listener(IPLSimulator iplSim, IPLSimulationSharedInputs iplSimInputs) {
|
void SteamAudioListener::update_listener(IPLSimulator iplSim, IPLSimulationSharedInputs iplSimInputs) {
|
||||||
needs_update=false;
|
needs_update = false;
|
||||||
|
|
||||||
Transform3D transform = get_global_transform();
|
Transform3D transform = get_global_transform();
|
||||||
|
|
||||||
IPLCoordinateSpace3 space = SteamAudio::godot_to_ipl_space(transform);
|
IPLCoordinateSpace3 space = SteamAudio::godot_to_ipl_space(transform);
|
||||||
|
|
||||||
iplSimInputs.listener=space;
|
iplSimInputs.listener = space;
|
||||||
|
|
||||||
iplSimulatorSetSharedInputs(iplSim,IPL_SIMULATIONFLAGS_DIRECT,&iplSimInputs);
|
iplSimulatorSetSharedInputs(iplSim, IPL_SIMULATIONFLAGS_DIRECT, &iplSimInputs);
|
||||||
iplSimulatorSetSharedInputs(iplSim,IPL_SIMULATIONFLAGS_PATHING,&iplSimInputs);
|
iplSimulatorSetSharedInputs(iplSim, IPL_SIMULATIONFLAGS_PATHING, &iplSimInputs);
|
||||||
iplSimulatorSetSharedInputs(iplSim,IPL_SIMULATIONFLAGS_REFLECTIONS,&iplSimInputs);
|
iplSimulatorSetSharedInputs(iplSim, IPL_SIMULATIONFLAGS_REFLECTIONS, &iplSimInputs);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,11 +3,10 @@
|
|||||||
using namespace godot;
|
using namespace godot;
|
||||||
|
|
||||||
SteamAudioServer::SteamAudioServer() {
|
SteamAudioServer::SteamAudioServer() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SteamAudioServer::~SteamAudioServer() {
|
SteamAudioServer::~SteamAudioServer() {
|
||||||
shutdown();
|
shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Core Godot Methods
|
// Core Godot Methods
|
||||||
@@ -17,10 +16,13 @@ void SteamAudioServer::_bind_methods() {
|
|||||||
void SteamAudioServer::initialize() {
|
void SteamAudioServer::initialize() {
|
||||||
if (Engine::get_singleton()->is_editor_hint())
|
if (Engine::get_singleton()->is_editor_hint())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
IPLerror err = iplContextCreate(&ctxSettings,&ctx);
|
IPLerror err = iplContextCreate(&ctxSettings,&ctx);
|
||||||
|
|
||||||
if (err!=IPL_STATUS_SUCCESS) {
|
if (err!=IPL_STATUS_SUCCESS) {
|
||||||
ERR_PRINT("Failed to create IPL context");
|
ERR_PRINT("Failed to create IPL context");
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (static_cast<int>(proj_settings->get_setting("steam_audio/ray_tracer/RayTracer"))){
|
switch (static_cast<int>(proj_settings->get_setting("steam_audio/ray_tracer/RayTracer"))){
|
||||||
case 0:
|
case 0:
|
||||||
break;
|
break;
|
||||||
@@ -60,6 +62,8 @@ void SteamAudioServer::_notification(int p_what) {
|
|||||||
|
|
||||||
directThread->start(callable_mp(this,&SteamAudioServer::start_direct_thread),Thread::PRIORITY_NORMAL);
|
directThread->start(callable_mp(this,&SteamAudioServer::start_direct_thread),Thread::PRIORITY_NORMAL);
|
||||||
indirectThread->start(callable_mp(this,&SteamAudioServer::start_indirect_thread),Thread::PRIORITY_NORMAL);
|
indirectThread->start(callable_mp(this,&SteamAudioServer::start_indirect_thread),Thread::PRIORITY_NORMAL);
|
||||||
|
default:
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void SteamAudioServer::start_direct_thread() {
|
void SteamAudioServer::start_direct_thread() {
|
||||||
|
|||||||
@@ -1,21 +1,22 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <godot_cpp/classes/audio_frame.hpp>
|
#include <godot_cpp/classes/audio_frame.hpp>
|
||||||
|
#include <godot_cpp/classes/mutex.hpp>
|
||||||
#include <godot_cpp/classes/scene_tree.hpp>
|
#include <godot_cpp/classes/scene_tree.hpp>
|
||||||
|
#include <godot_cpp/classes/thread.hpp>
|
||||||
#include <godot_cpp/classes/wrapped.hpp>
|
#include <godot_cpp/classes/wrapped.hpp>
|
||||||
#include <godot_cpp/core/class_db.hpp>
|
#include <godot_cpp/core/class_db.hpp>
|
||||||
#include <godot_cpp/godot.hpp>
|
#include <godot_cpp/godot.hpp>
|
||||||
#include <godot_cpp/classes/thread.hpp>
|
|
||||||
#include <godot_cpp/classes/mutex.hpp>
|
|
||||||
#include <phonon.h>
|
#include <phonon.h>
|
||||||
#include <steam_audio.hpp>
|
#include <steam_audio.hpp>
|
||||||
|
#include <unordered_map>
|
||||||
|
|
||||||
#include "steam_audio_dynamic_mesh.hpp"
|
#include "steam_audio_dynamic_mesh.hpp"
|
||||||
#include "steam_audio_source.hpp"
|
#include "steam_audio_source.hpp"
|
||||||
#include "steam_audio_static_mesh.hpp"
|
#include "steam_audio_static_mesh.hpp"
|
||||||
|
|
||||||
using namespace godot;
|
using namespace godot;
|
||||||
|
|
||||||
|
|
||||||
class SteamAudioServer : public Object {
|
class SteamAudioServer : public Object {
|
||||||
GDCLASS(SteamAudioServer, Object) // Godot class declaration macro
|
GDCLASS(SteamAudioServer, Object) // Godot class declaration macro
|
||||||
private:
|
private:
|
||||||
@@ -27,7 +28,7 @@ private:
|
|||||||
bool needs_processing = false;
|
bool needs_processing = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
std::unordered_map<SteamAudioSource*,AudioSourceData> audio_sources;
|
std::unordered_map<SteamAudioSource *, AudioSourceData> audio_sources;
|
||||||
Ref<Mutex> audio_mutex;
|
Ref<Mutex> audio_mutex;
|
||||||
IPLContext ctx=nullptr;
|
IPLContext ctx=nullptr;
|
||||||
IPLContextSettings ctxSettings;
|
IPLContextSettings ctxSettings;
|
||||||
@@ -47,8 +48,8 @@ private:
|
|||||||
Ref<Thread> indirectThread;
|
Ref<Thread> indirectThread;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SteamAudioServer(); // Constructor
|
SteamAudioServer();
|
||||||
~SteamAudioServer() override; // Destructor
|
~SteamAudioServer() override;
|
||||||
void _notification(int p_what);
|
void _notification(int p_what);
|
||||||
void register_audio_source(SteamAudioSource *source);
|
void register_audio_source(SteamAudioSource *source);
|
||||||
void unregister_audio_source(SteamAudioSource *source);
|
void unregister_audio_source(SteamAudioSource *source);
|
||||||
@@ -57,8 +58,11 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
static void _bind_methods();
|
static void _bind_methods();
|
||||||
|
|
||||||
|
public:
|
||||||
void initialize();
|
void initialize();
|
||||||
void shutdown();
|
void shutdown();
|
||||||
void start_direct_thread();
|
void start_direct_thread();
|
||||||
void start_indirect_thread();
|
void start_indirect_thread();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user