Improve physical geometry, fluid solvers, audio, and profiling
This commit is contained in:
@@ -17,7 +17,9 @@ struct OutdoorAudioConfig {
|
||||
Vec3 intake_position{-0.2f, 0.7f, 0.0f};
|
||||
Vec3 exhaust_position{0.55f, 0.5f, 0.0f};
|
||||
Vec3 second_exhaust_position{-0.55f, 0.5f, 0.0f};
|
||||
Vec3 valve_position{0.08f,0.42f,0.0f};
|
||||
bool dual_exhaust{};
|
||||
bool valve_contact_enabled{};
|
||||
float ear_spacing{0.18f}, sound_speed{343.0f};
|
||||
float ground_y{0.0f}, wall_x{-1.5f};
|
||||
float ground_reflection{0.35f}, wall_reflection{0.65f};
|
||||
@@ -29,10 +31,15 @@ struct OutdoorAudioConfig {
|
||||
// approximate diffuse tail. No feedback into the fluid/combustion simulation.
|
||||
class OutdoorAudio {
|
||||
public:
|
||||
static constexpr std::array<const char*,4> source_names{"intake", "exhaust", "exhaust-2", "valve-contact"};
|
||||
struct SourceFrames { AudioFrame rendered{}, dry{}, unfiltered{}; };
|
||||
const auto& source_frames() const { return sources_; }
|
||||
AudioFrame tail_frame() const { return last_tail_; }
|
||||
void set_source_enabled(std::size_t index,bool enabled) { enabled_.at(index)=enabled; }
|
||||
explicit OutdoorAudio(int sample_rate = 44100, OutdoorAudioConfig config = {});
|
||||
// Acoustic source inputs are ambient-density times mouth volume flow, kg/s.
|
||||
// Fluid transport still uses actual donor-density mass flux independently.
|
||||
AudioFrame process(float intake_mass_flow, float exhaust_mass_flow, float second_exhaust_mass_flow = 0);
|
||||
AudioFrame process(float intake_mass_flow, float exhaust_mass_flow, float second_exhaust_mass_flow = 0, float valve_contact_mass_flow = 0);
|
||||
void set_scene(OutdoorScene scene) { requested_scene_.store(scene, std::memory_order_relaxed); }
|
||||
OutdoorScene scene() const { return requested_scene_.load(std::memory_order_relaxed); }
|
||||
// Call on the simulation thread or under the scenario's simulation lock.
|
||||
@@ -66,12 +73,14 @@ private:
|
||||
std::atomic<OutdoorScene> requested_scene_{OutdoorScene::Wall};
|
||||
OutdoorScene active_scene_{OutdoorScene::Wall};
|
||||
bool monitor_filter_{true};
|
||||
std::array<Emitter, 3> emitters_;
|
||||
std::array<Emitter, 4> emitters_;
|
||||
OutdoorExhaustReverb late_reverb_;
|
||||
std::array<float, 5> weights_{1, 0, 0, 0, 0};
|
||||
float scene_alpha_{}, tail_mix_{};
|
||||
float geometry_alpha_{}, reverb_input_{};
|
||||
AudioFrame last_dry_{}, last_raw_{};
|
||||
AudioFrame last_dry_{}, last_raw_{}, last_tail_{};
|
||||
std::array<SourceFrames,4> sources_{};
|
||||
std::array<bool,4> enabled_{true,true,true,true};
|
||||
void configure_emitter(Emitter &emitter, Vec3 position);
|
||||
void update_geometry();
|
||||
AudioFrame render(Emitter &emitter, float flow, AudioFrame &dry, AudioFrame &raw);
|
||||
|
||||
Reference in New Issue
Block a user