RPR UpdateItemInProject

From CockosWiki

Jump to: navigation, search

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

Contents

UpdateItemInProject()

void UpdateItemInProject(MediaItem* item)

Use this function to redraw an object after it has been updated if the redraw is not triggered automatically.

Some API functions that may change the item's appearance won't automatically trigger a redraw of the item. This triggers a redraw of the item by REAPER.

Parameters

MediaItem* item

Returns

void

Examples

C++

 


Perl

#
# Script to increase the volume level of a Media Item by 1db.
# Used in conjunction with another, very similar, script that
# reduces the volume by 1db.
#
# by sfzgeek
# "I set up two copies of the script: one version increase the 
# volume by a 1 dB and the other version descrease by 1 dB. I
# assign [the two scripts to convenient keys whilst playing 
# the section containing the item]"
#
 
use strict;
use warnings;
 
use constant CURR_PROJ => 0;
use constant FIRST_SELECTED => 0;
 
$MediaItem = RPR_GetSelectedMediaItem(CURR_PROJ, FIRST_SELECTED);
$D_VOL = RPR_GetMediaItemInfo_Value($MediaItem, "D_VOL");
 
$Item_Vol = (20 * log($D_VOL)) / log(10);
$Item_Vol = sprintf "%.0f", $Item_Vol;
$Item_Vol++;
 
$D_VOL = 10 ** ($Item_Vol / 20);
 
RPR_SetMediaItemInfo_Value($MediaItem, "D_VOL", $D_VOL);
RPR_UpdateItemInProject($MediaItem);


Python

#
# Script to increase the volume level of a Media Item by 1db.
# Used in conjunction with another, very similar, script that
# reduces the volume by 1db.
#
# by sfzgeek
# "I set up two copies of the script: one version increase the 
# volume by a 1 dB and the other version descrease by 1 dB. I
# assign [the two scripts to convenient keys whilst playing 
# the section containing the item]"
#
 
CURR_PROJ = 0;
FIRST_SELECTED = 0;
 
MediaItem = RPR_GetSelectedMediaItem(CURR_PROJ, FIRST_SELECTED);
D_VOL = RPR_GetMediaItemInfo_Value(MediaItem, "D_VOL");
 
Item_Vol = (20 * log(D_VOL)) / log(10);
Item_Vol += 1;
 
D_VOL = 10 * (Item_Vol / 20);
 
RPR_SetMediaItemInfo_Value(MediaItem, "D_VOL", D_VOL);
RPR_UpdateItemInProject(MediaItem);

See Also

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 above this line may be overwritten.)

Screen Update Functions: UpdateTimeline UpdateItemInProject EnsureNotCompletelyOffscreen

Stuff

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

Personal tools