From 6aad482c99548c9c9a567576b46a9a8cfe0783b9 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Sat, 8 Oct 2016 02:27:56 +0200 Subject: [PATCH] update lua class doc --- .../24_lua-scripting/02_class_reference.html | 318 +++++++++++++++++- 1 file changed, 313 insertions(+), 5 deletions(-) diff --git a/_manual/24_lua-scripting/02_class_reference.html b/_manual/24_lua-scripting/02_class_reference.html index 01ec712..2833668 100644 --- a/_manual/24_lua-scripting/02_class_reference.html +++ b/_manual/24_lua-scripting/02_class_reference.html @@ -316,6 +316,7 @@ Pointer Classes cannot be created in lua scripts. It always requires a call to C voiduncombine (Region) Cast AudioPlaylistto_audioplaylist () + MidiPlaylistto_midiplaylist ()

Inherited from ARDOUR:SessionObject

@@ -543,6 +544,22 @@ Pointer Classes cannot be created in lua scripts. It always requires a call to C
boolisnil ()
boolsameinstance (Automatable)
+

 ARDOUR:AutomatableSequence

+

C‡: boost::shared_ptr< ARDOUR::AutomatableSequence<Evoral::Beats> >, boost::weak_ptr< ARDOUR::AutomatableSequence<Evoral::Beats> >

+

is-a: ARDOUR:Automatable

+
+ + + + + + +
Methods
boolisnil ()
boolsameinstance (AutomatableSequence)
Cast
Sequenceto_sequence ()
+

Inherited from ARDOUR:Automatable

+ + + +
Methods
AutomationControlautomation_control (Parameter, bool)

 ARDOUR:AutomationControl

C‡: boost::shared_ptr< ARDOUR::AutomationControl >, boost::weak_ptr< ARDOUR::AutomationControl >

is-a: PBD:Controllable

@@ -1083,6 +1100,7 @@ Pointer Classes cannot be created in lua scripts. It always requires a call to C

A convenience function for colorspace HSL to RGB conversion. All ranges are 0..1

Example:

 local r, g, b, a = ARDOUR.LuaAPI.hsla_to_rgba (hue, saturation, luminosity, alpha)

Returns 4 parameters: red, green, blue, alpha (in range 0..1)

Processornew_luaproc (Session, std::string)

create a new Lua Processor (Plugin)

s
Session Handle
p
Identifier or Name of the Processor

Returns Processor object (may be nil)

+ NotePtrnew_noteptr (unsigned char, Beats, Beats, unsigned char, unsigned char) Processornew_plugin (Session, std::string, PluginType, std::string)

create a new Plugin Instance

s
Session Handle
id
Plugin Name, ID or URI
type
Plugin Type

Returns Processor or nil

PluginInfonew_plugin_info (std::string, PluginType) @@ -1114,10 +1132,11 @@ Pointer Classes cannot be created in lua scripts. It always requires a call to C intanalyze (Readable, unsigned int, Lua-Function)

high-level abstraction to process a single channel of the given Readable.

If the plugin is not yet initialized, initialize() is called.

if is not nil, it is called with the immediate Vamp::Plugin::Features on every process call.

r
readable
channel
channel to process
fn
lua callback function

Returns 0 on success

boolinitialize () -

initialize the plugin for use with analyze().

This is equivalent to plugin():initialise (1, 512, 1024) and prepares a plugin for analyze.

Manual initialization is only required to set plugin-parameters which depend on prior initialization of the plugin.

 vamp:reset ()
+

initialize the plugin for use with analyze().

