ReaScript API

From CockosWiki

Jump to: navigation, search

Back to main ReaScript page
Back to main REAPER API page

ReaScript API Documentation

This page documents the ReaScript API functions.

ReaScript uses a large part of The API (available in CC++).

Using these functions

These functions each map onto a C++ function. C++ allows "pass by reference", which lets you pass a variable to a function in the parameter list and have the function change that parameter, so after this function call:

x = MyFunc(&var);

the var variable might well have a different value to the one it started with...

Perl and Python don't have compatible pass by reference mechanisms so when ReaScript sees a modifiable variable in the parameter list it returns all the values in the parameter list and the return value (if there is one) in an array, as in GetUserInputs() Go and look at it now if you haven't already done so. It will bite you if you don't understand it.

Specific REAPER type pointers, like MediaItem*, are not considered modifiable by ReaScript when deciding whether to return a scalar or array from a particular function.

Who is Allowed to Add to and Edit this Documentation?

You.

No, really - you are. Don't hesitate to get stuck in if you think you know something that even might be of help to some poor muso feeling his or her way around the API.

Anything in the API documentation that is marked with a '?' is an assumption - or something the writer just isn't sure about. If you happen to know whatever it is for certain - please correct or confirm the entry. If you're not sure either but you have different ideas to the author - then use the "discussion" tab at the top of each page and start a conversation with the author or authors of that page.

Please add a brief note or correction if you see anything that's wrong or incomplete or if you've used the function and know something that might be of use to the next user.

