RPR GetSetMediaTrackInfo String

From CockosWiki

Jump to: navigation, search

Main Page > REAPER Documentation > ReaScript > ReaScript API, Functions > RPR GetSetMediaTrackInfo String
Main Page > REAPER Documentation > REAPER API > REAPER API Functions > RPR GetSetMediaTrackInfo String

Contents

GetSetMediaTrackInfo_String()

bool GetSetMediaTrackInfo_String(MediaTrack* tr, const char* parmname, char* string, bool setnewvalue)

Get or set track string attributes. P_NAME : char * : track name (on master returns NULL)

Parameters

An array, containing
 bool
 MediaTrack* tr,
 const char* parmname,
 char* string,
 bool setnewvalue

Returns

MediaTrack* tr, const char* parmname, char* string, bool setnewvalue

Examples

C++

 


Perl

 


Python

This script will query all tracks in selection on their free item positioning mode (FIPM) state, and if they have FIPM active, the script will rename those tracks adding a [F] prefix. If the tracks have FIPM disabled, and [F] prefix is detected, the script will rename the tracks back to what they were called by removing the [F] prefix. Use this script in a custom action with "Toggle free item positioning" command, and use that instead of the usual toggle FIPM command (I have that custom command bound to Shift+F)


SelTrackCount = RPR_CountSelectedTracks(0)	# get number of selected tracks
Index = 0
mark = ""
flag = ""
 
while Index < SelTrackCount:		# repeat this for all selected tracks in the current project
 
	# get selected track index
	TrackIdx = RPR_GetSelectedTrack(0, Index)
	# get track name
	name = RPR_GetSetMediaTrackInfo_String(TrackIdx, "P_NAME","", False)[3]
	flag = name[:4]			# separate the prefix ("[F] " is the exact string)
	mark = name[4:]			# separate everything BUT the prefix
 
	# query FIPM status and save it to a variable
	FIPM = RPR_GetMediaTrackInfo_Value(TrackIdx, "B_FREEMODE")
 
	if FIPM == 1 and flag != "[F] ":	# if the flag is not present and FIPM is enabled, add the [F] prefix
		newname = "[F] " + name
		RPR_GetSetMediaTrackInfo_String(TrackIdx, "P_NAME",newname, True)
	elif FIPM == 0 and flag == "[F] ":	# if the flag is present and FIPM disabled, remove the [F] prefix
		RPR_GetSetMediaTrackInfo_String(TrackIdx, "P_NAME",mark, True)
 
	Index = Index + 1			# increment to the next track index


submitted by EvilDragon ;)

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 GetSetMediaTrackInfo String
Main Page > REAPER Documentation > REAPER API > REAPER API Functions > RPR GetSetMediaTrackInfo String

Personal tools