Skip to content

Commit

Permalink
feat(DmSynth): transfer key_group -> exclusiveClass generator
Browse files Browse the repository at this point in the history
  • Loading branch information
lmichaelis committed May 12, 2024
1 parent 0414311 commit 8382e83
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
6 changes: 5 additions & 1 deletion src/Performance.c
Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,11 @@ static void DmPerformance_handleSegmentMessage(DmPerformance* slf, DmMessage_Seg
// The message starts at the indicated message's time but aligned at zero based on the start offset.
uint32_t mt = slf->time + m->time - start;

DmMessageQueue_add(&slf->control_queue, m, mt, DmQueueConflict_REPLACE);
if (m->type != DmMessage_NOTE) {
DmMessageQueue_add(&slf->control_queue, m, mt, DmQueueConflict_REPLACE);
} else {
DmMessageQueue_add(&slf->control_queue, m, mt, DmQueueConflict_APPEND);
}
}

// If we don't yet have a command, add it!
Expand Down
11 changes: 8 additions & 3 deletions src/util/Tsf.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ enum {
kInitialAttenuation = 48,
kSampleID = 53,
kSampleModes = 54,
kExclusiveClass = 57,

kSamplePadding = 46,
};
Expand Down Expand Up @@ -230,9 +231,9 @@ static DmResult Dm_createHydraSkeleton(DmDls* dls, struct tsf_hydra* res) {
// -> We need one sample for each instrument region
res->shdrNum += ins->region_count;

// -> We need 6 generators for the implicit 'kKeyRange', 'kVelRange', 'kAttackVolEnv',
// 'kInitialAttenuation', 'kSampleModes' and 'kSampleID' for each zone
res->igenNum += ins->region_count * 6;
// -> We need 7 generators for the implicit 'kKeyRange', 'kVelRange', 'kAttackVolEnv',
// 'kInitialAttenuation', 'kSampleModes', 'kSampleID', 'kExclusiveClass' for each zone
res->igenNum += ins->region_count * 7;

// -> We need one generator for each instrument-level articulator connection
for (size_t a = 0; a < ins->articulator_count; ++a) {
Expand Down Expand Up @@ -362,6 +363,10 @@ static DmResult Dm_createHydra(DmDls* dls, struct tsf_hydra* hydra, float** pcm,
hydra->igens[igen_ndx].genAmount.wordAmount = shdr_ndx;
igen_ndx++;

hydra->igens[igen_ndx].genOper = kExclusiveClass;
hydra->igens[igen_ndx].genAmount.wordAmount = reg->key_group;
igen_ndx++;

// Additional sample configuration.
struct tsf_hydra_shdr* hdr = &hydra->shdrs[shdr_ndx];
*hdr = default_shdrs[reg->link_table_index];
Expand Down

0 comments on commit 8382e83

Please sign in to comment.