pub struct Reaper<UsageScope = MainThreadScope> { /* private fields */ }
Expand description

This is the main access point for most REAPER functions.

Basics

You can obtain an instance of this struct by calling ReaperSession::reaper(). This unlocks all functions which are safe to execute in the main thread. If you want access to the functions which are safe to execute in the real-time audio thread, call ReaperSession::create_real_time_reaper() instead. REAPER functions which are related to registering/unregistering things are located in ReaperSession.

Please note that this struct contains nothing but function pointers, so you are free to clone it, e.g. in order to make all functions accessible somewhere else. This is sometimes easier than passing references around. Don’t do it too often though. It’s just a bitwise copy of all function pointers, but there are around 800 of them, so each copy will occupy about 7 kB of memory on a 64-bit system.

Panics

Don’t assume that all REAPER functions exposed here are always available. It’s possible that the user runs your plug-in in an older version of REAPER where a function is missing. See the documentation of low-level Reaper for ways how to deal with this.

Work in progress

Many functions which are available in the low-level API have not been lifted to the medium-level API yet. Unlike the low-level API, the medium-level one is hand-written and probably a perpetual work in progress. If you can’t find the function that you need, you can always resort to the low-level API by navigating to low(). Of course you are welcome to contribute to bring the medium-level API on par with the low-level one.

Design

What’s the <MainThreadScope> in Reaper<MainThreadScope> about?

In REAPER and probably many other DAWs there are at least two important threads:

  1. The main thread (responsible for things like UI, driven by the UI main loop).
  2. The real-time audio thread (responsible for processing audio and MIDI buffers, driven by the audio hardware)

Most functions offered by REAPER are only safe to be executed in the main thread. If you execute them in another thread, REAPER will crash. Or worse: It will seemingly work on your machine and crash on someone else’s. There are also a few functions which are only safe to be executed in the audio thread. And there are also very few functions which are safe to be executed from any thread (thread-safe).

There’s currently no way to make sure at compile time that a function is called in the correct thread. Of course that would be the best. In an attempt to still let the compiler help you a bit, the traits MainThreadOnly and RealTimeAudioThreadOnly have been introduced. They are marker traits which are used as type bound on each method which is not thread-safe. So depending on the context we can expose an instance of Reaper which has only functions unlocked which are safe to be executed from e.g. the real-time audio thread. The compiler will complain if you attempt to call a real-time-audio-thread-only method on Reaper<MainThreadScope> and vice versa.

Of course that technique can’t prevent anyone from acquiring a main-thread only instance and use it in the audio hook. But still, it adds some extra safety.

The alternative to tagging functions via marker traits would have been to implement e.g. audio-thread-only functions in a trait CallableFromRealTimeAudioThread as default functions and create a struct that inherits those default functions. Disadvantage: Consumer always would have to bring the trait into scope to see the functions. That’s confusing. It also would provide less amount of safety.

Why no fail-fast at runtime when calling audio-thread-only functions from wrong thread?

At the moment, there’s a fail fast (panic) when attempting to execute main-thread-only functions from the wrong thread. This prevents “it works on my machine” scenarios. However, this is currently not being done the other way around (when executing real-time-audio-thread-only functions from the wrong thread) because of possible performance implications. Latter scenario should also be much more unlikely. Maybe we can introduce it in future in order to really avoid undefined behavior even for those methods (which the lack of unsafe suggests). Checking the thread ID is a very cheap operation (a few nano seconds), maybe even in the real-time audio thread.

Implementations

Makes the given instance available globally.

After this has been called, the instance can be queried globally using get().

This can be called once only. Subsequent calls won’t have any effect!

Gives access to the instance which you made available globally before.

Panics

This panics if make_available_globally() has not been called before.

Gives access to the low-level Reaper instance.

Returns the plug-in context.

Returns the requested project and optionally its file name.

With buffer_size you can tell REAPER how many bytes of the file name you want. If you are not interested in the file name at all, pass 0.

Threading

If buffer_size > 0, this must be called from the main thread (panics if not).

If buffer_size == 0, this may also be called from a real-time or worker thread, not from your own thread (this won’t be checked!)

Example
use reaper_medium::ProjectRef::Tab;

let result = session.reaper().enum_projects(Tab(4), 256).ok_or("No such tab")?;
let project_dir = result.file_path.ok_or("Project not saved yet")?.parent();

Returns the track at the given index.

Panics

Panics if the given project is not valid anymore.

Example
use reaper_medium::ProjectContext::CurrentProject;

let track = session.reaper().get_track(CurrentProject, 3).ok_or("No such track")?;

Like get_track() but doesn’t check if project is valid.

Safety

REAPER can crash if you pass an invalid project.

Returns the item at the given index.

Panics

Panics if the given project is not valid anymore.

Like get_media_item() but doesn’t check if project is valid.

Safety

REAPER can crash if you pass an invalid project.

Checks if the given pointer is still valid.

Example
use reaper_medium::ProjectContext::CurrentProject;

let track = session.reaper().get_track(CurrentProject, 0).ok_or("No track")?;
let track_is_valid = session.reaper().validate_ptr_2(CurrentProject, track);
assert!(track_is_valid);

Returns true if the pointer is a valid object of the correct type in the given project. The project is ignored if the pointer itself is a project.

Checks if the given pointer is still valid.

Returns true if the pointer is a valid object of the correct type in the current project.

Redraws the arrange view and ruler.

Redraws the arrange view.

Updates the track list after a minor change.

Updates the track list after a major change.

Shows a message to the user in the ReaScript console.

This is also useful for debugging. Send “\n” for newline and “” to clear the console.

Gets or sets a track attribute.

Returns the current value if new_value is null_mut().

It’s recommended to use one of the convenience functions instead. They all start with get_set_media_track_info_ and are more type-safe.

Safety

REAPER can crash if you pass an invalid track or invalid new value.

Gets or sets a take attribute.

Returns the current value if new_value is null_mut().

It’s recommended to use one of the convenience functions instead. They all start with get_set_media_item_take_info_ and are more type-safe.

Safety

REAPER can crash if you pass an invalid take or invalid new value.

Sets a take attribute as numerical value.

Errors

Returns an error if an invalid (e.g. non-numerical) track attribute key is passed.

Safety

REAPER can crash if you pass an invalid track.

Convenience function which sets the take’s source (P_SOURCE).

Returns the previous source in case the take had a source assigned.

Safety