Don't worry about making it look good if you're hurried; someone will be along in a while with the time. (Don't hesitate to make it look good if you *do* have the time... :o)

The ReaScript API Functions

ReaScript directives

DirectiveDescription
includeInclude another file in a script; it works in the same way as the #include directive in the C programming language.

Functions

Generated from REAPER v3.21 by mkReaScriptAPITable.pl

AddMediaItemToTrack format_timestr GetTrackEnvelopeByName plugin_getImportableProjectFilterList
AddProjectMarker format_timestr_len GetTrackGUID PluginWantsAlwaysRunFx
AddTakeToMediaItem format_timestr_pos GetTrackMediaItem projectconfig_var_addr
adjustZoom get_config_var GetTrackMIDINoteName projectconfig_var_getoffs
APITest get_ini_file GetTrackMIDINoteNameEx ReaperGetPitchShiftAPI
Audio_IsPreBuffer GetActiveTake GetTrackNumMediaItems relative_fn
Audio_IsRunning GetColorThemeStruct GetTrackState Resample_EnumModes
Audio_RegHardwareHook GetCursorPosition GetTrackUIVolPan Resampler_Create
BypassFxAllTracks GetCursorPositionEx GetUserFileNameForRead resolve_fn
CalculatePeaks GetEnvelopeName GetUserInputs screenset_register
ClearAllRecArmed GetExePath GSC_mainwnd screenset_unregister
ClearPeakCache GetHZoomLevel guidToString screenset_unregisterByParam
CountMediaItems GetIconThemePointer HasTrackMIDIPrograms SelectProjectInstance
CountSelectedMediaItems GetIconThemeStruct HasTrackMIDIProgramsEx SetAutomationMode
CountSelectedTracks GetInputChannelName HiresPeaksFromSource SetEditCurPos
CountTakes GetItemProjectContext InsertMedia SetEditCurPos2
CountTrackEnvelopes GetLastTouchedTrack InsertTrackAtIndex SetMediaItemInfo_Value
CountTrackMediaItems GetMainHwnd IsInRealTimeAudio SetMediaItemTakeInfo_Value
CountTracks GetMasterMuteSoloFlags IsMediaExtension SetMediaTrackInfo_Value
CreateMIDIInput GetMaxMidiInputs kbd_OnMidiEvent SetProjectMarker
CreateMIDIOutput GetMaxMidiOutputs kbd_OnMidiList SetProjectMarker2
CSurf_FlushUndo GetMediaItem LICE_Blit SetTrackAutomationMode
CSurf_GetTouchState GetMediaItem_Track LICE_ClipLine SetTrackMIDINoteName
CSurf_GoEnd GetMediaItemInfo_Value LICE_Line SetTrackMIDINoteNameEx
CSurf_GoStart GetMediaItemNumTakes LICE_LineInt SetTrackSelected
CSurf_NumTracks GetMediaItemTake Main_OnCommand ShowActionList
CSurf_OnArrow GetMediaItemTake_Item Main_OnCommandEx ShowConsoleMsg
CSurf_OnFwd GetMediaItemTake_Source Main_openProject ShowMessageBox
CSurf_OnFXChange GetMediaItemTake_Track Main_UpdateLoopInfo SLIDER2DB
CSurf_OnMuteChange GetMediaItemTakeInfo_Value Master_GetPlayRateAtTime SoloAllTracks
CSurf_OnPanChange GetMediaTrackInfo_Value MB SplitMediaItem
CSurf_OnPanChangeEx GetMidiInput MIDI_eventlist_Create StopPreview
CSurf_OnPlay GetMIDIInputName MIDI_eventlist_Destroy StopTrackPreview
CSurf_OnRecArmChange GetMidiOutput MIDIEditor_GetActive StopTrackPreview2
CSurf_OnRecord GetMIDIOutputName MIDIEditor_GetMode stringToGuid
CSurf_OnRew GetNumMIDIInputs MIDIEditor_OnCommand TimeMap2_beatsToTime
CSurf_OnSelectedChange GetNumMIDIOutputs mkpanstr TimeMap2_GetDividedBpmAtTime
CSurf_OnSoloChange GetNumTracks mkvolpanstr TimeMap2_GetNextChangeTime
CSurf_OnStop GetOutputChannelName mkvolstr TimeMap2_QNToTime
CSurf_OnTrackSelection GetOutputLatency MoveEditCursor TimeMap2_timeToBeats
CSurf_OnVolumeChange GetPeakFileName MoveMediaItemToTrack TimeMap2_timeToQN
CSurf_OnVolumeChangeEx GetPeaksBitmap MuteAllTracks TimeMap_GetDividedBpmAtTime
CSurf_ResetAllCachedVolPanStates GetPlayPosition my_getViewport TimeMap_QNToTime
CSurf_ScrubAmt GetPlayPosition2 NamedCommandLookup TimeMap_timeToQN
CSurf_SetAutoMode GetPlayPosition2Ex OnPauseButton Track_GetPeakInfo
CSurf_SetPlayState GetPlayPositionEx OnPauseButtonEx TrackFX_FormatParamValue
CSurf_SetRepeatState GetPlayState OnPlayButton TrackFX_GetCount
CSurf_SetSurfaceMute GetPlayStateEx OnPlayButtonEx TrackFX_GetFXName
CSurf_SetSurfacePan GetProjectPath OnStopButton TrackFX_GetNumParams
CSurf_SetSurfaceRecArm GetProjectPathEx OnStopButtonEx TrackFX_GetParam
CSurf_SetSurfaceSelected GetProjectTimeSignature parse_timestr TrackFX_GetParamName
CSurf_SetSurfaceSolo GetProjectTimeSignature2 parse_timestr_len TrackFX_SetParam
CSurf_SetSurfaceVolume GetSelectedMediaItem parse_timestr_pos TrackList_AdjustWindows
CSurf_SetTrackListChange GetSelectedTrack parsepanstr TrackList_UpdateAllExternalSurfaces
CSurf_TrackFromID GetSelectedTrackEnvelope PCM_Sink_Create Undo_BeginBlock
CSurf_TrackToID GetSet_ArrangeView2 PCM_Sink_CreateEx Undo_BeginBlock2
DB2SLIDER GetSet_LoopTimeRange PCM_Sink_CreateMIDIFile Undo_CanRedo2
DeleteProjectMarker GetSet_LoopTimeRange2 PCM_Sink_CreateMIDIFileEx Undo_CanUndo2
DeleteTrack GetSetEnvelopeState PCM_Sink_Enum Undo_DoRedo2
DeleteTrackMediaItem GetSetItemState PCM_Sink_GetExtension Undo_DoUndo2
DockWindowActivate GetSetMediaItemTakeInfo_String PCM_Sink_ShowConfig Undo_EndBlock
DockWindowAdd GetSetMediaTrackInfo_String PCM_Source_CreateFromFile Undo_EndBlock2
DockWindowRemove GetSetRepeat PCM_Source_CreateFromFileEx Undo_OnStateChange
EnsureNotCompletelyOffscreen GetSetRepeatEx PCM_Source_CreateFromSimple Undo_OnStateChange2
EnumPitchShiftModes GetSetTrackState PCM_Source_CreateFromType Undo_OnStateChange_Item
EnumPitchShiftSubModes GetTake PeakBuild_Create Undo_OnStateChangeEx
EnumProjectMarkers GetTakeEnvelopeByName PeakGet_Create Undo_OnStateChangeEx2
EnumProjectMarkers2 GetTooltipWindow PlayPreview UpdateItemInProject
EnumProjects GetTrack PlayTrackPreview UpdateTimeline
EnumTrackMIDIProgramNames GetTrackAutomationMode PlayTrackPreview2 ValidatePtr
EnumTrackMIDIProgramNamesEx GetTrackEnvelope plugin_getFilterList WDL_VirtualWnd_ScaledBlitBG
Personal tools