RPR AddProjectMarker
From CockosWiki
Main Page > REAPER Documentation > ReaScript > ReaScript API, Functions > RPR AddProjectMarker
Main Page > REAPER Documentation > REAPER API > REAPER API Functions > RPR AddProjectMarker
Contents |
AddProjectMarker()
int AddProjectMarker(ReaProject* proj, bool isrgn, double pos, double rgnend, const char* name, int wantidx)
This function creates a marker or a region it returns the index of the created object, or -1 on failure.
You can specify an index number in the wantidx parameter by setting it to a number >= 0 if you want a particular marker index number, but you'll get a different index number if the index number you ask for is already is already in use.
Parameters
ReaProject* proj, 0 for the current project bool isrgn, Set to true (1) if you want to create a region, false (0) to create a marker double pos, The start position, in seconds double rgnend, The end position, in seconds (ignored if you're creating a marker) const char* name, The name of the marker or region int wantidx A request for a particulat index number for the new region/marker - if that index is free then fine, otherwise a new one is returned by the function
Returns
int the index of the region or marker that has been created, this might or might not be the same index number as requested in the function call.
Examples
C++
void RenumberIds(COMMAND_T*) { MarkerList ml(NULL, true); DeleteAllMarkers(); int iID = 1; for (int i = 0; i < ml.m_items.GetSize(); i++) { MarkerItem* mi = ml.m_items.Get(i); if (!mi->m_bReg) AddProjectMarker(NULL, false, mi->m_dPos, mi->m_dRegEnd, mi->GetName(), iID++); } pMarkerList->Update(); UpdateTimeline(); }
Perl
This script adds a named region and then a named marker in the current project
# # AddProjectMarker.pl # # AddProjectMarker(ReaProject* proj, bool isrgn, double pos, double rgnend, const char* name, int wantidx) use strict; use warnings; use constant CURR_PROJ => 0; my $pos; my $isrgn; my $rgnend; my $name; my $wantidx; my $retval; $pos = 1; $isrgn = 1; $rgnend = 3; $name = "first region"; $wantidx = 1; $retval = RPR_AddProjectMarker(CURR_PROJ, $isrgn, $pos, $rgnend, $name, $wantidx); $pos = 5; $isrgn = 0; $rgnend = 8; $name = "a marker"; $wantidx = 1; $retval = RPR_AddProjectMarker(CURR_PROJ, $isrgn, $pos, $rgnend, $name, $wantidx);
Python
# # AddProjectMarker.py # # AddProjectMarker(ReaProject* proj, bool isrgn, double pos, double rgnend, const char* name, int wantidx) #------------------------------------------------------------------------------- CURR_PROJ = 0 pos = 1 isrgn = 1 rgnend = 3 name = "first region" wantidx = 1 retval = RPR_AddProjectMarker(CURR_PROJ, isrgn, pos, rgnend, name, wantidx) #------------------------------------------------------------------------------- pos = 5 isrgn = 0 rgnend = 8 name = "a marker" wantidx = 1 retval = RPR_AddProjectMarker(CURR_PROJ, isrgn, pos, rgnend, name, wantidx) #------------------------------------------------------------------------------- # place twenty markers every 5 seconds for i in range( 20 ): pos = i * 5.0 name = 'M %d' % (i+1) RPR_AddProjectMarker(CURR_PROJ, 0, pos, pos, name, 1)
See Also
marker: AddProjectMarker, SetProjectMarker, SetProjectMarker2, DeleteProjectMarker, EnumProjectMarkers, EnumProjectMarkers2,
project: GetItemProjectContext, GetProjectPath, GetProjectPathEx, GetProjectTimeSignature, GetProjectTimeSignature2, Main_openProject, SelectProjectInstance, SetProjectMarker, SetProjectMarker2, UpdateItemInProject, plugin_getImportableProjectFilterList, projectconfig_var_addr, projectconfig_var_getoffs, AddProjectMarker, DeleteProjectMarker, EnumProjectMarkers, EnumProjectMarkers2, EnumProjects,
(Section automatically generated, edits may be overwritten.)
Stuff
Main Page > REAPER Documentation > ReaScript > ReaScript API, Functions > RPR AddProjectMarker
Main Page > REAPER Documentation > REAPER API > REAPER API Functions > RPR AddProjectMarker