Lua method parameters

Actually, I’m trying to dig into Lua more by trial and error, since many methods and their parameters are not explained in detail in the Lua Bindings Class Reference.
For example, I don’t know what parameters 4,8 and 9 in new_audio_track() do, and I wished I could find out, what these do.
Is there a way to find that out for all these methods? Maybe in the source code? But I guess, in this case I’m a little lost, since I wouldn’t know, where to start there.
Any hints on that?

I am going to share with you a trick which is useful when working with source code, in general.

Install ripgrep and then move into Ardour’s source code directory and run:

rg new_audio_track

It will find you all usages of new_audio_track, including its definition and some Lua scripts calling it. That should be enough, but we know that definitions in C/C++ are stored in header files (with *.h or *.hpp extenson) so let’s refine our search a bit, and show 10 lines (there are 9 parameters) after our match:

rg new_audio_track -g '*.{h,hpp}' -A10

We get:

        std::list<std::shared_ptr<AudioTrack> > new_audio_track (
                int input_channels,
                int output_channels,
                RouteGroup* route_group,
                uint32_t how_many,
                std::string name_template,
                PresentationInfo::order_t order,
                TrackMode mode = Normal,
                bool input_auto_connect = true,
                bool trigger_visibility = false
                );

Which should be what you are looking for! This is why FLOSS is awesome :slight_smile:

3 Likes

That’s awesome, mate! Thank you! :blush:

1 Like

The Lua Bindings Class Reference page uses documentation from the source-code (doxygen comments). Sadly many of Ardour’s API methods are not documented.

Initially I had the goal to document methods when adding Lua bindings for each of them, but in recent years that good intention turned out to be road to hell :slight_smile:

But as @fretboard mentioned you can just look it up the source-code.
You can also use the search feature of github (top-left on GitHub - Ardour/ardour: Mirror of Ardour Source Code).

1 Like

I’m aware that it’s a big task to create a documentation for the API and maintaing such a nice piece of software, like Ardour is! So, just a big thanks to all at this point, who are working hard on the development of Ardour to make it such a great, flexible and affordable DAW! :hugs:

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.