I've been getting some success resetting stem parameters on a deck when loading a song. My code works for deck 1 and 2, but I can't get it to work for deck 3 and 4.
I tweaked the resetFocusedStemDeckVolumeAndFilter function using the structure shown below:
function resetFocusedStemDeckVolumeAndFilter(deckId)
{
var defaultVolume = 1.0;
if (deckId == topDeckId)
{
// Set all volumes to maximum
topStemVolume1.value = defaultVolume;
topStemVolume2.value = defaultVolume;
topStemVolume3.value = defaultVolume;
topStemVolume4.value = defaultVolume;
}
else
{
// Set all volumes to maximum
bottomStemVolume1.value = defaultVolume;
bottomStemVolume2.value = defaultVolume;
bottomStemVolume3.value = defaultVolume;
bottomStemVolume4.value = defaultVolume;
}
}
I haven't been able to make this work for deck3 and 4, and I think that's because of the topDeckId/bottomDeckId.
I'm working on a dynamic code using declarations as follow:
AppProperty { id: topStemVolume1; path: "app.traktor.decks.1.stems.1.volume" }
AppProperty { id: topStemVolume2; path: "app.traktor.decks.1.stems.2.volume" }
AppProperty { id: topStemVolume3; path: "app.traktor.decks.1.stems.3.volume" }
AppProperty { id: topStemVolume4; path: "app.traktor.decks.1.stems.4.volume" }
AppProperty { id: bottomStemVolume1; path: "app.traktor.decks.2.stems.1.volume" }
AppProperty { id: bottomStemVolume2; path: "app.traktor.decks.2.stems.2.volume" }
AppProperty { id: bottomStemVolume3; path: "app.traktor.decks.2.stems.3.volume" }
AppProperty { id: bottomStemVolume4; path: "app.traktor.decks.2.stems.4.volume" }
function updatePropertyPaths() {
topStemVolume1.path = `app.traktor.decks.${topDeck}.stems.1.volume`;
topStemVolume2.path = `app.traktor.decks.${topDeck}.stems.2.volume`;
topStemVolume3.path = `app.traktor.decks.${topDeck}.stems.3.volume`;
topStemVolume4.path = `app.traktor.decks.${topDeck}.stems.4.volume`;
bottomStemVolume1.path = `app.traktor.decks.${bottomDeck}.stems.1.volume`;
bottomStemVolume2.path = `app.traktor.decks.${bottomDeck}.stems.2.volume`;
bottomStemVolume3.path = `app.traktor.decks.${bottomDeck}.stems.3.volume`;
bottomStemVolume4.path = `app.traktor.decks.${bottomDeck}.stems.4.volume`;
// Update Track Type paths
topDeckTrackType.path = `app.traktor.decks.${topDeck}.track.content.stem_available`;
bottomDeckTrackType.path = `app.traktor.decks.${bottomDeck}.track.content.stem_available`;
}
function resetFocusedStemDeckVolumeAndFilter(deckId)
{
var defaultVolume = 1.0;
// Determine if we're working with top or bottom deck
var isTopDeck = (deckId === getTopDeckId(decksAssignment));
// Select the appropriate properties based on top/bottom deck
var stemVolume = isTopDeck ?
[topStemVolume1, topStemVolume2, topStemVolume3, topStemVolume4] :
[bottomStemVolume1, bottomStemVolume2, bottomStemVolume3, bottomStemVolume4];
// Reset volume on all channels
for (var i = 0; i < 4; i++)
{
// Set volumes to maximum
stemVolume[i].value = defaultVolume;
}
}
enum DecksAssignment {
AC,
BD
}
// Add this to trigger reset when a new track is loaded
AppProperty
{
id: deckLoadedProperty; path: "app.traktor.decks." + deckId + ".is_loaded"
}
onDeckLoadedPropertyChanged:
{
if (deckLoadedProperty.value) {
resetFocusedStemDeckVolumeAndFilter(deckId);
}
}
Does it look like a promising direction? Or should I look elsewhere?
Thanks a lot for your help!