-
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Playtime: Add a simple Playtime main preset for generic grid controllers
- Loading branch information
Showing
1 changed file
with
70 additions
and
0 deletions.
There are no files selected for viewing
70 changes: 70 additions & 0 deletions
70
resources/main-presets/factory/generic/grid/playtime.preset.luau
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
--- name: Generic grid controller - Playtime | ||
--- realearn_version: 2.16.0-pre.8 | ||
--- author: helgoboss | ||
--- description: | | ||
--- This main preset turns any grid-like controller into a device for doing very basic clip launching via Playtime. | ||
--- | ||
--- This generic preset is intended to be used as fallback if no device-specific preset exists. It lacks features because it can't take advantage | ||
--- of device-specific features. | ||
--- used_schemes: [grid] | ||
--- required_features: [playtime] | ||
|
||
--!strict | ||
|
||
-- Configuration | ||
|
||
-- Requires | ||
|
||
local realearn = require("realearn") | ||
|
||
-- Constants | ||
|
||
-- TODO This should be parameterized from the controller preset. One more reason to allow script parameterization :) | ||
|
||
local column_count = 4 | ||
local row_count = 4 | ||
|
||
-- Mappings | ||
|
||
local mappings = {} | ||
|
||
-- For each slot | ||
for col = 0, column_count - 1 do | ||
for row = 0, row_count - 1 do | ||
local mapping = realearn.Mapping { | ||
name = `Trigger slot {col + 1}/{row + 1}`, | ||
source = realearn.Source.Virtual { | ||
character = "Button", | ||
id = `col{col + 1}/row{row + 1}/pad`, | ||
}, | ||
glue = { | ||
feedback = realearn.Feedback.Text { | ||
text_expression = "{{ target.slot_state.id }}", | ||
color = realearn.VirtualColor { | ||
prop = "target.slot.color", | ||
}, | ||
}, | ||
}, | ||
target = realearn.Target.PlaytimeSlotTransportAction { | ||
slot = realearn.PlaytimeSlotDescriptor.Dynamic { | ||
column_expression = `control_unit_column_index + {col}`, | ||
row_expression = `control_unit_row_index + {row}`, | ||
}, | ||
action = "Trigger", | ||
}, | ||
} | ||
table.insert(mappings, mapping) | ||
end | ||
end | ||
|
||
return realearn.Compartment { | ||
mappings = mappings :: any, | ||
custom_data = { | ||
playtime = { | ||
control_unit = { | ||
column_count = column_count, | ||
row_count = row_count, | ||
}, | ||
}, | ||
}, | ||
} |