top of page

Media

6

All media on the specified track is re-arranged at 0.7x speed every second

RANK

AZSTOKE_TrackAllMediaSetRateMoveToSec

import sys

sys.path.append(RPR_GetResourcePath() + r"\UserPlugins")

from AZSTOKE_BRONZE_python import *


def Msg(parm):

    RPR_ShowConsoleMsg(str(parm) + "\n")

    

retval,_,_,_,allCount,_ = AZ_GetTrackMediaTypeCount(0,1,"",0,0)


mediaList = []

mediaInterval = 1

setMeidaRate = 0.7


for i in range(allCount):

    mediaList.insert(i, {})

    mediaList[i]["media"] = AZ_GetMediaTrackItemSelect(0,1,i,0)

    _, _, _, _,mediaList[i]["startPos"] = AZ_GetTrackMediaStartTimeSeconds(0,1,i,0)

    AZ_SetTrackMediaRate(0,1,i,setMeidaRate)

    _,_,_,_,mediaList[i]["length"] = AZ_GetTrackMediaLength(0,1,i,0)

    

startPos = 0


for index, value in enumerate(mediaList,0):

    if index == 0:

       startPos = mediaList[index]["startPos"]

    else:

       startPos = startPos + mediaList[index-1]["length"] + mediaInterval

       AZ_SetMediaItemStartTimeSeconds(mediaList[index]["media"],startPos)

      

import sys

sys.path.append(RPR_GetResourcePath() + r"\UserPlugins")

from AZSTOKE_BRONZE_python import *

  • Import the Bronze API.

  • If you don't have it installed, you'll need to download it here

def Msg(parm):

RPR_ShowConsoleMsg(str(parm) + "\n")

  • Install the Msg function to check the signal (not required)

retval,_,_,_,allCount,_ = AZ_GetTrackMediaTypeCount(0,1,"",0,0)

  • Get the number of all media in the specified track (allCount)


mediaList = []

  • Define the array (medialist)

mediaInterval = 1

  • Prepare media interval value as a variable

  • This time it's 1 second

setMediaRate = 0.7

  • Prepare media playback speed as a variable

  • This time it's 0.7


for i in range(allCount):

  • Loop the number of times specified by the variable (allCount)

mediaList.insert(i, {})

  • Adds an element to the specified location in the list (mediaList).

  • i: Position to insert

  • {}: The element you want to add

mediaList[i]["media"] = AZ_GetMediaTrackItemSelect(0,1,i,0)

  • Get MediaItem and save it in ["media"] of mediaList[i]

_, _, _, _,mediaList[i]["startPos"] = AZ_GetTrackMediaStartTimeSeconds(0,1,i,0)

  • Get the start position of the media and save it in ["start"] of mediaList[i]

AZ_SetTrackMediaRate(0,1,i,setMediaRate)

  • Set the media playback speed to a variable (setMediaRate)

_,_,_,_,mediaList[i]["length"] = AZ_GetTrackMediaLength(0,1,i,0)

  • Get the length of the media and save it in ["length"] of mediaList[i]

startPos = 0

  • Set start position


for index, value in enumerate(mediaList,0):

  • enumerate() function: You can get the stored values and order at the same time

  • Repeat for the number of elements in the array (mediaList)

if index == 0:

  • If index is 0

  • ==: equal

startPos = mediaList[index]["startPos"]

  • Set the start position of the array mediaList[index] to the variable startPos.

else:

  • If not the first one, continue below

startPos = startPos + mediaList[index-1]["length"] + mediaInterval

  • Set the variable startPos to the value (startNextPos) + the length of the media in the array mediaList[index] + the media interval value (1 second).

AZ_SetMediaItemStartTimeSeconds(mediaList[index]["media"],startPos)

  • Set the media in the array mediaList[index] to the variable (startNextPos).

APIの利用にはBRONZEに

加入し専用APIを

ダウンロード

する必要があります。

Multiple media in a project

- Script Code -
- Script Image -
- Warm Up -
- Script Detail -
- API -

PYTHON

​ReaScript File Download 👇

​※実行するには専用APIが必要です

- Script Image -
bottom of page