This is equivalent to plugin():initialise (1, ssiz, bsiz) and prepares a plugin for analyze. (by preferred step and block sizes are used. if the plugin does not specify them or they're larger than 8K, both are set to 1024)

Manual initialization is only required to set plugin-parameters which depend on prior initialization of the plugin.

 vamp:reset ()
  vamp:initialize ()
  vamp:plugin():setParameter (0, 1.5, nil)
  vamp:analyze (r, 0)
+ StringVectorlist_plugins () Pluginplugin () FeatureSetprocess (FloatArrayVector, RealTime)

process given array of audio-samples.

This is a lua-binding for vamp:plugin():process ()

d
audio-data, the vector must match the configured channel count and hold a complete buffer for every channel as set during plugin():initialise()
rt
timestamp matching the provided buffer.

Returns features extracted from that data (if the plugin is causal)

@@ -1201,6 +1220,129 @@ Pointer Classes cannot be created in lua scripts. It always requires a call to C unsigned longsize () ...table (--lua--) +

 ARDOUR:MidiModel

+

C‡: boost::shared_ptr< ARDOUR::MidiModel >, boost::weak_ptr< ARDOUR::MidiModel >

+

is-a: ARDOUR:AutomatableSequence

+
+

This is a higher level (than MidiBuffer) model of MIDI data, with separate representations for notes (instead of just unassociated note on/off events) and controller data. Controller data is represented as part of the Automatable base (i.e. in a map of AutomationList, keyed by Parameter). Because of this MIDI controllers and automatable controllers/widgets/etc are easily interchangeable.

+ + + + + + + +
Methods
voidapply_command (Session, Command)
boolisnil ()
NoteDiffCommandnew_note_diff_command (std::string)

Start a new NoteDiff command.

This has no side-effects on the model or Session, the returned command can be held on to for as long as the caller wishes, or discarded without formality, until apply_command is called and ownership is taken.

boolsameinstance (MidiModel)
+

Inherited from ARDOUR:AutomatableSequence

+ + + +
Cast
Sequenceto_sequence ()
+

Inherited from ARDOUR:Automatable

+ + + +
Methods
AutomationControlautomation_control (Parameter, bool)
+

 ARDOUR:MidiModel:DiffCommand

+

C‡: ARDOUR::MidiModel::DiffCommand

+

is-a: PBD:Command

+
+

Base class for Undo/Redo commands and changesets

+

This class object is only used indirectly as return-value and function-parameter. It provides no methods by itself.

+

Inherited from PBD:Command

+ + + + +
Methods
std::stringname ()
voidset_name (std::string)
+

Inherited from PBD:Stateful

+ + + + + + +
Methods
voidclear_changes ()

Forget about any changes to this object's properties

IDid ()
OwnedPropertyListproperties ()
+

 ARDOUR:MidiModel:NoteDiffCommand

+

C‡: ARDOUR::MidiModel::NoteDiffCommand

+

is-a: ARDOUR:MidiModel:DiffCommand

+
+

Base class for Undo/Redo commands and changesets

+ + + + +
Methods
voidadd (NotePtr)
voidremove (NotePtr)
+

Inherited from PBD:Command

+ + + + +
Methods
std::stringname ()
voidset_name (std::string)
+

Inherited from PBD:Stateful

+ + + + + + +
Methods
voidclear_changes ()

Forget about any changes to this object's properties

IDid ()
OwnedPropertyListproperties ()
+

 ARDOUR:MidiPlaylist

+

C‡: boost::shared_ptr< ARDOUR::MidiPlaylist >, boost::weak_ptr< ARDOUR::MidiPlaylist >

+

is-a: ARDOUR:Playlist

+
+

A named object associated with a Session. Objects derived from this class are expected to be destroyed before the session calls drop_references().

+ + + + + +
Methods
boolisnil ()
boolsameinstance (MidiPlaylist)
voidset_note_mode (NoteMode)
+

Inherited from ARDOUR:Playlist

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Methods
voidadd_region (Region, long, float, bool, int)
Regioncombine (RegionList)
unsigned intcount_regions_at (long)
Playlistcut (AudioRangeList&, bool)
DataTypedata_type ()
voidduplicate (Region, long, long, float)
gap
from the beginning of the region to the next beginning
voidduplicate_range (AudioRange&, float)
voidduplicate_until (Region, long, long, long)
gap
from the beginning of the region to the next beginning
end
the first frame that does _not_ contain a duplicated frame
Regionfind_next_region (long, RegionPoint, int)
longfind_next_region_boundary (long, int)
voidlower_region (Region)
voidlower_region_to_bottom (Region)
unsigned intn_regions ()
voidraise_region (Region)
voidraise_region_to_top (Region)
Regionregion_by_id (ID)
RegionListPtrregion_list ()
RegionListPtrregions_at (long)
RegionListPtrregions_touched (long, long)
start
Range start.
end
Range end.

Returns regions which have some part within this range.

RegionListPtrregions_with_end_within (Range)
RegionListPtrregions_with_start_within (Range)
voidremove_region (Region)
voidsplit (long)
voidsplit_region (Region, long, int)
Regiontop_region_at (long)
Regiontop_unmuted_region_at (long)
voiduncombine (Region)
Cast
AudioPlaylistto_audioplaylist ()
MidiPlaylistto_midiplaylist ()
+

Inherited from ARDOUR:SessionObject

+ + + + + + +
Methods
std::stringname ()
Cast
Statefulto_stateful ()
StatefulDestructibleto_statefuldestructible ()

 ARDOUR:MidiPort

C‡: boost::shared_ptr< ARDOUR::MidiPort >, boost::weak_ptr< ARDOUR::MidiPort >

is-a: ARDOUR:Port

@@ -1237,6 +1379,101 @@ Pointer Classes cannot be created in lua scripts. It always requires a call to C AudioPortto_audioport () MidiPortto_midiport () +

 ARDOUR:MidiRegion

+

C‡: boost::shared_ptr< ARDOUR::MidiRegion >, boost::weak_ptr< ARDOUR::MidiRegion >

+

is-a: ARDOUR:Region

+
+

A named object associated with a Session. Objects derived from this class are expected to be destroyed before the session calls drop_references().

+ + + + + + + + +
Methods
booldo_export (std::string)

Export the MIDI data of the MidiRegion to a new MIDI file (SMF).

boolisnil ()
MidiSourcemidi_source (unsigned int)
MidiModelmodel ()
boolsameinstance (MidiRegion)
+

Inherited from ARDOUR:Region

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Methods
boolat_natural_position ()
boolautomatic ()
boolcan_move ()
boolcaptured ()
voidclear_sync_position ()
boolcovers (long)
voidcut_end (long, int)
voidcut_front (long, int)
DataTypedata_type ()
boolexternal ()
boolhidden ()
boolimport ()
boolis_compound ()
unsigned intlayer ()
longlength ()
boollocked ()
voidlower ()
voidlower_to_bottom ()
voidmove_start (long, int)
voidmove_to_natural_position ()
boolmuted ()
voidnudge_position (long)
boolopaque ()
longposition ()

How the region parameters play together:

POSITION: first frame of the region along the timeline START: first frame of the region within its source(s) LENGTH: number of frames the region represents

boolposition_locked ()
voidraise ()
voidraise_to_top ()
voidset_hidden (bool)
voidset_initial_position (long)

A gui may need to create a region, then place it in an initial position determined by the user. When this takes place within one gui operation, we have to reset _last_position to prevent an implied move.

voidset_length (long, int)
voidset_locked (bool)
voidset_muted (bool)
voidset_opaque (bool)
voidset_position (long, int)
voidset_position_locked (bool)
voidset_start (long)
voidset_sync_position (long)

Set the region's sync point.

absolute_pos
Session time.
voidset_video_locked (bool)
floatshift ()
longstart ()
floatstretch ()
boolsync_marked ()
LuaTable(long, ...)sync_offset (int&)
longsync_position ()

Returns Sync position in session time

voidtrim_end (long, int)
voidtrim_front (long, int)
voidtrim_to (long, long, int)
boolvideo_locked ()
boolwhole_file ()
Cast
MidiRegionto_midiregion ()
Readableto_readable ()
+

Inherited from ARDOUR:SessionObject

+ + + + + + +
Methods
std::stringname ()
Cast
Statefulto_stateful ()
StatefulDestructibleto_statefuldestructible ()
+

 ARDOUR:MidiSource

+

C‡: boost::shared_ptr< ARDOUR::MidiSource >, boost::weak_ptr< ARDOUR::MidiSource >

+

is-a: ARDOUR:Source

+
+

Source for MIDI data

+ + + + + + + +
Methods
boolempty ()
boolisnil ()
longlength (long)
MidiModelmodel ()
boolsameinstance (MidiSource)

 ARDOUR:MidiTrack

C‡: boost::shared_ptr< ARDOUR::MidiTrack >, boost::weak_ptr< ARDOUR::MidiTrack >

is-a: ARDOUR:Track

@@ -1645,6 +1882,7 @@ Pointer Classes cannot be created in lua scripts. It always requires a call to C voiduncombine (Region) Cast AudioPlaylistto_audioplaylist () + MidiPlaylistto_midiplaylist ()

Inherited from ARDOUR:SessionObject

@@ -2070,6 +2308,7 @@ Pointer Classes cannot be created in lua scripts. It always requires a call to C +
boolvideo_locked ()
boolwhole_file ()
Cast
MidiRegionto_midiregion ()
Readableto_readable ()

Inherited from ARDOUR:SessionObject

@@ -2857,6 +3096,9 @@ Pointer Classes cannot be created in lua scripts. It always requires a call to C Methods MeterSectionadd_meter (Meter, double, BBT_TIME, long, PositionLockStyle) TempoSectionadd_tempo (Tempo, double, long, Type, PositionLockStyle) + BBT_TIMEbbt_at_frame (long) + doubleexact_beat_at_frame (long, int) + doubleexact_qn_at_frame (long, int) MeterSectionmeter_section_at_beat (double) MeterSectionmeter_section_at_frame (long) TempoSectiontempo_section_at_frame (long) @@ -3534,6 +3776,9 @@ Pointer Classes cannot be created in lua scripts. It always requires a call to C

Musical time in beats.

+ + +
Constructor
Evoral.Beats (double)

Create from a real number of beats.

Methods
doubleto_double ()
@@ -3614,6 +3859,20 @@ Pointer Classes cannot be created in lua scripts. It always requires a call to C unsigned intsize () longtime () +

 Evoral:NotePtr

+

C‡: boost::shared_ptr< Evoral::Note<Evoral::Beats> >, boost::weak_ptr< Evoral::Note<Evoral::Beats> >

+
+ + + + + + + + + + +
Methods
unsigned charchannel ()
boolisnil ()
Beatslength ()
unsigned charnote ()
unsigned charoff_velocity ()
boolsameinstance (NotePtr)
Beatstime ()
unsigned charvelocity ()

 Evoral:Parameter

C‡: Evoral::Parameter

@@ -3653,6 +3912,15 @@ Pointer Classes cannot be created in lua scripts. It always requires a call to C longfrom longto +

 Evoral:Sequence

+

C‡: boost::shared_ptr< Evoral::Sequence<Evoral::Beats> >, boost::weak_ptr< Evoral::Sequence<Evoral::Beats> >

+

is-a: Evoral:ControlSet

+
+ + + + +
Methods
boolisnil ()
boolsameinstance (Sequence)

 LuaSignal:Set

C‡: std::bitset<47ul>

@@ -3896,6 +4164,10 @@ Pointer Classes cannot be created in lua scripts. It always requires a call to C + + + +
Constructor
Timecode.BBT_TIME (unsigned int, unsigned int, unsigned int)
Data Members
unsigned intbars
unsigned intbeats
unsigned intticks

 Vamp:Plugin

C‡: Vamp::Plugin

@@ -3904,8 +4176,26 @@ Pointer Classes cannot be created in lua scripts. It always requires a call to C

Vamp::Plugin is a base class for plugin instance classes that provide feature extraction from audio or related data.

In most cases, the input will be audio and the output will be a stream of derived data at a lower sampling resolution than the input.

Note that this class inherits several abstract methods from PluginBase. These must be implemented by the subclass.

PLUGIN LIFECYCLE

Feature extraction plugins are managed differently from real-time plugins (such as VST effects). The main difference is that the parameters for a feature extraction plugin are configured before the plugin is used, and do not change during use.

1. Host constructs the plugin, passing it the input sample rate. The plugin may do basic initialisation, but should not do anything computationally expensive at this point. You must make sure your plugin is cheap to construct, otherwise you'll seriously affect the startup performance of almost all hosts. If you have serious initialisation to do, the proper place is in initialise() (step 5).

2. Host may query the plugin's available outputs.

3. Host queries programs and parameter descriptors, and may set some or all of them. Parameters that are not explicitly set should take their default values as specified in the parameter descriptor. When a program is set, the parameter values may change and the host will re-query them to check.

4. Host queries the preferred step size, block size and number of channels. These may all vary depending on the parameter values. (Note however that you cannot make the number of distinct outputs dependent on parameter values.)

5. Plugin is properly initialised with a call to initialise. This fixes the step size, block size, and number of channels, as well as all of the parameter and program settings. If the values passed in to initialise do not match the plugin's advertised preferred values from step 4, the plugin may refuse to initialise and return false (although if possible it should accept the new values). Any computationally expensive setup code should take place here.

6. Host finally checks the number of values, resolution, extents etc per output (which may vary depending on the number of channels, step size and block size as well as the parameter values).

7. Host will repeatedly call the process method to pass in blocks of input data. This method may return features extracted from that data (if the plugin is causal).

8. Host will call getRemainingFeatures exactly once, after all the input data has been processed. This may return any non-causal or leftover features.

9. At any point after initialise was called, the host may optionally call the reset method and restart processing. (This does not mean it can change the parameters, which are fixed from initialise until destruction.)

A plugin does not need to handle the case where setParameter or selectProgram is called after initialise has been called. It's the host's responsibility not to do that. Similarly, the plugin may safely assume that initialise is called no more than once.

+ + + + + + + + + + + + + + + + + +
Methods
InputDomaingetInputDomain ()

Get the plugin's required input domain.

If this is TimeDomain, the samples provided to the process() function (below) will be in the time domain, as for a traditional audio processing plugin.

If this is FrequencyDomain, the host will carry out a windowed FFT of size equal to the negotiated block size on the data before passing the frequency bin data in to process(). The input data for the FFT will be rotated so as to place the origin in the centre of the block. The plugin does not get to choose the window type -- the host will either let the user do so, or will use a Hanning window.

unsigned longgetMaxChannelCount ()

Get the maximum supported number of input channels.

unsigned longgetMinChannelCount ()

Get the minimum supported number of input channels.

OutputListgetOutputDescriptors ()

Get the outputs of this plugin. An output's index in this list is used as its numeric index when looking it up in the FeatureSet returned from the process() call.

unsigned longgetPreferredBlockSize ()

Get the preferred block size (window size -- the number of sample frames passed in each block to the process() function). This should be called before initialise().

A plugin that can handle any block size may return 0. The final block size will be set in the initialise() call.

unsigned longgetPreferredStepSize ()

Get the preferred step size (window increment -- the distance in sample frames between the start frames of consecutive blocks passed to the process() function) for the plugin. This should be called before initialise().

A plugin may return 0 if it has no particular interest in the step size. In this case, the host should make the step size equal to the block size if the plugin is accepting input in the time domain. If the plugin is accepting input in the frequency domain, the host may use any step size. The final step size will be set in the initialise() call.

FeatureSetgetRemainingFeatures ()

After all blocks have been processed, calculate and return any remaining features derived from the complete input.

std::stringgetType ()

Used to distinguish between Vamp::Plugin and other potential sibling subclasses of PluginBase. Do not reimplement this function in your subclass.

boolinitialise (unsigned long, unsigned long, unsigned long)

Initialise a plugin to prepare it for use with the given number of input channels, step size (window increment, in sample frames) and block size (window size, in sample frames).

The input sample rate should have been already specified at construction time.

Return true for successful initialisation, false if the number of input channels, step size and/or block size cannot be supported.

voidreset ()

Reset the plugin after use, to prepare it for another clean run. Not called for the first initialisation (i.e. initialise must also do a reset).

Inherited from Vamp:PluginBase

@@ -3930,8 +4220,6 @@ Pointer Classes cannot be created in lua scripts. It always requires a call to C - - @@ -3978,6 +4266,7 @@ Pointer Classes cannot be created in lua scripts. It always requires a call to C + @@ -4153,6 +4442,11 @@ Pointer Classes cannot be created in lua scripts. It always requires a call to C
  • Evoral.InterpolationStyle.Linear
  • Evoral.InterpolationStyle.Curved
  • +

     Vamp.Plugin.InputDomain

    +
      +
    • Vamp.Plugin.InputDomain.TimeDomain
    • +
    • Vamp.Plugin.InputDomain.FrequencyDomain
    • +

     Vamp.Plugin.OutputDescriptor.SampleType

    • Vamp.Plugin.OutputDescriptor.SampleType.OneSamplePerStep
    • @@ -4247,6 +4541,11 @@ Pointer Classes cannot be created in lua scripts. It always requires a call to C
    • ARDOUR.MeterPoint.MeterOutput
    • ARDOUR.MeterPoint.MeterCustom
    +

     ARDOUR.NoteMode

    +
      +
    • ARDOUR.NoteMode.Sustained
    • +
    • ARDOUR.NoteMode.Percussive
    • +

     ARDOUR.PortFlags

    - + -
    Ardour 5.4-25-gb233a56  -  Wed, 05 Oct 2016 04:37:46 +0200
    +
    Ardour 5.4-66-g40a57f2  -  Sat, 08 Oct 2016 01:49:55 +0200
    -- 2.37.2

    Get the version number of the plugin.

    StringVectorgetPrograms ()

    Get the program settings available in this plugin. A program is a named shorthand for a set of parameter values; changing the program may cause the plugin to alter the values of its published parameters (and/or non-public internal processing parameters). The host should re-read the plugin's parameter values after setting a new program.

    The programs must have unique names.

    std::stringgetType ()

    Get the type of plugin. This is to be implemented by the immediate subclass, not by actual plugins. Do not attempt to implement this in plugin code.

    voidselectProgram (std::string)

    Select a program. (If the given program name is not one of the available programs, do nothing.)

    voidsetParameter (std::string, float)
    Vamp.Plugin.FeatureSet ()
    Methods
    LuaTableadd (LuaTable {Feature})
    ...at (--lua--)
    voidclear ()
    unsigned longcount (int)
    boolempty ()