Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

One Small Step v0.1 (initial release) #1307

Merged
merged 4 commits into from
Feb 7, 2024

Conversation

BenTalagan
Copy link
Contributor

This is a PR for releasing the very first version of a new tool, One Small Step, which is an alternative step input method for REAPER.

It uses the tracks FX input chains instead of the MIDI control path, and adds other input methods (sustain pedal validation, REAPER action validation).

Copy link
Member

@cfillion cfillion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Packaging looks all good, I can release this as-is. 👍

I've also posted a few general observations/suggestions that might be relevant below.


function stop()
updateToolbarButtonState(0);
reaper.ImGui_DestroyContext(ctx);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function no-op currently and will removed in ReaImGui 0.9, I highly recommend enabling the backward-compatibility module (imgui.lua) to shield the script against such breaking changes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The compatibility module is now enabled.

package.path = debug.getinfo(1,"S").source:match[[^@?(.*[\/])[^\/]-$]] .."?.lua;".. package.path;

local engine_lib = require "talagan_OneSmallStep/talagan_OneSmallStep Engine lib";
engine_lib.setNoteLen("1");
Copy link
Member

@cfillion cfillion Feb 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A nice trick you can do to avoid having to keep in sync multiple small files like this:

@provides
  author_Some source file.lua > author_Install name - 1.lua
  author_Some source file.lua > author_Install name - 2.lua
  author_Some source file.lua > author_Install name - Foo.lua
  author_Some source file.lua > author_Install name - Bar.lua

Then have that one source file detect at runtime what it's meant to be:

local SCRIPT_NAME <const> = select(2, reaper.get_action_context()):match("([^/\\_]+)%.lua$")
local SLOT <const> = tonumber(script_name:match("%- (%d+)"))

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks ! i'll take a little time to correct my PR on this point.

Copy link
Contributor Author

@BenTalagan BenTalagan Feb 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed for the various note lengths. (Edit : And also for the note len modifiers).

-- @license MIT
-- @description This is part of One Small Step

return "\z
Copy link
Member

@cfillion cfillion Feb 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Out of curiosity, why did you encode the images as Lua files instead raw PNG blobs/CreateImage?

The original intent behind CreateImageFromMem was to allow embedding small image data directly into the script's source, or packing multiple ones in a single file. Though I guess this works too. 😄

There's also the option of creating an image map, one big PNG and only showing portion of it each time. That should be more efficient than multiple small images too.

Copy link
Contributor Author

@BenTalagan BenTalagan Feb 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It required a bit of archeology to recall why I've used this technique 😆 - I wrote OSS recently, but took some parts from an older script. I'm not sure exactly, but it's probable that I simply got inspired by the demo because it is my main source for learning (more than the API) and I copied how it was done there. Having all those little icons as lua files reminded me how we embed XPM icons in Qt/C++ projects for example, and this is a pattern I'm used too. But yeah, I admit it looks funny there ! For this time I'll probably leave things as they are since this is working but I keep the idea of the big PNG for the next version.

-------------------------

--[[
# Ruby script to convert from png > lua to load binary img for ReaImGui
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's also "Dump file to string literal" in ReaPack for that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool ! I didn't have the reflex to check in ReaPack for those little convenient tools. Thanks for the tip !

Comment on lines 9 to 11
puts "slider#{3*note + 10}<0,127,1>Note #{note} Pitch"
puts "slider#{3*note + 1 + 10}<0,15,1> Note #{note} Channel"
puts "slider#{3*note + 2 + 10}<0,127,1>Note #{note} Velocity"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

REAPER v6.74 added JSFX pre-processing so that JSFX code can generate itself.

https://www.reaper.fm/sdk/js/preproc.php

An example of it used to generate sliders: https://github.com/ReaTeam/JSFX/blob/99510175e9fa087eac446df3b66dedb5e264d4fa/Utility/mschnell_Inter%20Track%20Parameter%20Modulation.jsfx#L26.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missed that one. This is insane 😄 I'm going to give it a try !

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, this opens up a new world ! So cool ! Thanks for pointing me to this worthy feature.

@BenTalagan
Copy link
Contributor Author

@cfillion , I think I've finished this pass of corrections. I let you have the last word !

@cfillion cfillion merged commit d47571a into ReaTeam:master Feb 7, 2024
1 check passed
@BenTalagan BenTalagan deleted the one_small_step/v0.1 branch February 23, 2024 16:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants