2013-04-20 12:37:36 +02:00
|
|
|
|
2013-09-11 13:57:31 +02:00
|
|
|
#include "config.hxx"
|
2013-04-20 12:37:36 +02:00
|
|
|
|
|
|
|
#include <iostream>
|
|
|
|
#include <unistd.h>
|
|
|
|
|
|
|
|
#include <jack/ringbuffer.h>
|
|
|
|
|
2013-04-20 12:50:30 +02:00
|
|
|
#include "gui.hxx"
|
2013-04-20 12:37:36 +02:00
|
|
|
#include "jack.hxx"
|
2013-04-20 12:54:16 +02:00
|
|
|
#include "event.hxx"
|
2013-04-20 13:20:46 +02:00
|
|
|
#include "denormals.hxx"
|
2013-04-20 12:37:36 +02:00
|
|
|
|
|
|
|
char* processDspMem = 0;
|
2013-05-16 14:38:46 +02:00
|
|
|
char* processGuiMem = 0;
|
2013-04-20 12:37:36 +02:00
|
|
|
|
|
|
|
jack_ringbuffer_t* rbToDsp = 0;
|
|
|
|
jack_ringbuffer_t* rbToGui = 0;
|
|
|
|
|
2013-05-16 14:38:46 +02:00
|
|
|
// global static pointers, for access from EventHandlerGui and EventHandlerDsp
|
|
|
|
Gui * gui = 0;
|
2013-04-20 12:37:36 +02:00
|
|
|
Jack* jack = 0;
|
|
|
|
|
2013-09-11 13:57:31 +02:00
|
|
|
|
|
|
|
int main(int argc, char** argv)
|
2013-04-20 12:37:36 +02:00
|
|
|
{
|
2013-09-17 11:17:33 +02:00
|
|
|
bool runTests = false;
|
|
|
|
bool stopAfterTest = false;
|
2013-09-18 12:46:25 +02:00
|
|
|
if(runTests == stopAfterTest){} // warning
|
|
|
|
|
2013-09-17 11:17:33 +02: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-09-18 12:46:25 +02:00
|
|
|
|
2013-04-20 13:20:46 +02:00
|
|
|
// setup the environment
|
|
|
|
AVOIDDENORMALS();
|
|
|
|
|
2013-04-20 12:54:16 +02:00
|
|
|
// allocate data to read from
|
|
|
|
processDspMem = (char*)malloc( sizeof(EventBase) );
|
2013-05-16 14:38:46 +02:00
|
|
|
processGuiMem = (char*)malloc( sizeof(EventBase) );
|
2013-04-20 12:54:16 +02:00
|
|
|
|
2013-05-16 14:38:46 +02:00
|
|
|
rbToDsp = jack_ringbuffer_create( 5000 * sizeof(EventBase));
|
|
|
|
rbToGui = jack_ringbuffer_create( 5000 * sizeof(EventBase));
|
2013-04-20 12:54:16 +02:00
|
|
|
|
2013-09-11 13:57:31 +02:00
|
|
|
#ifdef BUILD_TESTS
|
2013-09-17 11:17:33 +02:00
|
|
|
if ( runTests )
|
|
|
|
{
|
2013-09-17 13:07:25 +02:00
|
|
|
// counts failures
|
|
|
|
int testResult = 0;
|
|
|
|
|
2013-09-17 12:00:12 +02:00
|
|
|
// setup the testing Gui / JACK
|
|
|
|
gui = new Gui();
|
|
|
|
jack = new Jack();
|
|
|
|
|
2013-09-17 11:17:33 +02:00
|
|
|
// test offline functionality
|
2013-09-17 13:07:25 +02:00
|
|
|
testResult += gui->getDiskWriter()->runTests();
|
2013-09-17 12:00:12 +02:00
|
|
|
|
2013-09-17 11:17:33 +02:00
|
|
|
// test realtime functionality
|
2013-09-17 13:07:25 +02:00
|
|
|
testResult += jack->getGridLogic()->runTests();
|
2013-09-17 11:17:33 +02:00
|
|
|
|
2013-09-17 12:00:12 +02:00
|
|
|
delete gui;
|
|
|
|
delete jack;
|
|
|
|
|
2013-09-12 16:44:30 +02:00
|
|
|
#ifdef BUILD_COVERAGE_TEST
|
2013-09-17 11:17:33 +02:00
|
|
|
if ( stopAfterTest )
|
|
|
|
{
|
2013-09-17 13:07:25 +02:00
|
|
|
return testResult;
|
2013-09-17 11:17:33 +02:00
|
|
|
}
|
2013-09-12 16:44:30 +02:00
|
|
|
#endif
|
2013-09-17 11:17:33 +02:00
|
|
|
}
|
2013-09-12 16:44:30 +02:00
|
|
|
// FIXME: Reset the state of GUI / GridLogic here. Create a "new session"?
|
2013-09-11 13:57:31 +02:00
|
|
|
#endif
|
2013-09-17 12:00:12 +02:00
|
|
|
|
|
|
|
// setup the "real" GUI / JACK
|
|
|
|
gui = new Gui();
|
|
|
|
jack = new Jack();
|
|
|
|
|
2013-07-31 02:05:14 +02:00
|
|
|
jack->activate();
|
2013-05-16 14:38:46 +02:00
|
|
|
gui->show();
|
2013-09-17 13:07:25 +02:00
|
|
|
|
|
|
|
return 0;
|
2013-04-20 12:37:36 +02:00
|
|
|
}
|
2013-09-11 13:57:31 +02:00
|
|
|
|