diff --git a/functions_compat/fxchange.py b/functions_compat/fxchange.py index 83b2f5a8..5d7978c2 100644 --- a/functions_compat/fxchange.py +++ b/functions_compat/fxchange.py @@ -297,10 +297,51 @@ def process(convproj_obj, in_dawinfo, out_dawinfo, out_type): for fxnum in used_fxchans: convproj_obj.track_order.append('fxrack_'+str(fxnum)) return True + + + + + + + + + elif in_fxtype == 'route' and out_fxtype == 'groupreturn' and convproj_obj.type in ['r', 'ri']: + + if not convproj_obj.trackroute: + for t in convproj_obj.track_order: + convproj_obj.fx__route__add(t) + + fx_trackids = {} + for trackid, track_obj in convproj_obj.track__iter(): + s = convproj_obj.trackroute[trackid] + if not s.to_master_active and s.data: + firstsend = list(s.data)[0] + if firstsend not in fx_trackids: fx_trackids[firstsend] = [] + fx_trackids[firstsend].append(trackid) + track_obj.group = 'group_'+firstsend + + for trackid, track_obj in fx_trackids.items(): + track_obj = convproj_obj.track_data[trackid] + group_obj = convproj_obj.fx__group__add('group_'+trackid) + group_obj.visual = track_obj.visual.copy() + group_obj.plugslots.slots_audio = track_obj.plugslots.slots_audio + group_obj.plugslots.slots_mixer = track_obj.plugslots.slots_mixer + + return True + + + + + + + + + + + elif in_fxtype == 'route' and out_fxtype == 'rack' and convproj_obj.type in ['r', 'ri']: tracknums = {} - #track2fxrack(convproj_obj, convproj_obj.track_master, 0, 'Master', '', True, ['master']) if not convproj_obj.trackroute: for t in convproj_obj.track_order: convproj_obj.fx__route__add(t) diff --git a/objects/convproj/fileref.py b/objects/convproj/fileref.py index 49d87fe9..8a78ea48 100644 --- a/objects/convproj/fileref.py +++ b/objects/convproj/fileref.py @@ -4,6 +4,7 @@ import os import sys import getpass +import glob from plugins import base as dv_plugins from functions import data_values @@ -88,9 +89,36 @@ def apply(self, fileref_obj, basepaths): return False +sampleref__searchmissing_limit = 1000 + class filesearcher: basepaths = {} searchparts = {} + searchcache = None + + def scan_local_files(dirpath): + filesearcher.searchcache = filesearcher.searchcache + if filesearcher.searchcache == None: + filesearcher.searchcache = {} + numfile = 0 + + for n, file in enumerate(glob.glob(os.path.join(dirpath, '*'))): + fileref_obj = cvpj_fileref() + fileref_obj.set_path(None, file, True) + filename = str(fileref_obj.file) + if filename not in filesearcher.searchcache: + filesearcher.searchcache[filename] = fileref_obj + numfile += 1 + if numfile > sampleref__searchmissing_limit: break + + for n, file in enumerate(glob.glob(os.path.join(dirpath, '**', '*'))): + fileref_obj = cvpj_fileref() + fileref_obj.set_path(None, file, True) + filesearcher.searchcache[str(fileref_obj.file)] = fileref_obj + if filename not in filesearcher.searchcache: + filesearcher.searchcache[filename] = fileref_obj + numfile += 1 + if numfile > sampleref__searchmissing_limit: break def add_basepath(searchseries, in_path): pathdata = cvpj_fileref() @@ -412,7 +440,6 @@ def set_path(self, in_os_type, in_path): self.get_info() def find_relative(self, searchseries): - if not self.found: orgpath = self.fileref.get_path(None, False) @@ -424,10 +451,20 @@ def find_relative(self, searchseries): return iffound - - return False + def search_local(self, dirpath): + filesearcher.scan_local_files(dirpath) + files = filesearcher.searchcache + filename = str(self.fileref.file) + + if filename in files: + logger_filesearch.debug(' >>| file found: searchmissing >'+self.fileref.get_path(None, False)) + self.fileref = files[filename] + self.get_info() + else: + logger_filesearch.debug(' ..| file not found: searchmissing > '+str(self.fileref.get_path(None, False))) + def get_info(self): wav_realpath = self.fileref.get_path(os_path, False) diff --git a/objects/convproj/project.py b/objects/convproj/project.py index ae5b8fa2..6b80b947 100644 --- a/objects/convproj/project.py +++ b/objects/convproj/project.py @@ -71,8 +71,6 @@ def autoloc_getname(autopath): plugin_id_counter = idcounter.counter(1000, 'plugin_') -sampleref__searchmissing_limit = 1000 - def routetrackord(trackord, groupdata, outl, insidegroup): for t, i in trackord: outl.append([t, i, insidegroup]) @@ -468,25 +466,12 @@ def sampleref__get(self, fileid): def sampleref__searchmissing(self, input_file): dirpath = os.path.dirname(input_file) - files = None + files = self.filesearcher.searchcache for sampleref_id, sampleref_obj in self.sampleref__iter(): if not sampleref_obj.found: - if files == None: - files = {} - for n, file in enumerate(glob.glob(os.path.join(dirpath, '**', '*'))): - fileref_obj = fileref.cvpj_fileref() - fileref_obj.set_path(None, file, True) - files[str(fileref_obj.file)] = fileref_obj - if n == sampleref__searchmissing_limit: break - - filename = str(sampleref_obj.fileref.file) - if filename in files: - logger_filesearch.debug(' >>| file found: searchmissing >'+sampleref_obj.fileref.get_path(None, False)) - sampleref_obj.fileref = files[filename] - sampleref_obj.get_info() - else: - logger_filesearch.debug(' ..| file not found: searchmissing > '+str(sampleref_obj.fileref.get_path(None, False))) + self.filesearcher.scan_local_files(dirpath) + sampleref_obj.search_local() # --------------------------------------------------------- FX --------------------------------------------------------- diff --git a/objects/convproj/tracks.py b/objects/convproj/tracks.py index 3616a5d2..c0af8474 100644 --- a/objects/convproj/tracks.py +++ b/objects/convproj/tracks.py @@ -85,11 +85,15 @@ def set_synth(self, pluginid): self.synth = pluginid def plugin_autoplace(self, plugin_obj, pluginid): - if plugin_obj.role == 'fx': self.slots_audio.append(pluginid) - elif plugin_obj.role == 'notefx': self.slots_notes.append(pluginid) - elif plugin_obj.role == 'synth': - if not self.synth: self.synth = pluginid - self.slots_synths.append(pluginid) + if plugin_obj is not None: + if plugin_obj.role == 'fx': self.slots_audio.append(pluginid) + elif plugin_obj.role == 'notefx': self.slots_notes.append(pluginid) + elif plugin_obj.role == 'synth': + if not self.synth: self.synth = pluginid + self.slots_synths.append(pluginid) + + def copy(self): + return copy.deepcopy(self) def __iter__(self): for x in self.slots_notes: yield 'notes', x diff --git a/objects/data_bytes/bytereader.py b/objects/data_bytes/bytereader.py index d0671e73..0157e180 100644 --- a/objects/data_bytes/bytereader.py +++ b/objects/data_bytes/bytereader.py @@ -118,7 +118,7 @@ def load_file(self, filename): self.buf = mmap.mmap(f.fileno(), 0, access = mmap.ACCESS_READ) return True else: - print('File Not Found', filename) + #print('File Not Found', filename) return False def load_raw(self, rawdata): diff --git a/plugins/input/r_audiosauna.py b/plugins/input/r_audiosauna.py index d10e6d2e..81e45e3e 100644 --- a/plugins/input/r_audiosauna.py +++ b/plugins/input/r_audiosauna.py @@ -33,6 +33,7 @@ def get_priority(self): return 0 def get_prop(self, in_dict): in_dict['file_ext'] = ['song'] in_dict['placement_cut'] = True + in_dict['placement_loop'] = ['loop', 'loop_off', 'loop_adv', 'loop_adv_off'] in_dict['audio_filetypes'] = ['wav', 'mp3'] in_dict['plugin_included'] = ['native:audiosauna', 'universal:sampler:multi', 'universal:bitcrush'] in_dict['fxtype'] = 'groupreturn'