summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2022-05-30 19:25:08 +0200
committerLars Knoll <lars.knoll@qt.io>2022-05-31 11:31:38 +0200
commit5853819466e36396be4ea155a694549857609026 (patch)
tree31cce750c25ae1bbbadcfd7ace22dfcd65a9478e
parent5e4876dd97ed8c6649edbba306350891f1359424 (diff)
Patch resonance audio to give access to reverb data
When retrieving the ambisonic sound field from resonance audio, that data does contain room reflections, but not reverb for the room. The reason is that reverb is directionally independent and resonance audio only calculates it in stereo. Work around this, by adding a small getter that allows us to retrieve the audio buffer that contains the reverb data. Change-Id: I6dd177293d38713ce29c40483dfc8d2409828fce Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
-rw-r--r--src/3rdparty/resonance-audio/resonance_audio/graph/graph_manager.cc7
-rw-r--r--src/3rdparty/resonance-audio/resonance_audio/graph/graph_manager.h9
-rw-r--r--src/3rdparty/resonance-audio/resonance_audio/graph/resonance_audio_api_impl.cc6
-rw-r--r--src/3rdparty/resonance-audio/resonance_audio/graph/resonance_audio_api_impl.h5
-rw-r--r--src/3rdparty/resonance-audio/resonance_audio/graph/reverb_node.cc5
-rw-r--r--src/3rdparty/resonance-audio/resonance_audio/graph/reverb_node.h2
6 files changed, 32 insertions, 2 deletions
diff --git a/src/3rdparty/resonance-audio/resonance_audio/graph/graph_manager.cc b/src/3rdparty/resonance-audio/resonance_audio/graph/graph_manager.cc
index 2046699f8..cb5b85590 100644
--- a/src/3rdparty/resonance-audio/resonance_audio/graph/graph_manager.cc
+++ b/src/3rdparty/resonance-audio/resonance_audio/graph/graph_manager.cc
@@ -164,7 +164,12 @@ const AudioBuffer* GraphManager::GetAmbisonicBuffer() const {
}
const AudioBuffer* GraphManager::GetStereoBuffer() const {
- return stereo_mixer_node_->GetOutputBuffer();
+ return stereo_mixer_node_->GetOutputBuffer();
+}
+
+const AudioBuffer *GraphManager::GetReverbBuffer() const
+{
+ return reverb_node_->GetOutputBuffer();
}
size_t GraphManager::GetNumMaxAmbisonicChannels() const {
diff --git a/src/3rdparty/resonance-audio/resonance_audio/graph/graph_manager.h b/src/3rdparty/resonance-audio/resonance_audio/graph/graph_manager.h
index ab797ff54..818b6fa01 100644
--- a/src/3rdparty/resonance-audio/resonance_audio/graph/graph_manager.h
+++ b/src/3rdparty/resonance-audio/resonance_audio/graph/graph_manager.h
@@ -227,6 +227,15 @@ class GraphManager {
// @return Output audio buffer of the stereo mix, or nullptr if no output.
const AudioBuffer* GetStereoBuffer() const;
+ // Returns the last processed buffer containing the reverb data for the room.
+ // The buffer contains stereo data.
+ // Note that, this method will *not* trigger the processing of the audio
+ // graph. |GraphManager::Process| must be called prior to this method call to
+ // ensure that the buffer is up-to-date.
+ //
+ // @return Room reverb audio buffer, or nullptr if no output.
+ const AudioBuffer* GetReverbBuffer() const;
+
// Returns the maximum allowed number of ambisonic channels.
//
// @return Number of channels based on Ambisonic order in the global config.
diff --git a/src/3rdparty/resonance-audio/resonance_audio/graph/resonance_audio_api_impl.cc b/src/3rdparty/resonance-audio/resonance_audio/graph/resonance_audio_api_impl.cc
index ec508144a..f8cc6731b 100644
--- a/src/3rdparty/resonance-audio/resonance_audio/graph/resonance_audio_api_impl.cc
+++ b/src/3rdparty/resonance-audio/resonance_audio/graph/resonance_audio_api_impl.cc
@@ -448,7 +448,11 @@ const AudioBuffer* ResonanceAudioApiImpl::GetAmbisonicOutputBuffer() const {
}
const AudioBuffer* ResonanceAudioApiImpl::GetStereoOutputBuffer() const {
- return graph_manager_->GetStereoBuffer();
+ return graph_manager_->GetStereoBuffer();
+}
+
+const AudioBuffer *ResonanceAudioApiImpl::GetReverbBuffer() const {
+ return graph_manager_->GetReverbBuffer();
}
void ResonanceAudioApiImpl::ProcessNextBuffer() {
diff --git a/src/3rdparty/resonance-audio/resonance_audio/graph/resonance_audio_api_impl.h b/src/3rdparty/resonance-audio/resonance_audio/graph/resonance_audio_api_impl.h
index cac118387..0adbc1c67 100644
--- a/src/3rdparty/resonance-audio/resonance_audio/graph/resonance_audio_api_impl.h
+++ b/src/3rdparty/resonance-audio/resonance_audio/graph/resonance_audio_api_impl.h
@@ -124,6 +124,11 @@ class ResonanceAudioApiImpl : public ResonanceAudioApi {
// @return Pointer to stereo output buffer.
const AudioBuffer* GetStereoOutputBuffer() const;
+ // Returns the last processed buffer containing stereo data for the room reverb
+ //
+ // @return Pointer to room reverb stereo buffer.
+ const AudioBuffer* GetReverbBuffer() const;
+
// Triggers processing of the audio graph with the updated system properties.
void ProcessNextBuffer();
diff --git a/src/3rdparty/resonance-audio/resonance_audio/graph/reverb_node.cc b/src/3rdparty/resonance-audio/resonance_audio/graph/reverb_node.cc
index 36b7042bd..6a9999881 100644
--- a/src/3rdparty/resonance-audio/resonance_audio/graph/reverb_node.cc
+++ b/src/3rdparty/resonance-audio/resonance_audio/graph/reverb_node.cc
@@ -95,6 +95,11 @@ void ReverbNode::Update() {
}
}
+const AudioBuffer* ReverbNode::GetOutputBuffer() const
+{
+ return &output_buffer_;
+}
+
const AudioBuffer* ReverbNode::AudioProcess(const NodeInput& input) {
if (rt60_updating_) {
for (size_t i = 0; i < kNumReverbOctaveBands; ++i) {
diff --git a/src/3rdparty/resonance-audio/resonance_audio/graph/reverb_node.h b/src/3rdparty/resonance-audio/resonance_audio/graph/reverb_node.h
index e25d0a577..f9921fa66 100644
--- a/src/3rdparty/resonance-audio/resonance_audio/graph/reverb_node.h
+++ b/src/3rdparty/resonance-audio/resonance_audio/graph/reverb_node.h
@@ -41,6 +41,8 @@ class ReverbNode : public ProcessingNode {
// values depending on the system settings.
void Update();
+ const AudioBuffer *GetOutputBuffer() const;
+
protected:
// Implements ProcessingNode.
const AudioBuffer* AudioProcess(const NodeInput& input) override;