pub struct Track<'a, T: ProbablyMutable> {
pub info_buf_size: usize,
/* private fields */
}
Fields
info_buf_size: usize
Used to get string info about the track. default is 512
Implementations
sourceimpl<'a, T: ProbablyMutable> Track<'a, T>
impl<'a, T: ProbablyMutable> Track<'a, T>
pub fn new(project: &'a Project, pointer: MediaTrack) -> Self
pub fn from_index(project: &'a Project, index: usize) -> Option<Self>
pub fn from_name(project: &'a Project, name: impl Into<String>) -> Option<Self>
pub fn from_point(project: &'a Project, point: PositionPixel) -> Option<Self>
pub fn from_guid(project: &'a Project, guid: GUID) -> Option<Self>
pub fn name(&self) -> String
pub fn icon(&self) -> Option<PathBuf>
pub fn mcp_layout(&self) -> Option<String>
pub fn tcp_layout(&self) -> Option<String>
sourcepub fn ui_element_rect(
&self,
element: impl Into<String>
) -> ReaperResult<RectPixel>
pub fn ui_element_rect(
&self,
element: impl Into<String>
) -> ReaperResult<RectPixel>
allows querying screen position + size of track WALTER elements (tcp.size queries screen position and size of entire TCP, etc).
sourcepub fn razor_edits(&self) -> Vec<RazorEdit>
pub fn razor_edits(&self) -> Vec<RazorEdit>
pub fn guid(&self) -> GUID
pub fn index(&self) -> usize
pub fn muted(&self) -> bool
pub fn phase_flipped(&self) -> bool
sourcepub fn is_currently_monitored(&self) -> bool
pub fn is_currently_monitored(&self) -> bool
True, while playback and rec_armed and monitored.
pub fn solo(&self) -> SoloMode
sourcepub fn solo_defeat(&self) -> bool
pub fn solo_defeat(&self) -> bool
when set, if anything else is soloed and this track is not muted, this track acts soloed
pub fn fx_bypassed(&self) -> bool
pub fn rec_armed(&self) -> bool
pub fn rec_input(&self) -> RecInput
pub fn rec_mode(&self) -> RecMode
sourcepub fn rec_out_mode(&self) -> Option<RecOutMode>
pub fn rec_out_mode(&self) -> Option<RecOutMode>
If rec_mode records output. Otherwise — None.
pub fn rec_monitoring(&self) -> RecMonitoring
sourcepub fn auto_rec_arm(&self) -> bool
pub fn auto_rec_arm(&self) -> bool
True if automatically armed when track is selected.
pub fn vu_mode(&self) -> VUMode
pub fn n_channels(&self) -> usize
pub fn n_items(&self) -> usize
pub fn n_envelopes(&self) -> usize
pub fn selected(&self) -> bool
pub fn dimensions(&self) -> TrackDimensions
pub fn folder_state(&self) -> TrackFolderState
sourcepub fn midi_hardware_out(&self) -> Option<(u8, HardwareSocket)>
pub fn midi_hardware_out(&self) -> Option<(u8, HardwareSocket)>
Get channel and hardware midi out socket, if any.
ch=0 → all channels
pub fn performance_flags(&self) -> TrackPerformanceFlags
sourcepub fn height_override(&self) -> Option<u32>
pub fn height_override(&self) -> Option<u32>
If track height was overrided by script.
sourcepub fn height_lock(&self) -> Option<bool>
pub fn height_lock(&self) -> Option<bool>
None
, if Track::height_override is None
.
pub fn volume(&self) -> Volume
pub fn pan(&self) -> TrackPan
pub fn pan_law(&self) -> PanLaw
pub fn pan_law_mode(&self) -> PanLawMode
pub fn visible_in_mcp(&self) -> bool
pub fn visible_in_tcp(&self) -> bool
sourcepub fn parent_send(&self) -> Option<u32>
pub fn parent_send(&self) -> Option<u32>
Get channel offset of parent track. None, if no parent send.
pub fn free_item_positioning(&self) -> bool
pub fn time_base(&self) -> TimeMode
sourcepub fn mcp_fx_send_scale(&self) -> f64
pub fn mcp_fx_send_scale(&self) -> f64
scale of fx+send area in MCP (0=minimum allowed, 1=maximum allowed)
sourcepub fn mcp_fx_param_scale(&self) -> f64
pub fn mcp_fx_param_scale(&self) -> f64
scale of fx parameter area in MCP (0=minimum allowed, 1=maximum allowed)
sourcepub fn mcp_fx_send_region_scale(&self) -> f64
pub fn mcp_fx_send_region_scale(&self) -> f64
scale of send area as proportion of the fx+send total area (0=minimum allowed, 1=maximum allowed)
sourcepub fn tcp_fx_param_scale(&self) -> f64
pub fn tcp_fx_param_scale(&self) -> f64
scale of TCP parameter area when TCP FX are embedded (0=min allowed, default, 1=max allowed)
pub fn play_offset(&self) -> Option<TrackPlayOffset>
sourcepub fn get_fx_ny_name(
&self,
name: impl Into<String>,
is_rec_fx: bool
) -> Option<TrackFX<'_, Immutable>>
pub fn get_fx_ny_name(
&self,
name: impl Into<String>,
is_rec_fx: bool
) -> Option<TrackFX<'_, Immutable>>
On Master Track is_rec_fx represents monitoring chain.
sourcepub fn get_fx_instrument(&self) -> Option<TrackFX<'_, T>>
pub fn get_fx_instrument(&self) -> Option<TrackFX<'_, T>>
Get first instrument FX on track, if any.
pub fn n_sends(&self) -> usize
pub fn n_receives(&self) -> usize
pub fn n_hardware_sends(&self) -> usize
pub fn get_automation_mode(&self) -> AutomationMode
pub fn get_color(&self) -> Color
sourcepub fn group_membership(&self, group: TrackGroupParam) -> (u32, u32)
pub fn group_membership(&self, group: TrackGroupParam) -> (u32, u32)
Get status of all track groups for specified parameter as bits.
Returns 2 u32 values, each representing 32 track groups.
See Track::set_group_membership for example.
sourcepub fn note_name(&self, channel: u8, pitch: u16) -> Option<String>
pub fn note_name(&self, channel: u8, pitch: u16) -> Option<String>
pitch 128 for CC0, 129 for CC1 etc.
pub fn chunk(&self) -> ReaperStaticResult<String>
sourceimpl<'a> Track<'a, Immutable>
impl<'a> Track<'a, Immutable>
pub fn get_parent_track(&self) -> Option<Track<'_, Immutable>>
pub fn get_item(&self, index: usize) -> Option<Item<'_, Immutable>>
pub fn get_envelope(&self, index: usize) -> Option<Envelope<'_, Self, Immutable>>
pub fn get_envelope_by_chunk(
&self,
selector: EnvelopeSelector
) -> Option<Envelope<'_, Self, Immutable>>
pub fn get_envelope_by_name(
&self,
name: impl Into<String>
) -> Option<Envelope<'_, Self, Immutable>>
sourceimpl<'a> Track<'a, Mutable>
impl<'a> Track<'a, Mutable>
pub fn get_parent_track(self) -> Option<Track<'a, Mutable>>
pub fn make_only_selected_track(&self)
pub fn get_item(&mut self, index: usize) -> Option<Item<'_, Mutable>>
pub fn get_envelope(
&mut self,
index: usize
) -> Option<Envelope<'_, Self, Mutable>>
pub fn get_envelope_by_chunk(
&mut self,
selector: EnvelopeSelector
) -> Option<Envelope<'_, Self, Mutable>>
pub fn get_envelope_by_name(
&mut self,
name: impl Into<String>
) -> Option<Envelope<'_, Self, Mutable>>
pub fn get_fx_mut(&mut self, index: usize) -> Option<TrackFX<'_, Mutable>>
sourcepub fn get_fx_ny_name_mut(
&mut self,
name: impl Into<String>,
is_rec_fx: bool
) -> Option<TrackFX<'_, Mutable>>
pub fn get_fx_ny_name_mut(
&mut self,
name: impl Into<String>,
is_rec_fx: bool
) -> Option<TrackFX<'_, Mutable>>
On Master Track is_rec_fx represents monitoring chain.
pub fn set_chunk(
&mut self,
chunk: impl Into<String>,
need_undo: bool
) -> ReaperStaticResult<()>
sourcepub fn set_note_name(
&mut self,
channel: u8,
pitch: u16,
note_name: impl Into<String>
) -> ReaperStaticResult<()>
pub fn set_note_name(
&mut self,
channel: u8,
pitch: u16,
note_name: impl Into<String>
) -> ReaperStaticResult<()>
pitch 128-255 for CC. 128=CC0, 129=CC1 etc.
sourcepub fn set_razor_edits(
&mut self,
edits: Vec<RazorEdit>
) -> ReaperStaticResult<()>
pub fn set_razor_edits(
&mut self,
edits: Vec<RazorEdit>
) -> ReaperStaticResult<()>
pub fn set_guid(&mut self, guid: GUID)
pub fn set_name(&mut self, name: impl Into<String>) -> ReaperStaticResult<()>
pub fn set_icon(&mut self, path: PathBuf) -> ReaperStaticResult<()>
pub fn set_mcp_layout(
&mut self,
layout: impl Into<String>
) -> ReaperStaticResult<()>
pub fn set_tcp_layout(
&mut self,
layout: impl Into<String>
) -> ReaperStaticResult<()>
pub fn add_audio_accessor(
&mut self
) -> ReaperResult<AudioAccessor<'_, Self, Mutable>>
sourcepub fn add_fx(
&mut self,
name: impl Into<String>,
position: impl Into<Option<u8>>,
input_fx: bool,
even_if_exists: bool
) -> Option<TrackFX<'_, Mutable>>
pub fn add_fx(
&mut self,
name: impl Into<String>,
position: impl Into<Option<u8>>,
input_fx: bool,
even_if_exists: bool
) -> Option<TrackFX<'_, Mutable>>
Add FX at given position, or return existing one.
If even_if_exists
is false
, plugin will be added only
if no plugin exists on track.
Otherwise, if position is None → the last slot will be used. The resulting FX will have real index, that may differ from the desired.
If input_fx
is true
→ input fx chain on regular Track will be used,
of monitoring FX chain in case of master track.
sourcepub fn add_item(
&mut self,
start: impl Into<Position>,
length: impl GetLength
) -> Item<'_, Mutable>
pub fn add_item(
&mut self,
start: impl Into<Position>,
length: impl GetLength
) -> Item<'_, Mutable>
Add an empty Item to Track.
Item will not have any takes.
pub fn add_midi_item(
&mut self,
start: impl Into<Position>,
length: impl GetLength
) -> Item<'_, Mutable>
sourcepub fn add_hardware_send(&mut self) -> HardwareSend<'_, Mutable>
pub fn add_hardware_send(&mut self) -> HardwareSend<'_, Mutable>
Add HardwareSend, that sends audio or midi to hardware outs.
All future tweaks done on the HardwareSend.
Try to keep send object as little as possible. It is accessed by indexing, so everything falls, as sends are changed.
Note
To add regular track send use crate::send::TrackSend::create_new
pub fn delete(self)
pub fn set_automation_mode(&mut self, mode: AutomationMode)
pub fn set_color(&mut self, color: impl Into<Color>)
sourcepub fn set_midi_hardware_out(
&mut self,
channel: u8,
socket: Option<HardwareSocket>
) -> ReaperResult<()>
pub fn set_midi_hardware_out(
&mut self,
channel: u8,
socket: Option<HardwareSocket>
) -> ReaperResult<()>
If socket is None — delete hardware out.
ch=0 → all channels
pub fn set_muted(&mut self, state: bool) -> ReaperResult<()>
pub fn set_phase_flipped(&mut self, state: bool) -> ReaperResult<()>
pub fn set_solo(&mut self, mode: SoloMode) -> ReaperResult<()>
sourcepub fn set_solo_defeat(&mut self, state: bool) -> ReaperResult<()>
pub fn set_solo_defeat(&mut self, state: bool) -> ReaperResult<()>
when set, if anything else is soloed and this track is not muted, this track acts soloed
pub fn set_fx_bypassed(&mut self, state: bool) -> ReaperResult<()>
pub fn set_rec_armed(&mut self, state: bool) -> ReaperResult<()>
pub fn set_rec_input(&mut self, rec_input: RecInput) -> ReaperResult<()>
pub fn set_rec_mode(&mut self, rec_mode: RecMode) -> ReaperResult<()>
sourcepub fn set_rec_out_mode(&mut self, flags: RecOutMode) -> ReaperResult<()>
pub fn set_rec_out_mode(&mut self, flags: RecOutMode) -> ReaperResult<()>
If rec_mode records output. Otherwise — None.
pub fn set_rec_monitoring(&mut self, value: RecMonitoring) -> ReaperResult<()>
sourcepub fn set_auto_rec_arm(&mut self, value: bool) -> ReaperResult<()>
pub fn set_auto_rec_arm(&mut self, value: bool) -> ReaperResult<()>
True if automatically armed when track is selected.
If track is already selected and not rec armed — it will not arm track.
pub fn set_vu_mode(&mut self, value: VUMode) -> ReaperResult<()>
pub fn set_n_channels(&mut self, amount: usize) -> ReaperResult<()>
pub fn set_selected(&mut self, selected: bool) -> ReaperResult<()>
pub fn set_folder_state(&mut self, state: TrackFolderState) -> ReaperResult<()>
pub fn set_performance_flags(
&mut self,
flags: TrackPerformanceFlags
) -> ReaperResult<()>
sourcepub fn set_height_override(
&mut self,
height: impl Into<Option<u32>>
) -> ReaperResult<()>
pub fn set_height_override(
&mut self,
height: impl Into<Option<u32>>
) -> ReaperResult<()>
If track height was overrided by script.
pub fn set_height_lock(&mut self, value: bool) -> ReaperResult<()>
pub fn set_volume(&mut self, volume: Volume) -> ReaperResult<()>
pub fn set_pan(&mut self, track_pan: TrackPan) -> ReaperResult<()>
pub fn set_pan_law(&mut self, law: PanLaw) -> ReaperResult<()>
pub fn set_pan_law_mode(&mut self, law_mode: PanLawMode) -> ReaperResult<()>
pub fn set_visible_in_mcp(&mut self, value: bool) -> ReaperResult<()>
pub fn set_visible_in_tcp(&mut self, value: bool) -> ReaperResult<()>
pub fn set_parent_send(
&mut self,
parent_ch_offset: impl Into<Option<u32>>
) -> ReaperResult<()>
pub fn set_free_item_positioning(
&mut self,
free: bool,
update_timeline: bool
) -> ReaperResult<()>
pub fn set_time_base(&mut self, mode: TimeMode) -> ReaperResult<()>
sourcepub fn set_mcp_fx_send_scale(&mut self, value: f64) -> ReaperResult<()>
pub fn set_mcp_fx_send_scale(&mut self, value: f64) -> ReaperResult<()>
scale of fx+send area in MCP (0=minimum allowed, 1=maximum allowed)
sourcepub fn set_mcp_fx_param_scale(&mut self, value: f64) -> ReaperResult<()>
pub fn set_mcp_fx_param_scale(&mut self, value: f64) -> ReaperResult<()>
scale of fx parameter area in MCP (0=minimum allowed, 1=maximum allowed)
sourcepub fn set_mcp_fx_send_region_scale(&mut self, value: f64) -> ReaperResult<()>
pub fn set_mcp_fx_send_region_scale(&mut self, value: f64) -> ReaperResult<()>
scale of send area as proportion of the fx+send total area (0=minimum allowed, 1=maximum allowed)
sourcepub fn set_tcp_fx_param_scale(&mut self, value: f64) -> ReaperResult<()>
pub fn set_tcp_fx_param_scale(&mut self, value: f64) -> ReaperResult<()>
scale of TCP parameter area when TCP FX are embedded (0=min allowed, default, 1=max allowed)
pub fn set_play_offset(
&mut self,
play_offset: Option<TrackPlayOffset>
) -> ReaperResult<()>
sourcepub fn set_group_membership(
&mut self,
group: TrackGroupParam,
low_groups: u32,
high_groups: u32,
low_groups_set_mask: impl Into<Option<u32>>,
high_groups_set_mask: impl Into<Option<u32>>
)
pub fn set_group_membership(
&mut self,
group: TrackGroupParam,
low_groups: u32,
high_groups: u32,
low_groups_set_mask: impl Into<Option<u32>>,
high_groups_set_mask: impl Into<Option<u32>>
)
Set track membership for specified parameter in track groups.
If masks are None
— corresponding true bits of groups will be used.
For complete rewrite of values use u32::MAX.
Example
use rea_rs::{TrackGroupParam, Reaper};
use bitvec::prelude::*;
let mut pr = Reaper::get().current_project();
let mut tr = pr.get_track_mut(0).unwrap();
assert_eq!(tr.index(), 0);
let (mut low_u32, mut high_u32) =
tr.group_membership(TrackGroupParam::MuteLead);
let (low, high) = (
low_u32.view_bits_mut::<Lsb0>(),
high_u32.view_bits_mut::<Lsb0>(),
);
low.set(3, true);
low.set(5, true);
high.set(6, true);
tr.set_group_membership(
TrackGroupParam::MuteLead,
low.load(),
high.load(),
None,
None
);
let (low_u32, high_u32) =
tr.group_membership(TrackGroupParam::MuteLead);
assert!(low_u32 & 0b1000 > 0);
assert!(low_u32 & 0b100000 > 0);
assert!(low_u32 & 0b1000000 == 0);
assert!(high_u32 & 0b1000000 > 0);
Trait Implementations
sourceimpl<'a, T: Debug + ProbablyMutable> Debug for Track<'a, T>
impl<'a, T: Debug + ProbablyMutable> Debug for Track<'a, T>
sourceimpl<'a, T: ProbablyMutable> FXParent<'a, TrackFX<'a, Immutable>> for Track<'a, T>
impl<'a, T: ProbablyMutable> FXParent<'a, TrackFX<'a, Immutable>> for Track<'a, T>
fn n_fx(&self) -> usize
fn get_fx(&'a self, index: usize) -> Option<TrackFX<'_, Immutable>>
fn iter_fx(&'a self) -> FXIterator<'a, T, Self>ⓘNotable traits for FXIterator<'a, T, P>impl<'a, T: FX<Immutable> + 'a, P: FXParent<'a, T>> Iterator for FXIterator<'a, T, P> type Item = T;
where
Self: Sized,
sourceimpl<'a> HasExtState for Track<'a, Mutable>
impl<'a> HasExtState for Track<'a, Mutable>
sourceimpl<'a, T: ProbablyMutable> KnowsProject for Track<'a, T>
impl<'a, T: ProbablyMutable> KnowsProject for Track<'a, T>
sourceimpl<'a, T: PartialEq + ProbablyMutable> PartialEq<Track<'a, T>> for Track<'a, T>
impl<'a, T: PartialEq + ProbablyMutable> PartialEq<Track<'a, T>> for Track<'a, T>
sourceimpl<'a, T: ProbablyMutable> WithReaperPtr<'a> for Track<'a, T>
impl<'a, T: ProbablyMutable> WithReaperPtr<'a> for Track<'a, T>
type Ptr = NonNull<MediaTrack>
sourcefn get_pointer(&self) -> Self::Ptr
fn get_pointer(&self) -> Self::Ptr
sourcefn make_unchecked(&mut self)
fn make_unchecked(&mut self)
sourcefn make_checked(&mut self)
fn make_checked(&mut self)
sourcefn should_check(&self) -> bool
fn should_check(&self) -> bool
sourcefn require_valid(&self) -> ReaperResult<()>
fn require_valid(&self) -> ReaperResult<()>
sourcefn require_valid_2(&self, project: &Project) -> ReaperResult<()>
fn require_valid_2(&self, project: &Project) -> ReaperResult<()>
sourcefn with_valid_ptr(
&mut self,
f: impl FnMut(&mut Self) -> ReaperResult<()>
) -> ReaperResult<()>
fn with_valid_ptr(
&mut self,
f: impl FnMut(&mut Self) -> ReaperResult<()>
) -> ReaperResult<()>
impl<'a, T: ProbablyMutable> StructuralPartialEq for Track<'a, T>
Auto Trait Implementations
impl<'a, T> RefUnwindSafe for Track<'a, T>where
T: RefUnwindSafe,
impl<'a, T> !Send for Track<'a, T>
impl<'a, T> !Sync for Track<'a, T>
impl<'a, T> Unpin for Track<'a, T>where
T: Unpin,
impl<'a, T> UnwindSafe for Track<'a, T>where
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
sourceimpl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
sourcefn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
. Read moresourcefn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
. Read moresourcefn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s. Read moresourcefn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s. Read more