diff --git a/LICENSE.txt b/LICENSE.txt old mode 100755 new mode 100644 diff --git a/puredata/glsl/gain.ctl.pd b/puredata/glsl/gain.ctl.pd old mode 100755 new mode 100644 diff --git a/puredata/glsl/gain.frag b/puredata/glsl/gain.frag old mode 100755 new mode 100644 diff --git a/puredata/glsl/gain.vert b/puredata/glsl/gain.vert old mode 100755 new mode 100644 diff --git a/puredata/lms-video.pd b/puredata/lms-video.pd index 5386115..bbe78f3 100644 --- a/puredata/lms-video.pd +++ b/puredata/lms-video.pd @@ -1,6 +1,6 @@ -#N canvas 548 180 611 438 10; +#N canvas -93 562 1280 675 10; #X declare -path . -path externals; -#N canvas 57 385 240 272 fondo 0; +#N canvas 54 425 240 272 fondo 0; #X obj -452 -118 color 0 0 0; #X obj -452 -150 alpha; #X text -486 -209 Pantalla fondo Negra; @@ -73,7 +73,7 @@ #X connect 27 7 12 0; #X connect 27 8 10 0; #X restore -249 -438 pd receive; -#N canvas 814 208 450 333 window 0; +#N canvas 1408 248 1280 675 window 1; #X msg 809 -348 color 0 0 0; #X msg 620 -350 print; #X msg 466 -352 border \$1; @@ -103,6 +103,9 @@ #X msg 161 -350 0 \, destroy; #X msg 93 -265 frame \$1; #X obj 55 -290 r fps; +#X obj 682 -129 import gem; +#X obj 680 -175 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 +-1 -1; #X connect 0 0 24 0; #X connect 1 0 24 0; #X connect 2 0 24 0; @@ -138,6 +141,7 @@ #X connect 26 0 24 0; #X connect 27 0 24 0; #X connect 28 0 27 0; +#X connect 30 0 29 0; #X restore -175 -438 pd window; #N canvas 818 219 450 300 layer_5 0; #X msg -209 -32 1; @@ -246,7 +250,7 @@ #X connect 13 0 14 1; #X connect 14 0 3 0; #X restore -28 -379 pd layer_7; -#N canvas 889 319 450 300 layer_8 0; +#N canvas 830 332 450 300 layer_8 1; #X msg -124 -41 1; #X msg -177 -42 0; #X obj -177 -64 select 0; @@ -351,7 +355,7 @@ #X connect 13 0 14 1; #X connect 14 0 3 0; #X restore -323 -379 pd layer_3; -#N canvas 879 237 450 300 layer_2 0; +#N canvas 876 250 450 300 layer_2 0; #X msg -86 -22 1; #X msg -139 -23 0; #X obj -139 -45 select 0; @@ -386,7 +390,7 @@ #X connect 13 0 14 1; #X connect 14 0 3 0; #X restore -396 -379 pd layer_2; -#N canvas 899 309 450 300 layer_1 0; +#N canvas 830 322 450 300 layer_1 1; #X obj -253 -28 layer; #X msg -61 -33 1; #X msg -114 -34 0; @@ -467,6 +471,8 @@ GPL License; #X text -474 -219 This patch can not be run alone \, needs the libremediaserver GUI http://libremediaserver.googlecode.com; #X obj -388 -164 declare -path . -path externals; +#N canvas 0 93 450 300 layer_9 0; +#X restore 420 -224 pd layer_9; #X connect 4 0 15 0; #X connect 4 0 18 0; #X connect 13 0 14 0; diff --git a/puredata/vera.ttf b/puredata/vera.ttf old mode 100755 new mode 100644 diff --git a/scripts/install_precise.sh b/scripts/install_precise.sh old mode 100755 new mode 100644 diff --git a/scripts/install_wheezy.sh b/scripts/install_wheezy.sh old mode 100755 new mode 100644 diff --git a/src/Gem/autogen.sh b/src/Gem/autogen.sh old mode 100755 new mode 100644 diff --git a/src/Gem/build/osx-dmginstaller/buildinstaller.sh b/src/Gem/build/osx-dmginstaller/buildinstaller.sh old mode 100755 new mode 100644 diff --git a/src/Gem/build/osx-dmginstaller/icon2app b/src/Gem/build/osx-dmginstaller/icon2app old mode 100755 new mode 100644 diff --git a/src/Gem/src/importGLEW.sh b/src/Gem/src/importGLEW.sh old mode 100755 new mode 100644 diff --git a/src/Gem/src/openGL/fun2object.sh b/src/Gem/src/openGL/fun2object.sh old mode 100755 new mode 100644 diff --git a/src/Gem/src/pkgversion.sh b/src/Gem/src/pkgversion.sh old mode 100755 new mode 100644 diff --git a/src/Gem/tests/all/existence.sh b/src/Gem/tests/all/existence.sh old mode 100755 new mode 100644 diff --git a/src/Gem/tests/runtests.sh b/src/Gem/tests/runtests.sh old mode 100755 new mode 100644 diff --git a/src/libremediaserver.cpp b/src/libremediaserver.cpp index 1e9ff68..8cea672 100644 --- a/src/libremediaserver.cpp +++ b/src/libremediaserver.cpp @@ -73,6 +73,7 @@ libreMediaServer::libreMediaServer(QStringList args, QWidget *parent) qDebug() << VERSION; qDebug() << COPYRIGHT; qDebug() << LICENSE; + // Init Unix Local Sockets QFile socket(SOCKET); if (socket.exists()) @@ -97,6 +98,7 @@ libreMediaServer::libreMediaServer(QStringList args, QWidget *parent) connect(ui.actionSave_conf, SIGNAL(triggered()), this, SLOT(saveFile())); connect(ui.actionChange_Media_Path, SIGNAL(triggered()), this, SLOT(ChangeMediaPath())); connect(ui.actionLaunch_OLA_Setup,SIGNAL(triggered()),this, SLOT(olasetup())); + connect(ui.actionSettings,SIGNAL(triggered()),this, SLOT(settings())); // Start PD pdstart(); // Load the configuration @@ -106,6 +108,13 @@ libreMediaServer::libreMediaServer(QStringList args, QWidget *parent) connect(m_olaInterface->m_msex->m_timer, SIGNAL(timeout()), this, SLOT(sendFrame())); connect(m_olaInterface, SIGNAL(sendDmx(int,int,int)), this, SLOT(receiveDMX(int,int,int))); connect(m_olaInterface, SIGNAL(newFile(QString)), this, SLOT(newFile(QString))); + + // Load the last configuration + settingswindow = new settingsDialog(); + connect(settingswindow, SIGNAL(pathChanged(QString)), m_olaInterface, SLOT(setPath(QString))); + connect(settingswindow, SIGNAL(dmxChanged(int,int,int)), m_olaInterface->worker,SLOT(dmxConf(int,int,int))); + settingswindow->readXML(); // Read the last configuration file + m_olaInterface->open(); // Start the dmx reading } /////////////////////////////////////////////////////////////////// @@ -197,6 +206,12 @@ void libreMediaServer::ChangeMediaPath() m_olaInterface->setPath(file); } +void libreMediaServer::settings(){ + settingswindow->show(); + settingswindow->exec(); //retorno de error + +} + /////////////////////////////////////////////////////////////////// // Open/save Subroutines. The real work. /////////////////////////////////////////////////////////////////// diff --git a/src/libremediaserver.h b/src/libremediaserver.h index 71a9143..16f6ed6 100644 --- a/src/libremediaserver.h +++ b/src/libremediaserver.h @@ -39,6 +39,7 @@ #include "MSEXDefines.h" #include "ui_libremediaserver.h" #include "olainterface.h" +#include "settingsdialog.h" #define VERSION "LibreMediaServer Version 0.05-1" #define COPYRIGHT "(C) 2012-2013 Santi Norena libremediaserver@gmail.com" @@ -77,8 +78,9 @@ protected: int m_startvideo; // Counter starts video engine. Debugging purpose bool m_gui; -private: + settingsDialog *settingswindow; // The settings dialog +private: void errorsending(); void pdstart(); @@ -118,6 +120,7 @@ private slots: void openFile(); void saveFile(); void ChangeMediaPath();// Change the path to medias + void settings(); // Open the settings window }; #endif // LIBREMEDIASERVER_H diff --git a/src/libremediaserver.pro b/src/libremediaserver.pro index f070e90..056e210 100644 --- a/src/libremediaserver.pro +++ b/src/libremediaserver.pro @@ -11,7 +11,8 @@ HEADERS += libremediaserver.h \ msex.h \ CITPDefines.h \ MSEXDefines.h \ - olainterface.h + olainterface.h \ + settingsdialog.h SOURCES += main.cpp \ libremediaserver.cpp \ @@ -19,10 +20,12 @@ SOURCES += main.cpp \ PacketCreator.cpp \ PeerInformationSocket.cpp \ msex.cpp \ - olainterface.cpp + olainterface.cpp \ + settingsdialog.cpp FORMS += \ - libremediaserver.ui + libremediaserver.ui \ + settingsdialog.ui #INCLUDEPATH += ./ diff --git a/src/libremediaserver.ui b/src/libremediaserver.ui index 88efc66..2168f9d 100644 --- a/src/libremediaserver.ui +++ b/src/libremediaserver.ui @@ -451,6 +451,7 @@ + @@ -497,6 +498,11 @@ OLA Setup + + + Settings + + diff --git a/src/olainterface.cpp b/src/olainterface.cpp old mode 100755 new mode 100644 index e5ee7d9..6ff5728 --- a/src/olainterface.cpp +++ b/src/olainterface.cpp @@ -4,6 +4,7 @@ olaWorker is the threading class that reads raw DMX from ola daemon and save it into a buffer ordered in layers olaInterface controls olaWorker and translates DMX values received from olaWorker into orders to RenderingManager and Source */ + #include "olainterface.h" olaInterface::olaInterface() @@ -12,12 +13,12 @@ olaInterface::olaInterface() m_thread = NULL; worker = new olaWorker(); Q_CHECK_PTR(worker); - readDataFromXML(); // Read the dmx setting from dmx.xml +// readDataFromXML(); // Read the dmx setting from dmx.xml connect (worker, SIGNAL(dmx(int,int,int)), this, SLOT(dmx(int,int,int)), Qt::QueuedConnection); // The DMX values. initMediaLibrary(); // Init the media library reading the files in m_pathmedia m_msex = new msex(this); // Init the CITP/MSEx protocol Q_CHECK_PTR(m_msex); - open(); +// open(); } olaInterface::~olaInterface() @@ -49,6 +50,7 @@ void olaInterface::close() // - The number of sources/layers controlled by DMX // - The first DMX channel of each source/layer // - The universe to bind in OLA +// All this is being moved to settingsDialog Class void olaInterface::readDataFromXML() { QFile* xmlFile = new QFile("dmx.xlm"); @@ -319,6 +321,7 @@ olaWorker::olaWorker() { m_dmx[i][j] = 0; } } + m_layersNumber = 8; // hardcoded at the moment. This should be variable --> the gui must be dynamic... } // --- DECONSTRUCTOR --- @@ -407,21 +410,19 @@ void olaWorker::RegisterComplete(const string &error) { qWarning() << "olaWorker|" << "Register command failed" << QString::fromStdString(error); } } +/* + * Slot for change the dmx configuration + */ + +void olaWorker::dmxConf(int layer, int address, int universe) { + dmxSettings temp; + temp.address = address; + temp.universe = universe; + m_settings.replace(layer, temp); + // If the universe is not in the list, append it. + if(!m_universe.contains(universe)) { + m_universe.append(universe); + } +} //////////////////////////////////////////////////////////////////////////////////////////// - -/* We will need some GUI interaction from the user for settings. We will need: - * - Change the path to the medias - * - Change the DMX address of each layer - * - Change the universe to bind in ola - * - Write and read different xml configuration files for different setups - * - Start and stop the dmx reading - -void savesetttingtoxml{ -// Habrá que salvar las settings en algún sitio -} - -void opensettings{ -Posibilidad de abrir otro archivo de configuración -} -*/ diff --git a/src/olainterface.h b/src/olainterface.h old mode 100755 new mode 100644 index 25bbd0f..1758524 --- a/src/olainterface.h +++ b/src/olainterface.h @@ -75,6 +75,9 @@ private: bool CheckDataLoss(); void RegisterComplete(const string &error); // Called after completing the register +public slots: + void dmxConf(int layer, int address, int universe); + protected slots: void olastart(); // Starts the conexion with olad. olad must be running before this @@ -100,7 +103,7 @@ public: olaWorker *worker; // The thread of connection with ola. - inline void setPath(QString path) {m_pathmedia = path;} // Set the path to the root media path. The media files are inside this folder tree. + inline QString getPath () {return m_pathmedia;} // Get the path to the medias folder tree. msex *m_msex; @@ -124,6 +127,7 @@ public slots: void dmx(int layer, int channel, int value); // Connected with signal dmx from olaWorker. This is the horsepower of all this. Converts DMX orders // into orders to RenderingManager and Source. Mantains updated the videolayer struct. + inline void setPath(QString path) {m_pathmedia = path;} // Set the path to the root media path. The media files are inside this folder tree. signals: void sendDmx(int layer,int channel, int value); diff --git a/src/settingsdialog.cpp b/src/settingsdialog.cpp new file mode 100644 index 0000000..3e727ca --- /dev/null +++ b/src/settingsdialog.cpp @@ -0,0 +1,98 @@ +#include +#include +#include +#include + +#include "settingsdialog.h" +#include "ui_settingsdialog.h" + +settingsDialog::settingsDialog(QWidget *parent) : + QDialog(parent), + ui(new Ui::settingsDialog) +{ + ui->setupUi(this); + readXML(); + connect(ui->choosePathButton,SIGNAL(clicked(QAbstractButton*)), this, SLOT(changeMediaPath())); +} + +settingsDialog::~settingsDialog() +{ + delete ui; +} + +void settingsDialog::readXML() { +// QFile xmlFile("conf.xml"); + QFile* xmlFile = new QFile("conf.xlm"); + Q_CHECK_PTR(xmlFile); + if (!xmlFile->open(QIODevice::ReadOnly | QIODevice::Text)) { + QMessageBox::critical(NULL,"Load XML File Problem", + "Couldn't open configuration file", + QMessageBox::Ok); + //return; + } + QXmlStreamReader* xmlReader = new QXmlStreamReader(xmlFile); + //Parse the XML until we reach end of it + while(!xmlReader->atEnd() && !xmlReader->hasError()) { + // Read next element + QXmlStreamReader::TokenType token = xmlReader->readNext(); + //If token is just StartDocument - go to next + if(token == QXmlStreamReader::StartDocument) { + continue; + } + //If token is StartElement - read it + if(token == QXmlStreamReader::StartElement) { + if(xmlReader->name() == "windowSettings") { + int version = xmlReader->attributes().value("fileVersion").toLocal8Bit().toInt(); + if(version == 1) { + ui->winpositionx->setValue(xmlReader->attributes().value("XPos").toLocal8Bit().toInt()); + ui->winpositiony->setValue(xmlReader->attributes().value("YPos").toLocal8Bit().toInt()); + ui->winsizex->setValue(xmlReader->attributes().value("XSize").toLocal8Bit().toInt()); + ui->winsizey->setValue(xmlReader->attributes().value("YSize").toLocal8Bit().toInt()); + ui->fps->setValue(xmlReader->attributes().value("FPS").toLocal8Bit().toInt()); + continue; + } + } + int counter = 0; + if(xmlReader->name() == "dmxSettings") { + int version = xmlReader->attributes().value("fileVersion").toLocal8Bit().toInt(); + if(version == 1) { +// worker->m_layersNumber = xmlReader->attributes().value("layersNumber").toLocal8Bit().toInt(); + emit pathChanged(xmlReader->attributes().value("path").toLocal8Bit()); + continue; + } + } +// if (worker->m_layersNumber > MAX_SOURCE_DMX) { +// worker->m_layersNumber = MAX_SOURCE_DMX; +// } + QString add = "layer"; + add.append(QString("%1").arg(counter)); + if((xmlReader->name() == add)/* && (counter < worker->m_layersNumber)*/) { + emit dmxChanged(counter, (xmlReader->attributes().value("dmx").toLocal8Bit().toInt() - 1),xmlReader->attributes().value("universe").toLocal8Bit().toInt()); + } + counter++; + } + } + if(xmlReader->hasError()) { + QMessageBox::critical(NULL,"xmlFile.xml Parse Error",xmlReader->errorString(), QMessageBox::Ok); + } + //close reader and flush file + xmlReader->clear(); + xmlFile->close(); + + delete xmlReader; + delete xmlFile; +} + +void settingsDialog::changeMediaPath(){ + QFileDialog dialog(this); + dialog.setFileMode(QFileDialog::Directory); + QStringList fileNames; + if (!dialog.exec()) + return; + fileNames = dialog.selectedFiles(); + QString file = fileNames.at(0); + ui->currentPath->clear(); + ui->currentPath->setText(file); + emit pathChanged(file); + // m_olaInterface->setPath(file); //Setear en olaInterface +} diff --git a/src/settingsdialog.h b/src/settingsdialog.h new file mode 100644 index 0000000..e02e269 --- /dev/null +++ b/src/settingsdialog.h @@ -0,0 +1,32 @@ +#ifndef SETTINGSDIALOG_H +#define SETTINGSDIALOG_H + +#include + +#define LMS_CONF_FILE "lmsconf.xml" + +namespace Ui { +class settingsDialog; +} + +class settingsDialog : public QDialog +{ + Q_OBJECT + +public: + explicit settingsDialog(QWidget *parent = 0); + ~settingsDialog(); + void readXML(); + +private: + Ui::settingsDialog *ui; + +signals: + void pathChanged(QString); + void dmxChanged(int layer, int address, int universe); +private slots: + void changeMediaPath(); + +}; + +#endif // SETTINGSDIALOG_H diff --git a/src/settingsdialog.ui b/src/settingsdialog.ui new file mode 100644 index 0000000..72f4ec7 --- /dev/null +++ b/src/settingsdialog.ui @@ -0,0 +1,340 @@ + + + settingsDialog + + + + 0 + 0 + 615 + 341 + + + + Dialog + + + + + 260 + 300 + 341 + 32 + + + + Qt::Horizontal + + + QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + true + + + + + + 10 + 10 + 591 + 281 + + + + 0 + + + + General + + + + + 10 + 20 + 371 + 31 + + + + Path to medias + + + + + + 390 + 20 + 91 + 31 + + + + QDialogButtonBox::Open + + + + + + 10 + 60 + 561 + 121 + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Cantarell'; font-size:11pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Warning! </p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Changing this will reload the library and will make the thumbnails for all the medias. This will take a while.</p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Do not use in live!</p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">You are warned.</p></body></html> + + + + + + true + + + Video + + + Video + + + + + 30 + 130 + 121 + 20 + + + + Window Position + + + + + + 20 + 90 + 55 + 27 + + + + 5000 + + + + + + 20 + 40 + 55 + 27 + + + + QAbstractSpinBox::UpDownArrows + + + 5000 + + + + + + 80 + 90 + 55 + 27 + + + + 5000 + + + + + + 80 + 40 + 55 + 27 + + + + 5000 + + + + + + 30 + 70 + 101 + 17 + + + + Window Size + + + + + + 340 + 40 + 81 + 31 + + + + QDialogButtonBox::Reset + + + + + + 20 + 180 + 59 + 31 + + + + + + + 90 + 180 + 121 + 20 + + + + FPS + + + + + + DMX + + + + + 30 + 20 + 59 + 31 + + + + + + + 100 + 20 + 101 + 21 + + + + OLA Universe + + + + + + 10 + 90 + 516 + 131 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 170 + 60 + 101 + 21 + + + + DMX Address + + + + + + + + + buttonBox + accepted() + settingsDialog + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + settingsDialog + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/todo.txt b/todo.txt index ce2e4c4..10c7ac7 100644 --- a/todo.txt +++ b/todo.txt @@ -16,10 +16,11 @@ v0.05 video: Necesarios: + ¿Cómo transmitir el dmx a Pure Data? --> Unix Domain Socket parece lo mejor. Habría que hacer external en PD? -+ Mover ola2pd a la parte C++ (importar de glmixer-dmx) -+ Mover fileselector a la parte C++ (importar de glmixer-dmx) -+ Crear base de datos al inicio en vez de leer ficheros del disco. Generar thumbs --> Importar de glmixer-dmx ++ Mover ola2pd a la parte C++ ++ Mover fileselector a la parte C++ ++ Crear base de datos al inicio en vez de leer ficheros del disco. + Cambiar archivo de configuracion a xml (importar de glmixer-dmx) + - Añadir shaders, cambiar objetos Gem por uniform glsl. Alpha, chroma, ... - Añadir la configuración de la ventana al archivo de configuración xlm - Documentación en inglés