diff --git a/.clang-format b/.clang-format index 2ea6d77..eb758b1 100644 --- a/.clang-format +++ b/.clang-format @@ -2,7 +2,7 @@ BasedOnStyle: WebKit AccessModifierOffset: -4 AlignAfterOpenBracket: BlockIndent -AlignArrayOfStructures: Left +AlignArrayOfStructures: Right AlignConsecutiveAssignments: Consecutive AlignConsecutiveBitFields: Consecutive AlignConsecutiveDeclarations: None @@ -12,13 +12,13 @@ AlignOperands: AlignAfterOperator AlignTrailingComments: true AllowAllArgumentsOnNextLine: false AllowAllParametersOfDeclarationOnNextLine: false -AllowShortBlocksOnASingleLine: Empty +AllowShortBlocksOnASingleLine: Always AllowShortCaseLabelsOnASingleLine: true AllowShortEnumsOnASingleLine: false AllowShortFunctionsOnASingleLine: All -AllowShortIfStatementsOnASingleLine: Never +AllowShortIfStatementsOnASingleLine: false AllowShortLambdasOnASingleLine: All -AllowShortLoopsOnASingleLine: true +AllowShortLoopsOnASingleLine: false AlwaysBreakAfterReturnType: None AlwaysBreakBeforeMultilineStrings: false AlwaysBreakTemplateDeclarations: Yes @@ -51,12 +51,12 @@ BreakInheritanceList: BeforeComma BreakStringLiterals: true ColumnLimit: 120 CompactNamespaces: false +ConstructorInitializerAllOnOneLineOrOnePerLine: true Cpp11BracedListStyle: true DisableFormat: false FixNamespaceComments: true IndentCaseLabels: true IndentPPDirectives: BeforeHash -IndentRequiresClause: true IndentWidth: 4 IndentWrappedFunctionNames: false KeepEmptyLinesAtTheStartOfBlocks: true @@ -69,7 +69,7 @@ PointerAlignment: Left ReferenceAlignment: Left ReflowComments: true SeparateDefinitionBlocks: Always -SortIncludes: CaseInsensitive +SortIncludes: true SortUsingDeclarations: true SpaceAfterCStyleCast: false SpaceAfterLogicalNot: false diff --git a/src/ra/acoustics/stochastic_raytracing.cpp b/src/ra/acoustics/stochastic_raytracing.cpp index a5e75fb..04c76fe 100644 --- a/src/ra/acoustics/stochastic_raytracing.cpp +++ b/src/ra/acoustics/stochastic_raytracing.cpp @@ -214,12 +214,12 @@ auto StochasticRaytracing::randomRaysOnSphere(size_t count, std::mt19937& rng) - auto StochasticRaytracing::getWallNormal(std::ptrdiff_t index) -> glm::dvec3 { static constexpr auto surfaces = std::array{ - glm::dvec3{1.0, 0.0, 0.0 }, - glm::dvec3{-1.0, 0.0, 0.0 }, - glm::dvec3{0.0, 1.0, 0.0 }, - glm::dvec3{0.0, -1.0, 0.0 }, - glm::dvec3{0.0, 0.0, 1.0 }, - glm::dvec3{0.0, 0.0, -1.0}, + glm::dvec3{ 1.0, 0.0, 0.0}, + glm::dvec3{-1.0, 0.0, 0.0}, + glm::dvec3{ 0.0, 1.0, 0.0}, + glm::dvec3{ 0.0, -1.0, 0.0}, + glm::dvec3{ 0.0, 0.0, 1.0}, + glm::dvec3{ 0.0, 0.0, -1.0}, }; assert(index >= 0); diff --git a/src/ra/raum_akustik/tabs/absorber_simulation_tab.cpp b/src/ra/raum_akustik/tabs/absorber_simulation_tab.cpp index cecc431..1f3b148 100644 --- a/src/ra/raum_akustik/tabs/absorber_simulation_tab.cpp +++ b/src/ra/raum_akustik/tabs/absorber_simulation_tab.cpp @@ -28,8 +28,8 @@ PorousAbsorberSimulationEditor::PorousAbsorberSimulationEditor(juce::ValueTree v _absorberSpecs.addSection( "Atmospheric Environment", juce::Array{ - new juce::SliderPropertyComponent{_temperature.getPropertyAsValue(), "Temperature (C)", 0.0, 100.0, 1.0 }, - new juce::SliderPropertyComponent{_pressure.getPropertyAsValue(), "Pressure (Bar)", 0.0, 2.0, 0.01}, + new juce::SliderPropertyComponent{_temperature.getPropertyAsValue(), "Temperature (C)", 0.0, 100.0, 1.0}, + new juce::SliderPropertyComponent{ _pressure.getPropertyAsValue(), "Pressure (Bar)", 0.0, 2.0, 0.01}, } ); @@ -38,37 +38,32 @@ PorousAbsorberSimulationEditor::PorousAbsorberSimulationEditor(juce::ValueTree v juce::Array{ new juce::SliderPropertyComponent{ _absorberThickness.getPropertyAsValue(), - "Thickness (mm)", 0.0, - 1000.0, 1.0 - }, + "Thickness (mm)", 0.0, + 1000.0, 1.0 }, new juce::SliderPropertyComponent{ _absorberFlowResisitivity.getPropertyAsValue(), - "Flow Resisitivity", 0.0, - 40'000.0, 1.0 - }, + "Flow Resisitivity", 0.0, + 40'000.0, 1.0 }, new juce::SliderPropertyComponent{ _absorberAngleOfIncidence.getPropertyAsValue(), - "Angle Of Incidence", 0.0, - 90.0, 1.0 - }, - new juce::SliderPropertyComponent{_absorberAirGap.getPropertyAsValue(), "Air Gap (mm)", 0.0, 1000.0, 1.0}, + "Angle Of Incidence", 0.0, + 90.0, 1.0 }, + new juce::SliderPropertyComponent{ _absorberAirGap.getPropertyAsValue(), "Air Gap (mm)", 0.0, 1000.0, 1.0}, } ); _absorberSpecs.addSection( "Plot", juce::Array{ - new juce::SliderPropertyComponent{_plotNumPoints.getPropertyAsValue(), "Num Points", 0.0, 256.0, 1.0}, + new juce::SliderPropertyComponent{_plotNumPoints.getPropertyAsValue(),"Num Points", 0.0,256.0, 1.0 }, new juce::SliderPropertyComponent{ _plotStartFrequency.getPropertyAsValue(), - "Start Frequency", 0.0, - 60.0, 1.0 - }, + "Start Frequency", 0.0, + 60.0, 1.0}, new juce::SliderPropertyComponent{ _plotOctaveSubdivision.getPropertyAsValue(), - "Octave Subdivisions", 0.0, - 12.0, 1.0 - }, + "Octave Subdivisions", 0.0, + 12.0, 1.0}, } ); diff --git a/src/ra/raum_akustik/tabs/room_editor.cpp b/src/ra/raum_akustik/tabs/room_editor.cpp index 704f398..3ba3841 100644 --- a/src/ra/raum_akustik/tabs/room_editor.cpp +++ b/src/ra/raum_akustik/tabs/room_editor.cpp @@ -5,24 +5,24 @@ namespace ra { static constexpr auto Materials = std::array>, 18>{ - std::pair{"Painted concrete", std::array{0.01, 0.01, 0.01, 0.05, 0.06, 0.07, 0.09, 0.08, 0.08, 0.08} }, - std::pair{"Coarse concrete", std::array{0.36, 0.36, 0.36, 0.44, 0.31, 0.29, 0.39, 0.25, 0.25, 0.25} }, - std::pair{"Wood floor", std::array{0.15, 0.15, 0.15, 0.11, 0.1, 0.07, 0.06, 0.07, 0.07, 0.07} }, - std::pair{"Vinyl flooring", std::array{0.03, 0.03, 0.03, 0.04, 0.05, 0.04, 0.05, 0.05, 0.05, 0.05} }, - std::pair{"Window glass", std::array{0.35, 0.35, 0.35, 0.25, 0.18, 0.12, 0.07, 0.04, 0.04, 0.04} }, - std::pair{"Plate glass", std::array{0.18, 0.18, 0.18, 0.06, 0.04, 0.03, 0.02, 0.02, 0.02, 0.02} }, - std::pair{"6mm glass", std::array{0.1, 0.1, 0.1, 0.06, 0.04, 0.03, 0.02, 0.02, 0.02, 0.02} }, - std::pair{"Brickwork", std::array{0.05, 0.05, 0.05, 0.04, 0.02, 0.04, 0.05, 0.05, 0.05, 0.05} }, - std::pair{"Drapes 1/2 area. 15oz/sq yd", std::array{0.07, 0.07, 0.07, 0.37, 0.49, 0.81, 0.65, 0.54, 0.54, 0.54} }, - std::pair{"Foam backed carpet on concrete", std::array{0.05, 0.05, 0.05, 0.16, 0.44, 0.7, 0.6, 0.4, 0.4, 0.4} }, - std::pair{"Carpet + foam underlay on concrete", std::array{0.15, 0.15, 0.15, 0.25, 0.5, 0.6, 0.7, 0.8, 0.8, 0.8} }, - std::pair{"Plaster on brick", std::array{0.013, 0.013, 0.013, 0.015, 0.02, 0.03, 0.04, 0.05, 0.05, 0.05}}, - std::pair{"9mm Plasterboard over 20mm air gap", std::array{0.3, 0.3, 0.3, 0.2, 0.15, 0.05, 0.05, 0.05, 0.05, 0.05} }, - std::pair{"Breeze block", std::array{0.25, 0.25, 0.25, 0.4, 0.6, 0.5, 0.75, 0.5, 0.5, 0.5} }, - std::pair{"50mm Acoustic Foam", std::array{0.08, 0.08, 0.08, 0.25, 0.6, 0.9, 0.95, 0.9, 0.9, 0.9} }, - std::pair{"100mm Acoustic Foam", std::array{0.2, 0.2, 0.2, 0.7, 0.99, 0.99, 0.99, 0.99, 0.99, 0.99} }, - std::pair{"50mm Mineral Wool (Med Density)", std::array{0.2, 0.2, 0.2, 0.45, 0.7, 0.8, 0.8, 0.8, 0.8, 0.8} }, - std::pair{"LF panel absorber", std::array{0.28, 0.28, 0.28, 0.22, 0.17, 0.09, 0.1, 0.11, 0.11, 0.11} }, + std::pair{ "Painted concrete", std::array{0.01, 0.01, 0.01, 0.05, 0.06, 0.07, 0.09, 0.08, 0.08, 0.08}}, + std::pair{ "Coarse concrete", std::array{0.36, 0.36, 0.36, 0.44, 0.31, 0.29, 0.39, 0.25, 0.25, 0.25}}, + std::pair{ "Wood floor", std::array{0.15, 0.15, 0.15, 0.11, 0.1, 0.07, 0.06, 0.07, 0.07, 0.07}}, + std::pair{ "Vinyl flooring", std::array{0.03, 0.03, 0.03, 0.04, 0.05, 0.04, 0.05, 0.05, 0.05, 0.05}}, + std::pair{ "Window glass", std::array{0.35, 0.35, 0.35, 0.25, 0.18, 0.12, 0.07, 0.04, 0.04, 0.04}}, + std::pair{ "Plate glass", std::array{0.18, 0.18, 0.18, 0.06, 0.04, 0.03, 0.02, 0.02, 0.02, 0.02}}, + std::pair{ "6mm glass", std::array{0.1, 0.1, 0.1, 0.06, 0.04, 0.03, 0.02, 0.02, 0.02, 0.02}}, + std::pair{ "Brickwork", std::array{0.05, 0.05, 0.05, 0.04, 0.02, 0.04, 0.05, 0.05, 0.05, 0.05}}, + std::pair{ "Drapes 1/2 area. 15oz/sq yd", std::array{0.07, 0.07, 0.07, 0.37, 0.49, 0.81, 0.65, 0.54, 0.54, 0.54}}, + std::pair{ "Foam backed carpet on concrete", std::array{0.05, 0.05, 0.05, 0.16, 0.44, 0.7, 0.6, 0.4, 0.4, 0.4}}, + std::pair{"Carpet + foam underlay on concrete", std::array{0.15, 0.15, 0.15, 0.25, 0.5, 0.6, 0.7, 0.8, 0.8, 0.8}}, + std::pair{ "Plaster on brick", std::array{0.013, 0.013, 0.013, 0.015, 0.02, 0.03, 0.04, 0.05, 0.05, 0.05}}, + std::pair{"9mm Plasterboard over 20mm air gap", std::array{0.3, 0.3, 0.3, 0.2, 0.15, 0.05, 0.05, 0.05, 0.05, 0.05}}, + std::pair{ "Breeze block", std::array{0.25, 0.25, 0.25, 0.4, 0.6, 0.5, 0.75, 0.5, 0.5, 0.5}}, + std::pair{ "50mm Acoustic Foam", std::array{0.08, 0.08, 0.08, 0.25, 0.6, 0.9, 0.95, 0.9, 0.9, 0.9}}, + std::pair{ "100mm Acoustic Foam", std::array{0.2, 0.2, 0.2, 0.7, 0.99, 0.99, 0.99, 0.99, 0.99, 0.99}}, + std::pair{ "50mm Mineral Wool (Med Density)", std::array{0.2, 0.2, 0.2, 0.45, 0.7, 0.8, 0.8, 0.8, 0.8, 0.8}}, + std::pair{ "LF panel absorber", std::array{0.28, 0.28, 0.28, 0.22, 0.17, 0.09, 0.1, 0.11, 0.11, 0.11}}, }; RoomEditor::RoomEditor(juce::ValueTree vt, juce::UndoManager* um) @@ -43,9 +43,18 @@ auto RoomEditor::getRoomLayout() const -> RoomLayout { return { RoomDimensions{_roomLength, _roomWidth, _roomHeight}, - glm::dvec3(double{_leftX}, double{_leftY}, double{_leftZ} ), - glm::dvec3(double{_rightX}, double{_rightY}, double{_rightZ} ), - glm::dvec3(double{_listenX}, double{_listenY}, double{_listenZ} ), + glm::dvec3(double{_leftX}, + double{_leftY}, + double{_leftZ} + ), + glm::dvec3(double{_rightX}, + double{_rightY}, + double{_rightZ} + ), + glm::dvec3(double{_listenX}, + double{_listenY}, + double{_listenZ} + ), }; } @@ -170,7 +179,7 @@ auto RoomEditor::buildProperties() -> void "Room Dimensions", juce::Array{ new juce::SliderPropertyComponent{_roomLength.getPropertyAsValue(), "Length", 0.0, 10.0, 0.01}, - new juce::SliderPropertyComponent{_roomWidth.getPropertyAsValue(), "Width", 0.0, 10.0, 0.01}, + new juce::SliderPropertyComponent{ _roomWidth.getPropertyAsValue(), "Width", 0.0, 10.0, 0.01}, new juce::SliderPropertyComponent{_roomHeight.getPropertyAsValue(), "Height", 0.0, 10.0, 0.01}, } ); @@ -207,7 +216,7 @@ auto RoomEditor::buildProperties() -> void _renderProperties.addSection( "First Reflections", juce::Array{ - new juce::BooleanPropertyComponent{_renderLeftReflections.getPropertyAsValue(), "Left", "Draw"}, + new juce::BooleanPropertyComponent{ _renderLeftReflections.getPropertyAsValue(), "Left", "Draw"}, new juce::BooleanPropertyComponent{_renderRightReflections.getPropertyAsValue(), "Right", "Draw"}, } ); diff --git a/src/ra/raum_akustik/tabs/stochastic_raytracing_tab.cpp b/src/ra/raum_akustik/tabs/stochastic_raytracing_tab.cpp index 5c85b11..2c2329b 100644 --- a/src/ra/raum_akustik/tabs/stochastic_raytracing_tab.cpp +++ b/src/ra/raum_akustik/tabs/stochastic_raytracing_tab.cpp @@ -82,12 +82,12 @@ auto StochasticRaytracingEditor::run() -> void .floor = woodFloor, }; auto const scattering = RoomScattering{ - .front = {0.05, 0.05, 0.05, 0.3, 0.4, 0.5, 0.55, 0.6, 0.6, 0.6}, - .back = {0.05, 0.05, 0.05, 0.3, 0.4, 0.5, 0.55, 0.6, 0.6, 0.6}, - .left = {0.05, 0.05, 0.05, 0.3, 0.4, 0.5, 0.55, 0.6, 0.6, 0.6}, - .right = {0.05, 0.05, 0.05, 0.3, 0.4, 0.5, 0.55, 0.6, 0.6, 0.6}, - .ceiling = {0.05, 0.05, 0.05, 0.3, 0.4, 0.5, 0.55, 0.6, 0.6, 0.6}, - .floor = {0.01, 0.01, 0.01, 0.05, 0.1, 0.2, 0.3, 0.5, 0.5, 0.5}, + .front = {0.05, 0.05, 0.05, 0.3, 0.4, 0.5, 0.55, 0.6, 0.6, 0.6}, + .back = {0.05, 0.05, 0.05, 0.3, 0.4, 0.5, 0.55, 0.6, 0.6, 0.6}, + .left = {0.05, 0.05, 0.05, 0.3, 0.4, 0.5, 0.55, 0.6, 0.6, 0.6}, + .right = {0.05, 0.05, 0.05, 0.3, 0.4, 0.5, 0.55, 0.6, 0.6, 0.6}, + .ceiling = {0.05, 0.05, 0.05, 0.3, 0.4, 0.5, 0.55, 0.6, 0.6, 0.6}, + .floor = {0.01, 0.01, 0.01, 0.05, 0.1, 0.2, 0.3, 0.5, 0.5, 0.5}, }; auto const room = StochasticRaytracing::Room{