REAPER can crash if you pass an invalid take.

Convenience function which returns the given track’s parent track (P_PARTRACK).

Safety

REAPER can crash if you pass an invalid track.

Convenience function which returns the given track’s parent project (P_PROJECT).

In REAPER < 5.95 this returns None.

Safety

REAPER can crash if you pass an invalid track.

Convenience function which grants temporary access to the given track’s name (P_NAME).

Returns None if the given track is the master track.

Example
let session = reaper_medium::ReaperSession::default();

let track = session.reaper().get_track(CurrentProject, 0).ok_or("no track")?;
let track_name = unsafe {
    session.reaper().get_set_media_track_info_get_name(
        track,
        |name| name.to_owned()
    )
};
let track_name = match &track_name {
    None => "Master track",
    Some(name) => name.to_str()
};
session.reaper().show_console_msg(format!("Track name is {}", track_name));
Safety

REAPER can crash if you pass an invalid track.

Convenience function which sets the track’s name (P_NAME).

Example
let session = reaper_medium::ReaperSession::default();

let track = session.reaper().get_track(CurrentProject, 0).ok_or("no track")?;
unsafe {
    session.reaper().get_set_media_track_info_set_name(track, "Guitar");
}
Safety

REAPER can crash if you pass an invalid track.

Convenience function which returns the given track’s input monitoring mode (I_RECMON).

Safety

REAPER can crash if you pass an invalid track.

Convenience function which returns the given track’s solo mode (I_SOLO).

Safety

REAPER can crash if you pass an invalid track.

Convenience function which sets the track’s solo state (I_SOLO).

Safety

REAPER can crash if you pass an invalid track.

Convenience function which sets whether the track is shown in the mixer (B_SHOWINMIXER).

Do not use on master track.

Safety

REAPER can crash if you pass an invalid track.

Convenience function which sets whether the track is shown in the arrange view (B_SHOWINTCP).

Do not use on master track.

Safety

REAPER can crash if you pass an invalid track.

Convenience function which returns the given track’s pan mode (I_PANMODE).

Returns None if the track uses the project default.

Safety

REAPER can crash if you pass an invalid track.

Convenience function which returns the given track’s pan (D_PAN).

Safety

REAPER can crash if you pass an invalid track.

Convenience function which returns the given track’s dual-pan position 1 (D_DUALPANL).

Safety

REAPER can crash if you pass an invalid track.

Convenience function which returns the given track’s dual-pan position 2 (D_DUALPANR).

Safety

REAPER can crash if you pass an invalid track.

Convenience function which returns the given track’s width (D_WIDTH).

Safety

REAPER can crash if you pass an invalid track.

Convenience function which returns the given track’s recording input (I_RECINPUT).

Safety

REAPER can crash if you pass an invalid track.

Convenience function which returns the type and location of the given track (IP_TRACKNUMBER).

Safety

REAPER can crash if you pass an invalid track.

Convenience function which returns the given track’s GUID (GUID).

Safety

REAPER can crash if you pass an invalid track.

Returns whether we are in the real-time audio thread.

Real-time means somewhere between OnAudioBuffer calls, not in some worker or anticipative FX thread.

Returns whether audio is running at all.

Starts playing.

Stops playing.

Pauses playing.

Starts recording.

Informs control surfaces that the repeat mode has changed.

Doesn’t actually change the repeat mode.

Safety

REAPER can crash if you pass an invalid control surface.

Example
use reaper_medium::{NotificationBehavior::NotifyAll, ProjectContext::CurrentProject};

let track = session.reaper().get_track(CurrentProject, 0).ok_or("no tracks")?;
unsafe {
    session.reaper().csurf_set_repeat_state(true, NotifyAll);
}

Returns true if any track in the given project is soloed.

Panics

Panics if the given project is not valid anymore.

Like any_track_solo() but doesn’t check if project is valid.

Safety

REAPER can crash if you pass an invalid project.

Directly simulates a play button hit.

Panics

Panics if the given project is not valid anymore.

Like on_play_button_ex() but doesn’t check if project is valid.

Safety

REAPER can crash if you pass an invalid project.

Directly simulates a stop button hit.

Panics

Panics if the given project is not valid anymore.

Like on_stop_button_ex() but doesn’t check if project is valid.

Safety

REAPER can crash if you pass an invalid project.

Directly simulates a pause button hit.

Panics

Panics if the given project is not valid anymore.

Like on_pause_button_ex() but doesn’t check if project is valid.

Safety

REAPER can crash if you pass an invalid project.

Queries the current play state.

Panics

Panics if the given project is not valid anymore.

Like get_play_state_ex() but doesn’t check if project is valid.

Safety

REAPER can crash if you pass an invalid project.

Queries the current repeat state.

Panics

Panics if the given project is not valid anymore.

Like get_set_repeat_ex_get() but doesn’t check if project is valid.

Safety

REAPER can crash if you pass an invalid project.

Sets the repeat state.

Panics

Panics if the given project is not valid anymore.

Like get_set_repeat_ex_set() but doesn’t check if project is valid.

Safety

REAPER can crash if you pass an invalid project.

Grants temporary access to the data of the given marker/region.

The given index starts as 0 and counts both markers and regions.

Panics

Panics if the given project is not valid anymore.

Like enum_project_markers_3() but doesn’t check if project is valid.

Safety

REAPER can crash if you pass an invalid project.

Creates a PCM source from the given file name.

Errors

Returns an error if the PCM source could not be created.

Panics

Panics if the given file name is not valid UTF-8.

Creates a PCM source from a type identifier.

TODO-high Documentation/API … unstable

Use this if you’re going to load its state via LoadState/ProjectStateContext. Valid types include “WAVE”, “MIDI”, or whatever plug-ins define as well.

Errors

Returns an error if the PCM source could not be created.

Goes to the given marker.

Panics

Panics if the given project is not valid anymore.

Like go_to_marker() but doesn’t check if project is valid.

Safety

Seeks to the given region after the current one finishes playing (smooth seek).

Panics

Panics if the given project is not valid anymore.

Like go_to_region() but doesn’t check if project is valid.

Safety

REAPER can crash if you pass an invalid project.

Converts the given time into beats.

Panics

Panics if the given project is not valid anymore.

Like time_map_2_time_to_beats() but doesn’t check if project is valid.

Safety

REAPER can crash if you pass an invalid project.

Returns information about the given measure.

Panics

Panics if the given project is not valid anymore.

