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) {
|
||||
return Status::fail(JOC_ERR_RENDER_FAILED, stage::kRender, "sofa reset failed");
|
||||
}
|
||||
timeline_ = timeline::OamdPositionTimeline();
|
||||
timeline_.reset();
|
||||
output_.clear();
|
||||
staged_ = 0;
|
||||
input_samples_ = 0;
|
||||
|
||||
@@ -1329,7 +1329,7 @@ Status RosellaRuntime::reset() {
|
||||
impl_->raw_output_samples = 0u;
|
||||
impl_->metadata_block_updates = 0u;
|
||||
impl_->finished = false;
|
||||
impl_->timeline = timeline::OamdPositionTimeline(timeline::kTimelineObjects);
|
||||
impl_->timeline.reset();
|
||||
return Status::success();
|
||||
}
|
||||
|
||||
@@ -1355,4 +1355,8 @@ std::uint64_t RosellaRuntime::metadata_block_updates() const {
|
||||
}
|
||||
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
|
||||
@@ -56,6 +56,9 @@ public:
|
||||
std::uint64_t metadata_block_updates() const;
|
||||
const timeline::OamdPositionTimeline& timeline() const;
|
||||
|
||||
// bed 声道是固定通道:OAMD 不给位置,方位由声明的 bed 布局给出。
|
||||
void set_fixed_position(int object_index, const double position[3]);
|
||||
|
||||
private:
|
||||
struct Impl;
|
||||
std::unique_ptr<Impl> impl_;
|
||||
|
||||
@@ -206,8 +206,13 @@ void Stream::apply_bed_positions(const FrameMetadata& entry) {
|
||||
++slot) {
|
||||
const ::joc::joc::BedChannel channel = bed.channels[slot];
|
||||
double xyz[3] = {0.0, 0.0, 0.0};
|
||||
if (binaural_ready_ && ::joc::joc::bed_channel_adm_position(channel, xyz)) {
|
||||
binaural_.set_fixed_position(static_cast<int>(slot) + 1, xyz);
|
||||
if (::joc::joc::bed_channel_adm_position(channel, 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_) {
|
||||
continue;
|
||||
|
||||
@@ -1780,6 +1780,10 @@ Status run(const joc_task_config& raw, const joc_event_sink* sink, joc_task_resu
|
||||
binaural.set_fixed_position(
|
||||
static_cast<int>(slot) + 1, xyz);
|
||||
}
|
||||
if (rosella_enabled) {
|
||||
rosella.set_fixed_position(
|
||||
static_cast<int>(slot) + 1, xyz);
|
||||
}
|
||||
}
|
||||
if (!speaker_enabled) {
|
||||
continue;
|
||||
|
||||
@@ -60,6 +60,23 @@ public:
|
||||
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 transition_count() const { return transition_count_; }
|
||||
bool initialized() const { return initialized_; }
|
||||
|
||||
Reference in new issue
Block a user