Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/domain/JsonSerialization.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

#include <algorithm>

#include "domain/ProjectProfile.h"

namespace automix::domain {

void to_json(Json& j, const Stem& value) {
Expand Down Expand Up @@ -293,7 +295,7 @@ void from_json(const Json& j, Session& value) {
value.buses = j.value("buses", std::vector<Bus>{});
value.projectProfileId = j.value("projectProfileId", "default");
value.safetyPolicyId = j.value("safetyPolicyId", "balanced");
value.preferredStemCount = std::clamp(j.value("preferredStemCount", 4), 2, 6);
value.preferredStemCount = std::clamp(j.value("preferredStemCount", 4), kMinPreferredStemCount, kMaxPreferredStemCount);

const auto timelineJson = j.value("timeline", Json::object());
value.timeline.loopEnabled = timelineJson.value("loopEnabled", false);
Expand Down
2 changes: 1 addition & 1 deletion src/domain/ProjectProfile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ ProjectProfile profileFromJson(const nlohmann::json& json) {
profile.mixModelPackId = json.value("mixModelPackId", "none");
profile.masterModelPackId = json.value("masterModelPackId", "none");
profile.safetyPolicyId = json.value("safetyPolicyId", "balanced");
profile.preferredStemCount = std::clamp(json.value("preferredStemCount", 4), 2, 6);
profile.preferredStemCount = std::clamp(json.value("preferredStemCount", 4), kMinPreferredStemCount, kMaxPreferredStemCount);
profile.metadataPolicy = json.value("metadataPolicy", "copy_common");
if (profile.metadataPolicy != "copy_all" &&
profile.metadataPolicy != "copy_common" &&
Expand Down
6 changes: 6 additions & 0 deletions src/domain/ProjectProfile.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@

namespace automix::domain {

// Stem count constraints for audio separation.
// Maximum of 6 stems is based on common separation models (vocals, drums, bass, guitar, keys, other)
// and practical UI/performance limits for real-time mixing workflows.
constexpr int kMinPreferredStemCount = 2;
constexpr int kMaxPreferredStemCount = 6;

struct ProjectProfile {
std::string id;
std::string name;
Expand Down
2 changes: 1 addition & 1 deletion tools/commands/DevToolsUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -693,7 +693,7 @@ std::optional<automix::domain::ProjectProfile> projectProfileFromJson(const nloh
profile.mixModelPackId = json.value("mixModelPackId", "none");
profile.masterModelPackId = json.value("masterModelPackId", "none");
profile.safetyPolicyId = json.value("safetyPolicyId", "balanced");
profile.preferredStemCount = std::clamp(json.value("preferredStemCount", 4), 2, 6);
profile.preferredStemCount = std::clamp(json.value("preferredStemCount", 4), kMinPreferredStemCount, kMaxPreferredStemCount);
profile.metadataPolicy = json.value("metadataPolicy", "copy_common");
if (profile.metadataPolicy != "copy_all" &&
profile.metadataPolicy != "copy_common" &&
Expand Down