Skip to content

Instantly share code, notes, and snippets.

@sigma
Last active September 19, 2022 11:54
Show Gist options
  • Save sigma/55d606dcc3c6ec1ea4ec3302a6d7a9be to your computer and use it in GitHub Desktop.
Save sigma/55d606dcc3c6ec1ea4ec3302a6d7a9be to your computer and use it in GitHub Desktop.
Maschine Studio file hack

This hack recreates for Maschine Studio the File/Save button as working in Maschine MK3. It is mapped to the All/Save button, given that as far as I can tell "All" doesn't map to any functionality.

How to install on a Mac:

  • copy both files to a new directory /Applications/Native Instruments/Maschine 2/Maschine 2.app/Contents/Resources/Scripts/Maschine/MaschineSigma
  • modify /Applications/Native Instruments/Maschine 2/Maschine 2.app/Contents/Resources/Scripts/Maschine/Controllers.lua to read:
...
elseif Model == "MS1" then

    require "Scripts/Maschine/MaschineSigma/MaschineSigmaController"
...

That last part is the only modification to provided Native Instruments content. As such it should be fairly resistant to updates.

require "Scripts/Maschine/MaschineMK3/Pages/FilePageMK3"
local class = require 'Scripts/Shared/Helpers/classy'
FilePageSigma = class( 'FilePageSigma', FilePageMK3 )
-- Just inherit from the MK3 page and adjust the LED to light
function FilePageSigma:__init(Controller)
FilePageMK3.__init(self, Controller)
self.Name = "FilePageSigma"
self.PageLEDs = { NI.HW.LED_ALL }
end
------------------------------------------------------------------------------------------------------------------------
-- Maschine Studio Controller -- Sigma edition
------------------------------------------------------------------------------------------------------------------------
require "Scripts/Maschine/MaschineStudio/MaschineStudioController"
require "Scripts/Shared/Helpers/MaschineHelper"
local class = require 'Scripts/Shared/Helpers/classy'
-- Inherit from Maschine Studio to limit the scope of modifications
MaschineSigmaController = class( 'MaschineSigmaController', MaschineStudioController )
-- Expose constants for code that doesn't really handle inheritance
MaschineSigmaController.SCREEN_BUTTON_LEDS = MaschineStudioController.SCREEN_BUTTON_LEDS
MaschineSigmaController.SCREEN_BUTTONS = MaschineStudioController.SCREEN_BUTTONS
MaschineSigmaController.GROUP_LEDS = MaschineStudioController.GROUP_LEDS
MaschineSigmaController.JOGWHEEL_RING_LEDS = MaschineStudioController.JOGWHEEL_RING_LEDS
MaschineSigmaController.LEVELMETER_LEFT_LEDS = MaschineStudioController.LEVELMETER_LEFT_LEDS
MaschineSigmaController.LEVELMETER_RIGHT_LEDS = MaschineStudioController.LEVELMETER_RIGHT_LEDS
MaschineSigmaController.GROUP_BUTTONS = MaschineStudioController.GROUP_BUTTONS
MaschineStudioController.BUTTON_TO_PAGE = MaschineStudioController.BUTTON_TO_PAGE
MaschineSigmaController.LEDValues = MaschineStudioController.LEDValues
-- Add PAGE_FILE to the list of modifier pages
MaschineSigmaController.MODIFIER_PAGES =
{
NI.HW.PAGE_DUPLICATE,
NI.HW.PAGE_GRID,
NI.HW.PAGE_MUTE,
NI.HW.PAGE_PAD,
NI.HW.PAGE_NAVIGATE,
NI.HW.PAGE_PAGE,
NI.HW.PAGE_SCENE,
NI.HW.PAGE_PATTERN,
NI.HW.PAGE_REPEAT,
NI.HW.PAGE_SELECT,
NI.HW.PAGE_EVENTS,
NI.HW.PAGE_SOLO,
NI.HW.PAGE_VARIATION,
NI.HW.PAGE_FILE
}
-- Define PAGE_SAVE_AS as a temporary page
MaschineSigmaController.TEMPORARY_PAGES =
{
NI.HW.PAGE_SAVE_AS
}
function MaschineSigmaController:__init()
MaschineStudioController.__init(self)
end
-- Register additional pages to handle files
function MaschineSigmaController:createPages()
MaschineStudioController.createPages(self)
self.PageManager:register(NI.HW.PAGE_FILE, "Scripts/Maschine/MaschineSigma/FilePageSigma", "FilePageSigma", true)
self.PageManager:register(NI.HW.PAGE_SAVE_AS, "Scripts/Maschine/Shared/Pages/SaveAsPage", "SaveAsPage", true)
end
-- Clear any temporary page when a button is activated
function MaschineSigmaController:onPageButton(Button, PageID, Pressed)
MaschineStudioController.onPageButton(self, Button, PageID, Pressed)
self:clearTempPage()
end
-- The following are adapted from MK3 File code
function MaschineSigmaController:onAllButton(Pressed)
local PageStack = NHLController:getPageStack()
if NHLController:isInModalState() then
return
end
if self:getShiftPressed() then
if PageStack:getTopPage() ~= NI.HW.PAGE_FILE and PageStack:getTopPage() ~= NI.HW.PAGE_SAVE_AS then
LEDHelper.updateButtonLED(self, NI.HW.LED_ALL, NI.HW.BUTTON_ALL, Pressed)
end
if Pressed then
local InfoBarTempMode = NHLController:getPageStack():getTopPage() == NI.HW.PAGE_FILE and "FilePageProjectSaved"
MaschineHelper.saveProject(self:getInfoBar(), InfoBarTempMode)
end
else
MaschineSigmaController.onPageButton(self, NI.HW.BUTTON_ALL, NI.HW.PAGE_FILE, Pressed)
end
end
function MaschineSigmaController:clearTempPage()
local TopPageID = NHLController:getPageStack():getTopPage()
for Index, TempPageID in ipairs(MaschineSigmaController.TEMPORARY_PAGES) do
if TopPageID ~= TempPageID then
NHLController:getPageStack():removePage(TempPageID)
end
end
end
ControllerScriptInterface = MaschineSigmaController()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment