Skip to content

Commit 7e602e6

Browse files
author
Shaji Khan
committed
Atom port support
1 parent ddf60a3 commit 7e602e6

17 files changed

Lines changed: 54 additions & 27 deletions

Plugin.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -574,23 +574,23 @@ void Plugin::setFilePortValue1 (std::string filename) {
574574
}
575575

576576
bool Plugin::check_notify () {
577-
IN
577+
//~ IN
578578
if (notifyPort == nullptr) {
579-
LOGD ("notify port is null, so .. well.. this is awkward");
579+
//~ LOGD ("notify port is null, so .. well.. this is awkward");
580580
OUT
581581
return true;
582582
}
583583

584584
if (ampAtom != nullptr && filePort != nullptr && ampAtom->has_file_path(filePort)) {
585-
LOGD ("[atom port] reset file port");
585+
//~ LOGD ("[atom port] reset file port");
586586
ampAtom->resetAtom(filePort, filePortSize);
587-
LOGD ("[atom port] reset notify port");
587+
//~ LOGD ("[atom port] reset notify port");
588588
ampAtom->resetAtom(notifyPort, filePortSize);
589-
OUT
589+
//~ OUT
590590
return true ;
591591
}
592592

593-
OUT
593+
//~ OUT
594594
return false;
595595
}
596596

Plugin.o

-408 Bytes
Binary file not shown.

amprack

103 KB
Binary file not shown.

assets/lv2_plugins.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1458,7 +1458,7 @@
14581458
},
14591459
"34700": {
14601460
"id": 8118,
1461-
"name": "Impulse Loader",
1461+
"name": "ImpulseLoader",
14621462
"index": 0,
14631463
"desc": "This is a simple, mono, IR-File loader/convolution LV2 plugin",
14641464
"library": "ImpulseLoader.so"

engine.cc

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ Engine::Engine () {
133133
queueManager->init (driver -> get_buffer_size ());
134134
fileWriter = new FileWriter ();
135135
queueManager->add_function (fileWriter->disk_write);
136+
queueManager->add_function (check_notify);
136137
processor->lockFreeQueueManager = queueManager ;
137138
HERE LOGD ("processor status %d\n", processor->bypass);
138139
//~ processor -> bypass = false ;
@@ -325,11 +326,11 @@ void Engine::set_atom_port (int index, int control, char * filename) {
325326
activePlugins->at (index)->setAtomPortValue (control, std::string (filename));
326327
}
327328

328-
usleep (1400) ; // ayyo
329-
while (! activePlugins->at (index)->check_notify ()) {
330-
LOGD ("[check notify] wait ..\n");
331-
usleep (400);
332-
}
329+
//~ usleep (1400000) ; // ayyo
330+
//~ while (! activePlugins->at (index)->check_notify ()) {
331+
//~ LOGD ("[check notify] wait ..\n");
332+
//~ usleep (400000);
333+
//~ }
333334

334335
activePlugins->at (index)->loadedFileType = 2 ;
335336
std::string path = std::string (filename) ;
@@ -454,3 +455,18 @@ void Engine::stopRecording () {
454455
fileWriter->stopRecording ();
455456
OUT
456457
}
458+
459+
int Engine::check_notify (AudioBuffer * a) {
460+
int ret = 0 ;
461+
if (activePlugins == nullptr)
462+
return -1 ;
463+
464+
for (int i = 0 ; i < activePlugins->size () ; i ++) {
465+
if (activePlugins->at (i)->filePort != nullptr) {
466+
activePlugins->at (i)->check_notify () ;
467+
ret ++ ;
468+
}
469+
}
470+
471+
return ret ;
472+
}

engine.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ class Engine {
5757
void print ();
5858
void startRecording ();
5959
void stopRecording ();
60+
static int check_notify (AudioBuffer * a) ;
6061
};
6162

6263
#endif

engine.o

552 Bytes
Binary file not shown.

libs/linux/x86_64/Ratatouille.so

-64.2 KB
Binary file not shown.

main.o

144 Bytes
Binary file not shown.

pluginui.cpp

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,12 @@ float knob_get (GtkSpinButton * s) {
204204

205205
PluginUI::PluginUI (Engine * _engine, Plugin * _plugin, GtkBox * _parent, std::string pluginName, int _index, bool has_file_chooser, void * _rack) {
206206
IN
207+
# ifdef __linux__
208+
std::string dir = std::string (getenv ("HOME")).append ("/amprack/models/").append (pluginName).append ("/");
209+
# else
210+
std::string dir = std::string (getenv ("USERPROFILE")).append ("/amprack/models/").append (pluginName).append ("/");
211+
# endif
212+
207213
LOGD ("[plugin ui] loading %s\n", pluginName.c_str ());
208214
Rack * niceRack = (Rack *) _rack ;
209215
engine = _engine ;
@@ -342,12 +348,21 @@ PluginUI::PluginUI (Engine * _engine, Plugin * _plugin, GtkBox * _parent, std::s
342348
gtk_widget_set_valign ((GtkWidget *) load_file, GTK_ALIGN_CENTER);
343349
gtk_widget_set_margin_bottom ((GtkWidget *) load_file, 20);
344350

345-
const char * options [1000] ;
346-
options [0] = strdup ("one");
347-
options [1] = strdup ("two");
348-
options [2] = nullptr ;
351+
char ** options = list_directory (dir);
352+
LOGD ("looking for models in %s\n", dir.c_str());
353+
//~ options [0] = strdup ("one");
354+
//~ options [1] = strdup ("two");
355+
//~ options [2] = nullptr ;
349356

350357
GtkWidget * dropdown = gtk_drop_down_new_from_strings (options);
358+
//~ char * f = options [0] ;
359+
int ii = 0 ;
360+
while (options [++ii]!= nullptr)
361+
free (options [ii]);
362+
//~ while (f != nullptr) {
363+
//~ free (f);
364+
//~ f++ ;
365+
//~ }
351366

352367
char * name = (char *) malloc (3) ;
353368
name [0] = i ;
@@ -607,11 +622,6 @@ PluginUI::PluginUI (Engine * _engine, Plugin * _plugin, GtkBox * _parent, std::s
607622
wtf ("[file chooser] mmmmph\n");
608623
GtkWidget * box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
609624
gtk_widget_set_hexpand (box, true);
610-
# ifdef __linux__
611-
std::string dir = std::string (getenv ("HOME")).append ("/amprack/models/").append (pluginName).append ("/");
612-
# else
613-
std::string dir = std::string (getenv ("USERPROFILE")).append ("/amprack/models/").append (pluginName).append ("/");
614-
# endif
615625

616626
char ** entries = list_directory (dir);
617627
GtkWidget * down = gtk_drop_down_new_from_strings (entries) ;

0 commit comments

Comments
 (0)