Add American V8 preset, carb fuel transport, and adaptive desktop audio
This commit is contained in:
@@ -47,6 +47,7 @@ OutdoorAudio::OutdoorAudio(int rate, OutdoorAudioConfig config) : rate_(rate), c
|
||||
config_.listener_right.z / norm};
|
||||
configure_emitter(emitters_[0], config_.intake_position);
|
||||
configure_emitter(emitters_[1], config_.exhaust_position);
|
||||
if (config_.dual_exhaust) configure_emitter(emitters_[2], config_.second_exhaust_position);
|
||||
constexpr std::array<int, 4> lengths{1499, 2111, 2633, 3251};
|
||||
for (std::size_t i = 0; i < tail_.size(); ++i) {
|
||||
auto &line = tail_[i];
|
||||
@@ -148,8 +149,8 @@ AudioFrame OutdoorAudio::diffuse(float input) {
|
||||
}
|
||||
return {(values[0] + values[2]) * .35f, (values[1] + values[3]) * .35f};
|
||||
}
|
||||
AudioFrame OutdoorAudio::process(float intake, float exhaust) {
|
||||
if (!std::isfinite(intake) || !std::isfinite(exhaust))
|
||||
AudioFrame OutdoorAudio::process(float intake, float exhaust, float second_exhaust) {
|
||||
if (!std::isfinite(intake) || !std::isfinite(exhaust) || !std::isfinite(second_exhaust))
|
||||
throw std::runtime_error("nonfinite acoustic source flow");
|
||||
const bool wet = scene_ != OutdoorScene::Dry;
|
||||
const std::array<float, 4> target{1, wet ? 1.f : 0.f, scene_ == OutdoorScene::Wall ? 1.f : 0.f,
|
||||
@@ -165,7 +166,8 @@ AudioFrame OutdoorAudio::process(float intake, float exhaust) {
|
||||
last_raw_ = {};
|
||||
const auto a = render(emitters_[0], intake, last_dry_, last_raw_);
|
||||
const auto b = render(emitters_[1], exhaust, last_dry_, last_raw_);
|
||||
const auto c = config_.dual_exhaust ? render(emitters_[2], second_exhaust, last_dry_, last_raw_) : AudioFrame{};
|
||||
const auto tail = diffuse((last_dry_.left + last_dry_.right) * .5f);
|
||||
return {a.left + b.left + tail.left * tail_mix_, a.right + b.right + tail.right * tail_mix_};
|
||||
return {a.left + b.left + c.left + tail.left * tail_mix_, a.right + b.right + c.right + tail.right * tail_mix_};
|
||||
}
|
||||
} // namespace fluidsim::port
|
||||
|
||||
Reference in New Issue
Block a user