Skip to content
This repository has been archived by the owner on Nov 12, 2024. It is now read-only.

Commit

Permalink
Browser issue, code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
nfxbeats committed Nov 16, 2022
1 parent f522ac7 commit 59066bd
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 52 deletions.
55 changes: 30 additions & 25 deletions device_FIRE-NFX.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@
_DebugPrn = True
_DebugMin = lvlD

from fireNFX_Classes import _rd3d2PotParams, _rd3d2PotParamOffsets
#from fireNFX_Classes import _rd3d2PotParams, _rd3d2PotParamOffsets
from fireNFX_Macros import *

# list of notes that are mapped to pads
Expand Down Expand Up @@ -552,6 +552,7 @@ def OnMidiIn(event):
if(padNum in pdMacros) and (pMap.Pressed):
event.handled = HandleMacros(pdMacros.index(padNum))
RefreshMacros()
RefreshWindowStates()
return

# always handle nav
Expand Down Expand Up @@ -904,7 +905,7 @@ def HandleNav(padIdx):
RefreshDrumPads()

RefreshNavPads()
RefreshDisplay()
#RefreshDisplay()

return True

Expand All @@ -916,7 +917,7 @@ def RunMacro(macro):
macro.Execute()
return True
else:
DisplayTimedText('Failed! ' + macro.Name)
#DisplayTimedText('Failed! ' + macro.Name)
return False

def ToggleRepeat():
Expand All @@ -942,7 +943,8 @@ def HandleMacros(macIdx):
if(_PadMode.NavSet.MacroNav == False):
return
macro = _MacroList[macIdx]
if(not RunMacro(macro)):
# print('Macro:', macro.Name, (macro.Execute==None))
if(macro.Execute == None):
if( macro.Name == "Chan Rack"): #macIdx == 1):
ShowChannelRack(-1)
if(Settings.TOGGLE_CR_AND_BROWSER):
Expand All @@ -957,17 +959,18 @@ def HandleMacros(macIdx):
ShowPlaylist(-1)
elif(macro.Name == "Mixer"): #"macIdx == 3):
ShowMixer(-1)
elif(macro.Name == "Close All"): #macIdx == 0):
# DisplayTimedText('Reset Windows')
transport.globalTransport(FPT_F12, 1) # close all...
if(Settings.REOPEN_WINDOWS_AFTER_CLOSE_ALL):
ShowBrowser(1)
ShowMixer(1)
ShowChannelRack(1)
ShowPlaylist(1)
# elif(macro.Name == "Close All"): #macIdx == 0):
# # DisplayTimedText('Reset Windows')
# transport.globalTransport(FPT_F12, 1) # close all...
# if(Settings.REOPEN_WINDOWS_AFTER_CLOSE_ALL):
# ShowBrowser(1)
# ShowMixer(1)
# ShowChannelRack(1)
# ShowPlaylist(1)
else:
return False

else:
RunMacro(macro)
return True

def HandleNotes(event, padNum):
Expand Down Expand Up @@ -2021,6 +2024,8 @@ def RefreshMacros():
return
for idx, pad in enumerate(pdMacros):
SetPadColor(pad, _MacroList[idx].PadColor, dimDefault)




def RefreshMarkers():
Expand Down Expand Up @@ -3466,7 +3471,8 @@ def ShowBrowser(showVal, bUpdateDisplay = False):
if(Settings.TOGGLE_CR_AND_BROWSER):
ui.hideWindow(widChannelRack)

if(_resetAutoHide):
#if(_resetAutoHide):
if(isAutoHide):
ui.setBrowserAutoHide(False) # if hidden it will become visible

ui.showWindow(widBrowser)
Expand All @@ -3482,7 +3488,8 @@ def ShowBrowser(showVal, bUpdateDisplay = False):
ui.setBrowserAutoHide(True) # BUG? does not auto close
_resetAutoHide = False
else:
ui.hideWindow(widBrowser)
if(ui.getVersion(0) > 20): # BUG: can't reopen pre FL 21, so we don't close it.
ui.hideWindow(widBrowser)

if(Settings.TOGGLE_CR_AND_BROWSER):
ShowChannelRack(1)
Expand Down Expand Up @@ -3629,8 +3636,6 @@ def ShowNote(note, isOn = True):
def UpdateWindowStates():
global _PadMode

prn(lvlA, 'UpdateWindowStates')

if(Settings.TOGGLE_CR_AND_BROWSER) and (ui.getFocused(widBrowser)):
if ui.getVisible(widChannelRack) == 1:
ShowChannelRack(0)
Expand Down Expand Up @@ -3875,14 +3880,14 @@ def getPlugin(pluginName):
else:
pl = getPluginInfo(-1) # unknown, read the info

rd3d2Present = ('rd3d2 Ext' in pl.ParameterGroups.keys())
UseExternalKnobPresets = (len(pl.getCurrentKnobParamOffsets()) == 0) and rd3d2Present

if(UseExternalKnobPresets):
pl.assignKnobs(_rd3d2PotParamOffsets)
plist = _rd3d2PotParams.get(pl.PluginName)
pl.assignKnobsFromParamList(plist)
print('rd3d2 params loaded for {}'.format(pl.Name))
# rd3d2Present = ('rd3d2 Ext' in pl.ParameterGroups.keys())
# UseExternalKnobPresets = (len(pl.getCurrentKnobParamOffsets()) == 0) and rd3d2Present

# if(UseExternalKnobPresets):
# pl.assignKnobs(_rd3d2PotParamOffsets)
# plist = _rd3d2PotParams.get(pl.PluginName)
# pl.assignKnobsFromParamList(plist)
# print('rd3d2 params loaded for {}'.format(pl.Name))

