Struct reaper_medium::OwnedPcmSource
source · [−]#[repr(transparent)]pub struct OwnedPcmSource(_);
Expand description
Owned PCM source.
This PCM source automatically destroys the associated C++ PCM_source
when dropped.
Implementations
Methods from Deref<Target = BorrowedPcmSource>
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 OwnedPcmSource
impl AsMut<BorrowedPcmSource> for OwnedPcmSource
sourcefn as_mut(&mut self) -> &mut BorrowedPcmSource
fn as_mut(&mut self) -> &mut BorrowedPcmSource
sourceimpl AsRef<BorrowedPcmSource> for OwnedPcmSource
impl AsRef<BorrowedPcmSource> for OwnedPcmSource
sourcefn as_ref(&self) -> &BorrowedPcmSource
fn as_ref(&self) -> &BorrowedPcmSource
sourceimpl Borrow<BorrowedPcmSource> for OwnedPcmSource
impl Borrow<BorrowedPcmSource> for OwnedPcmSource
sourcefn borrow(&self) -> &BorrowedPcmSource
fn borrow(&self) -> &BorrowedPcmSource
sourceimpl Clone for OwnedPcmSource
impl Clone for OwnedPcmSource
sourcefn clone(&self) -> OwnedPcmSource
fn clone(&self) -> OwnedPcmSource
1.0.0 · sourceconst fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
source
. Read moresourceimpl Debug for OwnedPcmSource
impl Debug for OwnedPcmSource
sourceimpl Deref for OwnedPcmSource
impl Deref for OwnedPcmSource
type Target = BorrowedPcmSource
type Target = BorrowedPcmSource
sourcefn deref(&self) -> &BorrowedPcmSource
fn deref(&self) -> &BorrowedPcmSource
sourceimpl DerefMut for OwnedPcmSource
impl DerefMut for OwnedPcmSource
sourcefn deref_mut(&mut self) -> &mut BorrowedPcmSource
fn deref_mut(&mut self) -> &mut BorrowedPcmSource
sourceimpl Drop for OwnedPcmSource
impl Drop for OwnedPcmSource
sourceimpl Hash for OwnedPcmSource
impl Hash for OwnedPcmSource
sourceimpl PartialEq<OwnedPcmSource> for OwnedPcmSource
impl PartialEq<OwnedPcmSource> for OwnedPcmSource
sourcefn eq(&self, other: &OwnedPcmSource) -> bool
fn eq(&self, other: &OwnedPcmSource) -> bool
impl Eq for OwnedPcmSource
impl Send for OwnedPcmSource
impl StructuralEq for OwnedPcmSource
impl StructuralPartialEq for OwnedPcmSource
Auto Trait Implementations
impl RefUnwindSafe for OwnedPcmSource
impl !Sync for OwnedPcmSource
impl Unpin for OwnedPcmSource
impl UnwindSafe for OwnedPcmSource
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