Sync the kernel copy with the HRTF bed position fixes
This commit is contained in:
1 parent
30e2654a3e
commit
d3c9818409
7 files changed
+41
-7
No files matched your search
@@ -205,7 +205,7 @@ Status SofaBinauralRuntime::reset() {
|
|||||||
if (ejoc_sofa_binaural_reset(handle_) != 0) {
|
if (ejoc_sofa_binaural_reset(handle_) != 0) {
|
||||||
return Status::fail(JOC_ERR_RENDER_FAILED, stage::kRender, "sofa reset failed");
|
return Status::fail(JOC_ERR_RENDER_FAILED, stage::kRender, "sofa reset failed");
|
||||||
}
|
}
|
||||||
timeline_ = timeline::OamdPositionTimeline();
|
timeline_.reset();
|
||||||
output_.clear();
|
output_.clear();
|
||||||
staged_ = 0;
|
staged_ = 0;
|
||||||
input_samples_ = 0;
|
input_samples_ = 0;
|
||||||
|
|||||||
@@ -1329,7 +1329,7 @@ Status RosellaRuntime::reset() {
|
|||||||
impl_->raw_output_samples = 0u;
|
impl_->raw_output_samples = 0u;
|
||||||
impl_->metadata_block_updates = 0u;
|
impl_->metadata_block_updates = 0u;
|
||||||
impl_->finished = false;
|
impl_->finished = false;
|
||||||
impl_->timeline = timeline::OamdPositionTimeline(timeline::kTimelineObjects);
|
impl_->timeline.reset();
|
||||||
return Status::success();
|
return Status::success();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1355,4 +1355,8 @@ std::uint64_t RosellaRuntime::metadata_block_updates() const {
|
|||||||
}
|
}
|
||||||
const timeline::OamdPositionTimeline& RosellaRuntime::timeline() const { return impl_->timeline; }
|
const timeline::OamdPositionTimeline& RosellaRuntime::timeline() const { return impl_->timeline; }
|
||||||
|
|
||||||
|
void RosellaRuntime::set_fixed_position(int object_index, const double position[3]) {
|
||||||
|
impl_->timeline.set_fixed_position(object_index, position);
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace joc::hrtf
|
} // namespace joc::hrtf
|
||||||
@@ -56,6 +56,9 @@ public:
|
|||||||
std::uint64_t metadata_block_updates() const;
|
std::uint64_t metadata_block_updates() const;
|
||||||
const timeline::OamdPositionTimeline& timeline() const;
|
const timeline::OamdPositionTimeline& timeline() const;
|
||||||
|
|
||||||
|
// bed 声道是固定通道:OAMD 不给位置,方位由声明的 bed 布局给出。
|
||||||
|
void set_fixed_position(int object_index, const double position[3]);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct Impl;
|
struct Impl;
|
||||||
std::unique_ptr<Impl> impl_;
|
std::unique_ptr<Impl> impl_;
|
||||||
|
|||||||
@@ -206,8 +206,13 @@ void Stream::apply_bed_positions(const FrameMetadata& entry) {
|
|||||||
++slot) {
|
++slot) {
|
||||||
const ::joc::joc::BedChannel channel = bed.channels[slot];
|
const ::joc::joc::BedChannel channel = bed.channels[slot];
|
||||||
double xyz[3] = {0.0, 0.0, 0.0};
|
double xyz[3] = {0.0, 0.0, 0.0};
|
||||||
if (binaural_ready_ && ::joc::joc::bed_channel_adm_position(channel, xyz)) {
|
if (::joc::joc::bed_channel_adm_position(channel, xyz)) {
|
||||||
binaural_.set_fixed_position(static_cast<int>(slot) + 1, xyz);
|
if (binaural_ready_) {
|
||||||
|
binaural_.set_fixed_position(static_cast<int>(slot) + 1, xyz);
|
||||||
|
}
|
||||||
|
if (rosella_ready_) {
|
||||||
|
rosella_.set_fixed_position(static_cast<int>(slot) + 1, xyz);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!speaker_enabled_) {
|
if (!speaker_enabled_) {
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@@ -1780,6 +1780,10 @@ Status run(const joc_task_config& raw, const joc_event_sink* sink, joc_task_resu
|
|||||||
binaural.set_fixed_position(
|
binaural.set_fixed_position(
|
||||||
static_cast<int>(slot) + 1, xyz);
|
static_cast<int>(slot) + 1, xyz);
|
||||||
}
|
}
|
||||||
|
if (rosella_enabled) {
|
||||||
|
rosella.set_fixed_position(
|
||||||
|
static_cast<int>(slot) + 1, xyz);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!speaker_enabled) {
|
if (!speaker_enabled) {
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@@ -60,6 +60,23 @@ public:
|
|||||||
fixed_xyz_[object_index - 1][2] = position[2];
|
fixed_xyz_[object_index - 1][2] = position[2];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Drops the OAMD state and every transition but keeps the fixed bed positions:
|
||||||
|
// they describe the content, not the playback position.
|
||||||
|
void reset() {
|
||||||
|
state_.reset();
|
||||||
|
for (int index = 0; index < kTimelineObjects; ++index) {
|
||||||
|
tracks_[index] = ObjectPositionTrack();
|
||||||
|
has_previous_[index] = false;
|
||||||
|
for (int axis = 0; axis < 3; ++axis) {
|
||||||
|
previous_targets_[index][axis] = 0.0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
initialized_ = false;
|
||||||
|
payload_count_ = 0;
|
||||||
|
transition_count_ = 0;
|
||||||
|
last_coded_event_sample_ = -1;
|
||||||
|
}
|
||||||
|
|
||||||
std::uint64_t payload_count() const { return payload_count_; }
|
std::uint64_t payload_count() const { return payload_count_; }
|
||||||
std::uint64_t transition_count() const { return transition_count_; }
|
std::uint64_t transition_count() const { return transition_count_; }
|
||||||
bool initialized() const { return initialized_; }
|
bool initialized() const { return initialized_; }
|
||||||
|
|||||||
+4
-3
@@ -1108,9 +1108,10 @@ bool Engine::seek(double seconds, double total_seconds, std::string* error) {
|
|||||||
impl.delivered = 0;
|
impl.delivered = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// joc_stream_reset keeps the renderer and its HRTF field: it drops the whole
|
// joc_stream_reset keeps the renderer and its HRTF field: it drops the timeline
|
||||||
// timeline, gain ramps, room tail and filter-bank history, which is exactly
|
// state, gain ramps, room tail and filter-bank history, which is exactly what a
|
||||||
// what a restart at another position needs.
|
// restart at another position needs. The fixed bed positions survive: they
|
||||||
|
// describe the content, not the playback position.
|
||||||
const joc_error reset = impl.api.reset(impl.stream);
|
const joc_error reset = impl.api.reset(impl.stream);
|
||||||
if (reset != JOC_OK) {
|
if (reset != JOC_OK) {
|
||||||
if (error != nullptr) {
|
if (error != nullptr) {
|
||||||
|
|||||||
Reference in new issue
Block a user