Trait reaper_medium::CustomPcmSource
source · [−]pub trait CustomPcmSource {
Show 24 methods
fn duplicate(&mut self) -> Option<OwnedPcmSource>;
fn is_available(&mut self) -> bool;
fn get_type(&mut self) -> &ReaperStr;
fn set_file_name(&mut self, args: SetFileNameArgs<'_>) -> bool;
fn get_num_channels(&mut self) -> Option<u32>;
fn get_sample_rate(&mut self) -> Option<Hz>;
fn get_length(&mut self) -> DurationInSeconds;
fn properties_window(&mut self, args: PropertiesWindowArgs) -> i32;
fn get_samples(&mut self, args: GetSamplesArgs<'_>);
fn get_peak_info(&mut self, args: GetPeakInfoArgs<'_>);
fn save_state(&mut self, args: SaveStateArgs<'_>);
fn load_state(
&mut self,
args: LoadStateArgs<'_>
) -> Result<(), Box<dyn Error>>;
fn peaks_clear(&mut self, args: PeaksClearArgs);
fn peaks_build_begin(&mut self) -> bool;
fn peaks_build_run(&mut self) -> bool;
fn peaks_build_finish(&mut self);
fn set_available(&mut self, args: SetAvailableArgs) { ... }
fn get_file_name(&mut self) -> Option<&ReaperStr> { ... }
fn get_source(&mut self) -> Option<PcmSource> { ... }
fn set_source(&mut self, args: SetSourceArgs) { ... }
fn get_length_beats(&mut self) -> Option<DurationInBeats> { ... }
fn get_bits_per_sample(&mut self) -> u32 { ... }
fn get_preferred_position(&mut self) -> Option<PositionInSeconds> { ... }
unsafe fn extended(&mut self, args: ExtendedArgs) -> i32 { ... }
}
Expand description
Consumers can implement this trait in order to provide own PCM source types.
Required Methods
fn duplicate(&mut self) -> Option<OwnedPcmSource>
fn is_available(&mut self) -> bool
fn get_type(&mut self) -> &ReaperStr
sourcefn set_file_name(&mut self, args: SetFileNameArgs<'_>) -> bool
fn set_file_name(&mut self, args: SetFileNameArgs<'_>) -> bool
Return true
if supported. This will only be called when offline.
sourcefn get_num_channels(&mut self) -> Option<u32>
fn get_num_channels(&mut self) -> Option<u32>
Return number of channels.
sourcefn get_sample_rate(&mut self) -> Option<Hz>
fn get_sample_rate(&mut self) -> Option<Hz>
Return preferred sample rate. If None
then it is assumed to be silent (or MIDI).
sourcefn get_length(&mut self) -> DurationInSeconds
fn get_length(&mut self) -> DurationInSeconds
Length in seconds.
sourcefn properties_window(&mut self, args: PropertiesWindowArgs) -> i32
fn properties_window(&mut self, args: PropertiesWindowArgs) -> i32
Unstable!!!
fn get_samples(&mut self, args: GetSamplesArgs<'_>)
fn get_peak_info(&mut self, args: GetPeakInfoArgs<'_>)
fn save_state(&mut self, args: SaveStateArgs<'_>)
fn load_state(&mut self, args: LoadStateArgs<'_>) -> Result<(), Box<dyn Error>>
sourcefn peaks_clear(&mut self, args: PeaksClearArgs)
fn peaks_clear(&mut self, args: PeaksClearArgs)
Called by the peaks building UI to build peaks for files.
sourcefn peaks_build_begin(&mut self) -> bool
fn peaks_build_begin(&mut self) -> bool
Unstable!!!
Return true
if building is opened, otherwise it may mean building isn’t necessary.
sourcefn peaks_build_run(&mut self) -> bool
fn peaks_build_run(&mut self) -> bool
Unstable!!!
Return true
if building should continue.
sourcefn peaks_build_finish(&mut self)
fn peaks_build_finish(&mut self)
Called when done.
Provided Methods
sourcefn set_available(&mut self, args: SetAvailableArgs)
fn set_available(&mut self, args: SetAvailableArgs)
If called with false, close files etc.
Optional.
sourcefn get_file_name(&mut self) -> Option<&ReaperStr>
fn get_file_name(&mut self) -> Option<&ReaperStr>
Return None
if no file name (not purely a file).
sourcefn get_source(&mut self) -> Option<PcmSource>
fn get_source(&mut self) -> Option<PcmSource>
Return parent source, if any.
fn set_source(&mut self, args: SetSourceArgs)
sourcefn get_length_beats(&mut self) -> Option<DurationInBeats>
fn get_length_beats(&mut self) -> Option<DurationInBeats>
Length in beats if supported.
sourcefn get_bits_per_sample(&mut self) -> u32
fn get_bits_per_sample(&mut self) -> u32
Return bits/sample, if available. Only used for metadata purposes, since everything returns as doubles anyway.
sourcefn get_preferred_position(&mut self) -> Option<PositionInSeconds>
fn get_preferred_position(&mut self) -> Option<PositionInSeconds>
Return None
if not supported.
sourceunsafe fn extended(&mut self, args: ExtendedArgs) -> i32
unsafe fn extended(&mut self, args: ExtendedArgs) -> i32
Generic method which is called for many kinds of events. Prefer implementing the type-safe
ext_
methods instead!
reaper-rs calls this method only if you didn’t process the event already in one of the
ext_
methods. The meaning of the return value depends on the particular event type
(args.call
). In any case, returning 0 means that the event has not been handled.
Safety
Implementing this is unsafe because you need to deal with raw pointers.