RPR SetMediaTrackInfo Value

From CockosWiki

Jump to: navigation, search

Main Page > REAPER Documentation > ReaScript > ReaScript API, Functions > RPR SetMediaTrackInfo Value
Main Page > REAPER Documentation > REAPER API > REAPER API Functions > RPR SetMediaTrackInfo Value

Contents

SetMediaTrackInfo_Value()

bool SetMediaTrackInfo_Value(MediaTrack* tr, const char* parmname, double newvalue)

This is a powerful function, it is used to set most of the Track attributes.

It cannot be used to set attributes with a string value such as NAME, these can be set using GetSetTrackState().

  • B_MUTE : bool * : mute flag
  • B_PHASE : bool * : invert track phase
  • IP_TRACKNUMBER : int : track number (returns zero if not found, -1 for master track) (read-only, returns the int directly)
  • I_SOLO : int * : 0=not soloed, 1=solo, 2=soloed in place
  • I_FXEN : int * : 0=fx bypassed, nonzero = fx active
  • I_RECARM : int * : 0=not record armed, 1=record armed
  • I_RECINPUT : int * : record input. 0..n = mono hardware input, 512+n = rearoute input, 1024 set for stereo input pair. 4096 set for MIDI input, if set, then low 5 bits represent channel (0=all, 1-16=only chan), then next 5 bits represent physical input (31=all, 30=VKB)
  • I_RECMODE : int * : record mode (0=input, 1=stereo out, 2=none, 3=stereo out w/latcomp, 4=midi output, 5=mono out, 6=mono out w/ lat comp, 7=midi overdub, 8=midi replace
  • I_RECMON : int * : record monitor (0=off, 1=normal, 2=not when playing (tapestyle))
  • I_RECMONITEMS : int * : monitor items while recording (0=off, 1=on)
  • I_AUTOMODE : int * : track automation mode (0=trim/off, 1=read, 2=touch, 3=write, 4=latch
  • I_NCHAN : int * : number of track channels, must be 2-64, even
  • I_SELECTED : int * : track selected? 0 or 1
  • I_WNDH : int * : current TCP window height (Read-only)
  • I_ISFOLDER : int * : folder status (1=folder, 0=normal, 2=last track in folder)
  • I_FOLDERCOMPACT : int * : folder compacting (only valid on folders), 0=normal, 1=small, 2=tiny children
  • I_MIDIHWOUT : int * : track midi hardware output index (<0 for disabled, low 5 bits are which channels (0=all, 1-16), next 5 bits are output device index (0-31))
  • I_PERFFLAGS : int * : track perf flags (&1=no media buffering, &2=no anticipative FX)
  • I_CUSTOMCOLOR : int * : custom color, windows standard color order (i.e. RGB(r,g,b)|0x100000). if you do not |0x100000, then it will not be used (though will store the color anyway)
  • I_HEIGHTOVERRIDE : int * : custom height override for TCP window. 0 for none, otherwise size in pixels
  • D_VOL : double * : trim volume of track (0 (-inf)..1 (+0dB) .. 2 (+6dB) etc ..)
  • D_PAN : double * : trim pan of track (-1..1)
  • D_PANLAW : double * : pan law of track. <0 for project default, 1.0 for +0dB, etc
  • B_SHOWINMIXER : bool * : show track panel in mixer -- do not use on master
  • B_SHOWINTCP : bool * : show track panel in tcp -- do not use on master
  • B_MAINSEND : bool * : track sends audio to parent
  • B_FREEMODE: bool * : track free-mode enabled (requires UpdateTimeline() after changing etc)
  • C_BEATATTACHMODE : char * : char * to one char of beat attached mode, -1=def, 0=time, 1=allbeats, 2=beatsposonly
  • F_MCP_FXSEND_SCALE : float * : scale of fx+send area in MCP (0.0=smallest allowed, 1=max allowed)
  • F_MCP_SENDRGN_SCALE : float * : scale of send area as proportion of the fx+send total area (0=min allow, 1=max)

Caveats

When updating attributes that visibly change a Track (in RED above) you may need to encourage REAPER to update its display, as in the Perl example below which sets the height of the first selected Track in pixels. This is done, as in the Perl example, by calling the following two functions:

RPR_TrackList_AdjustWindows()
RPR_UpdateTimeline()

(Thanks to sws for pointing this out.)

Parameters

MediaTrack* tr, 
const char* parmname, 
double newvalue

Returns

bool, 1=ok 0=fail?

Examples

C++

 


Perl

#  
# SetTrackHeight.pl  
#  
 
use strict;  
use warnings;  
 
use constant CURR_PROJ => 0;  
use constant FIRST_SEL => 0;  
use constant PNAME => 'I_HEIGHTOVERRIDE';  
use constant NEWHEIGHT => 150;  
 
 
my $tr;  
my $result;  
 
$tr = RPR_GetSelectedTrack(CURR_PROJ, FIRST_SEL);  
$result = RPR_SetMediaTrackInfo_Value($tr, PNAME, NEWHEIGHT);  
RPR_TrackList_AdjustWindows(CURR_PROJ);  
RPR_UpdateTimeline();


Python

#  
# SetTrackHeight.py
#  
 
CURR_PROJ = 0
FIRST_SEL = 0
PNAME = 'I_HEIGHTOVERRIDE'
NEWHEIGHT = 150
 
tr = RPR_GetSelectedTrack(CURR_PROJ, FIRST_SEL)
result = RPR_SetMediaTrackInfo_Value(tr, PNAME, NEWHEIGHT)
RPR_TrackList_AdjustWindows(CURR_PROJ)
RPR_UpdateTimeline()

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 SetMediaTrackInfo Value
Main Page > REAPER Documentation > REAPER API > REAPER API Functions > RPR SetMediaTrackInfo Value

Personal tools