Skip to content

Commit

Permalink
fl mobile input + route to groupreturn for r/ri + add scan_local_files
Browse files Browse the repository at this point in the history
  • Loading branch information
SatyrDiamond committed Nov 21, 2024
1 parent 638c71c commit 580bf3d
Show file tree
Hide file tree
Showing 6 changed files with 96 additions and 28 deletions.
43 changes: 42 additions & 1 deletion functions_compat/fxchange.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
43 changes: 40 additions & 3 deletions objects/convproj/fileref.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import os
import sys
import getpass
import glob

from plugins import base as dv_plugins
from functions import data_values
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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)

Expand All @@ -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)

Expand Down
21 changes: 3 additions & 18 deletions objects/convproj/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down Expand Up @@ -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 ---------------------------------------------------------

Expand Down
14 changes: 9 additions & 5 deletions objects/convproj/tracks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion objects/data_bytes/bytereader.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
1 change: 1 addition & 0 deletions plugins/input/r_audiosauna.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down

0 comments on commit 580bf3d

Please sign in to comment.