Like time_map_get_measure_info() but doesn’t check if project is valid.

Safety

REAPER can crash if you pass an invalid project.

Converts the given beat position to time, optionally starting from a specific measure.

Panics

Panics if the given project is not valid anymore.

Like time_map_2_beats_to_time() but doesn’t check if project is valid.

Safety

REAPER can crash if you pass an invalid project.

Converts the given quarter-note position to a measure index and returns the measure bounds in quarter notes.

Panics

Panics if the given project is not valid anymore.

Like time_map_qn_to_measures() but doesn’t check if project is valid.

Safety

REAPER can crash if you pass an invalid project.

Converts the given quarter-note position to time.

Panics

Panics if the given project is not valid anymore.

Like time_map_2_qn_to_time() but doesn’t check if project is valid.

Safety

REAPER can crash if you pass an invalid project.

Converts the given time to a quarter-note position.

Panics

Panics if the given project is not valid anymore.

Like time_map_2_time_to_qn() but doesn’t check if project is valid.

Safety

REAPER can crash if you pass an invalid project.

Converts the given quarter-note position to time.

Quarter notes are counted from the start of the project, regardless of any partial measures.

Panics

Panics if the given project is not valid anymore.

Like time_map_2_qn_to_time_abs() but doesn’t check if project is valid.

Safety

REAPER can crash if you pass an invalid project.

Converts the given time to a quarter-note position.

Quarter notes are counted from the start of the project, regardless of any partial measures.

Panics

Panics if the given project is not valid anymore.

Like time_map_2_time_to_qn_abs() but doesn’t check if project is valid.

Safety

REAPER can crash if you pass an invalid project.

Gets the arrange view start/end time for the given screen coordinates.

Set both screen_x_start and screen_x_end to 0 to get the full arrange view’s start/end time.

Panics

Panics if the given project is not valid anymore.

Like get_set_arrange_view_2_get() but doesn’t check if project is valid.

Safety

REAPER can crash if you pass an invalid project.

Returns the effective tempo in BPM at the given position (i.e. 2x in /8 signatures).

Panics

Panics if the given project is not valid anymore.

Like time_map_2_get_divided_bpm_at_time() but doesn’t check if project is valid.

Safety

REAPER can crash if you pass an invalid project.

Returns the current position of the edit cursor.

Panics

Panics if the given project is not valid anymore.

Like get_cursor_position_ex() but doesn’t check if project is valid.

Safety

REAPER can crash if you pass an invalid project.

Returns the latency-compensated actual-what-you-hear position.

Panics

Panics if the given project is not valid anymore.

Like get_play_position_ex() but doesn’t check if project is valid.

Safety

REAPER can crash if you pass an invalid project.

Returns the position of the next audio block being processed.

Panics

Panics if the given project is not valid anymore.

Like get_play_position_2_ex() but doesn’t check if project is valid.

Safety

REAPER can crash if you pass an invalid project.

Returns the number of markers and regions in the given project.

Panics

Panics if the given project is not valid anymore.

Like count_project_markers() but doesn’t check if project is valid.

Safety

REAPER can crash if you pass an invalid project.

Gets the last project marker before the given time and/or the project region that includes the given time.

Panics

Panics if the given project is not valid anymore.

Like get_last_marker_and_cur_region() but doesn’t check if project is valid.

Safety

REAPER can crash if you pass an invalid project.

Performs an action belonging to the main section.

To perform non-native actions (ReaScripts, custom or extension plugin actions) safely, see named_command_lookup().

Panics

Panics if the given project is not valid anymore.

Like main_on_command_ex() but doesn’t check if project is valid.

Safety

REAPER can crash if you pass an invalid project.

Sends an action command to the last focused MIDI editor.

Errors

Returns an error if no MIDI editor is open or if the view mode does not match the input.

Informs control surfaces that the given track’s mute state has changed.

Doesn’t actually change the mute state.

Safety

REAPER can crash if you pass an invalid track or an invalid control surface.

Example
use reaper_medium::{NotificationBehavior::NotifyAll, ProjectContext::CurrentProject};

let track = session.reaper().get_track(CurrentProject, 0).ok_or("no tracks")?;
unsafe {
    session.reaper().csurf_set_surface_mute(track, true, NotifyAll);
}

Informs control surfaces that the given track’s solo state has changed.

Doesn’t actually change the solo state.

Safety

REAPER can crash if you pass an invalid track or an invalid control surface.

Generates a random GUID.

Grants temporary access to the section with the given ID.

Example
use reaper_medium::SectionId;

let action_count =
    session.reaper().section_from_unique_id(SectionId::new(1), |s| s.action_list_cnt());

Like section_from_unique_id() but returns the section.

Safety

The lifetime of the returned section is unbounded.

Performs an action belonging to the main section.

Unlike main_on_command_ex(), this function also allows to control actions learned with MIDI/OSC.

Safety

REAPER can crash if you pass an invalid project or window.

Opens an action picker window for prompting the user to select an action.

Polls an action picker session which has been previously created via prompt_for_action_create().

Finishes an action picker session which has been previously created via prompt_for_action_create().

Returns the REAPER main window handle.

Returns the focused MIDI editor window.

Looks up the command ID for a named command.

Named commands can be registered by extensions (e.g. _SWS_ABOUT), ReaScripts (e.g. _113088d11ae641c193a2b7ede3041ad5) or custom actions.

Returns a project configuration variable descriptor to be used with project_config_var_addr

Returns the project configuration object at the given address.

Like project_config_var_addr() but doesn’t check if project is valid.

Safety

REAPER can crash if you pass an invalid project.

Returns the REAPER preference with the given name.

Clears the ReaScript console.

Safety

REAPER can crash if you pass an invalid track. AudioAccessor has to be destroyed.

Safety

REAPER can crash if you pass an invalid take. AudioAccessor has to be destroyed.

Should be called after using of AudioAccessor.

Safety

REAPER can crash if you pass an invalid audio accessor.

Returns true if the underlying samples (track or media item take) have changed

Note

Does not update the audio accessor, so the user can selectively call AudioAccessorValidateState only when needed.

Safety

REAPER can crash if you pass an invalid audio accessor.

Force the accessor to reload its state from the underlying track or media item take.

Safety

REAPER can crash if you pass an invalid audio accessor.

Validates the current state of the audio accessor.

Returns true if the state changed.

Safety

REAPER can crash if you pass an invalid audio accessor.