LOADED_PLUGINS[pl.getID()] = pl
return pl
Expand Down
48 changes: 24 additions & 24 deletions fireNFX_Classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -451,29 +451,29 @@ def addSubItem(self, item):
if(not exists):
self.SubItems.append(item)

_rd3d2PotParams = {} # 'PluginName':[param1, .., paramX]
_rd3d2PotParamOffsets = {}
try:
# from native_pot_parameters import PluginParameter, native_plugin_parameters as npp
# until rd3d2 approves my submitted code I will use the local file.
from rd3d2_pot_params import PluginParameter, native_plugin_parameters as npp
if(len(npp) < 1): # no error, but no list either
print('rd3d2 Pot Parameters found, but the dictionary did not load.')
else:
print('rd3d2 Pot Parameters found. {} plugins available in the dictionary.'.format(len(npp)))
for plugin in npp.keys():
_rd3d2PotParams[plugin] = []
# for param in npp[plugin]:
# if param != None:
# bipolar = param.deadzone_centre != None
# name = param.name
# if name == '':
# name = '?'
# nfxParam = TnfxParameter(param.index, name, 0, '', bipolar)
# _rd3d2PotParams[plugin].append(nfxParam)
# _rd3d2PotParamOffsets[plugin].append(param.index)
print('rd3d2 Pot Parameters conversion. {} plugins converted.'.format(len(_rd3d2PotParams)))
except ImportError:
print('rd3d2 Pot Parameters NOT found.') # Failed to import - assume they don't have custom settings
# _rd3d2PotParams = {} # 'PluginName':[param1, .., paramX]
# _rd3d2PotParamOffsets = {}
# try:
# # from native_pot_parameters import PluginParameter, native_plugin_parameters as npp
# # until rd3d2 approves my submitted code I will use the local file.
# from rd3d2_pot_params import PluginParameter, native_plugin_parameters as npp
# if(len(npp) < 1): # no error, but no list either
# print('rd3d2 Pot Parameters found, but the dictionary did not load.')
# else:
# print('rd3d2 Pot Parameters found. {} plugins available in the dictionary.'.format(len(npp)))
# for plugin in npp.keys():
# _rd3d2PotParams[plugin] = []
# # for param in npp[plugin]:
# # if param != None:
# # bipolar = param.deadzone_centre != None
# # name = param.name
# # if name == '':
# # name = '?'
# # nfxParam = TnfxParameter(param.index, name, 0, '', bipolar)
# # _rd3d2PotParams[plugin].append(nfxParam)
# # _rd3d2PotParamOffsets[plugin].append(param.index)
# print('rd3d2 Pot Parameters conversion. {} plugins converted.'.format(len(_rd3d2PotParams)))
# except ImportError:
# print('rd3d2 Pot Parameters NOT found.') # Failed to import - assume they don't have custom settings


4 changes: 2 additions & 2 deletions fireNFX_Utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import transport
import time
import device
from fireNFX_Classes import TnfxColorMap, TnfxParameter, TnfxChannelPlugin, _rd3d2PotParams, cpChannelPlugin, cpMixerPlugin
from fireNFX_Classes import TnfxColorMap, TnfxParameter, TnfxChannelPlugin, cpChannelPlugin, cpMixerPlugin #, _rd3d2PotParams
import utils
import plugins
import mixer
Expand Down Expand Up @@ -330,7 +330,7 @@ def getPluginInfo(chanIdx, prn = False, inclBlanks = False, mixSlotIdx = -1):
else:
res.addParamToGroup("ALL", param)

if(res.Name in _rd3d2PotParams.keys()):
if(False): #(res.Name in _rd3d2PotParams.keys()):
res.addParamToGroup("rd32d3 Ext", param)
knobsSamples.append(param)
elif(len(knobsSamples) < 8):
Expand Down
13 changes: 12 additions & 1 deletion harmonicScales.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
print("Loading...")
# name=harmonic scales
# url=

Expand Down Expand Up @@ -27,10 +28,20 @@

HARMONICSCALE_LAST = 22

HarmonicScaleNamesT = ('Ionian/Major', 'Harmonic minor', 'Melodic minor', 'Whole tone', 'Diminished', 'Major penta', 'Minor penta', 'Jap in sen', 'Major bebop', 'Dominant bebop', 'Blues', 'Arabic', 'Enigmatic', 'Neapolitan', 'Neap. minor', 'Hungarian minor', 'Dorian', 'Phrygian', 'Lydian', 'Mixolydian', 'Aeolian/Minor', 'Locrian', 'Chromatic')
HarmonicScaleNamesT = ['Ionian/Major', 'Harmonic minor', 'Melodic minor', 'Whole tone', 'Diminished', 'Major penta', 'Minor penta', 'Jap in sen', 'Major bebop', 'Dominant bebop', 'Blues', 'Arabic', 'Enigmatic', 'Neapolitan', 'Neap. minor', 'Hungarian minor', 'Dorian', 'Phrygian', 'Lydian', 'Mixolydian', 'Aeolian/Minor', 'Locrian', 'Chromatic']

HarmonicScaleList = [[0 for x in range(13)] for y in range(23)]


def addScale(scaleName, noteList): # addScale('nfx', [9,8,7,6,5,4,3,2,1,0,9,8,7])
global HARMONICSCALE_LAST
global HarmonicScaleNamesT
global HarmonicScaleList
HarmonicScaleList.append(noteList)
HarmonicScaleNamesT.append(scaleName)
HARMONICSCALE_LAST = len(HarmonicScaleList)-1
return HarmonicScaleNamesT[-1], HarmonicScaleList[-1], HARMONICSCALE_LAST

def GetScaleNoteCount(scale):
Result = 0
for n in range(0, 13):
Expand Down

0 comments on commit 59066bd

Please sign in to comment.