2013-04-20 11:37:36 +01:00
|
|
|
|
2013-09-11 12:57:31 +01:00
|
|
|
#include "config.hxx"
|
2013-04-20 11:37:36 +01:00
|
|
|
|
|
|
|
#include <iostream>
|
|
|
|
#include <unistd.h>
|
2013-09-21 00:52:29 +01:00
|
|
|
#include <signal.h>
|
2013-04-20 11:37:36 +01:00
|
|
|
|
|
|
|
#include <jack/ringbuffer.h>
|
|
|
|
|
2013-04-20 11:50:30 +01:00
|
|
|
#include "gui.hxx"
|
2013-04-20 11:37:36 +01:00
|
|
|
#include "jack.hxx"
|
2013-04-20 11:54:16 +01:00
|
|
|
#include "event.hxx"
|
2013-04-20 12:20:46 +01:00
|
|
|
#include "denormals.hxx"
|
2013-04-20 11:37:36 +01:00
|
|
|
|
2013-09-21 00:52:29 +01:00
|
|
|
int signalHanlderInt = 0;
|
|
|
|
|
2013-04-20 11:37:36 +01:00
|
|
|
char* processDspMem = 0;
|
2013-05-16 13:38:46 +01:00
|
|
|
char* processGuiMem = 0;
|
2013-04-20 11:37:36 +01:00
|
|
|
|
|
|
|
jack_ringbuffer_t* rbToDsp = 0;
|
|
|
|
jack_ringbuffer_t* rbToGui = 0;
|
|
|
|
|
2013-05-16 13:38:46 +01:00
|
|
|
// global static pointers, for access from EventHandlerGui and EventHandlerDsp
|
|
|
|
Gui * gui = 0;
|
2013-04-20 11:37:36 +01:00
|
|
|
Jack* jack = 0;
|
|
|
|
|
2013-09-11 12:57:31 +01:00
|
|
|
|
2013-09-21 00:52:29 +01:00
|
|
|
void signalHanlder(int signum)
|
|
|
|
{
|
|
|
|
signalHanlderInt = signum;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-09-11 12:57:31 +01:00
|
|
|
int main(int argc, char** argv)
|
2013-04-20 11:37:36 +01:00
|
|
|
{
|
2013-09-17 10:17:33 +01:00
|
|
|
bool runTests = false;
|
|
|
|
bool stopAfterTest = false;
|
2013-09-18 11:46:25 +01:00
|
|
|
if(runTests == stopAfterTest){} // warning
|
|
|
|
|
2013-09-17 10:17:33 +01:00
|
|
|
for(int i = 0; i < argc; i++)
|
|
|
|
{
|
|
|
|
if ( strcmp(argv[i], "-test" ) == 0 ) {
|
|
|
|
runTests = true;
|
|
|
|
} else if ( strcmp( argv[i], "-stopAfterTest") == 0 ) {
|
|
|
|
stopAfterTest = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-04-20 12:20:46 +01:00
|
|
|
// setup the environment
|
|
|
|
AVOIDDENORMALS();
|
2013-09-21 00:52:29 +01:00
|
|
|
signal(SIGINT , signalHanlder);
|
|
|
|
signal(SIGTERM, signalHanlder);
|
2013-04-20 12:20:46 +01:00
|
|
|
|
2013-04-20 11:54:16 +01:00
|
|
|
// allocate data to read from
|
|
|
|
processDspMem = (char*)malloc( sizeof(EventBase) );
|
2013-05-16 13:38:46 +01:00
|
|
|
processGuiMem = (char*)malloc( sizeof(EventBase) );
|
2013-04-20 11:54:16 +01:00
|
|
|
|
2013-05-16 13:38:46 +01:00
|
|
|
rbToDsp = jack_ringbuffer_create( 5000 * sizeof(EventBase));
|
|
|
|
rbToGui = jack_ringbuffer_create( 5000 * sizeof(EventBase));
|
2013-04-20 11:54:16 +01:00
|
|
|
|
2013-09-11 12:57:31 +01:00
|
|
|
#ifdef BUILD_TESTS
|
2013-09-17 10:17:33 +01:00
|
|
|
if ( runTests )
|
|
|
|
{
|
2013-09-17 12:07:25 +01:00
|
|
|
// counts failures
|
|
|
|
int testResult = 0;
|
|
|
|
|
2013-10-03 10:17:23 +01:00
|
|
|
// setup the testing Gui / JACK: Jack first, then GUI
|
2013-09-17 11:00:12 +01:00
|
|
|
jack = new Jack();
|
2013-11-07 22:42:28 +00:00
|
|
|
gui = new Gui(argv[0]);
|
2013-09-17 11:00:12 +01:00
|
|
|
|
2013-09-17 10:17:33 +01:00
|
|
|
// test offline functionality
|
2013-09-23 12:21:33 +01:00
|
|
|
testResult += gui->getDiskReader()->runTests();
|
2013-09-17 12:07:25 +01:00
|
|
|
testResult += gui->getDiskWriter()->runTests();
|
2013-09-17 11:00:12 +01:00
|
|
|
|
2013-09-17 10:17:33 +01:00
|
|
|
// test realtime functionality
|
2013-09-17 12:07:25 +01:00
|
|
|
testResult += jack->getGridLogic()->runTests();
|
2013-09-17 10:17:33 +01:00
|
|
|
|
2013-09-17 11:00:12 +01:00
|
|
|
delete gui;
|
|
|
|
delete jack;
|
|
|
|
|
2013-09-12 15:44:30 +01:00
|
|
|
#ifdef BUILD_COVERAGE_TEST
|
2013-09-17 10:17:33 +01:00
|
|
|
if ( stopAfterTest )
|
|
|
|
{
|
2013-09-17 12:07:25 +01:00
|
|
|
return testResult;
|
2013-09-17 10:17:33 +01:00
|
|
|
}
|
2013-09-12 15:44:30 +01:00
|
|
|
#endif
|
2013-09-17 10:17:33 +01:00
|
|
|
}
|
2013-09-11 12:57:31 +01:00
|
|
|
#endif
|
2013-09-17 11:00:12 +01:00
|
|
|
|
2013-10-03 10:17:23 +01:00
|
|
|
// setup the "real" JACK / Gui: Jack first, then GUI
|
2013-09-17 11:00:12 +01:00
|
|
|
jack = new Jack();
|
|
|
|
|
2013-11-07 22:42:28 +00:00
|
|
|
gui = new Gui(argv[0]);
|
2013-10-03 10:17:23 +01:00
|
|
|
|
|
|
|
|
2013-07-31 01:05:14 +01:00
|
|
|
jack->activate();
|
2013-05-16 13:38:46 +01:00
|
|
|
gui->show();
|
2013-09-17 12:07:25 +01:00
|
|
|
|
|
|
|
return 0;
|
2013-04-20 11:37:36 +01:00
|
|
|
}
|
2013-09-11 12:57:31 +01:00
|
|
|
|