Skip to content

Commit

Permalink
Merge pull request #20 from thresholdpeople/master
Browse files Browse the repository at this point in the history
CleanEvent.sc: fixed event legato behavior
  • Loading branch information
danielmkarlsson authored Oct 9, 2021
2 parents 0cf4b98 + 2db6b6f commit e9b43c4
Showing 1 changed file with 46 additions and 1 deletion.
47 changes: 46 additions & 1 deletion classes/CleanEvent.sc
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,52 @@ CleanEvent {
if(~diversion.isNil) { ~notFound.value }
} {
// the stored sound event becomes the environment's proto slot, which partly can override its parent
currentEnvironment.proto = soundEvent
currentEnvironment.proto = soundEvent;


// legato/sustain/release overlap fix:

// synth's envelope release time cut along with event if legato < 1
~legato = if(~legato ?? { 1 } >= 1) {
~legato ?? { 1 } + (~dur ?? { 1 } * (~rel ?? {
if(~clean.soundLibrary.synthEvents[~snd].notNil) {
if(SynthDescLib.global.at(~clean.soundLibrary.synthEvents[~snd][0].[\instrument]).controlDict[\release].notNil) {
SynthDescLib.global.at(~clean.soundLibrary.synthEvents[~snd][0].[\instrument]).controlDict[\release].defaultValue
} {
if(SynthDescLib.global.at(~clean.soundLibrary.synthEvents[~snd][0].[\instrument]).controlDict[\rel].notNil) {
SynthDescLib.global.at(~clean.soundLibrary.synthEvents[~snd][0].[\instrument]).controlDict[\rel].defaultValue
} { 1 } }
} { if(SynthDescLib.global.at(~snd).notNil) {
if(SynthDescLib.global.at(~snd).controlDict[\release].notNil) {
SynthDescLib.global.at(~snd).controlDict[\release].defaultValue
} {
if(SynthDescLib.global.at(~snd).controlDict[\rel].notNil) {
SynthDescLib.global.at(~snd).controlDict[\rel].defaultValue
} { 1 } }
} { 1 } } }))
} {
~legato
}

// synth's envelope release time persists (still happens) even if legato < 1
/*
~legato = ~legato ?? { 1 } + (~dur ?? { 1 } * (~rel ?? {
if(~clean.soundLibrary.synthEvents[~snd].notNil) {
if(SynthDescLib.global.at(~clean.soundLibrary.synthEvents[~snd][0].[\instrument]).controlDict[\release].notNil) {
SynthDescLib.global.at(~clean.soundLibrary.synthEvents[~snd][0].[\instrument]).controlDict[\release].defaultValue
} {
if(SynthDescLib.global.at(~clean.soundLibrary.synthEvents[~snd][0].[\instrument]).controlDict[\rel].notNil) {
SynthDescLib.global.at(~clean.soundLibrary.synthEvents[~snd][0].[\instrument]).controlDict[\rel].defaultValue
} { 1 } }
} { if(SynthDescLib.global.at(~snd).notNil) {
if(SynthDescLib.global.at(~snd).controlDict[\release].notNil) {
SynthDescLib.global.at(~snd).controlDict[\release].defaultValue
} {
if(SynthDescLib.global.at(~snd).controlDict[\rel].notNil) {
SynthDescLib.global.at(~snd).controlDict[\rel].defaultValue
} { 1 } }
} { 1 } } }))
*/
}
}

Expand Down

0 comments on commit e9b43c4

Please sign in to comment.