Skip to content

Commit

Permalink
Fix small mistakes in docs (#109)
Browse files Browse the repository at this point in the history
  • Loading branch information
ales-tsurko authored May 25, 2020
1 parent c790a90 commit 1342a85
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 52 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ license-file = "LICENSE"
name = "fpsdk"
readme = "README.md"
repository = "https://github.com/tonikasoft/fpsdk"
version = "1.0.2"
version = "1.0.3"

[package.metadata.docs.rs]
targets = [ "x86_64-apple-darwin", "x86_64-pc-windows-msvc" ]
Expand Down
65 changes: 33 additions & 32 deletions src/host.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ impl Host {

/// Let the host show a hint, as specified by the parameters.
///
/// - `tag` - the plugin's tag
/// - `text` - the text to show as a hint
/// - `tag` - the plugin's tag.
/// - `text` - the text to show as a hint.
///
/// There is one extra feature of parameter hints. It is possible to tell FL Studio to show
/// little icons next to the hint, that have a special meaning. For the moment there are three
Expand All @@ -101,11 +101,11 @@ impl Host {
/// - `"^d"` - shows a mouse with the right button clicked, to denote a control that has a
/// popup menu.
/// - `"^e"` - shows an unhappy smiley, to use when something went wrong.
/// - `"^f"` - shows a left-pointing arrow
/// - `"^g"` - shows a double right-pointing arrow, for fast forward
/// - `"^h"` - is an exclamation mark, for a warning to the user
/// - `"^i"` - is an hourglass
/// - `"^j"` - shows a double left-pointing arrow, for fast reverse
/// - `"^f"` - shows a left-pointing arrow.
/// - `"^g"` - shows a double right-pointing arrow, for fast forward.
/// - `"^h"` - is an exclamation mark, for a warning to the user.
/// - `"^i"` - is an hourglass.
/// - `"^j"` - shows a double left-pointing arrow, for fast reverse.
pub fn on_hint(&mut self, tag: plugin::Tag, text: String) {
unsafe {
host_on_hint(
Expand Down Expand Up @@ -221,13 +221,14 @@ impl Host {

/// Get one of the buffers.
///
/// - `kind` the kind of the buffer you want to get (see [`Buffer`](../enum.Buffer.html)).
/// - `kind` the kind of the buffer you want to get
/// (see [`host::Buffer`](../host/enum.Buffer.html)).
/// - `length` is the buffer length (use the length of the output buffer passed to the render
/// function).
///
/// The buffers are valid only during
/// [`Plugin::render`](../plugin/trait.Plugin.html#method.render) (i.e. it's supposed to be
/// used inside this method only).
/// [`Plugin::render`](../plugin/trait.Plugin.html#method.render) (i.e. it's supposed to be used
/// inside this method only).
pub fn buffer(
&mut self,
tag: plugin::Tag,
Expand Down Expand Up @@ -555,7 +556,7 @@ extern "C" {
fn host_on_out_voice_event(host: *mut c_void, tag: intptr_t, message: FlMessage) -> intptr_t;
}

/// Message from the host to the plugin
/// Message from the host to the plugin.
#[derive(Debug)]
pub enum Message<'a> {
/// Contains the handle of the parent window if the editor has to be shown.
Expand All @@ -566,7 +567,7 @@ pub enum Message<'a> {
ProcessMode(ProcessModeFlags),
/// The continuity of processing is broken. This means that the user has jumped ahead or back
/// in the playlist, for example. When this happens, the plugin needs to clear all buffers and
/// start like new
/// start like new.
///
/// **Warning: this can be called from the mixer thread!**
Flush,
Expand All @@ -576,31 +577,31 @@ pub enum Message<'a> {
SetBlockSize(u32),
/// This changes the sample rate.
///
/// Value holds the new sample rate
/// Value holds the new sample rate.
SetSampleRate(u32),
/// This allows the plugin to define how the editor window should be resized.
///
/// The first value will hold a pointer to a rectangle (PRect) for the minimum (Left and Top)
/// and maximum (Right and Bottom) width and height of the window
/// and maximum (Right and Bottom) width and height of the window.
///
/// The second value holds a pointer (PPoint) to a point structure that defines by how much the
/// window size should change horizontally and vertically when the user drags the border.
WindowMinMax(*mut c_void, *mut c_void),
/// (not used yet) The host has noticed that too much processing power is used and asks the
/// plugin to kill its weakest voice.
///
/// The plugin has to return `true` if it did anything, `false` otherwise
/// The plugin has to return `true` if it did anything, `false` otherwise.
KillVoice,
/// Only full generators have to respond to this message. It's meant to allow the cutoff and
/// resonance parameters of a voice to be used for other purposes, if the generator doesn't use
/// them as cutoff and resonance.
///
/// - return `0u8` if the plugin doesn't support the default per-voice level value
/// - return `0u8` if the plugin doesn't support the default per-voice level value.
/// - return `1u8` if the plugin supports the default per-voice level value (filter cutoff (0)
/// or filter resonance (1))
/// or filter resonance (1)).
/// - return `2u8` if the plugin supports the per-voice level value, but for another function
/// (then check [`GetName::VoiceLevel`](../host/enum.GetName.html#variant.VoiceLevel) to
/// provide your own names)
/// provide your own names).
UseVoiceLevels(u8),
/// Called when the user selects a preset.
///
Expand All @@ -622,11 +623,11 @@ pub enum Message<'a> {
///
/// The value is playing status.
///
/// **Warning: can be called from the mixing thread**
/// **Warning: can be called from the mixing thread.**
SetPlaying(bool),
/// The song position has jumped from one position to another non-consecutive position
/// The song position has jumped from one position to another non-consecutive position.
///
/// **Warning: can be called from the mixing thread**
/// **Warning: can be called from the mixing thread.**
SongPosChanged,
/// The time signature has changed.
///
Expand All @@ -652,44 +653,44 @@ pub enum Message<'a> {
///
/// The value holds filename.
LoadFile(String),
/// Set fit to time in beats
/// Set fit to time in beats.
///
/// The value holds the time.
SetFitTime(f32),
/// Sets the number of samples in each tick. This value changes when the tempo, ppq or sample
/// rate have changed.
///
/// **Warning: can be called from the mixing thread**
/// **Warning: can be called from the mixing thread.**
SetSamplesPerTick(f32),
/// Sets the frequency at which Idle is called.
///
/// The value holds the new time (milliseconds)
/// The value holds the new time (milliseconds).
SetIdleTime(u64),
/// (FL 7.0) The host has focused/unfocused the editor (focused in the value) (plugin can use
/// this to steal keyboard focus)
/// this to steal keyboard focus).
SetFocus(bool),
/// (FL 8.0) This is sent by the host for special transport messages, from a controller.
///
/// The value is the type of message (see [`Transport`](../enum.Transport.html))
/// The value is the type of message (see [`Transport`](../enum.Transport.html)).
///
/// Result should be `true` if handled, `false` otherwise
/// Result should be `true` if handled, `false` otherwise.
Transport(Transport),
/// (FL 8.0) Live MIDI input preview. This allows the plugin to steal messages (mostly for
/// transport purposes).
///
/// The value has the packed MIDI message. Only note on/off for now.
///
/// Result should be `true` if handled, `false` otherwise
/// Result should be `true` if handled, `false` otherwise.
MidiIn(MidiMessage),
/// Mixer routing changed, must use
/// [`PluginMessage::GetInOuts`](../plugin/enum.PluginMessage.html#variant.GetInOuts) if
/// necessary
/// necessary.
RoutingChanged,
/// Retrieves info about a parameter.
///
/// The value is the parameter number.
///
/// see [`ParameterFlags`](../struct.ParameterFlags.html) for the result
/// see [`ParameterFlags`](../struct.ParameterFlags.html) for the result.
GetParamInfo(usize),
/// Called after a project has been loaded, to leave a chance to kill automation (that could be
/// loaded after the plugin is created) if necessary.
Expand All @@ -709,8 +710,8 @@ pub enum Message<'a> {
///
/// Result has to be:
///
/// * `0i32` - default number
/// * `-1i32` - none
/// * `0i32` - default number.
/// * `-1i32` - none.
PreferredNumIo(u8),
/// Unknown message.
Unknown,
Expand Down
16 changes: 8 additions & 8 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ impl From<TimeFormat> for u8 {
}
}

/// Time
/// Time.
///
/// The first value is mixing time.
///
Expand Down Expand Up @@ -354,9 +354,9 @@ pub struct NameColor {
pub index: usize,
}

/// Type used in FFI for [`NameColor`](struct.NameColor.html).
// Type used in FFI for [`NameColor`](struct.NameColor.html).
#[repr(C)]
pub struct TNameColor {
struct TNameColor {
name: [u8; 256],
vis_name: [u8; 256],
color: c_int,
Expand Down Expand Up @@ -432,7 +432,7 @@ impl From<c_int> for MidiMessage {

/// Collection of notes, which you can add to the piano roll using
/// [`Host::on_message`](host/struct.Host.html#on_message.new) with message
/// [`plugin::Message::AddToPianoRoll`](../plugin/enum.Message.html#variant.AddToPianoRoll).
/// [`plugin::message::AddToPianoRoll`](./plugin/message/struct.AddToPianoRoll.html).
#[derive(Debug)]
pub struct Notes {
// 0=step seq (not supported yet), 1=piano roll
Expand Down Expand Up @@ -472,7 +472,7 @@ pub struct Note {
}

bitflags! {
/// Notes parameters flags
/// Notes parameters flags.
pub struct NotesFlags: isize {
/// Delete everything currently on the piano roll before adding the notes.
const EMPTY_FIRST = 1;
Expand Down Expand Up @@ -520,7 +520,7 @@ pub struct ParamMenuEntry {
}

bitflags! {
/// Parameter popup menu item flags
/// Parameter popup menu item flags.
pub struct ParamMenuItemFlags: i32 {
/// The item is disabled
const DISABLED = 1;
Expand Down Expand Up @@ -592,7 +592,7 @@ bitflags! {
}

bitflags! {
/// Processing parameters flags
/// Processing parameters flags.
pub struct ProcessParamFlags: isize {
/// Update the value of the parameter.
const UPDATE_VALUE = 1;
Expand All @@ -619,7 +619,7 @@ bitflags! {
}

bitflags! {
/// Sample loading flags
/// Sample loading flags.
pub struct SampleLoadFlags: isize {
///This tells the sample loader to show an open box, for the user to select a sample
const SHOW_DIALOG = 1;
Expand Down
22 changes: 11 additions & 11 deletions src/plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ macro_rules! create_plugin {

/// This trait must be implemented for your plugin.
pub trait Plugin: std::fmt::Debug + RefUnwindSafe + Send + Sync + 'static {
/// Initializer
/// Initializer.
fn new(host: Host, tag: Tag) -> Self
where
Self: Sized;
Expand Down Expand Up @@ -107,11 +107,11 @@ pub trait Plugin: std::fmt::Debug + RefUnwindSafe + Send + Sync + 'static {
/// Called from GUI thread.
fn idle(&mut self) {}
/// Gets called before a new tick is mixed (not played), if the plugin added
/// [`PluginBuilder::want_new_tick`](../struct.InfoBuilder.html#method.want_new_tick) into
/// [`InfoBuilder::want_new_tick`](../plugin/struct.InfoBuilder.html#method.want_new_tick) into
/// [`Info`](../struct.Info.html).
///
/// Internal controller plugins should call
/// [`host::Host::on_control_change`](../host/struct.Host.html#method.on_control_change) from
/// [`host::Host::on_controller`](../host/struct.Host.html#method.on_controller) from
/// here.
///
/// Called from mixer thread.
Expand All @@ -135,7 +135,7 @@ pub trait Plugin: std::fmt::Debug + RefUnwindSafe + Send + Sync + 'static {
/// The host will call this when there's new MIDI data available. This function is only called
/// when the plugin has called the
/// [`host::Host::on_message`](../host/struct.Host.html#method.on_message) with
/// [`plugin::PluginMessage::WantMidiInput`](enum.PluginMessage.html#variant.WantMidiInput) and
/// [`plugin::message::WantMidiInput`](../plugin/message/struct.WantMidiInput.html) and
/// value set to `true`.
///
/// Can be called from GUI or mixer threads.
Expand All @@ -155,21 +155,21 @@ pub trait Plugin: std::fmt::Debug + RefUnwindSafe + Send + Sync + 'static {
#[derive(Debug)]
pub struct Info {
/// This has to be the version of the SDK used to create the plugin. This value is
/// available in the constant CurrentSDKVersion
/// available in the constant CurrentSDKVersion.
pub sdk_version: u32,
/// The name of the plugin dll, without the extension (.dll)
/// The name of the plugin dll, without the extension (.dll).
pub long_name: *mut c_char,
/// Short plugin name, to be used in labels to tell the user which plugin he is working
/// with
/// with.
pub short_name: *mut c_char,
flags: u32,
/// The number of parameters for this plugin
/// The number of parameters for this plugin.
pub num_params: u32,
/// Preferred (default) maximum polyphony (FL Studio manages the polyphony) (0=infinite)
/// Preferred (default) maximum polyphony (FL Studio manages the polyphony) (0=infinite).
pub def_poly: u32,
/// Number of internal output controllers
/// Number of internal output controllers.
pub num_out_ctrls: u32,
/// Number of internal output voices
/// Number of internal output voices.
pub num_out_voices: u32,
}

Expand Down

0 comments on commit 1342a85

Please sign in to comment.