Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jatinchowdhury18 committed Dec 2, 2024
1 parent 4a4b5f5 commit fc0c577
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions examples/StatefulPlugin/PluginEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ PluginEditor::PluginEditor (StatefulPlugin& plug) : juce::AudioProcessorEditor (
const auto setSizeFromState = [this]
{
const auto& stateSize = plugin.getState().nonParams.editorBounds.get();
setSize (stateSize.x, stateSize.y);
setSize (stateSize.first, stateSize.second);
};
setSizeFromState();

Expand Down Expand Up @@ -65,5 +65,5 @@ void PluginEditor::resized()
undoButton.setBounds (bounds.removeFromLeft (80));
redoButton.setBounds (bounds.removeFromLeft (80));

plugin.getState().nonParams.editorBounds = getLocalBounds().getBottomRight();
plugin.getState().nonParams.editorBounds = std::make_pair (getLocalBounds().getRight(), getLocalBounds().getBottom());
}
2 changes: 1 addition & 1 deletion examples/StatefulPlugin/StatefulPlugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ struct PluginNonParameterState : chowdsp::NonParamState
addStateValues ({ &editorBounds });
}

chowdsp::StateValue<juce::Point<int>> editorBounds { "editor_bounds", { 300, 500 } };
chowdsp::StateValue<std::pair<int, int>> editorBounds { "editor_bounds", { 300, 500 } };
};

using State = chowdsp::PluginStateImpl<PluginParameterState, PluginNonParameterState>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ void NonParamState::deserialize (nonstd::span<const std::byte> serial_data, NonP
return nullptr;
};

Check warning on line 86 in modules/plugin/chowdsp_plugin_state/Backend/chowdsp_NonParamState.cpp

View check run for this annotation

Codecov / codecov/patch

modules/plugin/chowdsp_plugin_state/Backend/chowdsp_NonParamState.cpp#L85-L86

Added lines #L85 - L86 were not covered by tests

while (data.size() > 0)
while (! data.empty())
{
const auto value_name = deserialize_string (data);
auto* value = get_value_ptr (value_name);

Check warning on line 91 in modules/plugin/chowdsp_plugin_state/Backend/chowdsp_NonParamState.cpp

View check run for this annotation

Codecov / codecov/patch

modules/plugin/chowdsp_plugin_state/Backend/chowdsp_NonParamState.cpp#L90-L91

Added lines #L90 - L91 were not covered by tests
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ inline void ParamHolder::getParameterPointers (ParamHolder& holder, ParamDeseria
break;

Check warning on line 280 in modules/plugin/chowdsp_plugin_state/Backend/chowdsp_ParamHolder.cpp

View check run for this annotation

Codecov / codecov/patch

modules/plugin/chowdsp_plugin_state/Backend/chowdsp_ParamHolder.cpp#L270-L280

Added lines #L270 - L280 were not covered by tests
}

parameters.insert (ParamDeserial { .id = paramID, .ptr = thing, .found = false });
parameters.insert (ParamDeserial { paramID, thing, false });

Check warning on line 283 in modules/plugin/chowdsp_plugin_state/Backend/chowdsp_ParamHolder.cpp

View check run for this annotation

Codecov / codecov/patch

modules/plugin/chowdsp_plugin_state/Backend/chowdsp_ParamHolder.cpp#L283

Added line #L283 was not covered by tests
}
}

Check warning on line 285 in modules/plugin/chowdsp_plugin_state/Backend/chowdsp_ParamHolder.cpp

View check run for this annotation

Codecov / codecov/patch

modules/plugin/chowdsp_plugin_state/Backend/chowdsp_ParamHolder.cpp#L285

Added line #L285 was not covered by tests

Expand Down Expand Up @@ -345,7 +345,7 @@ inline void ParamHolder::deserialize (nonstd::span<const std::byte>& serial_data
return {};
};

Check warning on line 346 in modules/plugin/chowdsp_plugin_state/Backend/chowdsp_ParamHolder.cpp

View check run for this annotation

Codecov / codecov/patch

modules/plugin/chowdsp_plugin_state/Backend/chowdsp_ParamHolder.cpp#L345-L346

Added lines #L345 - L346 were not covered by tests

while (data.size() > 0)
while (! data.empty())
{
const auto param_id = deserialize_string (data);
auto param_ptr = get_param_ptr (param_id);

Check warning on line 351 in modules/plugin/chowdsp_plugin_state/Backend/chowdsp_ParamHolder.cpp

View check run for this annotation

Codecov / codecov/patch

modules/plugin/chowdsp_plugin_state/Backend/chowdsp_ParamHolder.cpp#L350-L351

Added lines #L350 - L351 were not covered by tests
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ TEST_CASE ("Preset Manager Test", "[plugin][presets][state]")
}

ScopedPresetManager presetMgr {};
presetMgr.state.deserialize (state);
presetMgr.state.deserialize (std::move (state));
REQUIRE_MESSAGE (juce::approximatelyEqual (presetMgr.getFloatParam(), otherValue), "Preset state is overriding parameter state!");
REQUIRE (presetMgr->getCurrentPreset() == nullptr);
REQUIRE (presetMgr->getIsPresetDirty());
Expand All @@ -261,7 +261,7 @@ TEST_CASE ("Preset Manager Test", "[plugin][presets][state]")
}

ScopedPresetManager presetMgr {};
presetMgr.state.deserialize (state);
presetMgr.state.deserialize (std::move (state));
REQUIRE_MESSAGE (juce::approximatelyEqual (presetMgr.getFloatParam(), otherValue), "Preset state is overriding parameter state!");
REQUIRE (*presetMgr->getCurrentPreset() == preset);
REQUIRE (presetMgr->getIsPresetDirty());
Expand Down

0 comments on commit fc0c577

Please sign in to comment.