Struct reaper_medium::BorrowedPcmSource
source · [−]#[repr(transparent)]pub struct BorrowedPcmSource(_);
Expand description
Borrowed (reference-only) PCM source.
Implementations
sourceimpl BorrowedPcmSource
impl BorrowedPcmSource
sourcepub fn from_raw(raw: &PCM_source) -> &Self
pub fn from_raw(raw: &PCM_source) -> &Self
Creates a medium-level representation from the given low-level reference.
sourcepub fn from_raw_mut(raw: &mut PCM_source) -> &mut Self
pub fn from_raw_mut(raw: &mut PCM_source) -> &mut Self
Creates a mutable medium-level representation from the given low-level reference.
sourcepub fn duplicate(&self) -> Option<OwnedPcmSource>
pub fn duplicate(&self) -> Option<OwnedPcmSource>
Duplicates this source.
sourcepub fn is_available(&self) -> bool
pub fn is_available(&self) -> bool
Returns if this source is available.
sourcepub fn set_available(&self, available: bool)
pub fn set_available(&self, available: bool)
If called with false, closes files etc.
sourcepub fn get_type<R>(&self, use_type: impl FnOnce(&ReaperStr) -> R) -> R
pub fn get_type<R>(&self, use_type: impl FnOnce(&ReaperStr) -> R) -> R
Grants temporary access to the type of this source.
This type should not be empty but if a third-party source provider doesn’t get it right, this can still happen. An empty string is also used as fallback if the third-party source returns a null pointer.
sourcepub unsafe fn get_type_unchecked(&self) -> &ReaperStr
pub unsafe fn get_type_unchecked(&self) -> &ReaperStr
sourcepub fn get_file_name<R>(&self, use_file: impl FnOnce(Option<&Path>) -> R) -> R
pub fn get_file_name<R>(&self, use_file: impl FnOnce(Option<&Path>) -> R) -> R
Grants temporary access to the file of this source.
None
is a valid result. In that case it’s not purely a file. Takes care of converting an
empty path to None
.
sourcepub unsafe fn get_file_name_unchecked(&self) -> Option<&ReaperStr>
pub unsafe fn get_file_name_unchecked(&self) -> Option<&ReaperStr>
Returns the file of this source.
None
is a valid result. In that case it’s not purely a file. Takes care of converting an
empty path to None
.
Safety
Returned string’s lifetime is unbounded.
sourcepub fn set_file_name(&self, new_file_name: Option<&Path>) -> bool
pub fn set_file_name(&self, new_file_name: Option<&Path>) -> bool
Returns true
if supported. Only call when offline.
sourcepub fn get_source(&self) -> Option<PcmSource>
pub fn get_source(&self) -> Option<PcmSource>
Returns the parent source, if any.
pub fn set_source(&self, source: Option<PcmSource>)
sourcepub fn get_num_channels(&self) -> Option<u32>
pub fn get_num_channels(&self) -> Option<u32>
Returns number of channels.
sourcepub fn get_sample_rate(&self) -> Option<Hz>
pub fn get_sample_rate(&self) -> Option<Hz>
Returns preferred sample rate. If None
then it is assumed to be silent (or MIDI).
sourcepub fn get_length(&self) -> Result<DurationInSeconds, ReaperFunctionError>
pub fn get_length(&self) -> Result<DurationInSeconds, ReaperFunctionError>
Returns the length of this source.
Errors
Returns an error if this source doesn’t return a valid duration.
sourcepub fn get_length_beats(&self) -> Option<DurationInBeats>
pub fn get_length_beats(&self) -> Option<DurationInBeats>
Returns length in beats if supported.
sourcepub fn get_bits_per_sample(&self) -> u32
pub fn get_bits_per_sample(&self) -> u32
Returns bits/sample, if available. Only used for metadata purposes, since everything returns as doubles anyway.
sourcepub fn get_preferred_position(&self) -> Option<PositionInSeconds>
pub fn get_preferred_position(&self) -> Option<PositionInSeconds>
Returns None
if not supported.
sourcepub unsafe fn properties_window(&self, parent_window: Option<Hwnd>) -> i32
pub unsafe fn properties_window(&self, parent_window: Option<Hwnd>) -> i32
sourcepub unsafe fn get_samples(&self, block: &PcmSourceTransfer)
pub unsafe fn get_samples(&self, block: &PcmSourceTransfer)
sourcepub unsafe fn get_peak_info(&self, block: &PcmSourcePeakTransfer)
pub unsafe fn get_peak_info(&self, block: &PcmSourcePeakTransfer)
sourcepub unsafe fn save_state(&self, context: &BorrowedProjectStateContext)
pub unsafe fn save_state(&self, context: &BorrowedProjectStateContext)
sourcepub unsafe fn load_state(
&self,
first_line: &ReaperStr,
context: &BorrowedProjectStateContext
) -> Result<(), Box<dyn Error>>
pub unsafe fn load_state(
&self,
first_line: &ReaperStr,
context: &BorrowedProjectStateContext
) -> Result<(), Box<dyn Error>>
sourcepub fn peaks_clear(&self, delete_file: bool)
pub fn peaks_clear(&self, delete_file: bool)
Builds peaks for files.
sourcepub fn peaks_build_begin(&self) -> bool
pub fn peaks_build_begin(&self) -> bool
Returns true
if building is opened, otherwise it may mean building isn’t necessary.
sourcepub fn peaks_build_run(&self) -> bool
pub fn peaks_build_run(&self) -> bool
Returns true
if building should continue.
sourcepub fn peaks_build_finish(&self)
pub fn peaks_build_finish(&self)
Call when done.
sourcepub unsafe fn extended(
&self,
call: i32,
parm_1: *mut c_void,
parm_2: *mut c_void,
parm_3: *mut c_void
) -> i32
pub unsafe fn extended(
&self,
call: i32,
parm_1: *mut c_void,
parm_2: *mut c_void,
parm_3: *mut c_void
) -> i32
Safety
REAPER can crash if you pass invalid pointers.
sourcepub fn ext_get_pooled_midi_id(
&self
) -> Result<ExtGetPooledMidiIdResult, ReaperFunctionError>
pub fn ext_get_pooled_midi_id(
&self
) -> Result<ExtGetPooledMidiIdResult, ReaperFunctionError>
Unstable!!!
If this source represents pooled MIDI data, this will return information about it.
Errors
Returns an error if not supported.
sourcepub fn ext_export_to_file(
&self,
file_name: &Path
) -> Result<(), ReaperFunctionError>
pub fn ext_export_to_file(
&self,
file_name: &Path
) -> Result<(), ReaperFunctionError>
Writes the content of this source to the given file.
Only currently supported by MIDI but in theory any source could support this.
Errors
Returns an error if not supported.
sourcepub fn ext_remove_from_midi_pool(&self) -> Result<(), ReaperFunctionError>
pub fn ext_remove_from_midi_pool(&self) -> Result<(), ReaperFunctionError>
sourcepub fn ext_set_preview_tempo(
&self,
tempo: Option<Bpm>
) -> Result<(), ReaperFunctionError>
pub fn ext_set_preview_tempo(
&self,
tempo: Option<Bpm>
) -> Result<(), ReaperFunctionError>
Sets the preview tempo for this source.
This will make the source ignore the project tempo.
Setting None
will reset IGNTEMPO in REAPER versions >= v6.56+dev0425 or so.
Errors
Returns an error if not supported.
sourcepub unsafe fn ext_open_editor(
&self,
hwnd: Hwnd,
track_index: u32
) -> Result<(), ReaperFunctionError>
pub unsafe fn ext_open_editor(
&self,
hwnd: Hwnd,
track_index: u32
) -> Result<(), ReaperFunctionError>
Trait Implementations
sourceimpl AsMut<BorrowedPcmSource> for CustomOwnedPcmSource
impl AsMut<BorrowedPcmSource> for CustomOwnedPcmSource
sourcefn as_mut(&mut self) -> &mut BorrowedPcmSource
fn as_mut(&mut self) -> &mut BorrowedPcmSource
sourceimpl AsMut<BorrowedPcmSource> for FlexibleOwnedPcmSource
impl AsMut<BorrowedPcmSource> for FlexibleOwnedPcmSource
sourcefn as_mut(&mut self) -> &mut BorrowedPcmSource
fn as_mut(&mut self) -> &mut BorrowedPcmSource
sourceimpl AsMut<BorrowedPcmSource> for OwnedPcmSource
impl AsMut<BorrowedPcmSource> for OwnedPcmSource
sourcefn as_mut(&mut self) -> &mut BorrowedPcmSource
fn as_mut(&mut self) -> &mut BorrowedPcmSource
sourceimpl AsMut<PCM_source> for BorrowedPcmSource
impl AsMut<PCM_source> for BorrowedPcmSource
sourcefn as_mut(&mut self) -> &mut PCM_source
fn as_mut(&mut self) -> &mut PCM_source
sourceimpl AsRef<BorrowedPcmSource> for CustomOwnedPcmSource
impl AsRef<BorrowedPcmSource> for CustomOwnedPcmSource
sourcefn as_ref(&self) -> &BorrowedPcmSource
fn as_ref(&self) -> &BorrowedPcmSource
sourceimpl AsRef<BorrowedPcmSource> for FlexibleOwnedPcmSource
impl AsRef<BorrowedPcmSource> for FlexibleOwnedPcmSource
sourcefn as_ref(&self) -> &BorrowedPcmSource
fn as_ref(&self) -> &BorrowedPcmSource
sourceimpl AsRef<BorrowedPcmSource> for OwnedPcmSource
impl AsRef<BorrowedPcmSource> for OwnedPcmSource
sourcefn as_ref(&self) -> &BorrowedPcmSource
fn as_ref(&self) -> &BorrowedPcmSource
sourceimpl AsRef<PCM_source> for BorrowedPcmSource
impl AsRef<PCM_source> for BorrowedPcmSource
sourcefn as_ref(&self) -> &PCM_source
fn as_ref(&self) -> &PCM_source
sourceimpl Borrow<BorrowedPcmSource> for OwnedPcmSource
impl Borrow<BorrowedPcmSource> for OwnedPcmSource
sourcefn borrow(&self) -> &BorrowedPcmSource
fn borrow(&self) -> &BorrowedPcmSource
sourceimpl Debug for BorrowedPcmSource
impl Debug for BorrowedPcmSource
sourceimpl Hash for BorrowedPcmSource
impl Hash for BorrowedPcmSource
sourceimpl PartialEq<BorrowedPcmSource> for BorrowedPcmSource
impl PartialEq<BorrowedPcmSource> for BorrowedPcmSource
sourcefn eq(&self, other: &BorrowedPcmSource) -> bool
fn eq(&self, other: &BorrowedPcmSource) -> bool
sourceimpl RefCast for BorrowedPcmSource
impl RefCast for BorrowedPcmSource
type From = PCM_source
fn ref_cast(_from: &Self::From) -> &Self
fn ref_cast_mut(_from: &mut Self::From) -> &mut Self
sourceimpl ToOwned for BorrowedPcmSource
impl ToOwned for BorrowedPcmSource
type Owned = OwnedPcmSource
type Owned = OwnedPcmSource
sourcefn to_owned(&self) -> OwnedPcmSource
fn to_owned(&self) -> OwnedPcmSource
1.63.0 · sourcefn clone_into(&self, target: &mut Self::Owned)
fn clone_into(&self, target: &mut Self::Owned)
impl Eq for BorrowedPcmSource
impl StructuralEq for BorrowedPcmSource
impl StructuralPartialEq for BorrowedPcmSource
Auto Trait Implementations
impl RefUnwindSafe for BorrowedPcmSource
impl !Send for BorrowedPcmSource
impl !Sync for BorrowedPcmSource
impl Unpin for BorrowedPcmSource
impl UnwindSafe for BorrowedPcmSource
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