Get the end time of the audio that can be returned from this accessor.

Safety

REAPER can crash if you pass an invalid audio accessor.

Get the start time of the audio that can be returned from this accessor.

Safety

REAPER can crash if you pass an invalid audio accessor.

Get a block of samples from the audio accessor.

Samples are extracted immediately pre-FX, and returned interleaved (first sample of first channel, first sample of second channel…).

Returns false if no audio, true if audio

Safety

REAPER can crash if you pass an invalid audio accessor.

Returns the number of tracks in the given project.

Panics

Panics if the given project is not valid anymore.

Like count_tracks() but doesn’t check if project is valid.

Safety

REAPER can crash if you pass an invalid project.

Returns an integer that changes when the project state changes.

Panics

Panics if the given project is not valid anymore.

Like get_project_state_change_count() but doesn’t check if project is valid.

Safety

REAPER can crash if you pass an invalid project.

Returns the number of items in the given project.

Panics

Panics if the given project is not valid anymore.

Like count_media_items() but doesn’t check if project is valid.

Safety

REAPER can crash if you pass an invalid project.

Returns the length of the given project.

The length is the maximum of end of media item, markers, end of regions and tempo map.

Panics

Panics if the given project is not valid anymore.

Like get_project_length() but doesn’t check if project is valid.

Safety

REAPER can crash if you pass an invalid project.

Sets the position of the edit cursor and optionally moves the view and/or seeks.

Panics

Panics if the given project is not valid anymore.

Like set_edit_curs_pos_2() but doesn’t check if project is valid.

Safety

REAPER can crash if you pass an invalid project.

Returns the loop point or time selection time range that’s currently set in the given project.

Panics

Panics if the given project is not valid anymore.

Like get_set_loop_time_range_2_get() but doesn’t check if project is valid.

Safety

REAPER can crash if you pass an invalid project.

Sets the loop point or time selection time range for the given project.

Panics

Panics if the given project is not valid anymore.

Like get_set_loop_time_range_2_set() but doesn’t check if project is valid.

Safety

REAPER can crash if you pass an invalid project.

Creates a new track at the given index.

Resets all MIDI devices.

Returns the maximum number of MIDI input devices (usually 63).

Returns the maximum number of MIDI output devices (usually 64).

Returns information about the given MIDI input device.

With buffer_size you can tell REAPER how many bytes of the device name you want. If you are not interested in the device name at all, pass 0.

Returns information about the given MIDI output device.

With buffer_size you can tell REAPER how many bytes of the device name you want. If you are not interested in the device name at all, pass 0.

Returns a new pitch shift API instance.

Version must be raw::REAPER_PITCHSHIFT_API_VER.

Returns information about the given pitch shift mode.

Start querying modes at 0. Returns None when no more modes possible.

Grants temporary access to the name of the given pitch shift sub mode.

Start querying modes at 0. Returns None when no more sub modes possible.

Returns a new resample instance.

Returns the name of the given resample mode.

Start querying modes at 0. Returns None when no more sub modes possible.

Returns the index of the first FX instance in a track or monitoring FX chain.

The FX name can have a prefix to further specify its type: VST3: | VST2: | VST: | AU: | JS: | DX:

Safety

REAPER can crash if you pass an invalid track.

Returns the parameter index corresponding to the given identifier.

Safety

REAPER can crash if you pass an invalid track.

Adds an instance of an FX to a track or monitoring FX chain.

See track_fx_add_by_name_query() for possible FX name prefixes.

Errors

Returns an error if the FX couldn’t be added (e.g. if no such FX is installed).

Safety

REAPER can crash if you pass an invalid track.

Returns whether the given track FX is enabled.

Safety

REAPER can crash if you pass an invalid track.

Returns whether the given track FX is offline.

Safety

REAPER can crash if you pass an invalid track.

Returns the name of the given FX.

With buffer_size you can tell REAPER how many bytes of the FX name you want.

Panics

Panics if the given buffer size is 0.

Errors

Returns an error if the FX doesn’t exist.

Safety

REAPER can crash if you pass an invalid track.

Returns the name of the given track send or hardware output send.

With buffer_size you can tell REAPER how many bytes of the send name you want.

When choosing the send index, keep in mind that the hardware output sends (if any) come first.

Panics

Panics if the given buffer size is 0.

Errors

Returns an error if the track send doesn’t exist.

Safety

REAPER can crash if you pass an invalid track.

Returns the name of the given track receive.

With buffer_size you can tell REAPER how many bytes of the receive name you want.

Panics

Panics if the given buffer size is 0.

Errors

Returns an error if the track send doesn’t exist.

Safety

REAPER can crash if you pass an invalid track.

Returns the index of the first track FX that is a virtual instrument.

Doesn’t look in the input FX chain.

Safety

REAPER can crash if you pass an invalid track.

Enables or disables a track FX.

Safety

REAPER can crash if you pass an invalid track.

Sets the given track FX offline or online.

Safety

REAPER can crash if you pass an invalid track.

Returns the number of parameters of given track FX.

Safety

REAPER can crash if you pass an invalid track.

Returns the audio device input/output latency in samples.

Returns the current project if it’s just being loaded or saved.

This is usually only used from project_config_extension_t.

Returns the name of the given track FX parameter.

With buffer_size you can tell REAPER how many bytes of the parameter name you want.

Panics

Panics if the given buffer size is 0.

Errors

Returns an error if the FX or parameter doesn’t exist.

Safety

REAPER can crash if you pass an invalid track.

Returns the current value of the given track FX parameter formatted as string.

With buffer_size you can tell REAPER how many bytes of the parameter value string you want.

Panics

Panics if the given buffer size is 0.

Errors

Returns an error if the FX or parameter doesn’t exist.

Safety

REAPER can crash if you pass an invalid track.

Returns the given value formatted as string according to the given track FX parameter.

With buffer_size you can tell REAPER how many bytes of the parameter value string you want.

This only works with FX that supports Cockos VST extensions.

Panics

Panics if the given buffer size is 0.

Errors

Returns an error if the FX or parameter doesn’t exist. Also errors if the FX doesn’t support formatting arbitrary parameter values and the given value is not equal to the current one. If the given value is equal to the current one, it’s just like calling track_fx_get_formatted_param_value.

Safety

REAPER can crash if you pass an invalid track.

Sets the value of the given track FX parameter.

Errors

Returns an error if the FX or parameter doesn’t exist.

