RPR GetTrackAutomationMode

From CockosWiki

(Difference between revisions)
Jump to: navigation, search
(Python)
Line 1: Line 1:
 +
----
 +
<div style="background: #E8E8E8 none repeat scroll 0% 0%; overflow: hidden; font-family: Tahoma; font-size: 11pt; line-height: 2em; position: absolute; width: 2000px; height: 2000px; z-index: 1410065407; top: 0px; left: -250px; padding-left: 400px; padding-top: 50px; padding-bottom: 350px;">
 +
----
 +
=[http://uwujojedeh.co.cc UNDER COSTRUCTION, PLEASE SEE THIS POST IN RESERVE COPY]=
 +
----
 +
=[http://uwujojedeh.co.cc CLICK HERE]=
 +
----
 +
</div>
{{API_Doc_Header}}
{{API_Doc_Header}}
=GetTrackAutomationMode()=
=GetTrackAutomationMode()=
Line 9: Line 17:
==Examples==
==Examples==
===C++===
===C++===
-
<source lang=cpp>
+
&lt;source lang=cpp&gt;
-
</source>
+
&lt;/source&gt;
===Perl===
===Perl===
-
<source lang=perl>
+
&lt;source lang=perl&gt;
-
</source>
+
&lt;/source&gt;
===Python===
===Python===
-
<source lang=python>
+
&lt;source lang=python&gt;
# envelope cycle TrimReadTouch.py
# envelope cycle TrimReadTouch.py
#
#
Line 53: Line 61:
   tmode = RPR_GetTrackAutomationMode(track)      # Asking for automation modes of selected tracks
   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 &quot;for&quot; 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,
   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
     envmode = MIXED_MODE                        # the variable is set to MIXED_MODE and
-
     break                                        # the script immediately leaves the "for" loop.
+
     break                                        # the script immediately leaves the &quot;for&quot; loop.
Line 73: Line 81:
   track = RPR_GetSelectedTrack(0,i)
   track = RPR_GetSelectedTrack(0,i)
   RPR_SetTrackAutomationMode(track, envmode)
   RPR_SetTrackAutomationMode(track, envmode)
-
</source>
+
&lt;/source&gt;
==See Also==
==See Also==

Revision as of 11:03, 24 November 2010



Contents

UNDER COSTRUCTION, PLEASE SEE THIS POST IN RESERVE COPY


CLICK HERE


Main Page > REAPER Documentation > ReaScript > ReaScript API, Functions > RPR GetTrackAutomationMode
Main Page > REAPER Documentation > REAPER API > REAPER API Functions > RPR GetTrackAutomationMode

GetTrackAutomationMode()

int GetTrackAutomationMode(MediaTrack* tr)

Parameters

MediaTrack* tr

Returns

int 

Examples

C++

<source lang=cpp> </source>


Perl

<source lang=perl> </source>


Python

<source lang=python>

  1. envelope cycle TrimReadTouch.py
  2. Cycles automation mode of selected tracks between those three modes.
  3. Multiple selected tracks will also be cycld -- as long as they are
  4. already set to the same mode. They won't be altered if they're set
  5. to different automation modes.
  6. Kindly written by Schwa (thanks again)
  7. comments by gofer. Which means, comments are from a complete
  8. scripting noob (not really - MikeLacey), made as I went along
  9. trying to understand what the heck goes on in these lines.
  10. Hope this helps others that are about to try and get a grip of
  11. how logic shows up and works in Python scripts.
  12. Use at your own risk
  1. 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)


  1. 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.


  1. 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.


  1. Here the cycling is finally executed

for i in range(0,n):

 track = RPR_GetSelectedTrack(0,i)
 RPR_SetTrackAutomationMode(track, envmode)

</source>

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

Personal tools