Skip to content

Commit

Permalink
log(1) == 0, not log(0)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jengamon committed Aug 23, 2024
1 parent 940e80c commit 16db836
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 52 deletions.
4 changes: 2 additions & 2 deletions src/engine/zone.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,10 @@ struct Zone : MoveableOnly<Zone>, HasGroupZoneProcessors<Zone>, SampleRateSuppor
int loopCountWhenCounted{0};

int64_t loopFade{0};
float normalizationFactor{0.f}; // db
float normalizationFactor{1.f}; // db
// per-sample pitch and amplitude
float pitchOffset{0.f}; // semitones
float amplitude{0.f}; // db
float amplitude{1.f}; // db

bool operator==(const AssociatedSample &other) const
{
Expand Down
105 changes: 55 additions & 50 deletions src/json/engine_traits.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,10 @@ SC_STREAMDEF(scxt::engine::Engine, SC_FROM({
to.getPatch()->setSampleRate(to.getSampleRate());
}))

SC_STREAMDEF(scxt::engine::Patch,
SC_FROM({ v = {{"parts", from.getParts()}, {"busses", from.busses}}; }), SC_TO({
SC_STREAMDEF(scxt::engine::Patch, SC_FROM({
v = {{"parts", from.getParts()}, {"busses", from.busses}};
}),
SC_TO({
auto &patch = to;
patch.resetToBlankPatch();

Expand Down Expand Up @@ -145,32 +147,31 @@ SC_STREAMDEF(
findOrSet(v, "s", false, to.solo);
}));

SC_STREAMDEF(scxt::engine::Part, SC_FROM({
// TODO: Do a non-empty part stream with the If variant
v = {{"config", from.configuration},
{"groups", from.getGroups()},
{"macros", from.macros}};
}),
SC_TO({
auto &part = to;
part.clearGroups();

if (SC_UNSTREAMING_FROM_PRIOR_TO(0x2024'08'18))
{
findIf(v, "channel", part.configuration.channel);
}
else
{
findIf(v, "config", part.configuration);
}
findIf(v, "macros", part.macros);
auto vzones = v.at("groups").get_array();
for (const auto vz : vzones)
{
auto idx = part.addGroup() - 1;
vz.to(*(part.getGroup(idx)));
}
}))
SC_STREAMDEF(
scxt::engine::Part, SC_FROM({
// TODO: Do a non-empty part stream with the If variant
v = {{"config", from.configuration}, {"groups", from.getGroups()}, {"macros", from.macros}};
}),
SC_TO({
auto &part = to;
part.clearGroups();

if (SC_UNSTREAMING_FROM_PRIOR_TO(0x2024'08'18))
{
findIf(v, "channel", part.configuration.channel);
}
else
{
findIf(v, "config", part.configuration);
}
findIf(v, "macros", part.macros);
auto vzones = v.at("groups").get_array();
for (const auto vz : vzones)
{
auto idx = part.addGroup() - 1;
vz.to(*(part.getGroup(idx)));
}
}))

SC_STREAMDEF(scxt::engine::Group::GroupOutputInfo, SC_FROM({
v = {{"amplitude", t.amplitude}, {"pan", t.pan},
Expand Down Expand Up @@ -317,7 +318,9 @@ SC_STREAMDEF(scxt::engine::Zone::AssociatedSample, SC_FROM({
{"loopDirection", s.loopDirection},
{"loopCountWhenCounted", s.loopCountWhenCounted},
{"loopFade", s.loopFade},
{"normalizationFactor", s.normalizationFactor}};
{"normalizationFactor", s.normalizationFactor},
{"pitchOffset", s.pitchOffset},
{"amplitude", s.amplitude}};
}
else
{
Expand All @@ -343,6 +346,9 @@ SC_STREAMDEF(scxt::engine::Zone::AssociatedSample, SC_FROM({
s.loopDirection);
findOrSet(v, "loopFade", 0, s.loopFade);
findOrSet(v, "loopCountWhenCounted", 0, s.loopCountWhenCounted);
findOrSet(v, "normalizationFactor", 1.f, s.normalizationFactor);
findOrSet(v, "pitchOffset", 0.f, s.pitchOffset);
findOrSet(v, "amplitude", 1.f, s.amplitude);
}
else
{
Expand Down Expand Up @@ -409,15 +415,15 @@ SC_STREAMDEF(engine::Engine::EngineStatusMessage, SC_FROM({
findIf(v, "runningEnvironment", to.runningEnvironment);
}));

SC_STREAMDEF(engine::Bus, SC_FROM({
v = {{"busSendStorage", t.busSendStorage},
{"busEffectStorage", t.busEffectStorage}};
}),
SC_TO({
findIf(v, "busSendStorage", to.busSendStorage);
findIf(v, "busEffectStorage", to.busEffectStorage);
to.resetSendState();
}));
SC_STREAMDEF(
engine::Bus, SC_FROM({
v = {{"busSendStorage", t.busSendStorage}, {"busEffectStorage", t.busEffectStorage}};
}),
SC_TO({
findIf(v, "busSendStorage", to.busSendStorage);
findIf(v, "busEffectStorage", to.busEffectStorage);
to.resetSendState();
}));

STREAM_ENUM_WITH_DEFAULT(engine::Bus::BusSendStorage::AuxLocation,
engine::Bus::BusSendStorage::AuxLocation::POST_VCA,
Expand Down Expand Up @@ -478,19 +484,18 @@ SC_STREAMDEF(engine::BusEffectStorage, SC_FROM({
}
}));

SC_STREAMDEF(engine::Patch::Busses, SC_FROM({
v = {{"mainBus", t.mainBus},
{"partBusses", t.partBusses},
{"auxBusses", t.auxBusses}};
}),
SC_TO({
findIf(v, "mainBus", to.mainBus);
findIf(v, "partBusses", to.partBusses);
findIf(v, "auxBusses", to.auxBusses);
SC_STREAMDEF(
engine::Patch::Busses, SC_FROM({
v = {{"mainBus", t.mainBus}, {"partBusses", t.partBusses}, {"auxBusses", t.auxBusses}};
}),
SC_TO({
findIf(v, "mainBus", to.mainBus);
findIf(v, "partBusses", to.partBusses);
findIf(v, "auxBusses", to.auxBusses);

to.reconfigureSolo();
to.reconfigureOutputBusses();
}));
to.reconfigureSolo();
to.reconfigureOutputBusses();
}));

} // namespace scxt::json
#endif // SHORTCIRCUIT_ENGINE_TRAITS_H

0 comments on commit 16db836

Please sign in to comment.