@@ -131,6 +131,13 @@ const libPath = path.posix.join(system.app, '../patchers/visual/');
131131const libFile = path . posix . join ( base , '/Data/code-library.json' ) ;
132132let library = { } ;
133133
134+ const soundLibPath = path . posix . join ( system . app , '../patchers/sound/' ) ;
135+ const soundLibFile = path . posix . join ( base , '/Data/sound-extensions.json' ) ;
136+ let soundLibrary = { } ;
137+ const visualLibPath = path . posix . join ( system . app , '../patchers/visual/' ) ;
138+ const visualLibFile = path . posix . join ( base , '/Data/visual-extensions.json' ) ;
139+ let visualLibrary = { } ;
140+
134141// directories for storage of code logs, recordings and sketches
135142const userDirs = [ '/Code Logs' , '/Recordings' , '/Library' /*, '/Sketches'*/ ] ;
136143
@@ -196,11 +203,26 @@ max.addHandler('init', () => {
196203 }
197204
198205 // create path for requires and load if exists
199- library = loadFiles ( libPath , '**/*.maxpat' ) ;
200- library = Object . assign ( { } , loadFiles ( path . posix . join ( base , '/Library' ) , '**/*.maxpat' ) , library ) ;
201- writeJson ( libFile , library ) ;
202- max . post ( 'Created code library: ' + libFile ) ;
203- max . outlet ( 'lib' , library ) ;
206+ // library = loadFiles(libPath, '**/*.maxpat');
207+ // library = Object.assign({}, loadFiles(path.posix.join(base, '/Library'), '**/*.maxpat'), library);
208+
209+ soundLibrary = loadFiles ( soundLibPath , '**/*.maxpat' ) ;
210+ soundLibrary = Object . assign ( { } , loadFiles ( path . posix . join ( base , '/Library/Sound' ) , '**/*.maxpat' ) , soundLibrary ) ;
211+ visualLibrary = loadFiles ( visualLibPath , '**/*.maxpat' ) ;
212+ visualLibrary = Object . assign ( { } , loadFiles ( path . posix . join ( base , '/Library/Visual' ) , '**/*.maxpat' ) , visualLibrary ) ;
213+ // max.post('soundLib', soundLibrary);
214+ // max.post('visualLib', visualLibrary);
215+
216+ writeJson ( soundLibFile , soundLibrary ) ;
217+ writeJson ( visualLibFile , visualLibrary ) ;
218+
219+ // writeJson(libFile, library);
220+ // max.post('Created code library: '+libFile);
221+ // max.outlet('lib', library);
222+ max . outlet ( 'vlib' , visualLibrary ) ;
223+ max . outlet ( 'slib' , soundLibrary ) ;
224+ max . post ( 'Visual library imported: ' + visualLibFile ) ;
225+ max . post ( 'Sound library imported: ' + soundLibFile ) ;
204226} ) ;
205227
206228const prefHandlers = {
0 commit comments