/main.lua

https://code.google.com/p/airmann-faderport-driver/ · Lua · 239 lines · 116 code · 56 blank · 67 comment · 2 complexity · c52a48f1eaa140883288b0cb1b9240f2 MD5 · raw file

  1. --[[------------------------------------------------------------------------------------
  2. Airmann's FaderPort Renoise Driver
  3. A Renoise tool for integration of PreSonus FaderPort DAW Controller
  4. Copyright 2010 Matthias Ehrmann,
  5. Licensed under the Apache License, Version 2.0 (the "License");
  6. you may not use this file except in compliance with the License.
  7. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
  8. Unless required by applicable law or agreed to in writing, software distributed
  9. under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
  10. CONDITIONS OF ANY KIND, either express or implied. See the License for the specific
  11. language governing permissions and limitations under the License.
  12. -------------------------------------------------------------------------------------]]--
  13. require "FaderPort"
  14. --[[ locals ]] ---------------------------------------------------------------
  15. local fader_port = nil
  16. --[[ globals ]] --------------------------------------------------------------
  17. -- preferences
  18. prefs = renoise.Document.create("FaderPortPreferences") {
  19. dump_midi = false, -- dump midi messages
  20. auto_connect = true, -- true: Renoise connects to FaderPort automatically during start up
  21. default_is_post_fx_mixer = true, -- true: FaderPort driver starts in post fx mixer mode, false: in pre fx mixer mode
  22. latch_is_default_write_mode = true, -- true: default fader write mode is "latch",
  23. -- false: default fader write mode is "write"
  24. sticky_mode_support = true, -- sticky mode available (trns button)
  25. undo_workaround = false, -- use dirty undo workaround to avoid massive creation of undo data
  26. -- IMPORTANT: doesn't work WITHOUT FaderPort additional power supply !
  27. switch_off_when_app_resigned = false, -- reset FadePort state whenever Renoise is not the active Window
  28. -- and re-initialize state whenever Renoise get the active Window
  29. -- This is important if you want to use FaderPort for more than
  30. -- one Renoise instance simultaneously
  31. virtual_pan_resolution = 128, -- resolution of virtual pan control (0..127)
  32. anti_suck_min_turns = 3, -- the minimum number of hardware pan encoder turns for a virtual pan value change
  33. footswitch_pressed_signal = 1, -- either 0 or 1: means: signals for footswitch pressed / released can be swapped.
  34. -- This is helpfull for compensation of varying footswitch wiring
  35. midi_in_name = "FaderPort", -- name of MIDI in device
  36. midi_out_name = "FaderPort", -- name of MIDI out device
  37. -- list of device specific fader/pan binding pairs
  38. dsp_binding_list = {
  39. -- IMPORTANT HINT
  40. -- the order/focus of the bindings was laid on (final) mixing and not creative sound design
  41. -- means: level and stereo parameters like wet/gain/pan/width are usually the first binding pairs.
  42. -- E.g. compressors first binding pair is makeup and not threshold and so on
  43. --------------------- NATIVE DEVICES --------------------------------
  44. -- Delay
  45. -- hint: if line sync is active 1/2 can be modfified, but you will see nothing in Renoise.
  46. -- Moreover 7/8 are not accessible, instead 12/13 are accessible if line sync is active
  47. "Delay","5","5","9","10","1","2","3","4","-1",
  48. "Reverb","2","3","2","4","-1", -- room size, width, damp, we assume it's used in a sendtrack with 100% wet
  49. "mpReverb","1","6","2","7","-1", -- duration, width, predelay, pan, we assume it's used in a sendtrack with 100% wet
  50. -- Dynamics
  51. "Compressor","5","5","1","2","3","4","-1", -- makeup, makeup, threshold, ratio, attack, release
  52. "Bus Compressor","5","6","1","2","3","4","-1", -- makeup, knee, threshold, ratio, attack, release
  53. "Maximizer","1","5","3","4","-1", -- boost, ceiling, peak rel, slow rel
  54. "Gate","1","5","2","3","4","3","-1", -- threshold, floor, attack, hold, release, hold
  55. -- Filter
  56. "EQ 5","1","1","2","2","3","3","4","4","5","5","-1", -- iterate over bands
  57. "EQ 10","1","1","2","2","3","3","4","4","5","5", -- iterate over bands
  58. "6","6","7","7","8","8","9","9","10","10","-1",
  59. "Mixer EQ","1","5","3","2","2","4","-1", -- Lo. Hi, Freq, Mid, Mid, Q
  60. "Filter","2","3","2","1","4","5","-1", -- cutoff, resonance, cutoff, type, gain, inertia
  61. -- hint: 4 is opt. Gain value (not always shown)
  62. "Comb Filter","1","2","3","4","5","5","-1", -- freq, feedback, inertia, wet mix, dry mix, dry mix
  63. -- Modulation
  64. "Chorus","5","2","3","1","4","6","-1", -- wet, depth, feedback, rate, delay, phase
  65. "Flanger","1","5","3","2","4","6","-1", -- amount, delay, amplitude, rate, feedback, phase
  66. "Phaser","4","5","1","2","3","7","-1", -- depth , feedback, floor, ceiling, lfo rate, stages
  67. "RingMod","3","3","2","1","4","5","-1", -- amount, amount, freq, osc, phase, inertia
  68. -- Shape
  69. "Cabinet Simulator","4","5","3","3","-1", -- wet, dry , gain, gain
  70. "Distortion","4","5","3","2","1","1","-1", -- wet, dry, tone, drive, mode, mode
  71. "LofiMat","4","5","2","1","3","6","-1", -- wet, dry, rate, bit crunch, noise, smooth
  72. "Scream Filter","3","4","2","1","3","5","-1", -- cutoff, resonance, distortion, cutoff, inertia
  73. -- Tools
  74. "Gainer","1","2","-1", -- Gain, Pan
  75. "DC Offset","1","2","-1", -- offset, auto dc on/off
  76. "Stereo Expander","1","2","-1", -- expand, surround
  77. -- #Routing
  78. "#Line Input","2","1","-1", -- volume, panning
  79. "#ReWire Input","2","1","-1", -- volume, panning
  80. "#Send","1","2","-1", -- amount, receiver
  81. "#Multiband Send","1","7","3","8","5","8","2","2","4","4","6","6","-1", -- Amount1, Low, Amount2, High, Amount3, High, Receiver 1,2,3
  82. -- *Meta Automation
  83. "*Instr. Automation","1","2","3","4","5","6","7",
  84. "8","9","10","11","12","13","14","-1", -- iterate over parameters
  85. "*Instr. MIDI Control","1","2","3","4","5","6","7",
  86. "8","9","10","11","12","13","14","-1", -- iterate over channels
  87. -- *Mapping
  88. "*Hydra","1","1","5","6","10","11","15","16",
  89. "20","21","25","26","30","31","35","36",
  90. "40","41","45","46","-1", -- input, input, iterate over parameters
  91. "*XY Pad","2","1","6","7","11","12","-1", -- x,y, x-min, x-max, y-min, y-max
  92. -- Hint: auto reset not supported
  93. -- *Modulation
  94. "*Key Tracker","4","5","-1", -- min, max
  95. "*LFO","4","5","6","7","-1", -- amplitude, offset, freq, type
  96. "*Signal Follower","9","6","7","8","10","11","-1", -- sensitivity, dest off, attack, release, lp, hp
  97. "*Velocity Tracker","4","5","-1", -- min, max
  98. --------------------------- VST's --------------------------------------
  99. --Voxengo
  100. "VST: Voxengo: Elephant","3","4","-1", -- in, out
  101. "VST: Voxengo: Polysquasher", "5","1","3","4","2","2","-1" -- output,bypass, threshold, ratio, oversample, oversample
  102. }
  103. }
  104. prefs:load_from("config.xml")
  105. --prefs:save_as("config.xml")
  106. --[[ initialize ]] --------------------------------------------------------------
  107. -- instantiate driver
  108. if (not fader_port) then
  109. fader_port = FaderPort()
  110. end
  111. if (fader_port) then
  112. --[[ DEBUG: all lights on test
  113. fader_port.all_lights_on()
  114. --]]
  115. --[[ DEBUG: funky lights test
  116. fader_port.funky_lights()
  117. --]]
  118. -- add menu entries, keybindings
  119. -- reset
  120. renoise.tool():add_menu_entry {
  121. name = "Main Menu:Tools:FaderPort:Reset",
  122. invoke = function() fader_port:reset() end
  123. }
  124. renoise.tool():add_keybinding {
  125. name = "Global:Tools:Reset FaderPort",
  126. invoke = function() fader_port:reset() end
  127. }
  128. -- connect
  129. renoise.tool():add_menu_entry {
  130. name = "--- Main Menu:Tools:FaderPort:Connect",
  131. invoke = function() fader_port:connect() end
  132. }
  133. renoise.tool():add_keybinding {
  134. name = "Global:Tools:Connect to FaderPort",
  135. invoke = function() fader_port:connect() end
  136. }
  137. -- disconnect
  138. renoise.tool():add_menu_entry {
  139. name = "Main Menu:Tools:FaderPort:Disconnect",
  140. invoke = function() fader_port:disconnect() end
  141. }
  142. renoise.tool():add_keybinding {
  143. name = "Global:Tools:Disconnect from FaderPort",
  144. invoke = function() fader_port:disconnect() end
  145. }
  146. -- auto connect
  147. renoise.tool():add_menu_entry {
  148. name = "--- Main Menu:Tools:FaderPort:Auto Connect",
  149. invoke = function() fader_port:toggle_auto_connect() end,
  150. selected = function() return prefs.auto_connect.value end
  151. }
  152. -- undo workaround
  153. renoise.tool():add_menu_entry {
  154. name = "--- Main Menu:Tools:FaderPort:Undo Workaround",
  155. invoke = function() fader_port:toggle_undo_workaround() end,
  156. selected = function() return prefs.undo_workaround.value end
  157. }
  158. renoise.tool():add_keybinding {
  159. name = "Global:Tools:Toggle FaderPort Undo Workaround",
  160. invoke = function() fader_port:toggle_undo_workaround() end,
  161. selected = function() return prefs.undo_workaround.value end
  162. }
  163. -- device info dialog
  164. renoise.tool():add_menu_entry {
  165. name = "Main Menu:View:FaderPort Device Infos",
  166. invoke = function() fader_port:toggle_device_info_dialog() end,
  167. selected = function() return fader_port:device_info_dialog_visible() end
  168. }
  169. renoise.tool():add_keybinding {
  170. name = "Global:View:FaderPort Device Infos",
  171. invoke = function() fader_port:toggle_device_info_dialog() end,
  172. selected = function() return fader_port:device_info_dialog_visible() end
  173. }
  174. end
  175. --[[ debug ]]--------------------------------------------------------------]]--
  176. _AUTO_RELOAD_DEBUG = true