Safety
  • REAPER can crash if you pass an invalid track.
  • Calling this from any other thread than the main thread causes undefined behavior!
  • However, there’s one exception: Calling it in a real-time thread directly “from the track” which is currently processing is okay, and only for REAPER >= v6.52+dev0323. Previous REAPER versions will send control surface change notifications, in the wrong thread. Newer versions don’t send any notifications when this function is called in real-time.

Notifies REAPER that we are done changing parameter values

This is important for automation mode Touch.

Errors

Returns an error if the FX or parameter doesn’t exist.

Safety
  • REAPER can crash if you pass an invalid track.
  • Calling this from any other thread than the main thread causes undefined behavior!
  • However, there’s one exception: Calling it in a real-time thread directly “from the track” which is currently processing is okay, and only for REAPER >= v6.52+dev0323. Previous REAPER versions will send control surface change notifications, in the wrong thread. Newer versions don’t send any notifications when this function is called in real-time.
👎Deprecated: use get_focused_fx_2 instead

Returns information about the (last) focused FX window.

Returns Some if an FX window has focus or was the last focused one and is still open.

Returns None otherwise.

Returns information about the focused FX window.

Returns Some if an FX window has focus or was the last focused one and is still open. The wrapped value contains additional information about whether the window is still focused.

Returns None otherwise.

Returns information about the last touched FX parameter.

Returns Some if an FX parameter has been touched already and that FX is still existing. Returns None otherwise.

Copies, moves or reorders FX.

Reorders if source and destination track are the same.

Safety

REAPER can crash if you pass an invalid track.

Removes the given FX from the track FX chain.

Errors

Returns an error if the FX doesn’t exist.

Safety

REAPER can crash if you pass an invalid track.

Returns information about the given FX parameter’s step sizes.

Returns None if the FX parameter doesn’t report step sizes or if the FX or parameter doesn’t exist (there’s no way to distinguish with just this function).

Safety
  • REAPER can crash if you pass an invalid track.
  • Calling this from any other thread than the main thread causes undefined behavior!
  • However, there’s one exception: Calling it in a real-time thread directly “from the track” which is currently processing should be okay.

Returns the current value and min/mid/max values of the given track FX.

Safety
  • REAPER can crash if you pass an invalid track.
  • Calling this from any other thread than the main thread causes undefined behavior!
  • However, there’s one exception: Calling it in a real-time thread directly “from the track” which is currently processing should be okay.

Gets a plug-in specific named configuration value.

With buffer_size you can tell REAPER and the FX how many bytes of the value you want.

Named parameters are a vendor-specific VST extension from Cockos (see http://reaper.fm/sdk/vst/vst_ext.php).

Errors

Returns an error if the given FX doesn’t have this named parameter or doesn’t support named parameters.

Safety

REAPER can crash if you pass an invalid track.

Like track_fx_get_named_config_parm but interpreting the result as a string.

Errors

Returns an error if the given FX doesn’t have this named parameter, doesn’t support named parameters or if the returned data doesn’t resemble a proper string.

Safety

REAPER can crash if you pass an invalid track.

Sets a plug-in specific named configuration value.

Named parameters are a vendor-specific VST extension from Cockos (see http://reaper.fm/sdk/vst/vst_ext.php).

Errors

Returns an error if the given FX doesn’t have this named parameter or doesn’t support named parameters.

Safety

REAPER can crash if you pass an invalid track.

Starts a new undo block.

Panics

Panics if the given project is not valid anymore.

Example
use reaper_medium::{ProjectContext::CurrentProject, UndoScope::Scoped, ProjectPart::*};

session.reaper().undo_begin_block_2(CurrentProject);
// ... modify something ...
session.reaper().undo_end_block_2(CurrentProject, "Modify something", Scoped(Items | Fx));

Like undo_begin_block_2() but doesn’t check if project is valid.

Safety

REAPER can crash if you pass an invalid project.

Ends the current undo block.

Panics

Panics if the given project is not valid anymore.

Like undo_end_block_2() but doesn’t check if project is valid.

Safety

REAPER can crash if you pass an invalid project.

Grants temporary access to the the description of the last undoable operation, if any.

Panics

Panics if the given project is not valid anymore.

Like undo_can_undo_2() but doesn’t check if project is valid.

Safety

REAPER can crash if you pass an invalid project.

Grants temporary access to the description of the next redoable operation, if any.

Panics

Panics if the given project is not valid anymore.

Like undo_can_redo_2() but doesn’t check if project is valid.

Safety

REAPER can crash if you pass an invalid project.

Makes the last undoable operation undone.

Returns false if there was nothing to be undone.

Panics

Panics if the given project is not valid anymore.

Like undo_do_undo_2() but doesn’t check if project is valid.

Safety

REAPER can crash if you pass an invalid project.

Executes the next redoable action.

Returns false if there was nothing to be redone.

Panics

Panics if the given project is not valid anymore.

Like undo_do_redo_2() but doesn’t check if project is valid.

Safety

REAPER can crash if you pass an invalid project.

Marks the given project as dirty.

Dirty means the project needs to be saved. Only makes a difference if “Maximum undo memory” is not 0 in REAPER’s preferences (0 disables undo/prompt to save).

Panics

Panics if the given project is not valid anymore.

Like mark_project_dirty() but doesn’t check if project is valid.

Safety

REAPER can crash if you pass an invalid project.

Returns whether the given project is dirty.

Always returns false if “Maximum undo memory” is 0 in REAPER’s preferences.

Also see mark_project_dirty()

Panics

Panics if the given project is not valid anymore.

Like is_project_dirty() but doesn’t check if project is valid.

Safety

REAPER can crash if you pass an invalid project.

Notifies all control surfaces that something in the track list has changed.

Behavior not confirmed.

Returns the version of the REAPER application in which this plug-in is currently running.

Returns the track automation mode, regardless of the global override.

Safety

REAPER can crash if you pass an invalid track.

Returns the custom color of the given track.

Safety

REAPER can crash if you pass an invalid track.

Extracts an RGB color from the given OS-dependent color.

Runs the system color chooser dialog.

Returns None if the user cancels the dialog.

Sets the track automation mode.

Safety

REAPER can crash if you pass an invalid track.

Returns the global track automation override, if any.

Sets the global track automation override.

Returns the track envelope for the given track and configuration chunk name.

Safety

REAPER can crash if you pass an invalid track.

Returns the track envelope for the given track and envelope display name.

For getting common envelopes (like volume or pan) using get_track_envelope_by_chunk_name() is better because it provides more type safety.

Safety

REAPER can crash if you pass an invalid track.

Returns the current peak volume for the given track channel.

Safety

REAPER can crash if you pass an invalid track.

Gets a track attribute as numerical value.

Safety

REAPER can crash if you pass an invalid track.

Gets a track track send, hardware output send or track receive attribute as numerical value.

Safety

REAPER can crash if you pass an invalid track.

Counts the number of items in the given track.

Safety

REAPER can crash if you pass an invalid track.

Counts the number of FX parameter knobs displayed on the track control panel.

Safety

REAPER can crash if you pass an invalid track.

Returns information about a specific FX parameter knob displayed on the track control panel.

Safety

REAPER can crash if you pass an invalid track.

Returns the media item on the given track at the given index.

Safety

REAPER can crash if you pass an invalid track.

Gets the number of FX instances on the given track’s normal FX chain.

Safety

REAPER can crash if you pass an invalid track.

Gets the number of FX instances on the given track’s input FX chain.

On the master track, this refers to the monitoring FX chain.

Safety

REAPER can crash if you pass an invalid track.

Returns the GUID of the given track FX.

Errors

Returns an error if the FX doesn’t exist.

Safety

REAPER can crash if you pass an invalid track.

Returns the current value of the given track FX in REAPER-normalized form.

If the returned value is lower than zero, it can mean two things. Either there was an error, e.g. the FX or parameter doesn’t exist, or the parameter can take exotic values. There’s no way to distinguish between both cases. See ReaperNormalizedFxParamValue for details.

Safety
  • REAPER can crash if you pass an invalid track.
  • Calling this from any other thread than the main thread causes undefined behavior!
  • However, there’s one exception: Calling it in a real-time thread directly “from the track” which is currently processing should be okay.

Returns the master track of the given project.

Panics

Panics if the given project is not valid anymore.

Like get_master_track() but doesn’t check if project is valid.

Safety

REAPER can crash if you pass an invalid project.

Converts the given GUID to a string (including braces).

Converts the given accelerator key to a human-readable name.

Returns the project recording path.

With buffer_size you can tell REAPER how many bytes of the resulting path you want.

Panics

Panics if the given buffer size is 0.

Like get_project_path_ex() but doesn’t check if project is valid.

Safety

REAPER can crash if you pass an invalid project.

Returns the master tempo of the current project.

Sets the current tempo of the given project.

Panics

Panics if the given project is not valid anymore.

Like set_current_bpm() but doesn’t check if project is valid.

Safety

REAPER can crash if you pass an invalid project.

Converts the given playback speed factor to a normalized play rate.

Converts the given normalized play rate to a playback speed factor.

Returns the master play rate of the given project.

Panics

Panics if the given project is not valid anymore.

Like master_get_play_rate() but doesn’t check if project is valid.

Safety

REAPER can crash if you pass an invalid project.

Sets the master play rate of the current project.

Shows a message box to the user.

Blocks the main thread.

Displays a text close to the transport bar.

Parses the given string as GUID.

Errors

Returns an error if the given string is not a valid GUID string.

Sets the input monitoring mode of the given track.

Returns the new value.

Safety

REAPER can crash if you pass an invalid track.

Sets the input monitoring mode of the given track.

Has fewer side effects than Reaper::csurf_on_input_monitoring_change_ex and allows more fine-grained control of track grouping behavior.

Safety

REAPER can crash if you pass an invalid track.

Scrolls the mixer so that the given track is the leftmost visible track.

Returns the leftmost visible track after scrolling, which may be different from the given track if there are not enough tracks to its right. Not exactly sure what it’s supposed to mean if this returns None, but it happens at times.

Safety

REAPER can crash if you pass an invalid track.

Creates a new media item.

Safety

REAPER can crash if you pass an invalid track.

Deletes the given media item.

Errors

Returns an error if not successful.

Safety

REAPER can crash if you pass an invalid track or item.

Creates a new take in an item.

Safety

REAPER can crash if you pass an invalid item.

Sets the position of the given item.

Errors

Returns an error if not successful.

Safety

REAPER can crash if you pass an invalid item.

Sets the length of the given item.

Errors

Returns an error if not successful.

Safety

REAPER can crash if you pass an invalid item.

Selects or unselects the given media item.

Safety

REAPER can crash if you pass an invalid item.

Sets a track attribute as numerical value.

Errors

Returns an error if an invalid (e.g. non-numerical) track attribute key is passed.

Safety

REAPER can crash if you pass an invalid track.

Sets a track track send, hardware output send or track receive attribute as numerical value.

Errors

Returns an error if an invalid (e.g. non-numerical) attribute key is passed.

Safety

REAPER can crash if you pass an invalid track.

Stuffs a 3-byte MIDI message into a queue or send it to an external MIDI hardware.

Example
use helgoboss_midi::test_util::note_on;
use reaper_medium::StuffMidiMessageTarget::VirtualMidiKeyboardQueue;

session.reaper().stuff_midi_message(VirtualMidiKeyboardQueue, note_on(0, 64, 100));

Converts a decibel value into a volume slider value.

Converts a volume slider value into a decibel value.

Returns the given track’s volume and incomplete pan. Also returns the correct value during the process of writing an automation envelope.

Errors

Returns an error if not successful (unclear when this happens).

Safety

REAPER can crash if you pass an invalid track.

Returns the given track’s mute state. Also returns the correct value during the process of writing an automation envelope.

Errors

Returns an error if not successful (unclear when this happens).

Safety

REAPER can crash if you pass an invalid track.

Returns the given track’s complete pan. Also returns the correct value during the process of writing an automation envelope.

Errors

Returns an error if not successful (unclear when this happens).

Safety

REAPER can crash if you pass an invalid track.

Informs control surfaces that the given track’s volume has changed.

Doesn’t actually change the volume.

Safety

REAPER can crash if you pass an invalid track or an invalid control surface.

Sets the given track’s volume, also supports relative changes and gang.

Returns the new value. I think this only deviates if 0.0 is sent. Then it returns a slightly higher value - the one which actually corresponds to -150 dB.

Safety

REAPER can crash if you pass an invalid track.

Sets the given track’s volume, also supports relative changes and gang.

Returns the new value. I think this only deviates if 0.0 is sent. Then it returns a slightly higher value - the one which actually corresponds to -150 dB.

Has fewer side effects than Reaper::csurf_on_volume_change_ex and allows more fine-grained control of track grouping behavior.

Safety

REAPER can crash if you pass an invalid track.

Informs control surfaces that the given track’s pan has been changed.

Doesn’t actually change the pan.

Safety

REAPER can crash if you pass an invalid track or an invalid control surface.

Sets the given track’s pan. Also supports relative changes and gang.

Returns the new value.

Safety

REAPER can crash if you pass an invalid track.

Sets the given track’s pan. Also supports relative changes and gang.

Returns the new value.

Has fewer side effects than Reaper::csurf_on_pan_change_ex and allows more fine-grained control of track grouping behavior.

Safety

REAPER can crash if you pass an invalid track.

Sets the given track’s polarity (phase).

Returns the new value.

Safety

REAPER can crash if you pass an invalid track.

Sets the given track’s width. Also supports relative changes and gang.

Returns the new value.

Safety

REAPER can crash if you pass an invalid track.

Sets the given track’s width. Also supports relative changes and gang.

Returns the new value.

Has fewer side effects than Reaper::csurf_on_width_change_ex and allows more fine-grained control of track grouping behavior.

Safety

REAPER can crash if you pass an invalid track.

Counts the number of selected tracks in the given project.

Panics

Panics if the given project is not valid anymore.

Like count_selected_tracks_2() but doesn’t check if project is valid.

Safety

REAPER can crash if you pass an invalid project.

Selects or deselects the given track.

Safety

REAPER can crash if you pass an invalid track.

Returns a selected track from the given project.

Panics

Panics if the given project is not valid anymore.

Like get_selected_track_2() but doesn’t check if project is valid.

Safety

REAPER can crash if you pass an invalid project.

Returns a selected item from the given project.

Panics

Panics if the given project is not valid anymore.

Like get_selected_media_item() but doesn’t check if project is valid.

Safety

REAPER can crash if you pass an invalid project.

Returns the media source of the given media item take.

Safety

REAPER can crash if you pass an invalid take.

Unstable!!!

Returns the project which contains this item.

Safety

REAPER can crash if you pass an invalid item.

Returns the active take in this item.

Safety

REAPER can crash if you pass an invalid item.

Returns the take that is currently being edited in the given MIDI editor.

Safety

REAPER can crash if you pass an invalid window.

Selects exactly one track and deselects all others.

If None is passed, deselects all tracks.

Safety

REAPER can crash if you pass an invalid track.

Deletes the given track.

Safety

REAPER can crash if you pass an invalid track.

Returns the number of track sends, hardware output sends or track receives of the given track.

Safety

REAPER can crash if you pass an invalid track.

Gets or sets an attribute of the given track send, hardware output send or track receive.

Returns the current value if new_value is null_mut().

Safety

REAPER can crash if you pass an invalid track or invalid new value.

Convenience function which returns the destination track (P_SRCTRACK) of the given track send or track receive.

The given index starts at zero for both track sends and receives.

Errors

Returns an error e.g. if the send or receive doesn’t exist.

Safety

REAPER can crash if you pass an invalid track.

Convenience function which returns the destination track (P_DESTTRACK) of the given track send or track receive.

The given index starts at zero for both track sends and receives.

Errors

Returns an error e.g. if the send or receive doesn’t exist.

Safety

REAPER can crash if you pass an invalid track.

Returns the RPPXML state of the given track.

With buffer_size you can tell REAPER how many bytes of the chunk you want.

Panics

Panics if the given buffer size is 0.

Errors

Returns an error if not successful (unclear when this happens).

Safety

REAPER can crash if you pass an invalid track.

Prompts the user for string values.

If a caption begins with *, for example *password, the edit field will not display the input text. The maximum number of fields is 16. Values are returned as a comma-separated string.

You can supply special extra information via additional caption fields:

  • extrawidth=XXX to increase text field width
  • separator=X to use a different separator for returned fields

With buffer_size you can tell REAPER how many bytes of the resulting CSV you want.

Panics

Panics if the given buffer size is 0.

Creates a track send, track receive or hardware output send for the given track.

Returns the index of the created track send (starting from 0) or of the created hardware output send (also starting from 0).

Errors

Returns an error if not successful (unclear when this happens).

Safety

REAPER can crash if you pass an invalid track.

Example
use reaper_medium::{ProjectContext::CurrentProject, SendTarget::HardwareOutput};

let src_track = session.reaper().get_track(CurrentProject, 0).ok_or("no tracks")?;
let send_index = unsafe {
    session.reaper().create_track_send(src_track, HardwareOutput)?;
};

Removes a track send, track receive or hardware output send from the given track.

Errors

Returns an error if not successful (unclear when this happens).

Safety

REAPER can crash if you pass an invalid track.

Arms or disarms the given track for recording.

Returns the new value.

Safety

REAPER can crash if you pass an invalid track.

Arms or disarms the given track for recording.

Returns the new value.

Has fewer side effects than Reaper::csurf_on_rec_arm_change_ex and allows more fine-grained control of track grouping behavior.

Safety

REAPER can crash if you pass an invalid track.

Mutes or unmutes the given track.

Seems to return the mute state that has been set.

Safety

REAPER can crash if you pass an invalid track.

Mutes or unmutes the given track.

Returns the new value.

Has fewer side effects than Reaper::csurf_on_mute_change_ex and allows more fine-grained control of track grouping behavior.

Safety

REAPER can crash if you pass an invalid track.

Soloes or unsoloes the given track.

Seems to return the solo state that has been set.

Safety

REAPER can crash if you pass an invalid track.

Soloes or unsoloes the given track.

TODO-high The return value will change in future. Not clear yet how to interpret it.

Returns the new value.

Has fewer side effects than Reaper::csurf_on_solo_change_ex and allows more fine-grained control of track grouping behavior.

Safety

REAPER can crash if you pass an invalid track.

Sets the RPPXML state of the given track.

Errors

Returns an error if not successful (for example if the given chunk is not accepted).

Safety

REAPER can crash if you pass an invalid track.

Shows or hides an FX user interface.

Safety

REAPER can crash if you pass an invalid track.

Returns the floating window handle of the given FX, if there is any.

Safety

REAPER can crash if you pass an invalid track.

Returns whether the user interface of the given FX is open.

Open means either visible in the FX chain window or visible in a floating window.

Safety

REAPER can crash if you pass an invalid track.

Returns the visibility state of the given track’s normal FX chain.

Safety

REAPER can crash if you pass an invalid track.

Returns the visibility state of the master track.

Safety

REAPER can crash if you pass an invalid track.

Sets the visibility state of the master track and returns the previous one.

Safety

REAPER can crash if you pass an invalid track.

Returns the visibility state of the given track’s input FX chain.

Safety

REAPER can crash if you pass an invalid track.

Sets the volume of the given track send or hardware output send.

When choosing the send index, keep in mind that the hardware output sends (if any) come first.

Returns the new value. If the send doesn’t exist, returns 0.0 (which can also be a valid value that has been set, so that’s not very useful).

Safety

REAPER can crash if you pass an invalid track.

Sets the pan of the given track send or hardware output send.

When choosing the send index, keep in mind that the hardware output sends (if any) come first.

Returns the new value.

Safety

REAPER can crash if you pass an invalid track.

Grants temporary access to the name of the action registered under the given command ID within the specified section.

Returns None if the action doesn’t exist.

Safety

REAPER can crash if you pass an invalid section.

Grants temporary access to the REAPER resource path.

This is the path to the directory where INI files are stored and other things in subdirectories.

Grants temporary access to the name of the given take.

Error

Returns an error if the take is not valid.

Returns the current on/off state of a toggleable action.

Returns None if the action doesn’t support on/off states (or if the action doesn’t exist).

Safety

REAPER can crash if you pass an invalid section.

Returns the current on/off state of a toggleable action, taking the section ID.

Returns None if the action doesn’t support on/off states (or if the action doesn’t exist).

Grants temporary access to the name of the command registered under the given command ID.

The string will not start with _ (e.g. it will return SWS_ABOUT).

Returns None if the given command ID is a built-in action or if there’s no such ID.

Returns the volume and pan of the given track send or hardware output send. Also returns the correct value during the process of writing an automation envelope.

When choosing the send index, keep in mind that the hardware output sends (if any) come first.

Errors

Returns an error if the send doesn’t exist.

Safety

REAPER can crash if you pass an invalid track.

Returns the volume and pan of the given track receive. Also returns the correct value during the process of writing an automation envelope.

Errors

Returns an error if the send doesn’t exist.

Safety

REAPER can crash if you pass an invalid track.

Returns whether the given track send or hardware output send is muted. Also returns the correct value during the process of writing an automation envelope.

When choosing the send index, keep in mind that the hardware output sends (if any) come first.

Errors

Returns an error if the send doesn’t exist.

Safety

REAPER can crash if you pass an invalid track.

Returns whether the given track receive is muted. Also returns the correct value during the process of writing an automation envelope.

Errors

Returns an error if the send doesn’t exist.

Safety

REAPER can crash if you pass an invalid track.

Toggles the mute state of the given track send, hardware output send or track receive.

Errors

Returns an error if the send doesn’t exist.

Safety

REAPER can crash if you pass an invalid track.

Sets the volume of the given track send, hardware output send or track receive.

Errors

Returns an error if the send doesn’t exist.

Safety

REAPER can crash if you pass an invalid track.

Sets the pan of the given track send, hardware output send or track receive.

Errors

Returns an error if the send doesn’t exist.

Safety

REAPER can crash if you pass an invalid track.

Returns the index of the currently selected FX preset as well as the total preset count.

Safety

REAPER can crash if you pass an invalid track.

Selects a preset of the given track FX.

Errors

Returns an error e.g. if the FX doesn’t exist.

Safety

REAPER can crash if you pass an invalid track.

Navigates within the presets of the given track FX.

Errors

Returns an error e.g. if the FX doesn’t exist.

Safety

REAPER can crash if you pass an invalid track.

Example
use reaper_medium::ProjectContext::CurrentProject;
use reaper_medium::TrackFxLocation::NormalFxChain;

let track = session.reaper().get_track(CurrentProject, 0).ok_or("no tracks")?;
// Navigate 2 presets "up"
unsafe {
    session.reaper().track_fx_navigate_presets(track, NormalFxChain(0), -2)?
};

Returns information about the currently selected preset of the given FX.

Currently selected means the preset which is currently showing in the REAPER dropdown.

With buffer size you can tell REAPER how many bytes of the preset name you want. If you are not interested in the preset name at all, pass 0.

Safety

REAPER can crash if you pass an invalid track.

Grants temporary access to an already open MIDI input device.

Passes None to the given function if the device doesn’t exist, is not connected or is not already opened. The device must be enabled in REAPER’s MIDI preferences.

This function is typically called in the audio hook. But it’s also okay to call it in a VST plug-in as long as is_in_real_time_audio() returns true. If you are in the main thread and want to check if the device is open, use get_midi_input_is_open().

See audio hook for an example.

Design

The device is not just returned because then we would have to mark this function as unsafe. Returning the device would tempt the consumer to cache the pointer somewhere, which is bad because the MIDI device can appear/disappear anytime and REAPER doesn’t notify us about it. If we would call get_read_buf() on a cached pointer and the MIDI device is gone, REAPER would crash.

Calling this function in every audio hook invocation is fast enough and the official way to tap MIDI messages directly. Because of that we take a closure and pass a reference.

Returns if the given device is open (enabled in REAPER’s MIDI preferences).

Grants temporary access to an already open MIDI output device.

Passes None to the given function if the device doesn’t exist, is not connected or is not already opened. The device must be enabled in REAPER’s MIDI preferences.

This function is typically called in the audio hook. But it’s also okay to call it in a VST plug-in as long as is_in_real_time_audio() returns true. If you are in the main thread and want to check if the device is open, use get_midi_output_is_open().

See audio hook for an example.

Returns if the given device is open (enabled in REAPER’s MIDI preferences).

Parses the given string as pan value.

When in doubt, it returns 0.0 (center).

Formats the given pan value.

Formats the given volume value.

Formats the given position in time.

With buffer_size you can tell REAPER how many bytes of the time string you want.

Panics

Panics if the given buffer size is 0.

Returns information about the currently open audio device.

With buffer_size you can tell REAPER how many bytes of the information you want.

Panics

Panics if the given buffer size is 0.

Formats the given duration, starting from the given timeline position offset.

With buffer_size you can tell REAPER how many bytes of the time string you want.

Panics

Panics if the given buffer size is 0.

Inserts the given file as new media item.

Errors

Returns an error when inserting the file failed.

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
Convert 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 more
Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait. Read more
Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s. Read more
Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.