Created
December 11, 2017 15:22
-
-
Save raganmd/94df5caf44b7d948feb14b5369cb402a to your computer and use it in GitHub Desktop.
Code snippet from a blog post about preset building
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# me - this DAT | |
# | |
# channel - the Channel object which has changed | |
# sampleIndex - the index of the changed sample | |
# val - the numeric value of the changed sample | |
# prev - the previous sample value | |
# | |
# Make sure the corresponding toggle is enabled in the CHOP Execute DAT. | |
attr = op( 'constant_attr' ) | |
deck = op( 'null_deck' )[ 'trans' ] | |
deckA = op( 'moviefilein_a' ) | |
levelA = op( 'level_a' ) | |
deckB = op( 'moviefilein_b' ) | |
levelB = op( 'level_b' ) | |
cues = op( 'null_cues' ) | |
path = app.samplesFolder + '/Map/{file}' | |
def onOffToOn(channel, sampleIndex, val, prev): | |
return | |
def whileOn(channel, sampleIndex, val, prev): | |
return | |
def onOnToOff(channel, sampleIndex, val, prev): | |
return | |
def whileOff(channel, sampleIndex, val, prev): | |
return | |
def onValueChange(channel, sampleIndex, val, prev): | |
# we're in deckB, change A | |
if deck > 0.5: | |
deckA.par.file = path.format( file = cues[ int( val ), 'movie_file' ] ) | |
levelA.par.blacklevel = cues[ int( val ), 'blk_lvl' ] | |
levelA.par.invert = cues[ int( val ), 'invert' ] | |
attr.par.value0 = float( 1 / cues[ int( val ), 'trans_time' ] ) * - 1 | |
else: | |
deckB.par.file = path.format( file = cues[ int( val ), 'movie_file' ] ) | |
levelB.par.blacklevel = cues[ int( val ), 'blk_lvl' ] | |
levelB.par.invert = cues[ int( val ), 'invert' ] | |
attr.par.value0 = 1 / cues[ int( val ), 'trans_time' ] | |
return |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment