RPR GetTrackAutomationMode
From CockosWiki
(→Python) |
(→Python) |
||
Line 23: | Line 23: | ||
# | # | ||
# Cycles automation mode of selected tracks between those three modes. | # Cycles automation mode of selected tracks between those three modes. | ||
- | # Multiple selected tracks will be set to | + | # Multiple selected tracks will also be cycld -- as long as they are |
+ | # already set to the same mode. They won't be altered if they're set | ||
+ | # to different automation modes. | ||
# | # | ||
# Kindly written by Schwa (thanks again) | # Kindly written by Schwa (thanks again) | ||
# | # | ||
# comments by gofer. Which means, comments are from a complete | # comments by gofer. Which means, comments are from a complete | ||
- | # scripting noob, made as I went along trying to understand what the heck | + | # scripting noob (not really - MikeLacey), made as I went along |
- | + | # trying to understand what the heck goes on in these lines. | |
- | + | # Hope this helps others that are about to try and get a grip of | |
+ | # how logic shows up and works in Python scripts. | ||
# | # | ||
# Use at your own risk | # Use at your own risk | ||
# Initializing variables | # Initializing variables | ||
- | MIXED_MODE=-1 # | + | MIXED_MODE=-1 # This seems to be a do-nothing value, calling SetTrackAutomationMode with -1 does nothing. |
- | TRIMREAD_MODE=0 # | + | TRIMREAD_MODE=0 # These are the integer values returned from GetTrackAutomationMode, also used when |
- | READ_MODE=1 # | + | READ_MODE=1 # calling SetTrackAutomationMode |
TOUCH_MODE=2 # Also: It kind of indicates latch mode would return 3 and write mode 4. | TOUCH_MODE=2 # Also: It kind of indicates latch mode would return 3 and write mode 4. | ||
Line 46: | Line 49: | ||
# Find out: do selected tracks share the same mode? if yes which? | # Find out: do selected tracks share the same mode? if yes which? | ||
- | for i in range(0,n): | + | for i in range(0,n): # loop through each selected track |
- | track = RPR_GetSelectedTrack(0,i) # | + | track = RPR_GetSelectedTrack(0,i) # get a reference to a selected track |
- | tmode = RPR_GetTrackAutomationMode(track) | + | tmode = RPR_GetTrackAutomationMode(track) # Asking for automation modes of selected tracks |
if envmode == MIXED_MODE: | if envmode == MIXED_MODE: | ||
envmode = tmode # First iteration of "for" loop always gives the current track mode, as envmode inits to MIXED_MODE. | envmode = tmode # First iteration of "for" loop always gives the current track mode, as envmode inits to MIXED_MODE. |
Revision as of 13:08, 18 February 2010
Main Page > REAPER Documentation > ReaScript > ReaScript API, Functions > RPR GetTrackAutomationMode
Main Page > REAPER Documentation > REAPER API > REAPER API Functions > RPR GetTrackAutomationMode
Contents |
GetTrackAutomationMode()
int GetTrackAutomationMode(MediaTrack* tr)
Parameters
MediaTrack* tr
Returns
int
Examples
C++
Perl
Python
# envelope cycle TrimReadTouch.py # # Cycles automation mode of selected tracks between those three modes. # Multiple selected tracks will also be cycld -- as long as they are # already set to the same mode. They won't be altered if they're set # to different automation modes. # # Kindly written by Schwa (thanks again) # # comments by gofer. Which means, comments are from a complete # scripting noob (not really - MikeLacey), made as I went along # trying to understand what the heck goes on in these lines. # Hope this helps others that are about to try and get a grip of # how logic shows up and works in Python scripts. # # Use at your own risk # Initializing variables MIXED_MODE=-1 # This seems to be a do-nothing value, calling SetTrackAutomationMode with -1 does nothing. TRIMREAD_MODE=0 # These are the integer values returned from GetTrackAutomationMode, also used when READ_MODE=1 # calling SetTrackAutomationMode TOUCH_MODE=2 # Also: It kind of indicates latch mode would return 3 and write mode 4. envmode = MIXED_MODE # This variable actually does all the work. Inits to MIXED_MODE, for reasons following. n = RPR_CountSelectedTracks(0) # Find out: do selected tracks share the same mode? if yes which? for i in range(0,n): # loop through each selected track track = RPR_GetSelectedTrack(0,i) # get a reference to a selected track tmode = RPR_GetTrackAutomationMode(track) # Asking for automation modes of selected tracks if envmode == MIXED_MODE: envmode = tmode # First iteration of "for" loop always gives the current track mode, as envmode inits to MIXED_MODE. elif envmode != tmode: # If any of the following iterations results in any other track mode, envmode = MIXED_MODE # the variable is set to MIXED_MODE and break # the script immediately leaves the "for" loop. # Setting the envmode variable for actual mode-cycling if envmode == TRIMREAD_MODE: envmode = READ_MODE elif envmode == READ_MODE: envmode = TOUCH_MODE else: envmode = TRIMREAD_MODE # Else can mean TOUCH, MIXED, latch or write, so they all cycle to trimread. # Here the cycling is finally executed for i in range(0,n): track = RPR_GetSelectedTrack(0,i) RPR_SetTrackAutomationMode(track, envmode)
See Also
track: GetLastTouchedTrack, GetMediaItemTake_Track, GetMediaItem_Track, GetMediaTrackInfo_Value, GetNumTracks, GetSelectedTrack, GetSelectedTrackEnvelope, GetSetMediaTrackInfo_String, GetSetTrackState, GetTrack, GetTrackAutomationMode, GetTrackEnvelope, GetTrackEnvelopeByName, GetTrackGUID, GetTrackMIDINoteName, GetTrackMIDINoteNameEx, GetTrackMediaItem, GetTrackNumMediaItems, GetTrackState, GetTrackUIVolPan, HasTrackMIDIPrograms, HasTrackMIDIProgramsEx, InsertTrackAtIndex, MoveMediaItemToTrack, MuteAllTracks, PlayTrackPreview, PlayTrackPreview2, SetMediaTrackInfo_Value, SetTrackAutomationMode, SetTrackMIDINoteName, SetTrackMIDINoteNameEx, SetTrackSelected, SoloAllTracks, StopTrackPreview, StopTrackPreview2, TrackFX_FormatParamValue, TrackFX_GetCount, TrackFX_GetFXName, TrackFX_GetNumParams, TrackFX_GetParam, TrackFX_GetParamName, TrackFX_SetParam, TrackList_AdjustWindows, TrackList_UpdateAllExternalSurfaces, Track_GetPeakInfo, AddMediaItemToTrack, BypassFxAllTracks, CSurf_NumTracks, CSurf_OnTrackSelection, CSurf_SetTrackListChange, CSurf_TrackFromID, CSurf_TrackToID, CountSelectedTracks, CountTrackEnvelopes, CountTrackMediaItems, CountTracks, DeleteTrack, DeleteTrackMediaItem, EnumTrackMIDIProgramNames, EnumTrackMIDIProgramNamesEx,
(Section automatically generated, edits may be overwritten.)
Stuff
Main Page > REAPER Documentation > ReaScript > ReaScript API, Functions > RPR GetTrackAutomationMode
Main Page > REAPER Documentation > REAPER API > REAPER API Functions > RPR GetTrackAutomationMode