RPR SetEditCurPos2

From CockosWiki

(Redirected from RPR SetEditCurPos)
Jump to: navigation, search

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

Contents

SetEditCurPos2()

void SetEditCurPos(double time, bool moveview, bool seekplay) deprecated
void SetEditCurPos2(void* proj, double time, bool moveview, bool seekplay)

SetEditCurPos() repositions the edit cursor to "time" (in seconds), optionally moving the view if necessary, and optionally seeking playback (if playing back). This function should ONLY be called from a UI context (i.e. from the editor window, NOT from audio processing etc).

Parameters

void* proj,
double time,
bool moveview,
bool seekplay

Returns

An array, containing
 void* proj,
 double time,
 bool moveview,
 bool seekplay

Examples

C++

void DoInsRndFileEx(bool RndLen,bool RndOffset,bool UseTimeSel)
{
	if (g_filenames->GetSize()>0)
	{
		int filenameindex=rand() % g_filenames->GetSize();
 
		t_vect_of_Reaper_tracks TheTracks;
		XenGetProjectTracks(TheTracks,true);
		if (TheTracks.size()>0)
		{
		PCM_source *NewPCM=PCM_Source_CreateFromFile(g_filenames->Get(filenameindex));
		MediaItem *NewItem=AddMediaItemToTrack(TheTracks[0]);
		MediaItem_Take *NewTake=AddTakeToMediaItem(NewItem);
		double TimeSelStart=0.0;
		double TimeSelEnd=NewPCM->GetLength();
		GetSet_LoopTimeRange(false,false,&TimeSelStart,&TimeSelEnd,false);
		double ItemPos=TimeSelStart;
		double ItemLen=NewPCM->GetLength();
		double MediaOffset=0.0;
		if (RndOffset) 
		{
			MediaOffset=(NewPCM->GetLength()/RAND_MAX)*rand();
			ItemLen-=MediaOffset;
		}
		if (RndLen) ItemLen=((NewPCM->GetLength()-MediaOffset)/RAND_MAX)*rand();
		if (UseTimeSel) ItemLen=TimeSelEnd-TimeSelStart;
		if (!UseTimeSel) ItemPos=GetCursorPosition();
		GetSetMediaItemTakeInfo(NewTake,"P_SOURCE",NewPCM);
		GetSetMediaItemTakeInfo(NewTake,"D_STARTOFFS",&MediaOffset);
 
		GetSetMediaItemInfo(NewItem,"D_POSITION",&ItemPos);
		GetSetMediaItemInfo(NewItem,"D_LENGTH",&ItemLen);
		Main_OnCommand(40047,0); // build any missing peaks
		SetEditCurPos(ItemPos+ItemLen,false,false);		Undo_OnStateChangeEx("Insert random file (Extended)",4,-1);
 
		UpdateTimeline();
		}
	}	
}

Perl

 


Python

 

See Also

cursor: GetCursorPosition, GetCursorPositionEx, MoveEditCursor,

(Section automatically generated, edits above this line may be overwritten.)

Stuff

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

Personal tools