MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ publish()

void MayaFlux::Nodes::Network::DuctNetwork::publish ( std::shared_ptr< Prepared > next)
private

Definition at line 144 of file DuctNetwork.cpp.

145{
146 m_intervals = next->grid.intervals;
147 m_courant = next->grid.courant;
148 m_bandwidth = next->grid.bandwidth;
149 m_applied_friction = next->friction;
150 m_applied_viscosity = next->viscosity;
151
152 while (m_audio_buffer_lock.test_and_set(std::memory_order_acquire)) {
153 std::this_thread::yield();
154 }
155 m_field.reserve(next->grid.intervals + 1);
156 m_audio_buffer_lock.clear(std::memory_order_release);
157
158 for (;;) {
159 uint8_t state = m_handoff.load(std::memory_order_acquire);
160
161 if (state == k_retired) {
162 m_slot.reset();
163 m_handoff.store(k_empty, std::memory_order_release);
164 } else if (state == k_ready) {
165 if (m_handoff.compare_exchange_strong(state, k_busy, std::memory_order_acq_rel)) {
166 next->keep_state = next->keep_state && m_slot->keep_state;
167 m_slot = std::move(next);
168 m_handoff.store(k_ready, std::memory_order_release);
169 return;
170 }
171 } else if (state == k_busy) {
172 std::this_thread::yield();
173 } else {
174 m_slot = std::move(next);
175 m_handoff.store(k_ready, std::memory_order_release);
176 return;
177 }
178 }
179}
std::shared_ptr< Prepared > m_slot
std::atomic_flag m_audio_buffer_lock
Spinlock guarding m_last_audio_buffer.

References m_applied_friction, m_applied_viscosity, MayaFlux::Nodes::Network::NodeNetwork::m_audio_buffer_lock, m_bandwidth, m_courant, m_field, m_handoff, m_intervals, and m_slot.

Referenced by reset(), set_bell(), set_length(), set_mouth(), set_mouth_volume(), set_profile(), set_profile(), set_wall_losses(), and use_viscothermal_losses().

Here is the caller graph for this function: