├── LICENSE ├── README.md ├── SceneEditor ├── SceneEditor.pro ├── aboutwidget.cpp ├── aboutwidget.h ├── aboutwidget.ui ├── bottomwidget.cpp ├── bottomwidget.h ├── bottomwidget.ui ├── core.cpp ├── core.h ├── editorwidget.cpp ├── editorwidget.h ├── editorwidget.ui ├── fast2dquad.cpp ├── fast2dquad.h ├── fbo.cpp ├── fbo.h ├── highlighter.cpp ├── highlighter.h ├── main.cpp ├── mainwindow.cpp ├── mainwindow.h ├── mainwindow.ui ├── newshader.cpp ├── newshader.h ├── newshader.ui ├── newwidget.cpp ├── newwidget.h ├── newwidget.ui ├── openwidget.cpp ├── openwidget.h ├── openwidget.ui ├── paramwidget.cpp ├── paramwidget.h ├── paramwidget.ui ├── qdarkstyle │ ├── rc │ │ ├── Hmovetoolbar.png │ │ ├── Hsepartoolbar.png │ │ ├── Vmovetoolbar.png │ │ ├── Vsepartoolbar.png │ │ ├── branch_closed-on.png │ │ ├── branch_closed.png │ │ ├── branch_open-on.png │ │ ├── branch_open.png │ │ ├── checkbox.png │ │ ├── close.png │ │ ├── down_arrow.png │ │ ├── down_arrow_disabled.png │ │ ├── left_arrow.png │ │ ├── left_arrow_disabled.png │ │ ├── right_arrow.png │ │ ├── right_arrow_disabled.png │ │ ├── sizegrip.png │ │ ├── stylesheet-branch-end.png │ │ ├── stylesheet-branch-more.png │ │ ├── stylesheet-vline.png │ │ ├── transparent.png │ │ ├── undock.png │ │ ├── up_arrow.png │ │ └── up_arrow_disabled.png │ ├── style.qrc │ └── style.qss ├── renderwidget.cpp ├── renderwidget.h ├── res.qrc ├── res │ ├── framework │ │ ├── DF │ │ │ ├── Scene.glsl │ │ │ └── config.xml │ │ ├── Empty │ │ │ ├── Scene.glsl │ │ │ └── config.xml │ │ ├── Layer │ │ │ └── layer.glsl │ │ └── Raytracing │ │ │ ├── Scene.glsl │ │ │ └── config.xml │ ├── img │ │ ├── camera.png │ │ ├── filenew.png │ │ ├── fileopen.png │ │ ├── filesave.png │ │ ├── micro.png │ │ ├── music.png │ │ ├── new shader.png │ │ ├── new.png │ │ ├── open.png │ │ ├── projector.png │ │ ├── save.png │ │ ├── screenshot.png │ │ ├── setting.png │ │ ├── setting2.png │ │ ├── setting_visual.png │ │ └── vls.png │ └── logo.ico ├── ressource.rc ├── scene.cpp ├── scene.h ├── shader.cpp ├── shader.h ├── texteditor.cpp ├── texteditor.h ├── texture.cpp └── texture.h ├── VisualLiveSystem ├── FFTAnalyzer.cpp ├── FFTAnalyzer.h ├── VisualLiveSystem.pro ├── audiovisualizer.cpp ├── audiovisualizer.h ├── channelwidget.cpp ├── channelwidget.h ├── channelwidget.ui ├── core.cpp ├── core.h ├── fast2dquad.cpp ├── fast2dquad.h ├── fbo.cpp ├── fbo.h ├── glscene.cpp ├── glscene.h ├── loadingwidget.cpp ├── loadingwidget.h ├── loadingwidget.ui ├── main.cpp ├── mainwindow.cpp ├── mainwindow.h ├── mainwindow.ui ├── masterwidget.cpp ├── masterwidget.h ├── masterwidget.ui ├── midiwindow.cpp ├── midiwindow.h ├── midiwindow.ui ├── projectorwidget.cpp ├── projectorwidget.h ├── qdarkstyle │ ├── rc │ │ ├── Hmovetoolbar.png │ │ ├── Hsepartoolbar.png │ │ ├── Vmovetoolbar.png │ │ ├── Vsepartoolbar.png │ │ ├── branch_closed-on.png │ │ ├── branch_closed.png │ │ ├── branch_open-on.png │ │ ├── branch_open.png │ │ ├── checkbox.png │ │ ├── close.png │ │ ├── down_arrow.png │ │ ├── down_arrow_disabled.png │ │ ├── left_arrow.png │ │ ├── left_arrow_disabled.png │ │ ├── right_arrow.png │ │ ├── right_arrow_disabled.png │ │ ├── sizegrip.png │ │ ├── stylesheet-branch-end.png │ │ ├── stylesheet-branch-more.png │ │ ├── stylesheet-vline.png │ │ ├── transparent.png │ │ ├── undock.png │ │ ├── up_arrow.png │ │ └── up_arrow_disabled.png │ ├── style.qrc │ └── style.qss ├── qmidisequencer.cpp ├── qmidisequencer.h ├── renderwidget.cpp ├── renderwidget.h ├── res.qrc ├── res │ ├── img │ │ ├── micro.png │ │ ├── music.png │ │ ├── new.png │ │ ├── open.png │ │ ├── projector.png │ │ ├── save.png │ │ ├── setting.png │ │ ├── setting2.png │ │ ├── setting_visual.png │ │ └── vls.png │ ├── logo.ico │ └── shaders │ │ ├── audiovisualizer.glsl │ │ ├── open.glsl │ │ └── postprocess.glsl ├── ressource.rc ├── scene.cpp ├── scene.h ├── shader.cpp ├── shader.h ├── signal │ ├── audiopipe.cpp │ ├── audiopipe.hpp │ ├── bass.h │ ├── basserrorhandler.cpp │ ├── basserrorhandler.hpp │ ├── bassflac.h │ ├── decoder.cpp │ ├── decoder.hpp │ ├── fft.cpp │ ├── fft.hpp │ ├── signal.cpp │ └── signal.hpp ├── soundmanager.cpp ├── soundmanager.h ├── soundmanager.ui ├── texture.cpp ├── texture.h ├── transition.cpp ├── transition.h ├── visualmanager.cpp ├── visualmanager.h └── visualmanager.ui └── release ├── data ├── config │ └── midi │ │ ├── Akai LPD8.conf │ │ └── Akai MPK Mini.conf ├── postFX │ ├── Invert.glsl │ ├── Vignetting.glsl │ ├── green-pink blur.glsl │ ├── red-blue blur.glsl │ └── vertical_minibar.glsl ├── scenes │ └── Open │ │ ├── config.xml │ │ └── open.glsl ├── textures │ ├── noise.png │ ├── noise16.png │ ├── noise256.png │ ├── sky.tga.png │ ├── sprite.png │ ├── sprite2.png │ └── water.png └── transitions │ ├── Black fade │ ├── config.xml │ └── transition.glsl │ ├── Black flash │ ├── config.xml │ └── transition.glsl │ ├── Fade │ ├── config.xml │ └── transition.glsl │ ├── None │ ├── config.xml │ └── transition.glsl │ ├── Pyramid │ ├── config.xml │ └── transition.glsl │ ├── White fade │ ├── config.xml │ └── transition.glsl │ └── White flash │ ├── config.xml │ └── transition.glsl └── settings.ini /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 XT95 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # VisualLiveSystem 2 | Visual Live System is a new visual jockey software for professional live performance. 3 | Compatible with Mac and PC, he is able to render complex real time 3D scene fully based on the sound. 4 | He have an intuitive interface thinked like a DJ solution, 2 channels of real time effects and a master pannel for mixing theses. 5 | Midi controllers is supported. 6 | 7 | 8 | 9 | 10 | More details soon. 11 | 12 | ## Setup: 13 | 14 | Dependencies: 15 | * [qt 4.8](http://download.qt.io/archive/qt/4.8/4.8.4/) 16 | * [bass](http://www.un4seen.com/) 17 | * [bassflac](http://www.un4seen.com/) 18 | * [rtaudio](https://www.music.mcgill.ca/~gary/rtaudio/) 19 | * [portmidi](http://portmedia.sourceforge.net/portmidi/) 20 | * [glew](http://glew.sourceforge.net/) 21 | 22 | 23 | Compile: 24 | * Open /VisualLiveSystem/VisualLiveSystem.pro with Qt Creator, setup the binary output to /release and compil it. 25 | * You can do the same thing with /SceneEditor. 26 | 27 | 28 | ## Usage: 29 | 30 | Visual Live System 31 | * If you have a midi controller just go to the midi controller view, make a new profil and assign yours faders like of you want. 32 | * After that, open the visual manager select some few scenes and drag'n'drop of the channels A and B. Apply. 33 | * Go to the post processing tabulation, and add some post fx (the order change the result). Apply. 34 | * Get the output audio of your DJ on input of your computer (if you just want to make a test, the microphone should be correct). 35 | * Now, open the projector's window, move them to the projector screen and double clik for the fullscreen mode. 36 | * Enjoy by making beautiful transition between the channels when you have a drop :) ! 37 | -------------------------------------------------------------------------------- /SceneEditor/SceneEditor.pro: -------------------------------------------------------------------------------- 1 | #------------------------------------------------- 2 | # 3 | # Project created by QtCreator 2014-10-28T22:34:42 4 | # 5 | #------------------------------------------------- 6 | 7 | QT += core gui opengl xml 8 | 9 | TARGET = SceneEditor 10 | TEMPLATE = app 11 | 12 | RC_FILE = ressource.rc 13 | 14 | INCLUDEPATH += C:/Coding/Librarys/include 15 | LIBS += -LC:/Coding/Librarys/lib/32 16 | 17 | 18 | LIBS += -lwinmm -lole32 -lGLEW32 -ldsound 19 | 20 | 21 | SOURCES += main.cpp\ 22 | mainwindow.cpp \ 23 | texture.cpp \ 24 | shader.cpp \ 25 | scene.cpp \ 26 | fbo.cpp \ 27 | fast2dquad.cpp \ 28 | core.cpp \ 29 | renderwidget.cpp \ 30 | texteditor.cpp \ 31 | bottomwidget.cpp \ 32 | paramwidget.cpp \ 33 | editorwidget.cpp \ 34 | highlighter.cpp \ 35 | newwidget.cpp \ 36 | openwidget.cpp \ 37 | newshader.cpp \ 38 | aboutwidget.cpp 39 | 40 | HEADERS += mainwindow.h \ 41 | texture.h \ 42 | shader.h \ 43 | scene.h \ 44 | fbo.h \ 45 | fast2dquad.h \ 46 | core.h \ 47 | renderwidget.h \ 48 | texteditor.h \ 49 | bottomwidget.h \ 50 | paramwidget.h \ 51 | editorwidget.h \ 52 | highlighter.h \ 53 | newwidget.h \ 54 | openwidget.h \ 55 | newshader.h \ 56 | aboutwidget.h 57 | 58 | FORMS += mainwindow.ui \ 59 | bottomwidget.ui \ 60 | paramwidget.ui \ 61 | editorwidget.ui \ 62 | newwidget.ui \ 63 | openwidget.ui \ 64 | newshader.ui \ 65 | aboutwidget.ui 66 | 67 | RESOURCES += \ 68 | res.qrc \ 69 | qdarkstyle/style.qrc 70 | -------------------------------------------------------------------------------- /SceneEditor/aboutwidget.cpp: -------------------------------------------------------------------------------- 1 | #include "aboutwidget.h" 2 | #include "ui_aboutwidget.h" 3 | 4 | AboutWidget::AboutWidget(QWidget *parent) : 5 | QDialog(parent), 6 | ui(new Ui::AboutWidget) 7 | { 8 | ui->setupUi(this); 9 | } 10 | 11 | AboutWidget::~AboutWidget() 12 | { 13 | delete ui; 14 | } 15 | -------------------------------------------------------------------------------- /SceneEditor/aboutwidget.h: -------------------------------------------------------------------------------- 1 | #ifndef ABOUTWIDGET_H 2 | #define ABOUTWIDGET_H 3 | 4 | #include 5 | 6 | namespace Ui { 7 | class AboutWidget; 8 | } 9 | 10 | class AboutWidget : public QDialog 11 | { 12 | Q_OBJECT 13 | 14 | public: 15 | explicit AboutWidget(QWidget *parent = 0); 16 | ~AboutWidget(); 17 | 18 | private: 19 | Ui::AboutWidget *ui; 20 | }; 21 | 22 | #endif // ABOUTWIDGET_H 23 | -------------------------------------------------------------------------------- /SceneEditor/aboutwidget.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | AboutWidget 4 | 5 | 6 | 7 | 0 8 | 0 9 | 630 10 | 406 11 | 12 | 13 | 14 | Dialog 15 | 16 | 17 | 18 | 19 | 20 | www.aduprat.com 21 | 22 | 23 | Qt::AlignJustify|Qt::AlignVCenter 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /SceneEditor/bottomwidget.cpp: -------------------------------------------------------------------------------- 1 | #include "bottomwidget.h" 2 | #include "ui_bottomwidget.h" 3 | 4 | BottomWidget::BottomWidget(QWidget *parent) : 5 | QDockWidget(parent), 6 | ui(new Ui::BottomWidget) 7 | { 8 | ui->setupUi(this); 9 | connect(ui->logWidget, SIGNAL(textChanged()), this, SLOT(logChanged())); 10 | } 11 | 12 | BottomWidget::~BottomWidget() 13 | { 14 | delete ui; 15 | } 16 | 17 | QTextEdit* BottomWidget::getLogWidget() 18 | { return ui->logWidget; } 19 | 20 | void BottomWidget::logChanged() 21 | { 22 | ui->logWidget->ensureCursorVisible(); 23 | } 24 | -------------------------------------------------------------------------------- /SceneEditor/bottomwidget.h: -------------------------------------------------------------------------------- 1 | #ifndef BOTTOMWIDGET_H 2 | #define BOTTOMWIDGET_H 3 | 4 | #include 5 | #include 6 | 7 | namespace Ui { 8 | class BottomWidget; 9 | } 10 | 11 | class BottomWidget : public QDockWidget 12 | { 13 | Q_OBJECT 14 | 15 | public: 16 | explicit BottomWidget(QWidget *parent = 0); 17 | ~BottomWidget(); 18 | 19 | QTextEdit* getLogWidget(); 20 | 21 | private slots: 22 | void logChanged(); 23 | private: 24 | Ui::BottomWidget *ui; 25 | }; 26 | 27 | #endif // BOTTOMWIDGET_H 28 | -------------------------------------------------------------------------------- /SceneEditor/bottomwidget.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | BottomWidget 4 | 5 | 6 | 7 | 0 8 | 0 9 | 889 10 | 278 11 | 12 | 13 | 14 | 15 | 0 16 | 0 17 | 18 | 19 | 20 | Logs 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 0 29 | 0 30 | 31 | 32 | 33 | Qt::ScrollBarAlwaysOn 34 | 35 | 36 | false 37 | 38 | 39 | true 40 | 41 | 42 | Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /SceneEditor/core.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "core.h" 4 | #include "scene.h" 5 | 6 | Core* Core::m_instance = NULL; 7 | Core* Core::instance() 8 | { 9 | if(m_instance == NULL) 10 | { 11 | m_instance = new Core(); 12 | } 13 | return m_instance; 14 | } 15 | 16 | Core::Core() 17 | { 18 | m_resX = 640; 19 | m_resY = 360; 20 | 21 | m_scene = NULL; 22 | } 23 | 24 | static unsigned int mirand = 1; 25 | float sfrand(void) 26 | { 27 | float res; 28 | mirand *= 16807; 29 | *((unsigned int *) &res) = (mirand & 0x007fffff) | 0x40000000; 30 | return( res-3.0f ); 31 | } 32 | 33 | void Core::initGL() 34 | { 35 | glMatrixMode(GL_MODELVIEW); 36 | glEnable(GL_TEXTURE_2D); 37 | 38 | 39 | glEnable(GL_TEXTURE_3D); 40 | glGenTextures(1, &m_noise3D); 41 | glBindTexture(GL_TEXTURE_3D, m_noise3D); 42 | glTexParameteri(GL_TEXTURE_3D, GL_GENERATE_MIPMAP_SGIS, GL_TRUE); 43 | glTexParameteri(GL_TEXTURE_3D,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_LINEAR); 44 | glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); 45 | glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_S, GL_REPEAT); 46 | glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_T, GL_REPEAT); 47 | 48 | const int noiseSize=64; 49 | unsigned char *data = new unsigned char[noiseSize*noiseSize*noiseSize*4]; 50 | for(int i=0;isetTextColor( QColor(0,150,0) ); 136 | if(time) 137 | txt = getDate() + txt; 138 | 139 | m_log->textCursor().movePosition(QTextCursor::End); 140 | m_log->insertPlainText(txt); 141 | } 142 | void Core::writeWarning( QString txt, bool time) 143 | { 144 | // m_log->clear(); 145 | m_log->setTextColor( QColor(255,255,100) ); 146 | if(time) 147 | txt = getDate() + txt; 148 | 149 | m_log->textCursor().movePosition(QTextCursor::End); 150 | m_log->insertPlainText(txt); 151 | } 152 | void Core::writeError( QString txt, bool time) 153 | { 154 | // m_log->clear(); 155 | m_log->setTextColor( QColor(255,0,0) ); 156 | if(time) 157 | txt = getDate() + txt; 158 | 159 | m_log->textCursor().movePosition(QTextCursor::End); 160 | m_log->insertPlainText(txt); 161 | } 162 | -------------------------------------------------------------------------------- /SceneEditor/core.h: -------------------------------------------------------------------------------- 1 | #ifndef DATA_H 2 | #define DATA_H 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | class Scene; 10 | class FBO; 11 | 12 | 13 | 14 | #define BUFFER_OFFSET(a) ((char*)NULL + (a)) 15 | struct vec2 16 | { 17 | float x,y; 18 | }; 19 | 20 | 21 | class Core : public QObject 22 | { 23 | Q_OBJECT 24 | public: 25 | //Singleton ! 26 | static Core* instance(); 27 | void initGL(); 28 | 29 | //Show ! 30 | void setCC(int id, float v); 31 | float getCC(int id); 32 | 33 | //Log 34 | void setLogWidget( QTextEdit *w ) { m_log = w; } 35 | void writeInfo( QString txt, bool time=true); 36 | void writeWarning( QString txt, bool time=true ); 37 | void writeError( QString txt, bool time=true ); 38 | 39 | //Rendering 40 | Scene* getScene() { return m_scene; } 41 | void setScene( Scene *sc ) { m_scene = sc; } 42 | void setResolution(int x,int y); 43 | int getResX(); 44 | int getResY(); 45 | int getNoise3D(); 46 | 47 | 48 | //Utils 49 | Scene* getDefaultScene(); 50 | const char* getVertexShader(); 51 | const char* getVertexShaderParticle(); 52 | void setEffectName( QString name ) { m_effectName = name; } 53 | QString getEffectName() { return m_effectName; } 54 | QString getDate(); 55 | 56 | signals: 57 | void resolutionChanged(int,int); 58 | 59 | 60 | private: 61 | Core(); 62 | Scene *m_scene; 63 | static Core *m_instance; 64 | int m_resX,m_resY; 65 | GLuint m_noise3D; 66 | float m_cc[4]; 67 | QTextEdit *m_log; 68 | QString m_effectName; 69 | 70 | }; 71 | 72 | #endif // DATA_H 73 | -------------------------------------------------------------------------------- /SceneEditor/editorwidget.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XT95/VisualLiveSystem/e8b5b97718f294cf4d6fa001ff98e0e6d7cbcf74/SceneEditor/editorwidget.cpp -------------------------------------------------------------------------------- /SceneEditor/editorwidget.h: -------------------------------------------------------------------------------- 1 | #ifndef EDITORWIDGET_H 2 | #define EDITORWIDGET_H 3 | 4 | #include 5 | 6 | namespace Ui { 7 | class EditorWidget; 8 | } 9 | 10 | class EditorWidget : public QDockWidget 11 | { 12 | Q_OBJECT 13 | 14 | public: 15 | explicit EditorWidget(QWidget *parent = 0); 16 | ~EditorWidget(); 17 | 18 | void save(); 19 | public slots: 20 | void loadScene( QString filename ); 21 | 22 | signals: 23 | void recompil(QString,int); 24 | void nameCCChanged(int,QString); 25 | private slots: 26 | void shaderUpdate(QString, int); 27 | private: 28 | Ui::EditorWidget *ui; 29 | }; 30 | 31 | #endif // EDITORWIDGET_H 32 | -------------------------------------------------------------------------------- /SceneEditor/editorwidget.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | EditorWidget 4 | 5 | 6 | 7 | 0 8 | 0 9 | 640 10 | 378 11 | 12 | 13 | 14 | 15 | 0 16 | 0 17 | 18 | 19 | 20 | 21 | 640 22 | 88 23 | 24 | 25 | 26 | Editor 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 10 35 | 36 | 37 | 38 | -1 39 | 40 | 41 | true 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /SceneEditor/fast2dquad.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | 5 | 6 | #define BUFFER_OFFSET(a) ((char*)NULL + (a)) 7 | struct vec2 8 | { 9 | float x,y; 10 | }; 11 | 12 | static GLuint vbo; 13 | 14 | void Fast2DQuadInit(void) 15 | { 16 | vec2 point[4]; 17 | point[0].x =-1.0f; point[1].x = 1.0f; point[2].x =-1.0f; point[3].x = 1.0f; 18 | point[0].y =-1.0f; point[1].y =-1.0f; point[2].y = 1.0f; point[3].y = 1.0f; 19 | vec2 uv[4]; 20 | uv[0].x = 0.0f; uv[1].x = 1.0f; uv[2].x = 0.0f; uv[3].x = 1.0f; 21 | uv[0].y = 0.0f; uv[1].y = 0.0f; uv[2].y = 1.0f; uv[3].y = 1.0f; 22 | 23 | 24 | //make the vertex buffer object 25 | glGenBuffers(1, &vbo); 26 | glBindBuffer(GL_ARRAY_BUFFER, vbo); 27 | glBufferData(GL_ARRAY_BUFFER, 4*2*sizeof(float)*2, NULL, GL_STATIC_DRAW); 28 | glBufferSubData(GL_ARRAY_BUFFER, 0, 4*2*sizeof(float), point); 29 | glBufferSubData(GL_ARRAY_BUFFER, 4*2*sizeof(float), 4*2*sizeof(float), uv); 30 | glBindBuffer(GL_ARRAY_BUFFER, 0); 31 | 32 | } 33 | 34 | 35 | void Fast2DQuadDraw(void) 36 | { 37 | glBindBuffer(GL_ARRAY_BUFFER, vbo); 38 | glVertexPointer(2, GL_FLOAT, 0, BUFFER_OFFSET(0)); 39 | glTexCoordPointer(2, GL_FLOAT, 0, BUFFER_OFFSET(4*2*sizeof(float))); 40 | glEnableClientState(GL_VERTEX_ARRAY); 41 | glEnableClientState(GL_TEXTURE_COORD_ARRAY); 42 | glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); 43 | glDisableClientState(GL_TEXTURE_COORD_ARRAY); 44 | glDisableClientState(GL_VERTEX_ARRAY); 45 | glBindBuffer(GL_ARRAY_BUFFER, 0); 46 | } 47 | 48 | 49 | void Fast2DQuadFree(void) 50 | { 51 | glDeleteBuffers(1,&vbo); 52 | } 53 | -------------------------------------------------------------------------------- /SceneEditor/fast2dquad.h: -------------------------------------------------------------------------------- 1 | #ifndef DEF_FAST2DQUAD 2 | #define DEF_FAST2DQUAD 3 | 4 | 5 | 6 | void Fast2DQuadInit(void); 7 | void Fast2DQuadDraw(void); 8 | void Fast2DQuadFree(void); 9 | 10 | 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /SceneEditor/fbo.cpp: -------------------------------------------------------------------------------- 1 | #include "fbo.h" 2 | 3 | #include 4 | 5 | 6 | //----------------------------------------------------------------------------- 7 | // Constructor 8 | //----------------------------------------------------------------------------- 9 | FBO::FBO() 10 | { 11 | m_FrameBuffer=0; 12 | m_ColorTextureID=0; 13 | m_width = 1280; 14 | m_height = 720; 15 | m_format = GL_RGBA; 16 | 17 | //Create texture. 18 | glGenTextures(1, &m_ColorTextureID); 19 | glBindTexture(GL_TEXTURE_2D, m_ColorTextureID); 20 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); 21 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); 22 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); 23 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); 24 | 25 | glTexImage2D(GL_TEXTURE_2D, 0, m_format, m_width, m_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); 26 | 27 | 28 | glGenTextures(1, &m_DepthTextureID); 29 | glBindTexture(GL_TEXTURE_2D, m_DepthTextureID); 30 | glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT32, m_width, m_height, 0, GL_DEPTH_COMPONENT, GL_FLOAT, NULL); 31 | glTexParameteri(GL_TEXTURE_2D, GL_DEPTH_TEXTURE_MODE, GL_LUMINANCE); 32 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); 33 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); 34 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); 35 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); 36 | glBindTexture(GL_TEXTURE_2D, 0); 37 | 38 | glTexImage2D(GL_TEXTURE_2D, 0, m_format, m_width, m_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); 39 | glBindTexture(GL_TEXTURE_2D, 0); 40 | 41 | 42 | //Make buffer 43 | glGenFramebuffers(1, &m_FrameBuffer); 44 | glBindFramebuffer(GL_FRAMEBUFFER_EXT, m_FrameBuffer); 45 | 46 | 47 | 48 | glGenRenderbuffers(1, &m_DepthRenderBuffer); 49 | glBindRenderbuffer(GL_RENDERBUFFER_EXT, m_DepthRenderBuffer); 50 | glRenderbufferStorage(GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT, m_width, m_height); 51 | glBindRenderbuffer(GL_RENDERBUFFER_EXT, 0); 52 | 53 | glFramebufferTexture2D(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, m_ColorTextureID, 0); 54 | glFramebufferRenderbuffer(GL_FRAMEBUFFER_EXT,GL_DEPTH_ATTACHMENT_EXT,GL_RENDERBUFFER_EXT, m_DepthRenderBuffer); 55 | 56 | 57 | glBindFramebuffer(GL_FRAMEBUFFER_EXT, 0); 58 | 59 | } 60 | 61 | 62 | //----------------------------------------------------------------------------- 63 | // Destructor 64 | //----------------------------------------------------------------------------- 65 | FBO::~FBO() 66 | { 67 | glDeleteTextures(1, &m_ColorTextureID); 68 | glDeleteTextures(1, &m_DepthTextureID); 69 | glDeleteFramebuffers(1, &m_FrameBuffer); 70 | glDeleteRenderbuffers(1, &m_DepthRenderBuffer); 71 | } 72 | 73 | 74 | //----------------------------------------------------------------------------- 75 | // Enable 76 | //----------------------------------------------------------------------------- 77 | void FBO::enable(void) 78 | { 79 | glPushAttrib(GL_VIEWPORT_BIT); 80 | glViewport(0,0,m_width,m_height); 81 | 82 | glBindFramebuffer(GL_FRAMEBUFFER_EXT, m_FrameBuffer); 83 | glPushMatrix(); 84 | } 85 | 86 | //----------------------------------------------------------------------------- 87 | // Disable 88 | //----------------------------------------------------------------------------- 89 | void FBO::disable(void) 90 | { 91 | glPopMatrix(); 92 | glBindFramebuffer(GL_FRAMEBUFFER_EXT, 0); 93 | glPopAttrib(); 94 | } 95 | 96 | 97 | 98 | //----------------------------------------------------------------------------- 99 | // Set 100 | //----------------------------------------------------------------------------- 101 | void FBO::setSize( int width, int height ) 102 | { 103 | m_width = width; 104 | m_height = height; 105 | 106 | 107 | updateTexture(); 108 | } 109 | void FBO::setFormat(GLint format) 110 | { 111 | m_format = format; 112 | updateTexture(); 113 | } 114 | 115 | 116 | //----------------------------------------------------------------------------- 117 | // Get 118 | //----------------------------------------------------------------------------- 119 | GLuint FBO::getColor(void) 120 | { 121 | return m_ColorTextureID; 122 | } 123 | 124 | //----------------------------------------------------------------------------- 125 | // updateTexture 126 | //----------------------------------------------------------------------------- 127 | void FBO::updateTexture() 128 | { 129 | glBindTexture(GL_TEXTURE_2D, m_ColorTextureID); 130 | glTexImage2D(GL_TEXTURE_2D, 0, m_format, m_width, m_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); 131 | glBindTexture(GL_TEXTURE_2D, m_DepthTextureID); 132 | glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT32, m_width, m_height, 0, GL_DEPTH_COMPONENT, GL_FLOAT, NULL); 133 | 134 | glBindTexture(GL_TEXTURE_2D, 0); 135 | 136 | } 137 | 138 | //----------------------------------------------------------------------------- 139 | // bind 140 | //----------------------------------------------------------------------------- 141 | void FBO::bind() 142 | { 143 | glBindTexture(GL_TEXTURE_2D, m_ColorTextureID); 144 | } 145 | -------------------------------------------------------------------------------- /SceneEditor/fbo.h: -------------------------------------------------------------------------------- 1 | #ifndef DEF_CORE_FBO_H 2 | #define DEF_CORE_FBO_H 3 | 4 | #include 5 | 6 | #include "texture.h" 7 | 8 | //----------------------------------------------------------------------------- 9 | // Class Frame Buffer Object 10 | //----------------------------------------------------------------------------- 11 | class FBO : public Texture 12 | { 13 | public: 14 | FBO(); 15 | ~FBO(); 16 | 17 | void enable(void); 18 | void disable(void); 19 | 20 | 21 | void setSize( int width, int height ); 22 | void setFormat(GLint format); 23 | 24 | int getSizeX(){return m_width;} 25 | int getSizeY(){return m_height;} 26 | GLuint getColor(void); 27 | GLenum getFormat(){return m_format;} 28 | 29 | void bind(); 30 | private: 31 | void updateTexture(); 32 | 33 | GLuint m_FrameBuffer; 34 | GLuint m_DepthRenderBuffer; 35 | GLuint m_ColorTextureID; 36 | GLuint m_DepthTextureID; 37 | int m_width,m_height; 38 | GLint m_format; 39 | }; 40 | 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /SceneEditor/highlighter.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef HIGHLIGHTER_H 3 | #define HIGHLIGHTER_H 4 | 5 | #include 6 | 7 | #include 8 | #include 9 | 10 | class QTextDocument; 11 | 12 | class Highlighter : public QSyntaxHighlighter 13 | { 14 | Q_OBJECT 15 | 16 | public: 17 | Highlighter(QTextDocument *parent = 0); 18 | 19 | void defineXMLRule(); 20 | protected: 21 | void highlightBlock(const QString &text); 22 | 23 | private: 24 | struct HighlightingRule 25 | { 26 | QRegExp pattern; 27 | QTextCharFormat format; 28 | }; 29 | QVector highlightingRules; 30 | 31 | QRegExp commentStartExpression; 32 | QRegExp commentEndExpression; 33 | 34 | QTextCharFormat typeFormat; 35 | QTextCharFormat keywordFormat; 36 | QTextCharFormat singleLineCommentFormat; 37 | QTextCharFormat multiLineCommentFormat; 38 | QTextCharFormat quotationFormat; 39 | QTextCharFormat functionFormat; 40 | QTextCharFormat numberFormat; 41 | QTextCharFormat XMLNameFormat; 42 | QTextCharFormat XMLAttributeFormat; 43 | QTextCharFormat XMLParamFormat; 44 | }; 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /SceneEditor/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include "mainwindow.h" 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | #include "core.h" 11 | int main(int argc, char *argv[]) 12 | { 13 | QApplication a(argc, argv); 14 | QFile f(":qdarkstyle/style.qss"); 15 | f.open(QFile::ReadOnly | QFile::Text); 16 | QTextStream ts(&f); 17 | a.setStyleSheet(ts.readAll()); 18 | 19 | MainWindow w; 20 | w.showMaximized(); 21 | return a.exec(); 22 | } 23 | -------------------------------------------------------------------------------- /SceneEditor/mainwindow.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include "core.h" 6 | #include "mainwindow.h" 7 | #include "ui_mainwindow.h" 8 | #include "bottomwidget.h" 9 | #include "paramwidget.h" 10 | #include "editorwidget.h" 11 | #include "newwidget.h" 12 | #include "openwidget.h" 13 | #include "newshader.h" 14 | 15 | MainWindow::MainWindow(QWidget *parent) : 16 | QMainWindow(parent), 17 | ui(new Ui::MainWindow) 18 | { 19 | ui->setupUi(this); 20 | 21 | m_info = new BottomWidget(this); 22 | m_param = new ParamWidget(this); 23 | m_editor = new EditorWidget(this); 24 | 25 | m_newShader = new NewShader(); 26 | m_newShader->hide(); 27 | 28 | m_open = new OpenWidget(); 29 | m_open->hide(); 30 | 31 | Core::instance()->setLogWidget( m_info->getLogWidget() ); 32 | ui->toolBar->addAction(ui->actionNew); 33 | ui->toolBar->addAction(ui->actionOpen); 34 | ui->toolBar->addAction(ui->actionSave); 35 | ui->toolBar->addSeparator(); 36 | ui->toolBar->addAction(ui->actionReset_camera); 37 | ui->toolBar->addAction(ui->actionTake_screenshot); 38 | ui->toolBar->addAction(ui->actionProjector_output); 39 | ui->toolBar->addSeparator(); 40 | ui->toolBar->addAction(ui->actionAdd_shader); 41 | ui->toolBar->addSeparator(); 42 | ui->toolBar->addAction(ui->actionReload); 43 | 44 | addDockWidget(Qt::BottomDockWidgetArea, m_info); 45 | addDockWidget(Qt::LeftDockWidgetArea, m_editor); 46 | addDockWidget(Qt::BottomDockWidgetArea, m_param); 47 | 48 | connect(ui->actionNew,SIGNAL(triggered()), this, SLOT(newScene())); 49 | connect(ui->actionOpen,SIGNAL(triggered()), m_open, SLOT(show())); 50 | connect(ui->actionSave, SIGNAL(triggered()), this, SLOT(save())); 51 | connect(ui->actionQuit, SIGNAL(triggered()), this, SLOT(close())); 52 | connect(ui->actionAdd_shader, SIGNAL(triggered()), m_newShader, SLOT(show())); 53 | connect(ui->actionReset_camera, SIGNAL(triggered()), ui->widget, SLOT(resetCamera())); 54 | connect(ui->actionTake_screenshot, SIGNAL(triggered()), ui->widget, SLOT(takeScreenshot())); 55 | connect(m_editor, SIGNAL(recompil(QString,int)), ui->widget, SLOT(recompilShader( QString, int))); 56 | connect(m_editor, SIGNAL(nameCCChanged(int,QString)), m_param, SLOT(nameCCChanged(int,QString))); 57 | connect(m_open, SIGNAL(open(QString)), this, SLOT(open(QString))); 58 | 59 | connect(m_newShader, SIGNAL(reload()), this, SLOT(reloadEffect())); 60 | 61 | connect(ui->actionReload, SIGNAL(triggered()), this, SLOT(reloadEffect())); 62 | } 63 | 64 | MainWindow::~MainWindow() 65 | { 66 | delete m_info; 67 | delete ui; 68 | } 69 | 70 | 71 | 72 | 73 | void MainWindow::open(QString filename) 74 | { 75 | Core::instance()->setEffectName( filename ); 76 | m_param->clearName(); 77 | ui->widget->loadScene(filename); 78 | m_editor->loadScene(filename); 79 | } 80 | 81 | void MainWindow::reloadEffect() 82 | { 83 | m_param->clearName(); 84 | ui->widget->loadScene( Core::instance()->getEffectName() ); 85 | m_editor->loadScene( Core::instance()->getEffectName() ); 86 | 87 | } 88 | 89 | void MainWindow::save() 90 | { 91 | m_editor->save(); 92 | } 93 | 94 | void MainWindow::newScene() 95 | { 96 | NewWidget *w = new NewWidget(); 97 | w->show(); 98 | connect(w, SIGNAL(open(QString)), this, SLOT(open(QString))); 99 | } 100 | 101 | void MainWindow::newShader() 102 | { 103 | 104 | } 105 | -------------------------------------------------------------------------------- /SceneEditor/mainwindow.h: -------------------------------------------------------------------------------- 1 | #ifndef MAINWINDOW_H 2 | #define MAINWINDOW_H 3 | 4 | #include 5 | 6 | namespace Ui { 7 | class MainWindow; 8 | } 9 | 10 | class BottomWidget; 11 | class ParamWidget; 12 | class EditorWidget; 13 | class OpenWidget; 14 | class NewWidget; 15 | class NewShader; 16 | 17 | class MainWindow : public QMainWindow 18 | { 19 | Q_OBJECT 20 | 21 | public: 22 | explicit MainWindow(QWidget *parent = 0); 23 | ~MainWindow(); 24 | public slots: 25 | void newScene(); 26 | void newShader(); 27 | void open(QString); 28 | void save(); 29 | void reloadEffect(); 30 | private: 31 | Ui::MainWindow *ui; 32 | BottomWidget *m_info; 33 | ParamWidget *m_param; 34 | EditorWidget *m_editor; 35 | OpenWidget *m_open; 36 | NewShader *m_newShader; 37 | }; 38 | 39 | #endif // MAINWINDOW_H 40 | -------------------------------------------------------------------------------- /SceneEditor/newshader.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XT95/VisualLiveSystem/e8b5b97718f294cf4d6fa001ff98e0e6d7cbcf74/SceneEditor/newshader.cpp -------------------------------------------------------------------------------- /SceneEditor/newshader.h: -------------------------------------------------------------------------------- 1 | #ifndef NEWSHADER_H 2 | #define NEWSHADER_H 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | namespace Ui { 9 | class newShader; 10 | } 11 | 12 | class NewShader : public QWidget 13 | { 14 | Q_OBJECT 15 | 16 | public: 17 | explicit NewShader(QWidget *parent = 0); 18 | ~NewShader(); 19 | signals: 20 | void reload(); 21 | public slots: 22 | void show(); 23 | void ok(); 24 | void cancel(); 25 | private slots: 26 | void setImageChan1(); 27 | void setImageChan2(); 28 | void setImageChan3(); 29 | void setImageChan4(); 30 | void setPassChan1(); 31 | void setPassChan2(); 32 | void setPassChan3(); 33 | void setPassChan4(); 34 | 35 | private: 36 | bool writeDomChannel(QLineEdit *name, QLineEdit *value, QDomNode *node, QDomDocument &dom, int id); 37 | Ui::newShader *ui; 38 | }; 39 | 40 | #endif // NEWSHADER_H 41 | -------------------------------------------------------------------------------- /SceneEditor/newwidget.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include "newwidget.h" 6 | #include "ui_newwidget.h" 7 | 8 | NewWidget::NewWidget(QWidget *parent) : 9 | QWidget(parent), 10 | ui(new Ui::NewWidget) 11 | { 12 | ui->setupUi(this); 13 | connect(ui->buttonOK, SIGNAL(clicked()), this, SLOT(ok())); 14 | connect(ui->buttonCancel, SIGNAL(clicked()), this, SLOT(cancel())); 15 | } 16 | 17 | NewWidget::~NewWidget() 18 | { 19 | delete ui; 20 | } 21 | 22 | void NewWidget::ok() 23 | { 24 | if( QDir("./data/scenes/"+ui->name->text()).exists() ) 25 | { 26 | QMessageBox::critical(NULL, "Error", "The scene "+ui->name->text()+" already exist."); 27 | } 28 | else 29 | { 30 | QDir().mkdir("./data/scenes/"+ui->name->text()); 31 | if( ui->empty->isChecked() ) 32 | { 33 | QFile::copy(":res/framework/Empty/config.xml", "./data/scenes/"+ui->name->text()+"/config.xml"); 34 | QFile::copy(":res/framework/Empty/Scene.glsl", "./data/scenes/"+ui->name->text()+"/Scene.glsl"); 35 | } 36 | else if( ui->df->isChecked() ) 37 | { 38 | QFile::copy(":res/framework/DF/config.xml", "./data/scenes/"+ui->name->text()+"/config.xml"); 39 | QFile::copy(":res/framework/DF/Scene.glsl", "./data/scenes/"+ui->name->text()+"/Scene.glsl"); 40 | } 41 | else if( ui->raytrace->isChecked() ) 42 | { 43 | QFile::copy(":res/framework/Raytracing/config.xml", "./data/scenes/"+ui->name->text()+"/config.xml"); 44 | QFile::copy(":res/framework/Raytracing/Scene.glsl", "./data/scenes/"+ui->name->text()+"/Scene.glsl"); 45 | } 46 | emit open(ui->name->text()); 47 | cancel(); 48 | } 49 | 50 | } 51 | 52 | 53 | void NewWidget::cancel() 54 | { 55 | close(); 56 | } 57 | -------------------------------------------------------------------------------- /SceneEditor/newwidget.h: -------------------------------------------------------------------------------- 1 | #ifndef NEWWIDGET_H 2 | #define NEWWIDGET_H 3 | 4 | #include 5 | 6 | namespace Ui { 7 | class NewWidget; 8 | } 9 | 10 | class NewWidget : public QWidget 11 | { 12 | Q_OBJECT 13 | 14 | public: 15 | explicit NewWidget(QWidget *parent = 0); 16 | ~NewWidget(); 17 | 18 | signals: 19 | void open(QString); 20 | 21 | public slots: 22 | void ok(); 23 | void cancel(); 24 | 25 | private: 26 | Ui::NewWidget *ui; 27 | }; 28 | 29 | #endif // NEWWIDGET_H 30 | -------------------------------------------------------------------------------- /SceneEditor/newwidget.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | NewWidget 4 | 5 | 6 | Qt::ApplicationModal 7 | 8 | 9 | 10 | 0 11 | 0 12 | 570 13 | 308 14 | 15 | 16 | 17 | New effect 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | Name 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | Framework 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | Empty 58 | 59 | 60 | true 61 | 62 | 63 | 64 | 65 | 66 | 67 | Distance field 68 | 69 | 70 | 71 | 72 | 73 | 74 | Raytracing 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | Qt::Vertical 87 | 88 | 89 | 90 | 20 91 | 40 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | Qt::Horizontal 102 | 103 | 104 | 105 | 40 106 | 20 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | OK 115 | 116 | 117 | 118 | 119 | 120 | 121 | Cancel 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | -------------------------------------------------------------------------------- /SceneEditor/openwidget.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include "openwidget.h" 5 | #include "core.h" 6 | #include "ui_openwidget.h" 7 | 8 | OpenWidget::OpenWidget(QWidget *parent) : 9 | QWidget(parent), 10 | ui(new Ui::OpenWidget) 11 | { 12 | ui->setupUi(this); 13 | 14 | QTimer *timer = new QTimer(this); 15 | connect(timer, SIGNAL(timeout()), this, SLOT(refreshList())); 16 | timer->start(10000); 17 | 18 | connect(ui->cancelButton, SIGNAL(clicked()), this, SLOT(cancel())); 19 | connect(ui->okButton, SIGNAL(clicked()), this, SLOT(ok())); 20 | refreshList(); 21 | } 22 | 23 | OpenWidget::~OpenWidget() 24 | { 25 | delete ui; 26 | } 27 | 28 | void OpenWidget::ok() 29 | { 30 | emit open( ui->listWidget->currentItem()->text() ); 31 | cancel(); 32 | } 33 | 34 | 35 | void OpenWidget::cancel() 36 | { 37 | hide(); 38 | } 39 | 40 | 41 | void OpenWidget::refreshList() 42 | { 43 | ui->listWidget->clear(); 44 | 45 | QDir dir("./data/scenes"); 46 | QStringList files = dir.entryList(); 47 | for(int i=0; ilistWidget->addItem(item); 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /SceneEditor/openwidget.h: -------------------------------------------------------------------------------- 1 | #ifndef OPENWIDGET_H 2 | #define OPENWIDGET_H 3 | 4 | #include 5 | 6 | namespace Ui { 7 | class OpenWidget; 8 | } 9 | 10 | class OpenWidget : public QWidget 11 | { 12 | Q_OBJECT 13 | 14 | public: 15 | explicit OpenWidget(QWidget *parent = 0); 16 | ~OpenWidget(); 17 | 18 | public slots: 19 | void ok(); 20 | void cancel(); 21 | 22 | signals: 23 | void open(QString); 24 | private slots: 25 | void refreshList(); 26 | private: 27 | Ui::OpenWidget *ui; 28 | }; 29 | 30 | #endif // OPENWIDGET_H 31 | -------------------------------------------------------------------------------- /SceneEditor/openwidget.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | OpenWidget 4 | 5 | 6 | Qt::ApplicationModal 7 | 8 | 9 | 10 | 0 11 | 0 12 | 512 13 | 388 14 | 15 | 16 | 17 | Qt::DefaultContextMenu 18 | 19 | 20 | Open effect 21 | 22 | 23 | 24 | 25 | 26 | true 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | Qt::Horizontal 36 | 37 | 38 | 39 | 40 40 | 20 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | Open 49 | 50 | 51 | 52 | 53 | 54 | 55 | Cancel 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /SceneEditor/paramwidget.cpp: -------------------------------------------------------------------------------- 1 | #include "paramwidget.h" 2 | #include "ui_paramwidget.h" 3 | #include "core.h" 4 | ParamWidget::ParamWidget(QWidget *parent) : 5 | QDockWidget(parent), 6 | ui(new Ui::ParamWidget) 7 | { 8 | ui->setupUi(this); 9 | 10 | connect(ui->CC0, SIGNAL(valueChanged(int)), this, SLOT(CC0Changed(int))); 11 | connect(ui->CC1, SIGNAL(valueChanged(int)), this, SLOT(CC1Changed(int))); 12 | connect(ui->CC2, SIGNAL(valueChanged(int)), this, SLOT(CC2Changed(int))); 13 | connect(ui->CC3, SIGNAL(valueChanged(int)), this, SLOT(CC3Changed(int))); 14 | } 15 | 16 | ParamWidget::~ParamWidget() 17 | { 18 | delete ui; 19 | } 20 | 21 | void ParamWidget::clearName() 22 | { 23 | ui->label0->setText(""); 24 | ui->label1->setText(""); 25 | ui->label2->setText(""); 26 | ui->label3->setText(""); 27 | } 28 | 29 | void ParamWidget::nameCCChanged(int id, QString name) 30 | { 31 | if(id == 0) 32 | ui->label0->setText(name); 33 | else if(id == 1) 34 | ui->label1->setText(name); 35 | else if(id == 2) 36 | ui->label2->setText(name); 37 | else if(id == 3) 38 | ui->label3->setText(name); 39 | } 40 | 41 | void ParamWidget::CC0Changed(int v) 42 | { 43 | Core::instance()->setCC(0, float(v)/100.f); 44 | } 45 | 46 | void ParamWidget::CC1Changed(int v) 47 | { 48 | Core::instance()->setCC(1, float(v)/100.f); 49 | } 50 | void ParamWidget::CC2Changed(int v) 51 | { 52 | Core::instance()->setCC(2, float(v)/100.f); 53 | } 54 | void ParamWidget::CC3Changed(int v) 55 | { 56 | Core::instance()->setCC(3, float(v)/100.f); 57 | } 58 | -------------------------------------------------------------------------------- /SceneEditor/paramwidget.h: -------------------------------------------------------------------------------- 1 | #ifndef PARAMWIDGET_H 2 | #define PARAMWIDGET_H 3 | 4 | #include 5 | 6 | namespace Ui { 7 | class ParamWidget; 8 | } 9 | 10 | class ParamWidget : public QDockWidget 11 | { 12 | Q_OBJECT 13 | 14 | public: 15 | explicit ParamWidget(QWidget *parent = 0); 16 | ~ParamWidget(); 17 | 18 | void clearName(); 19 | public slots: 20 | void nameCCChanged(int id, QString name); 21 | 22 | private slots: 23 | void CC0Changed(int); 24 | void CC1Changed(int); 25 | void CC2Changed(int); 26 | void CC3Changed(int); 27 | private: 28 | Ui::ParamWidget *ui; 29 | }; 30 | 31 | #endif // PARAMWIDGET_H 32 | -------------------------------------------------------------------------------- /SceneEditor/paramwidget.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | ParamWidget 4 | 5 | 6 | 7 | 0 8 | 0 9 | 492 10 | 243 11 | 12 | 13 | 14 | 15 | 0 16 | 0 17 | 18 | 19 | 20 | Scene parameters 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 100 37 | 38 | 39 | Qt::Horizontal 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 100 58 | 59 | 60 | Qt::Horizontal 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 100 79 | 80 | 81 | Qt::Horizontal 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 100 | 101 | 102 | Qt::Horizontal 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | -------------------------------------------------------------------------------- /SceneEditor/qdarkstyle/rc/Hmovetoolbar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XT95/VisualLiveSystem/e8b5b97718f294cf4d6fa001ff98e0e6d7cbcf74/SceneEditor/qdarkstyle/rc/Hmovetoolbar.png -------------------------------------------------------------------------------- /SceneEditor/qdarkstyle/rc/Hsepartoolbar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XT95/VisualLiveSystem/e8b5b97718f294cf4d6fa001ff98e0e6d7cbcf74/SceneEditor/qdarkstyle/rc/Hsepartoolbar.png -------------------------------------------------------------------------------- /SceneEditor/qdarkstyle/rc/Vmovetoolbar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XT95/VisualLiveSystem/e8b5b97718f294cf4d6fa001ff98e0e6d7cbcf74/SceneEditor/qdarkstyle/rc/Vmovetoolbar.png -------------------------------------------------------------------------------- /SceneEditor/qdarkstyle/rc/Vsepartoolbar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XT95/VisualLiveSystem/e8b5b97718f294cf4d6fa001ff98e0e6d7cbcf74/SceneEditor/qdarkstyle/rc/Vsepartoolbar.png -------------------------------------------------------------------------------- /SceneEditor/qdarkstyle/rc/branch_closed-on.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XT95/VisualLiveSystem/e8b5b97718f294cf4d6fa001ff98e0e6d7cbcf74/SceneEditor/qdarkstyle/rc/branch_closed-on.png -------------------------------------------------------------------------------- /SceneEditor/qdarkstyle/rc/branch_closed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XT95/VisualLiveSystem/e8b5b97718f294cf4d6fa001ff98e0e6d7cbcf74/SceneEditor/qdarkstyle/rc/branch_closed.png -------------------------------------------------------------------------------- /SceneEditor/qdarkstyle/rc/branch_open-on.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XT95/VisualLiveSystem/e8b5b97718f294cf4d6fa001ff98e0e6d7cbcf74/SceneEditor/qdarkstyle/rc/branch_open-on.png -------------------------------------------------------------------------------- /SceneEditor/qdarkstyle/rc/branch_open.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XT95/VisualLiveSystem/e8b5b97718f294cf4d6fa001ff98e0e6d7cbcf74/SceneEditor/qdarkstyle/rc/branch_open.png -------------------------------------------------------------------------------- /SceneEditor/qdarkstyle/rc/checkbox.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XT95/VisualLiveSystem/e8b5b97718f294cf4d6fa001ff98e0e6d7cbcf74/SceneEditor/qdarkstyle/rc/checkbox.png -------------------------------------------------------------------------------- /SceneEditor/qdarkstyle/rc/close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XT95/VisualLiveSystem/e8b5b97718f294cf4d6fa001ff98e0e6d7cbcf74/SceneEditor/qdarkstyle/rc/close.png -------------------------------------------------------------------------------- /SceneEditor/qdarkstyle/rc/down_arrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XT95/VisualLiveSystem/e8b5b97718f294cf4d6fa001ff98e0e6d7cbcf74/SceneEditor/qdarkstyle/rc/down_arrow.png -------------------------------------------------------------------------------- /SceneEditor/qdarkstyle/rc/down_arrow_disabled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XT95/VisualLiveSystem/e8b5b97718f294cf4d6fa001ff98e0e6d7cbcf74/SceneEditor/qdarkstyle/rc/down_arrow_disabled.png -------------------------------------------------------------------------------- /SceneEditor/qdarkstyle/rc/left_arrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XT95/VisualLiveSystem/e8b5b97718f294cf4d6fa001ff98e0e6d7cbcf74/SceneEditor/qdarkstyle/rc/left_arrow.png -------------------------------------------------------------------------------- /SceneEditor/qdarkstyle/rc/left_arrow_disabled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XT95/VisualLiveSystem/e8b5b97718f294cf4d6fa001ff98e0e6d7cbcf74/SceneEditor/qdarkstyle/rc/left_arrow_disabled.png -------------------------------------------------------------------------------- /SceneEditor/qdarkstyle/rc/right_arrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XT95/VisualLiveSystem/e8b5b97718f294cf4d6fa001ff98e0e6d7cbcf74/SceneEditor/qdarkstyle/rc/right_arrow.png -------------------------------------------------------------------------------- /SceneEditor/qdarkstyle/rc/right_arrow_disabled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XT95/VisualLiveSystem/e8b5b97718f294cf4d6fa001ff98e0e6d7cbcf74/SceneEditor/qdarkstyle/rc/right_arrow_disabled.png -------------------------------------------------------------------------------- /SceneEditor/qdarkstyle/rc/sizegrip.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XT95/VisualLiveSystem/e8b5b97718f294cf4d6fa001ff98e0e6d7cbcf74/SceneEditor/qdarkstyle/rc/sizegrip.png -------------------------------------------------------------------------------- /SceneEditor/qdarkstyle/rc/stylesheet-branch-end.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XT95/VisualLiveSystem/e8b5b97718f294cf4d6fa001ff98e0e6d7cbcf74/SceneEditor/qdarkstyle/rc/stylesheet-branch-end.png -------------------------------------------------------------------------------- /SceneEditor/qdarkstyle/rc/stylesheet-branch-more.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XT95/VisualLiveSystem/e8b5b97718f294cf4d6fa001ff98e0e6d7cbcf74/SceneEditor/qdarkstyle/rc/stylesheet-branch-more.png -------------------------------------------------------------------------------- /SceneEditor/qdarkstyle/rc/stylesheet-vline.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XT95/VisualLiveSystem/e8b5b97718f294cf4d6fa001ff98e0e6d7cbcf74/SceneEditor/qdarkstyle/rc/stylesheet-vline.png -------------------------------------------------------------------------------- /SceneEditor/qdarkstyle/rc/transparent.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XT95/VisualLiveSystem/e8b5b97718f294cf4d6fa001ff98e0e6d7cbcf74/SceneEditor/qdarkstyle/rc/transparent.png -------------------------------------------------------------------------------- /SceneEditor/qdarkstyle/rc/undock.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XT95/VisualLiveSystem/e8b5b97718f294cf4d6fa001ff98e0e6d7cbcf74/SceneEditor/qdarkstyle/rc/undock.png -------------------------------------------------------------------------------- /SceneEditor/qdarkstyle/rc/up_arrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XT95/VisualLiveSystem/e8b5b97718f294cf4d6fa001ff98e0e6d7cbcf74/SceneEditor/qdarkstyle/rc/up_arrow.png -------------------------------------------------------------------------------- /SceneEditor/qdarkstyle/rc/up_arrow_disabled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XT95/VisualLiveSystem/e8b5b97718f294cf4d6fa001ff98e0e6d7cbcf74/SceneEditor/qdarkstyle/rc/up_arrow_disabled.png -------------------------------------------------------------------------------- /SceneEditor/qdarkstyle/style.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | rc/up_arrow_disabled.png 4 | rc/Hmovetoolbar.png 5 | rc/stylesheet-branch-end.png 6 | rc/branch_closed-on.png 7 | rc/stylesheet-vline.png 8 | rc/branch_closed.png 9 | rc/branch_open-on.png 10 | rc/transparent.png 11 | rc/right_arrow_disabled.png 12 | rc/sizegrip.png 13 | rc/close.png 14 | rc/down_arrow.png 15 | rc/Vmovetoolbar.png 16 | rc/left_arrow.png 17 | rc/stylesheet-branch-more.png 18 | rc/up_arrow.png 19 | rc/right_arrow.png 20 | rc/left_arrow_disabled.png 21 | rc/Hsepartoolbar.png 22 | rc/checkbox.png 23 | rc/branch_open.png 24 | rc/Vsepartoolbar.png 25 | rc/down_arrow_disabled.png 26 | rc/undock.png 27 | 28 | 29 | style.qss 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /SceneEditor/renderwidget.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #include "fast2dquad.h" 9 | #include "renderwidget.h" 10 | #include "core.h" 11 | 12 | 13 | RenderWidget::RenderWidget(QWidget *parent) : QGLWidget(parent) 14 | { 15 | QTimer *timer = new QTimer(this); 16 | connect(timer, SIGNAL(timeout()), this, SLOT(updateGL())); 17 | timer->start(10); 18 | 19 | resetCamera(); 20 | 21 | m_time.restart(); 22 | m_fpsTime.restart(); 23 | } 24 | 25 | RenderWidget::~RenderWidget() 26 | { 27 | Fast2DQuadFree(); 28 | } 29 | 30 | 31 | //----------------------------------------------------------------------------- 32 | // initializeGL 33 | //----------------------------------------------------------------------------- 34 | void RenderWidget::initializeGL() 35 | { 36 | //Glew 37 | GLenum err = glewInit(); 38 | if(GLEW_OK != err) 39 | { 40 | QMessageBox::critical(this, "Error", "GLEW Init fail !"); 41 | } 42 | if(!GLEW_ARB_vertex_program || !GLEW_ARB_fragment_program) 43 | { 44 | QMessageBox::critical(this, "Error", "GLSL Shader not supported !"); 45 | } 46 | 47 | Fast2DQuadInit(); 48 | glMatrixMode(GL_PROJECTION); 49 | gluPerspective(90., 16./9., 0.01, 10000.); 50 | glMatrixMode(GL_MODELVIEW); 51 | glLoadIdentity(); 52 | 53 | 54 | Core::instance()->initGL(); 55 | 56 | } 57 | 58 | //----------------------------------------------------------------------------- 59 | // loadScene 60 | //----------------------------------------------------------------------------- 61 | void RenderWidget::loadScene(QString filename) 62 | { 63 | 64 | Scene *oldS = NULL; 65 | Scene *newS = new Scene(); 66 | 67 | newS->read(filename.toStdString().c_str()); 68 | if( Core::instance()->getScene() ) 69 | { 70 | oldS = Core::instance()->getScene(); 71 | } 72 | 73 | Core::instance()->setScene(newS); 74 | delete oldS; 75 | } 76 | 77 | //----------------------------------------------------------------------------- 78 | // recompilShader 79 | //----------------------------------------------------------------------------- 80 | void RenderWidget::recompilShader(QString txt,int id) 81 | { 82 | Core::instance()->getScene()->compilShader(txt.toStdString().c_str(),id); 83 | } 84 | 85 | //----------------------------------------------------------------------------- 86 | // paintGL 87 | //----------------------------------------------------------------------------- 88 | void RenderWidget::paintGL() 89 | { 90 | glClear(GL_COLOR_BUFFER_BIT); 91 | 92 | if( Core::instance()->getScene() ) 93 | { 94 | if(m_alpha < 0.005f) m_alpha = 0.005f; 95 | if(m_alpha > 3.14f) m_alpha = 3.14f; 96 | float px = sin(m_theta)*m_rayon*sin(m_alpha); 97 | float py = cos(m_alpha)*m_rayon; 98 | float pz = cos(m_theta)*m_rayon*sin(m_alpha); 99 | 100 | glLoadIdentity(); 101 | gluLookAt( px,py,pz, 0.,0.,0., 0.,1.,0.); 102 | Core::instance()->getScene()->compute(); 103 | 104 | Core::instance()->getScene()->draw(); 105 | } 106 | glFlush(); 107 | glFinish(); 108 | } 109 | 110 | //----------------------------------------------------------------------------- 111 | // resizeGL 112 | //----------------------------------------------------------------------------- 113 | void RenderWidget::resizeGL(int width, int height) 114 | { 115 | m_w = width; 116 | m_h = height; 117 | glViewport(0,0,m_w,m_h); 118 | } 119 | 120 | 121 | void RenderWidget::resolutionChanged(int x,int y) 122 | { 123 | makeCurrent(); 124 | } 125 | 126 | 127 | 128 | void RenderWidget::mousePressEvent(QMouseEvent* event) 129 | { 130 | m_mousePos = event->pos(); 131 | if(event->button() == Qt::LeftButton) 132 | m_mousePressed = true; 133 | QWidget::mousePressEvent(event); 134 | } 135 | 136 | void RenderWidget::mouseReleaseEvent(QMouseEvent* event) 137 | { 138 | m_mousePos = event->pos(); 139 | if(event->button() == Qt::LeftButton) 140 | m_mousePressed = false; 141 | QWidget::mouseReleaseEvent(event); 142 | } 143 | 144 | void RenderWidget::mouseMoveEvent(QMouseEvent* event) 145 | { 146 | if(m_mousePressed) 147 | { 148 | m_theta -= 0.004f * float(event->pos().x() - m_mousePos.x()); 149 | m_alpha -= 0.004f * float(event->pos().y() - m_mousePos.y()); 150 | } 151 | m_mousePos = event->pos(); 152 | 153 | QWidget::mouseMoveEvent(event); 154 | } 155 | 156 | void RenderWidget::wheelEvent(QWheelEvent* event) 157 | { 158 | 159 | if(event->delta() > 0) m_rayon /= 1.05f; 160 | else m_rayon *= 1.05f; 161 | 162 | QWidget::wheelEvent(event); 163 | } 164 | 165 | void RenderWidget::resetCamera() 166 | { 167 | m_rayon = 10.; 168 | m_theta = 0.f; 169 | m_alpha = 0.f; 170 | m_mousePressed = false; 171 | } 172 | 173 | 174 | void RenderWidget::takeScreenshot() 175 | { 176 | emit updateGL(); 177 | QImage imageToSave = grabFrameBuffer(false); 178 | QString filename = QFileDialog::getSaveFileName(this, "Save a screenshot", QString(), "Images (*.png *.jpg)"); 179 | imageToSave.save(filename); 180 | } 181 | -------------------------------------------------------------------------------- /SceneEditor/renderwidget.h: -------------------------------------------------------------------------------- 1 | #ifndef RENDERWIDGET_H 2 | #define RENDERWIDGET_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | #include "fbo.h" 11 | #include "shader.h" 12 | 13 | class RenderWidget : public QGLWidget 14 | { 15 | Q_OBJECT 16 | 17 | public: 18 | RenderWidget(QWidget *parent = 0); 19 | ~RenderWidget(); 20 | 21 | public slots: 22 | void resolutionChanged(int x,int y); 23 | void loadScene( QString filename ); 24 | void recompilShader( QString txt, int id); 25 | 26 | 27 | void mousePressEvent(QMouseEvent* event); 28 | void mouseReleaseEvent(QMouseEvent* event); 29 | void mouseMoveEvent(QMouseEvent* event); 30 | void wheelEvent(QWheelEvent* event); 31 | 32 | void resetCamera(); 33 | void takeScreenshot(); 34 | protected: 35 | void initializeGL(); 36 | void paintGL(); 37 | void resizeGL(int width, int height); 38 | 39 | QTime m_timer; 40 | QTime m_time; 41 | QTime m_fpsTime; 42 | int m_w,m_h; 43 | 44 | QPoint m_mousePos; 45 | bool m_mousePressed; 46 | float m_rayon; 47 | float m_theta, m_alpha; 48 | }; 49 | 50 | #endif // RENDERWIDGET_H 51 | -------------------------------------------------------------------------------- /SceneEditor/res.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | res/img/micro.png 4 | res/img/music.png 5 | res/img/new.png 6 | res/img/open.png 7 | res/img/save.png 8 | res/img/setting.png 9 | res/img/setting2.png 10 | res/img/setting_visual.png 11 | res/img/vls.png 12 | res/img/projector.png 13 | res/framework/Empty/config.xml 14 | res/framework/Empty/Scene.glsl 15 | res/framework/DF/config.xml 16 | res/framework/DF/Scene.glsl 17 | res/framework/Raytracing/config.xml 18 | res/framework/Raytracing/Scene.glsl 19 | res/img/new shader.png 20 | res/img/camera.png 21 | res/img/screenshot.png 22 | res/framework/Layer/layer.glsl 23 | 24 | 25 | -------------------------------------------------------------------------------- /SceneEditor/res/framework/DF/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /SceneEditor/res/framework/Empty/Scene.glsl: -------------------------------------------------------------------------------- 1 | varying vec2 v; 2 | uniform float time; 3 | uniform float CC[4]; 4 | 5 | 6 | void main() 7 | { 8 | gl_FragColor = vec4( v*0.5+0.5, 0., 1.); 9 | } -------------------------------------------------------------------------------- /SceneEditor/res/framework/Empty/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /SceneEditor/res/framework/Layer/layer.glsl: -------------------------------------------------------------------------------- 1 | varying vec2 v; 2 | uniform sampler2D lastBuffer; 3 | uniform float time,bassTime,CC[4]; 4 | 5 | void main() 6 | { 7 | vec2 uv = v*vec2(.5,.5)+vec2(.5); 8 | vec4 col = texture2D(lastBuffer, uv); 9 | 10 | gl_FragColor = col; 11 | } 12 | -------------------------------------------------------------------------------- /SceneEditor/res/framework/Raytracing/Scene.glsl: -------------------------------------------------------------------------------- 1 | varying vec2 v; 2 | uniform float time; 3 | uniform float CC[4]; 4 | 5 | 6 | void main() 7 | { 8 | gl_FragColor = vec4( v*0.5+0.5, 0., 1.); 9 | } -------------------------------------------------------------------------------- /SceneEditor/res/framework/Raytracing/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /SceneEditor/res/img/camera.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XT95/VisualLiveSystem/e8b5b97718f294cf4d6fa001ff98e0e6d7cbcf74/SceneEditor/res/img/camera.png -------------------------------------------------------------------------------- /SceneEditor/res/img/filenew.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XT95/VisualLiveSystem/e8b5b97718f294cf4d6fa001ff98e0e6d7cbcf74/SceneEditor/res/img/filenew.png -------------------------------------------------------------------------------- /SceneEditor/res/img/fileopen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XT95/VisualLiveSystem/e8b5b97718f294cf4d6fa001ff98e0e6d7cbcf74/SceneEditor/res/img/fileopen.png -------------------------------------------------------------------------------- /SceneEditor/res/img/filesave.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XT95/VisualLiveSystem/e8b5b97718f294cf4d6fa001ff98e0e6d7cbcf74/SceneEditor/res/img/filesave.png -------------------------------------------------------------------------------- /SceneEditor/res/img/micro.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XT95/VisualLiveSystem/e8b5b97718f294cf4d6fa001ff98e0e6d7cbcf74/SceneEditor/res/img/micro.png -------------------------------------------------------------------------------- /SceneEditor/res/img/music.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XT95/VisualLiveSystem/e8b5b97718f294cf4d6fa001ff98e0e6d7cbcf74/SceneEditor/res/img/music.png -------------------------------------------------------------------------------- /SceneEditor/res/img/new shader.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XT95/VisualLiveSystem/e8b5b97718f294cf4d6fa001ff98e0e6d7cbcf74/SceneEditor/res/img/new shader.png -------------------------------------------------------------------------------- /SceneEditor/res/img/new.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XT95/VisualLiveSystem/e8b5b97718f294cf4d6fa001ff98e0e6d7cbcf74/SceneEditor/res/img/new.png -------------------------------------------------------------------------------- /SceneEditor/res/img/open.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XT95/VisualLiveSystem/e8b5b97718f294cf4d6fa001ff98e0e6d7cbcf74/SceneEditor/res/img/open.png -------------------------------------------------------------------------------- /SceneEditor/res/img/projector.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XT95/VisualLiveSystem/e8b5b97718f294cf4d6fa001ff98e0e6d7cbcf74/SceneEditor/res/img/projector.png -------------------------------------------------------------------------------- /SceneEditor/res/img/save.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XT95/VisualLiveSystem/e8b5b97718f294cf4d6fa001ff98e0e6d7cbcf74/SceneEditor/res/img/save.png -------------------------------------------------------------------------------- /SceneEditor/res/img/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XT95/VisualLiveSystem/e8b5b97718f294cf4d6fa001ff98e0e6d7cbcf74/SceneEditor/res/img/screenshot.png -------------------------------------------------------------------------------- /SceneEditor/res/img/setting.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XT95/VisualLiveSystem/e8b5b97718f294cf4d6fa001ff98e0e6d7cbcf74/SceneEditor/res/img/setting.png -------------------------------------------------------------------------------- /SceneEditor/res/img/setting2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XT95/VisualLiveSystem/e8b5b97718f294cf4d6fa001ff98e0e6d7cbcf74/SceneEditor/res/img/setting2.png -------------------------------------------------------------------------------- /SceneEditor/res/img/setting_visual.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XT95/VisualLiveSystem/e8b5b97718f294cf4d6fa001ff98e0e6d7cbcf74/SceneEditor/res/img/setting_visual.png -------------------------------------------------------------------------------- /SceneEditor/res/img/vls.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XT95/VisualLiveSystem/e8b5b97718f294cf4d6fa001ff98e0e6d7cbcf74/SceneEditor/res/img/vls.png -------------------------------------------------------------------------------- /SceneEditor/res/logo.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XT95/VisualLiveSystem/e8b5b97718f294cf4d6fa001ff98e0e6d7cbcf74/SceneEditor/res/logo.ico -------------------------------------------------------------------------------- /SceneEditor/ressource.rc: -------------------------------------------------------------------------------- 1 | IDI_ICON1 ICON DISCARDABLE "res/logo.ico" -------------------------------------------------------------------------------- /SceneEditor/scene.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XT95/VisualLiveSystem/e8b5b97718f294cf4d6fa001ff98e0e6d7cbcf74/SceneEditor/scene.cpp -------------------------------------------------------------------------------- /SceneEditor/scene.h: -------------------------------------------------------------------------------- 1 | #ifndef SCENE_H 2 | #define SCENE_H 3 | 4 | #include "texture.h" 5 | #include "shader.h" 6 | #include "fbo.h" 7 | #include 8 | #include 9 | 10 | typedef enum {DEFAULT, BLEND_ALPHA, BLEND_ADD, NONE} Mode; 11 | typedef enum {PIXEL,PARTICLE} Type; 12 | typedef struct 13 | { 14 | Shader *shader; 15 | FBO *buffer, *backBuffer, *tmpBuffer; 16 | int width, height; 17 | Type type; 18 | Mode mode; 19 | QString name; 20 | Texture *channel[4]; 21 | QString channelName[4]; 22 | int iterate; 23 | }Layer; 24 | typedef struct 25 | { 26 | FBO *src,*dest; 27 | }Copy; 28 | 29 | class Scene 30 | { 31 | public: 32 | Scene(); 33 | ~Scene(); 34 | 35 | void compilShader(const char *txt, int id); 36 | void read(const char *filename = NULL); // Must be call where we are an OGL context 37 | 38 | 39 | void resetTime(); 40 | void compute(); 41 | void draw(); 42 | 43 | QString getParamName(int a) { return m_param[a]; } 44 | Layer getLayer(int id) { return m_layer[id]; } 45 | private: 46 | void generateParticles(); 47 | void drawParticles(); 48 | 49 | int m_nbParticles; 50 | GLuint m_vboParticle; 51 | 52 | Layer *m_layer; 53 | int m_nbLayer; 54 | Copy *m_copy; 55 | int m_nbCopy; 56 | QString m_param[4]; 57 | 58 | QTime m_QTime; 59 | float m_time; 60 | }; 61 | 62 | #endif // SCENE_H 63 | -------------------------------------------------------------------------------- /SceneEditor/shader.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "shader.h" 3 | #include "core.h" 4 | #include 5 | 6 | 7 | 8 | //----------------------------------------------------------------------------- 9 | // Constructor 10 | //----------------------------------------------------------------------------- 11 | Shader::Shader() 12 | { 13 | 14 | } 15 | //----------------------------------------------------------------------------- 16 | // Destructor 17 | //----------------------------------------------------------------------------- 18 | Shader::~Shader() 19 | { 20 | 21 | } 22 | 23 | //----------------------------------------------------------------------------- 24 | // enable/disable 25 | //----------------------------------------------------------------------------- 26 | void Shader::enable() 27 | { 28 | glUseProgramObjectARB(m_program); 29 | } 30 | void Shader::disable() 31 | { 32 | glUseProgramObjectARB(0); 33 | } 34 | 35 | 36 | //----------------------------------------------------------------------------- 37 | // send uniform 38 | //----------------------------------------------------------------------------- 39 | void Shader::sendi(const char *name, int x) 40 | { 41 | glUniform1i(glGetUniformLocation(m_program,name), x); 42 | } 43 | void Shader::sendf(const char *name, float x) 44 | { 45 | glUniform1f(glGetUniformLocation(m_program,name), x); 46 | } 47 | void Shader::sendf(const char *name, float x, float y) 48 | { 49 | glUniform2f(glGetUniformLocation(m_program,name), x,y); 50 | } 51 | void Shader::sendf(const char *name, float x, float y, float z) 52 | { 53 | glUniform3f(glGetUniformLocation(m_program,name), x,y,z); 54 | } 55 | void Shader::sendf(const char *name, float x, float y, float z, float w) 56 | { 57 | glUniform4f(glGetUniformLocation(m_program,name), x,y,z,w); 58 | } 59 | 60 | 61 | //----------------------------------------------------------------------------- 62 | // compil 63 | //----------------------------------------------------------------------------- 64 | int Shader::compil( const char *vertex, const char *fragment ) 65 | { 66 | m_program = glCreateProgramObjectARB(); 67 | if( !makeShader(vertex, GL_VERTEX_SHADER_ARB) ) 68 | { 69 | //QMessageBox::critical(NULL, "Error", "Can't compil the vertex shader !"); 70 | return SHADER_VERTEX_ERROR; 71 | } 72 | if( !makeShader(fragment, GL_FRAGMENT_SHADER_ARB) ) 73 | { 74 | //QMessageBox::critical(NULL, "Error", "Can't compil this pixel shader !"); 75 | return SHADER_FRAGMENT_ERROR; 76 | } 77 | 78 | glLinkProgram(m_program); 79 | 80 | return SHADER_SUCCESS; 81 | } 82 | 83 | 84 | bool Shader::makeShader(const char *txt, GLuint type) 85 | { 86 | GLuint object = glCreateShaderObjectARB(type); 87 | glShaderSource(object, 1, (const GLchar**)(&txt), NULL); 88 | glCompileShader(object); 89 | 90 | if( checkShader(object) ) 91 | { 92 | glAttachObjectARB(m_program, object); 93 | glDeleteObjectARB(object); 94 | } 95 | else 96 | { 97 | return false; 98 | } 99 | return true; 100 | } 101 | 102 | bool Shader::checkShader(int id) 103 | { 104 | GLint ok = 0; 105 | 106 | glGetShaderiv(id, GL_COMPILE_STATUS, &ok); 107 | if( ok != GL_TRUE ) 108 | { 109 | GLint logLength = 0; 110 | GLchar* log = NULL; 111 | 112 | glGetShaderiv(id, GL_INFO_LOG_LENGTH, &logLength); 113 | log = new GLchar[logLength]; 114 | glGetShaderInfoLog(id, logLength, &logLength, log); 115 | 116 | 117 | Core::instance()->writeError( "\n"+QString(log)+"\n", false ); 118 | 119 | delete[] log; 120 | 121 | return false; 122 | } 123 | else 124 | { 125 | GLint logLength = 0; 126 | GLchar* log = NULL; 127 | 128 | glGetShaderiv(id, GL_INFO_LOG_LENGTH, &logLength); 129 | log = new GLchar[logLength]; 130 | glGetShaderInfoLog(id, logLength, &logLength, log); 131 | 132 | if(logLength>0) 133 | Core::instance()->writeWarning("\n"+QString(log)+"\n", false ); 134 | 135 | delete[] log; 136 | } 137 | 138 | return true; 139 | } 140 | 141 | 142 | 143 | 144 | -------------------------------------------------------------------------------- /SceneEditor/shader.h: -------------------------------------------------------------------------------- 1 | #ifndef DEF_SHADER 2 | #define DEF_SHADER 3 | 4 | 5 | #include 6 | #include 7 | 8 | #define SHADER_SUCCESS 1 9 | #define SHADER_VERTEX_ERROR 2 10 | #define SHADER_FRAGMENT_ERROR 3 11 | 12 | class Shader 13 | { 14 | public: 15 | Shader(); 16 | ~Shader(); 17 | 18 | int compil(const char *vertex, const char *fragment); 19 | 20 | void enable(); 21 | void disable(); 22 | 23 | void sendi(const char *name, int x); 24 | void sendf(const char *name, float x); 25 | void sendf(const char *name, float x, float y); 26 | void sendf(const char *name, float x, float y, float z); 27 | void sendf(const char *name, float x, float y, float z, float w); 28 | private: 29 | bool makeShader(const char *txt, GLuint type); 30 | bool checkShader( int id ); 31 | GLuint m_program; 32 | }; 33 | 34 | 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /SceneEditor/texteditor.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "texteditor.h" 4 | #include "highlighter.h" 5 | 6 | TextEditor::TextEditor(QWidget *parent) : QPlainTextEdit(parent) 7 | { 8 | lineNumberArea = new LineNumberArea(this); 9 | 10 | connect(this, SIGNAL(blockCountChanged(int)), this, SLOT(updateLineNumberAreaWidth(int))); 11 | connect(this, SIGNAL(updateRequest(QRect,int)), this, SLOT(updateLineNumberArea(QRect,int))); 12 | connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(highlightCurrentLine())); 13 | 14 | updateLineNumberAreaWidth(0); 15 | highlightCurrentLine(); 16 | 17 | QFont font("consolas",9); 18 | const int tabStop = 4; // 4 characters 19 | QFontMetrics metrics(font); 20 | setTabStopWidth(tabStop * metrics.width(' ')); 21 | setFont(font); 22 | setLineWrapMode(QPlainTextEdit::NoWrap); 23 | 24 | m_highlighter = new Highlighter(document()); 25 | 26 | m_autoUpdate = false; 27 | m_timer = new QTimer(); 28 | m_timer->setSingleShot(true); 29 | m_timer->setInterval(1000); 30 | connect(m_timer, SIGNAL(timeout()), this, SLOT(updateShader())); 31 | connect(this, SIGNAL(textChanged()), this, SLOT(resetTimer())); 32 | } 33 | 34 | void TextEditor::open(QString filename, int id) 35 | { 36 | if(id < 0) 37 | m_highlighter->defineXMLRule(); 38 | 39 | m_id = id; 40 | m_filename = filename; 41 | 42 | QFile f(m_filename); 43 | f.open(QIODevice::ReadOnly | QIODevice::Text); 44 | QTextStream flux(&f); 45 | setPlainText( flux.readAll() ); 46 | f.close(); 47 | 48 | 49 | m_autoUpdate = false; 50 | } 51 | 52 | void TextEditor::save() 53 | { 54 | QFile f(m_filename); 55 | f.setPermissions(QFile::WriteUser); 56 | f.open(QIODevice::WriteOnly | QIODevice::Text); 57 | QTextStream flux(&f); 58 | flux.setCodec("UTF-8"); 59 | flux << toPlainText(); 60 | f.close(); 61 | } 62 | 63 | int TextEditor::lineNumberAreaWidth() 64 | { 65 | int digits = 1; 66 | int max = qMax(1, blockCount()); 67 | while (max >= 10) { 68 | max /= 10; 69 | ++digits; 70 | } 71 | 72 | int space = 5 + fontMetrics().width(QLatin1Char('9')) * digits; 73 | 74 | return space; 75 | } 76 | 77 | 78 | 79 | void TextEditor::updateLineNumberAreaWidth(int /* newBlockCount */) 80 | { 81 | setViewportMargins(lineNumberAreaWidth(), 0, 0, 0); 82 | } 83 | 84 | 85 | 86 | void TextEditor::updateLineNumberArea(const QRect &rect, int dy) 87 | { 88 | if (dy) 89 | lineNumberArea->scroll(0, dy); 90 | else 91 | lineNumberArea->update(0, rect.y(), lineNumberArea->width(), rect.height()); 92 | 93 | if (rect.contains(viewport()->rect())) 94 | updateLineNumberAreaWidth(0); 95 | } 96 | 97 | 98 | 99 | void TextEditor::resizeEvent(QResizeEvent *e) 100 | { 101 | QPlainTextEdit::resizeEvent(e); 102 | 103 | QRect cr = contentsRect(); 104 | lineNumberArea->setGeometry(QRect(cr.left(), cr.top(), lineNumberAreaWidth(), cr.height())); 105 | } 106 | 107 | 108 | 109 | void TextEditor::highlightCurrentLine() 110 | { 111 | QList extraSelections; 112 | 113 | if (!isReadOnly()) { 114 | QTextEdit::ExtraSelection selection; 115 | 116 | QColor lineColor = QColor(Qt::darkGray).darker(300); 117 | 118 | selection.format.setBackground(lineColor); 119 | selection.format.setProperty(QTextFormat::FullWidthSelection, true); 120 | selection.cursor = textCursor(); 121 | selection.cursor.clearSelection(); 122 | extraSelections.append(selection); 123 | } 124 | 125 | setExtraSelections(extraSelections); 126 | } 127 | 128 | 129 | 130 | void TextEditor::lineNumberAreaPaintEvent(QPaintEvent *event) 131 | { 132 | QPainter painter(lineNumberArea); 133 | // painter.fillRect(event->rect(), Qt::black); 134 | 135 | 136 | QTextBlock block = firstVisibleBlock(); 137 | int blockNumber = block.blockNumber(); 138 | int top = (int) blockBoundingGeometry(block).translated(contentOffset()).top(); 139 | int bottom = top + (int) blockBoundingRect(block).height(); 140 | 141 | while (block.isValid() && top <= event->rect().bottom()) { 142 | if (block.isVisible() && bottom >= event->rect().top()) { 143 | QString number = QString::number(blockNumber + 1); 144 | painter.setPen(Qt::darkGray); 145 | painter.drawText(0, top, lineNumberArea->width(), fontMetrics().height(), 146 | Qt::AlignRight, number); 147 | } 148 | 149 | block = block.next(); 150 | top = bottom; 151 | bottom = top + (int) blockBoundingRect(block).height(); 152 | ++blockNumber; 153 | } 154 | } 155 | 156 | void TextEditor::resetTimer() 157 | { 158 | m_timer->start(); 159 | m_autoUpdate = true; 160 | } 161 | 162 | void TextEditor::updateShader() 163 | { 164 | if( m_autoUpdate ) 165 | { 166 | emit shaderUpdate( this->toPlainText(), m_id); 167 | m_autoUpdate = false; 168 | } 169 | } 170 | 171 | -------------------------------------------------------------------------------- /SceneEditor/texteditor.h: -------------------------------------------------------------------------------- 1 | #ifndef TEXTEDITOR_H 2 | #define TEXTEDITOR_H 3 | 4 | #include 5 | #include 6 | 7 | class QPaintEvent; 8 | class QResizeEvent; 9 | class QSize; 10 | class QWidget; 11 | 12 | class LineNumberArea; 13 | class Highlighter; 14 | 15 | class TextEditor : public QPlainTextEdit 16 | { 17 | Q_OBJECT 18 | 19 | public: 20 | TextEditor(QWidget *parent = 0); 21 | 22 | void lineNumberAreaPaintEvent(QPaintEvent *event); 23 | int lineNumberAreaWidth(); 24 | void open( QString filename, int id ); 25 | void save(); 26 | signals: 27 | void shaderUpdate(QString,int); 28 | void reload(); 29 | protected: 30 | void resizeEvent(QResizeEvent *event); 31 | 32 | private slots: 33 | void updateLineNumberAreaWidth(int newBlockCount); 34 | void highlightCurrentLine(); 35 | void updateLineNumberArea(const QRect &, int); 36 | void resetTimer(); 37 | void updateShader(); 38 | 39 | private: 40 | QString colorSyntax(QString in); 41 | QWidget *lineNumberArea; 42 | QString m_filename; 43 | Highlighter *m_highlighter; 44 | int m_id; 45 | QTimer *m_timer; 46 | bool m_autoUpdate; 47 | }; 48 | 49 | 50 | class LineNumberArea : public QWidget 51 | { 52 | public: 53 | LineNumberArea(TextEditor *editor) : QWidget(editor) { 54 | codeEditor = editor; 55 | } 56 | 57 | QSize sizeHint() const { 58 | return QSize(codeEditor->lineNumberAreaWidth(), 0); 59 | } 60 | 61 | protected: 62 | void paintEvent(QPaintEvent *event) { 63 | codeEditor->lineNumberAreaPaintEvent(event); 64 | } 65 | 66 | private: 67 | TextEditor *codeEditor; 68 | }; 69 | 70 | 71 | #endif // TEXTEDITOR_H 72 | -------------------------------------------------------------------------------- /SceneEditor/texture.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include "texture.h" 9 | 10 | Texture::Texture() 11 | { 12 | m_id=-1; 13 | } 14 | Texture::~Texture() 15 | { 16 | glDeleteTextures( 1, &m_id ); 17 | } 18 | 19 | void Texture::bind() 20 | { 21 | glBindTexture(GL_TEXTURE_2D, m_id); 22 | } 23 | 24 | void Texture::load(const std::string &path) 25 | { 26 | if(m_id != -1) 27 | glDeleteTextures( 1, &m_id ); 28 | 29 | QImage t; 30 | QImage b; 31 | 32 | if( !b.load( path.c_str() ) ) 33 | { 34 | QMessageBox::critical(NULL, "Error", QString(QString("Can't load image ")+path.c_str()) ); 35 | } 36 | t = QGLWidget::convertToGLFormat( b ); 37 | 38 | 39 | glGenTextures( 1, &m_id ); 40 | glBindTexture( GL_TEXTURE_2D, m_id ); 41 | glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP_SGIS, GL_TRUE); 42 | glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_LINEAR); 43 | glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); 44 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); 45 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); 46 | glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, t.width(), t.height(), 0, GL_RGBA, GL_UNSIGNED_BYTE, t.bits() ); 47 | } 48 | -------------------------------------------------------------------------------- /SceneEditor/texture.h: -------------------------------------------------------------------------------- 1 | #ifndef TEXTURE_H 2 | #define TEXTURE_H 3 | 4 | #include 5 | #include 6 | 7 | 8 | class Texture 9 | { 10 | public: 11 | Texture(); 12 | ~Texture(); 13 | 14 | void load(const std::string &path); 15 | virtual void bind(); 16 | private: 17 | GLuint m_id; 18 | }; 19 | 20 | #endif // TEXTURE_H 21 | -------------------------------------------------------------------------------- /VisualLiveSystem/FFTAnalyzer.h: -------------------------------------------------------------------------------- 1 | #ifndef FFTANALYZER_H 2 | #define FFTANALYZER_H 3 | 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | #define _USE_MATH_DEFINES 10 | #include 11 | 12 | enum FFTDirection 13 | { 14 | FFT_FORWARD = 0, 15 | FFT_REVERSE = 1 16 | }; 17 | 18 | 19 | class Window 20 | { 21 | public: 22 | enum Type 23 | { 24 | TYPE_RECT, 25 | TYPE_HANN 26 | }; 27 | 28 | static void generate(Type type, size_t N, float out[]); 29 | static double eval(Type type, size_t n, size_t N); 30 | }; 31 | 32 | 33 | 34 | // Send Short term FFT data to a listener. 35 | // Variable overlap. 36 | // Introduced approx. windowSize/2 samples delay. 37 | class FFTAnalyzer 38 | { 39 | public: 40 | 41 | // if zeroPhaseWindowing = true, "zero phase" windowing is used 42 | // (center of window is at first sample, zero-padding happen at center) 43 | FFTAnalyzer(Window::Type windowType, bool zeroPhaseWindowing, bool correctWindowLoss); 44 | 45 | size_t windowSize() const; 46 | size_t analysisPeriod() const; 47 | 48 | // To call at initialization and whenever samplerate changes 49 | // windowSize = size of analysis window, expressed in samples 50 | // fftSize = size of FFT. Must be power-of-two and >= windowSize. Missing samples are zero-padded in time domain. 51 | // analysisPeriod = period of analysis results, allow to be more precise frequentially, expressed in samples 52 | // Basic overlap is achieved with windowSize = 2 * analysisPeriod 53 | void setup(size_t windowSize, size_t fftSize, size_t analysisPeriod); 54 | 55 | // Process one sample, eventually return the result of short-term FFT 56 | // in a given Buffer 57 | bool feed(float x, std::vector< std::complex >* fftData); 58 | 59 | 60 | //Copy/Paste a buffer table 61 | bool pushStereoBuffer(float* buffer , unsigned int size , std::vector< std::complex >* fftData); 62 | 63 | private: 64 | std::vector _audioBuffer; 65 | std::vector _windowBuffer; 66 | 67 | size_t _fftSize; // in samples 68 | size_t _windowSize; // in samples 69 | size_t _analysisPeriod; // in samples 70 | 71 | Window::Type _windowType; 72 | bool _zeroPhaseWindowing; 73 | 74 | size_t _index; 75 | bool _setupWasCalled; 76 | 77 | // should we multiply by _windowGainCorrFactor? 78 | bool _correctWindowLoss; 79 | // the factor by which to multiply transformed data to get in range results 80 | float _windowGainCorrFactor; 81 | }; 82 | 83 | #endif // FFTANALYZER_H 84 | -------------------------------------------------------------------------------- /VisualLiveSystem/VisualLiveSystem.pro: -------------------------------------------------------------------------------- 1 | #------------------------------------------------- 2 | # 3 | # Project created by QtCreator 2013-07-12T18:33:16 4 | # 5 | #------------------------------------------------- 6 | 7 | QT += core gui opengl xml 8 | 9 | TARGET = VisualLiveSystem 10 | TEMPLATE = app 11 | 12 | RC_FILE = ressource.rc 13 | 14 | INCLUDEPATH += C:/Coding/Librarys/include 15 | LIBS += -LC:/Coding/Librarys/lib/32 16 | 17 | LIBS += -lrtaudio -lportmidi -lwinmm -lole32 -lGLEW32 -ldsound -lbass -lbassflac 18 | SOURCES += main.cpp\ 19 | mainwindow.cpp \ 20 | renderwidget.cpp \ 21 | scene.cpp \ 22 | shader.cpp \ 23 | fast2dquad.cpp \ 24 | fbo.cpp \ 25 | channelwidget.cpp \ 26 | visualmanager.cpp \ 27 | core.cpp \ 28 | masterwidget.cpp \ 29 | glscene.cpp \ 30 | projectorwidget.cpp \ 31 | loadingwidget.cpp \ 32 | texture.cpp \ 33 | soundmanager.cpp \ 34 | midiwindow.cpp \ 35 | qmidisequencer.cpp \ 36 | transition.cpp \ 37 | FFTAnalyzer.cpp \ 38 | audiovisualizer.cpp \ 39 | signal/decoder.cpp \ 40 | signal/signal.cpp \ 41 | signal/basserrorhandler.cpp \ 42 | signal/audiopipe.cpp \ 43 | signal/fft.cpp 44 | 45 | HEADERS += mainwindow.h \ 46 | renderwidget.h \ 47 | scene.h \ 48 | shader.h \ 49 | fast2dquad.h \ 50 | fbo.h \ 51 | channelwidget.h \ 52 | visualmanager.h \ 53 | core.h \ 54 | masterwidget.h \ 55 | glscene.h \ 56 | projectorwidget.h \ 57 | loadingwidget.h \ 58 | texture.h \ 59 | soundmanager.h \ 60 | midiwindow.h \ 61 | qmidisequencer.h \ 62 | transition.h \ 63 | FFTAnalyzer.h \ 64 | audiovisualizer.h \ 65 | signal/bass.h \ 66 | signal/bassflac.h \ 67 | signal/decoder.hpp \ 68 | signal/signal.hpp \ 69 | signal/basserrorhandler.hpp \ 70 | signal/audiopipe.hpp \ 71 | signal/fft.hpp 72 | 73 | FORMS += mainwindow.ui \ 74 | channelwidget.ui \ 75 | visualmanager.ui \ 76 | masterwidget.ui \ 77 | loadingwidget.ui \ 78 | midiwindow.ui \ 79 | soundmanager.ui 80 | 81 | RESOURCES += \ 82 | res.qrc \ 83 | qdarkstyle/style.qrc 84 | 85 | OTHER_FILES += \ 86 | res/shaders/open.glsl \ 87 | res/shaders/postprocess.glsl 88 | -------------------------------------------------------------------------------- /VisualLiveSystem/audiovisualizer.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include "core.h" 6 | #include "audiovisualizer.h" 7 | #include "core.h" 8 | #include "fast2dquad.h" 9 | 10 | 11 | AudioVisualizer::AudioVisualizer(QGLWidget *share, QWidget *parent) : QGLWidget(parent,share) 12 | { 13 | QTimer *timer = new QTimer(this); 14 | connect(timer, SIGNAL(timeout()), this, SLOT(updateGL())); 15 | timer->start(30); 16 | } 17 | 18 | AudioVisualizer::~AudioVisualizer() 19 | { 20 | delete m_shader; 21 | } 22 | 23 | 24 | //----------------------------------------------------------------------------- 25 | // initializeGL 26 | //----------------------------------------------------------------------------- 27 | void AudioVisualizer::initializeGL() 28 | { 29 | QFile f(":res/shaders/audiovisualizer.glsl"); 30 | f.open(QFile::ReadOnly | QFile::Text); 31 | QTextStream ts(&f); 32 | m_shader = new Shader(); 33 | m_shader->compil(Core::instance()->getVertexShader(), ts.readAll().toStdString().c_str()); 34 | m_shader->enable(); 35 | m_shader->sendi("spectrum", 0 ); 36 | m_shader->disable(); 37 | } 38 | 39 | 40 | //----------------------------------------------------------------------------- 41 | // paintGL 42 | //----------------------------------------------------------------------------- 43 | void AudioVisualizer::paintGL() 44 | { 45 | m_shader->enable(); 46 | m_shader->sendf("bassCutoff", (float)Core::instance()->bassCutoff / (float) Core::instance()->pow2Size ); 47 | Core::instance()->bindTextureSpectrum(); 48 | Fast2DQuadDraw(); 49 | m_shader->disable(); 50 | 51 | } 52 | 53 | //----------------------------------------------------------------------------- 54 | // resizeGL 55 | //----------------------------------------------------------------------------- 56 | void AudioVisualizer::resizeGL(int width, int height) 57 | { 58 | glViewport(0,0,width,height); 59 | } 60 | 61 | -------------------------------------------------------------------------------- /VisualLiveSystem/audiovisualizer.h: -------------------------------------------------------------------------------- 1 | #ifndef AUDIOVISUALIZER_H 2 | #define AUDIOVISUALIZER_H 3 | 4 | #include "shader.h" 5 | #include 6 | #include 7 | #include 8 | 9 | class AudioVisualizer : public QGLWidget 10 | { 11 | public: 12 | AudioVisualizer(QGLWidget *share, QWidget *parent); 13 | ~AudioVisualizer(); 14 | 15 | protected: 16 | void initializeGL(); 17 | void paintGL(); 18 | void resizeGL(int width, int height); 19 | 20 | private: 21 | Shader *m_shader; 22 | }; 23 | 24 | 25 | #endif // AUDIOVISUALIZER_H 26 | -------------------------------------------------------------------------------- /VisualLiveSystem/channelwidget.cpp: -------------------------------------------------------------------------------- 1 | #include "channelwidget.h" 2 | #include "ui_channelwidget.h" 3 | #include "glscene.h" 4 | #include "core.h" 5 | 6 | 7 | ChannelWidget::ChannelWidget(int id, QGLWidget *share, QWidget *parent) : 8 | QDockWidget(parent), 9 | ui(new Ui::ChannelWidget), 10 | m_id(id) 11 | { 12 | ui->setupUi(this); 13 | m_glscene = new GLScene(share,id,parent,m_id); 14 | m_scene = NULL; 15 | 16 | if(id==0) 17 | this->setWindowTitle( "Channel A"); 18 | else 19 | this->setWindowTitle( "Channel B"); 20 | ui->groupBox_3->layout()->addWidget(m_glscene); 21 | 22 | connect(ui->listWidget, SIGNAL(currentRowChanged(int)), this, SLOT(selectChanged(int))); 23 | connect(ui->CC0Bar, SIGNAL(valueChanged(int)), this, SLOT(CCChanged())); 24 | connect(ui->CC1Bar, SIGNAL(valueChanged(int)), this, SLOT(CCChanged())); 25 | connect(ui->CC2Bar, SIGNAL(valueChanged(int)), this, SLOT(CCChanged())); 26 | connect(ui->CC3Bar, SIGNAL(valueChanged(int)), this, SLOT(CCChanged())); 27 | } 28 | 29 | ChannelWidget::~ChannelWidget() 30 | { 31 | delete ui; 32 | } 33 | 34 | void ChannelWidget::updateList( QList list ) 35 | { 36 | Core::instance()->getLoadingWidget()->show(); 37 | ui->listWidget->clear(); 38 | //Copy ! 39 | if(list.size()) 40 | { 41 | foreach(QListWidgetItem *i, list) 42 | { 43 | ui->listWidget->addItem(i->text()); 44 | } 45 | } 46 | 47 | if(m_scene) 48 | { 49 | delete[] m_scene; 50 | m_scene = NULL; 51 | } 52 | if(!list.isEmpty()) 53 | { 54 | m_scene = new Scene[list.size()]; 55 | m_glscene->compilScenes(m_scene,list); 56 | selectChanged(0); 57 | } 58 | } 59 | 60 | void ChannelWidget::Switch() 61 | { 62 | if( Core::instance()->getCurrentChannel() == m_id && Core::instance()->inLive() ) 63 | ui->listWidget->setEnabled(false); 64 | else 65 | ui->listWidget->setEnabled(true); 66 | } 67 | 68 | void ChannelWidget::selectChanged(int a) 69 | { 70 | if(m_id == Core::instance()->getCurrentChannel() && Core::instance()->inLive()) 71 | return; 72 | 73 | if( Core::instance()->getLoadingWidget()->isHidden() ) 74 | { 75 | m_glscene->setCurrent(a); 76 | m_scene[a].resetTime(); 77 | ui->param0Label->setText( m_scene[a].getParamName(0) ); 78 | ui->param1Label->setText( m_scene[a].getParamName(1) ); 79 | ui->param2Label->setText( m_scene[a].getParamName(2) ); 80 | ui->param3Label->setText( m_scene[a].getParamName(3) ); 81 | } 82 | } 83 | 84 | void ChannelWidget::CCChanged(int id, float v) 85 | { 86 | if(id == 0) 87 | { 88 | ui->CC0Bar->setValue((int)(v)); 89 | Core::instance()->setCC(m_id,0,float(v)/100.f); 90 | } 91 | else if(id == 1) 92 | { 93 | ui->CC1Bar->setValue((int)(v)); 94 | Core::instance()->setCC(m_id,1,float(v)/100.f); 95 | } 96 | else if(id == 2) 97 | { 98 | ui->CC2Bar->setValue((int)(v)); 99 | Core::instance()->setCC(m_id,2,float(v)/100.f); 100 | } 101 | else if(id == 3) 102 | { 103 | ui->CC3Bar->setValue((int)(v)); 104 | Core::instance()->setCC(m_id,3,float(v)/100.f); 105 | } 106 | } 107 | 108 | void ChannelWidget::CCChanged() 109 | { 110 | 111 | Core::instance()->setCC(m_id,0,float(ui->CC0Bar->value())/100.f); 112 | Core::instance()->setCC(m_id,1,float(ui->CC1Bar->value())/100.f); 113 | Core::instance()->setCC(m_id,2,float(ui->CC2Bar->value())/100.f); 114 | Core::instance()->setCC(m_id,3,float(ui->CC3Bar->value())/100.f); 115 | } 116 | 117 | void ChannelWidget::sceneUp() 118 | { 119 | if( ( Core::instance()->getCurrentChannel() != m_id && Core::instance()->inLive() ) || !Core::instance()->inLive() ) 120 | { 121 | int n = (ui->listWidget->currentRow()+1)%ui->listWidget->count(); 122 | ui->listWidget->setCurrentRow(n); 123 | } 124 | 125 | } 126 | 127 | void ChannelWidget::sceneDown() 128 | { 129 | 130 | if( ( Core::instance()->getCurrentChannel() != m_id && Core::instance()->inLive() ) || !Core::instance()->inLive() ) 131 | { 132 | int n = ui->listWidget->currentRow()-1; 133 | if(n == -1) 134 | n = ui->listWidget->count()-1; 135 | ui->listWidget->setCurrentRow(n); 136 | } 137 | } 138 | -------------------------------------------------------------------------------- /VisualLiveSystem/channelwidget.h: -------------------------------------------------------------------------------- 1 | #ifndef CHANNELWIDGET_H 2 | #define CHANNELWIDGET_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include "scene.h" 9 | 10 | 11 | class GLScene; 12 | 13 | namespace Ui { 14 | class ChannelWidget; 15 | } 16 | 17 | class ChannelWidget : public QDockWidget 18 | { 19 | Q_OBJECT 20 | 21 | public: 22 | explicit ChannelWidget(int id, QGLWidget *share = 0, QWidget *parent = 0); 23 | ~ChannelWidget(); 24 | public slots: 25 | void updateList( QList list ); 26 | void selectChanged(int); 27 | void CCChanged(int, float); 28 | void CCChanged(); 29 | void sceneUp(); 30 | void sceneDown(); 31 | void Switch(); 32 | private: 33 | Ui::ChannelWidget *ui; 34 | int m_id; 35 | GLScene *m_glscene; 36 | Scene *m_scene; 37 | }; 38 | 39 | #endif // CHANNELWIDGET_H 40 | -------------------------------------------------------------------------------- /VisualLiveSystem/channelwidget.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | ChannelWidget 4 | 5 | 6 | 7 | 0 8 | 0 9 | 342 10 | 633 11 | 12 | 13 | 14 | Channel 15 | 16 | 17 | 18 | 19 | 20 | 21 | Scenes 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 256 35 | 180 36 | 37 | 38 | 39 | Preview 40 | 41 | 42 | 43 | 44 | 45 | 7 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | Faders 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 0 : 64 | 65 | 66 | 67 | 68 | 69 | 70 | 0 71 | 72 | 73 | 100 74 | 75 | 76 | 0 77 | 78 | 79 | Qt::Horizontal 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 1 : 91 | 92 | 93 | 94 | 95 | 96 | 97 | 100 98 | 99 | 100 | 0 101 | 102 | 103 | Qt::Horizontal 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 2 : 115 | 116 | 117 | 118 | 119 | 120 | 121 | 100 122 | 123 | 124 | 0 125 | 126 | 127 | Qt::Horizontal 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 3 : 139 | 140 | 141 | 142 | 143 | 144 | 145 | 100 146 | 147 | 148 | 0 149 | 150 | 151 | Qt::Horizontal 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | -------------------------------------------------------------------------------- /VisualLiveSystem/core.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XT95/VisualLiveSystem/e8b5b97718f294cf4d6fa001ff98e0e6d7cbcf74/VisualLiveSystem/core.cpp -------------------------------------------------------------------------------- /VisualLiveSystem/core.h: -------------------------------------------------------------------------------- 1 | #ifndef DATA_H 2 | #define DATA_H 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | #include "loadingwidget.h" 10 | #include "signal/audiopipe.hpp" 11 | #include "signal/decoder.hpp" 12 | #include "signal/fft.hpp" 13 | 14 | class Scene; 15 | class FBO; 16 | 17 | class Core : public QObject 18 | { 19 | Q_OBJECT 20 | public: 21 | //Singleton ! 22 | static Core* instance(); 23 | void initGL(); 24 | void initAudio(); 25 | void initWidgets(); 26 | 27 | //Show ! 28 | bool inLive() { return m_inLive; } 29 | void setBassMotion(float b) { m_bassMotion=b; } 30 | void setCC(int c, int id, float v); 31 | float getCC(int c, int id); 32 | 33 | //Transition 34 | void setCurrentTransition(int id); 35 | int getCurrentTransition(); 36 | 37 | //Channel 38 | void Switch(); 39 | int getCurrentChannel(); 40 | 41 | //Rendering 42 | void setResolution(int x,int y); 43 | int getResX(); 44 | int getResY(); 45 | int getNoise3D(); 46 | 47 | //FBO 48 | void setFBOChan(FBO *fbo, int n); 49 | FBO* getFBOChan(int n); 50 | void setFBOFinal(FBO *fbo); 51 | FBO* getFBOFinal(); 52 | 53 | //Spectrum & Time 54 | void bindTextureSpectrum(); 55 | void setBass(float bass); 56 | void setTimeSpeed(float t); 57 | void setBassTimeSpeed(float t); 58 | void resetBassTime(); 59 | void setNoise(float n); 60 | float getTimeSpeed(); 61 | float getBassTimeSpeed(); 62 | float getBass(); 63 | float getBassTime(); 64 | float getNoiseLvl(); 65 | 66 | 67 | //Utils 68 | Scene* getDefaultScene(); 69 | const char* getVertexShader(); 70 | LoadingWidget* getLoadingWidget(); 71 | 72 | //Audio 73 | unsigned int bassCutoff; 74 | AudioPipe* audioPipe; 75 | Decoder* decoder; 76 | PlaylistMixer* mixer; 77 | FFT* fft; 78 | VisualSignal* visualSignal; 79 | unsigned int pow2Size; 80 | 81 | 82 | void setPow2Size(unsigned int s); 83 | 84 | 85 | //Infos 86 | int infoChannelA,infoChannelB,infoPostFX,infoFPS,infoSound; 87 | 88 | //Settings 89 | QSettings settings; 90 | 91 | 92 | signals: 93 | void resolutionChanged(int,int); 94 | void channelSwitched(); 95 | void pow2Changed(unsigned int); 96 | 97 | public slots: 98 | void liveChanged(bool); 99 | 100 | private: 101 | Core(); 102 | 103 | static Core *m_instance; 104 | Scene *m_defaultScene; 105 | int m_currentChannel; 106 | int m_resX,m_resY; 107 | FBO *m_fboChan[2]; 108 | FBO *m_fboFinal; 109 | GLuint m_spectrum; 110 | GLuint m_noise3D; 111 | 112 | LoadingWidget *m_loadingw; 113 | float m_bass,m_bassTime, m_timeSpeed, m_bassTimeSpeed, m_bassMotion, m_noiseLvl; 114 | bool m_inLive; 115 | float m_cc[2][4]; 116 | int m_transition; 117 | 118 | }; 119 | 120 | #endif // DATA_H 121 | -------------------------------------------------------------------------------- /VisualLiveSystem/fast2dquad.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | 5 | 6 | #define BUFFER_OFFSET(a) ((char*)NULL + (a)) 7 | struct vec2 8 | { 9 | float x,y; 10 | }; 11 | 12 | static GLuint vbo; 13 | 14 | void Fast2DQuadInit(void) 15 | { 16 | vec2 point[4]; 17 | point[0].x =-1.0f; point[1].x = 1.0f; point[2].x =-1.0f; point[3].x = 1.0f; 18 | point[0].y =-1.0f; point[1].y =-1.0f; point[2].y = 1.0f; point[3].y = 1.0f; 19 | vec2 uv[4]; 20 | uv[0].x = 0.0f; uv[1].x = 1.0f; uv[2].x = 0.0f; uv[3].x = 1.0f; 21 | uv[0].y = 0.0f; uv[1].y = 0.0f; uv[2].y = 1.0f; uv[3].y = 1.0f; 22 | 23 | 24 | //make the vertex buffer object 25 | glGenBuffers(1, &vbo); 26 | glBindBuffer(GL_ARRAY_BUFFER, vbo); 27 | glBufferData(GL_ARRAY_BUFFER, 4*2*sizeof(float)*2, NULL, GL_STATIC_DRAW); 28 | glBufferSubData(GL_ARRAY_BUFFER, 0, 4*2*sizeof(float), point); 29 | glBufferSubData(GL_ARRAY_BUFFER, 4*2*sizeof(float), 4*2*sizeof(float), uv); 30 | glBindBuffer(GL_ARRAY_BUFFER, 0); 31 | 32 | } 33 | 34 | 35 | void Fast2DQuadDraw(void) 36 | { 37 | glBindBuffer(GL_ARRAY_BUFFER, vbo); 38 | glVertexPointer(2, GL_FLOAT, 0, BUFFER_OFFSET(0)); 39 | glTexCoordPointer(2, GL_FLOAT, 0, BUFFER_OFFSET(4*2*sizeof(float))); 40 | glEnableClientState(GL_VERTEX_ARRAY); 41 | glEnableClientState(GL_TEXTURE_COORD_ARRAY); 42 | glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); 43 | glDisableClientState(GL_TEXTURE_COORD_ARRAY); 44 | glDisableClientState(GL_VERTEX_ARRAY); 45 | glBindBuffer(GL_ARRAY_BUFFER, 0); 46 | } 47 | 48 | 49 | void Fast2DQuadFree(void) 50 | { 51 | glDeleteBuffers(1,&vbo); 52 | } 53 | -------------------------------------------------------------------------------- /VisualLiveSystem/fast2dquad.h: -------------------------------------------------------------------------------- 1 | #ifndef DEF_FAST2DQUAD 2 | #define DEF_FAST2DQUAD 3 | 4 | 5 | 6 | void Fast2DQuadInit(void); 7 | void Fast2DQuadDraw(void); 8 | void Fast2DQuadFree(void); 9 | 10 | 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /VisualLiveSystem/fbo.cpp: -------------------------------------------------------------------------------- 1 | #include "fbo.h" 2 | 3 | 4 | 5 | //----------------------------------------------------------------------------- 6 | // Constructor 7 | //----------------------------------------------------------------------------- 8 | FBO::FBO() 9 | { 10 | m_FrameBuffer=0; 11 | m_ColorTextureID=0; 12 | m_width = 1280; 13 | m_height = 720; 14 | m_format = GL_RGBA; 15 | 16 | //Create texture. 17 | glGenTextures(1, &m_ColorTextureID); 18 | glBindTexture(GL_TEXTURE_2D, m_ColorTextureID); 19 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); 20 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); 21 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER); 22 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER); 23 | glTexImage2D(GL_TEXTURE_2D, 0, m_format, m_width, m_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); 24 | glBindTexture(GL_TEXTURE_2D, 0); 25 | 26 | 27 | //Make buffer 28 | glGenFramebuffers(1, &m_FrameBuffer); 29 | glBindFramebuffer(GL_FRAMEBUFFER_EXT, m_FrameBuffer); 30 | 31 | 32 | glFramebufferTexture2D(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, m_ColorTextureID, 0); 33 | 34 | 35 | glBindFramebuffer(GL_FRAMEBUFFER_EXT, 0); 36 | 37 | } 38 | 39 | 40 | //----------------------------------------------------------------------------- 41 | // Destructor 42 | //----------------------------------------------------------------------------- 43 | FBO::~FBO() 44 | { 45 | glDeleteTextures(1, &m_ColorTextureID); 46 | glDeleteFramebuffers(1, &m_FrameBuffer); 47 | } 48 | 49 | 50 | //----------------------------------------------------------------------------- 51 | // Enable 52 | //----------------------------------------------------------------------------- 53 | void FBO::enable(void) 54 | { 55 | glPushAttrib(GL_VIEWPORT_BIT); 56 | glViewport(0,0,m_width,m_height); 57 | 58 | glBindFramebuffer(GL_FRAMEBUFFER_EXT, m_FrameBuffer); 59 | glPushMatrix(); 60 | } 61 | 62 | //----------------------------------------------------------------------------- 63 | // Disable 64 | //----------------------------------------------------------------------------- 65 | void FBO::disable(void) 66 | { 67 | glPopMatrix(); 68 | glBindFramebuffer(GL_FRAMEBUFFER_EXT, 0); 69 | glPopAttrib(); 70 | } 71 | 72 | 73 | 74 | //----------------------------------------------------------------------------- 75 | // Set 76 | //----------------------------------------------------------------------------- 77 | void FBO::setSize( int width, int height ) 78 | { 79 | m_width = width; 80 | m_height = height; 81 | 82 | 83 | updateTexture(); 84 | } 85 | void FBO::setFormat(GLint format) 86 | { 87 | m_format = format; 88 | updateTexture(); 89 | } 90 | 91 | 92 | //----------------------------------------------------------------------------- 93 | // Get 94 | //----------------------------------------------------------------------------- 95 | GLuint FBO::getColor(void) 96 | { 97 | return m_ColorTextureID; 98 | } 99 | 100 | //----------------------------------------------------------------------------- 101 | // updateTexture 102 | //----------------------------------------------------------------------------- 103 | void FBO::updateTexture() 104 | { 105 | glBindTexture(GL_TEXTURE_2D, m_ColorTextureID); 106 | glTexImage2D(GL_TEXTURE_2D, 0, m_format, m_width, m_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); 107 | glBindTexture(GL_TEXTURE_2D, 0); 108 | 109 | 110 | glBindFramebuffer(GL_FRAMEBUFFER_EXT, m_FrameBuffer); 111 | glFramebufferTexture2D(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, m_ColorTextureID, 0); 112 | glBindRenderbuffer(GL_RENDERBUFFER_EXT, 0); 113 | 114 | 115 | 116 | glBindFramebuffer(GL_FRAMEBUFFER_EXT, 0); 117 | 118 | } 119 | 120 | //----------------------------------------------------------------------------- 121 | // bind 122 | //----------------------------------------------------------------------------- 123 | void FBO::bind() 124 | { 125 | glBindTexture(GL_TEXTURE_2D, m_ColorTextureID); 126 | } 127 | -------------------------------------------------------------------------------- /VisualLiveSystem/fbo.h: -------------------------------------------------------------------------------- 1 | #ifndef DEF_CORE_FBO_H 2 | #define DEF_CORE_FBO_H 3 | 4 | #include 5 | #include "texture.h" 6 | 7 | //----------------------------------------------------------------------------- 8 | // Class Frame Buffer Object 9 | //----------------------------------------------------------------------------- 10 | class FBO : public Texture 11 | { 12 | public: 13 | FBO(); 14 | ~FBO(); 15 | 16 | void enable(void); 17 | void disable(void); 18 | 19 | 20 | void setSize( int width, int height ); 21 | void setFormat(GLint format); 22 | 23 | int getSizeX(){return m_width;} 24 | int getSizeY(){return m_height;} 25 | GLuint getColor(void); 26 | GLenum getFormat(){return m_format;} 27 | 28 | void bind(); 29 | private: 30 | void updateTexture(); 31 | 32 | GLuint m_FrameBuffer; 33 | GLuint m_ColorTextureID; 34 | int m_width,m_height; 35 | GLint m_format; 36 | }; 37 | 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /VisualLiveSystem/glscene.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "core.h" 4 | #include "fast2dquad.h" 5 | #include "glscene.h" 6 | 7 | 8 | GLScene::GLScene(QGLWidget *share, int channel, QWidget *parent, bool chanID) : 9 | QGLWidget(parent,share), 10 | m_id(channel), 11 | m_chanID(chanID) 12 | { 13 | m_scene = NULL; 14 | m_selectID = 0; 15 | m_nbScene = 0; 16 | 17 | QTimer *timer = new QTimer(this); 18 | connect(timer, SIGNAL(timeout()), this, SLOT(updateGL())); 19 | timer->start(1); 20 | 21 | connect(Core::instance(), SIGNAL(resolutionChanged(int,int)), this, SLOT(resolutionChanged(int,int))); 22 | } 23 | 24 | 25 | 26 | //----------------------------------------------------------------------------- 27 | // compilScenes 28 | //----------------------------------------------------------------------------- 29 | void GLScene::compilScenes( Scene *scene, QList list ) 30 | { 31 | makeCurrent(); 32 | m_scene = scene; 33 | m_nbScene = list.size(); 34 | LoadingWidget* loading = Core::instance()->getLoadingWidget(); 35 | loading->setTitle(QString("Scenes...")); 36 | if(m_id == 0) 37 | { 38 | loading->set(0); 39 | } 40 | else 41 | loading->set(45); 42 | 43 | for(int i=0; iset(i*45/list.size()); 47 | else 48 | loading->set(45+i*45/list.size()); 49 | m_scene[i].setChannel(m_id); 50 | m_scene[i].read(list.at(i)->text().toStdString().c_str()); 51 | } 52 | loading->hide(); 53 | } 54 | void GLScene::setCurrent(int a) 55 | { 56 | m_selectID = a; 57 | } 58 | 59 | //----------------------------------------------------------------------------- 60 | // initializeGL 61 | //----------------------------------------------------------------------------- 62 | void GLScene::initializeGL() 63 | { 64 | m_rtt = new FBO(); 65 | Core::instance()->setFBOChan(m_rtt,m_id); 66 | if(m_id == Core::instance()->getCurrentChannel()) 67 | { 68 | m_rtt->setSize(Core::instance()->getResX(), Core::instance()->getResY()); 69 | } 70 | else 71 | { 72 | m_rtt->setSize(Core::instance()->getResX()/6, Core::instance()->getResY()/6); 73 | } 74 | } 75 | 76 | 77 | //----------------------------------------------------------------------------- 78 | // paintGL 79 | //----------------------------------------------------------------------------- 80 | void GLScene::paintGL() 81 | { 82 | QTime time; 83 | time.restart(); 84 | 85 | if(m_scene) 86 | { 87 | m_scene[m_selectID].compute(); 88 | m_rtt->enable(); 89 | m_scene[m_selectID].draw(); 90 | m_rtt->disable(); 91 | } 92 | else 93 | { 94 | Core::instance()->getDefaultScene()->compute(); 95 | m_rtt->enable(); 96 | Core::instance()->getDefaultScene()->draw(); 97 | m_rtt->disable(); 98 | } 99 | glViewport(0,0,m_w,m_h); 100 | 101 | glEnable(GL_TEXTURE_2D); 102 | glBindTexture(GL_TEXTURE_2D, m_rtt->getColor()); 103 | Fast2DQuadDraw(); 104 | 105 | glFlush(); 106 | glFinish(); 107 | 108 | if(m_chanID==0) 109 | Core::instance()->infoChannelA = time.elapsed(); 110 | else 111 | Core::instance()->infoChannelB = time.elapsed(); 112 | } 113 | 114 | //----------------------------------------------------------------------------- 115 | // resizeGL 116 | //----------------------------------------------------------------------------- 117 | void GLScene::resizeGL(int width, int height) 118 | { 119 | m_w = width; 120 | m_h = height; 121 | } 122 | 123 | 124 | 125 | void GLScene::resolutionChanged(int x,int y) 126 | { 127 | makeCurrent(); 128 | if(m_id == Core::instance()->getCurrentChannel()) 129 | { 130 | m_rtt->setSize(Core::instance()->getResX(), Core::instance()->getResY()); 131 | for(int i=0; isetSize(Core::instance()->getResX()/8, Core::instance()->getResY()/8); 137 | for(int i=0; i 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include "scene.h" 10 | #include "fbo.h" 11 | 12 | 13 | 14 | //Mini widget de prévisu situé dans les channels widgets 15 | class GLScene : public QGLWidget 16 | { 17 | Q_OBJECT 18 | public: 19 | GLScene(QGLWidget *share, int channel, QWidget *parent, bool chanID); 20 | 21 | void compilScenes( Scene *scene, QList list ); 22 | void setCurrent( int a ); 23 | 24 | void initializeGL(); 25 | void paintGL(); 26 | void resizeGL(int width, int height); 27 | 28 | private slots: 29 | void resolutionChanged(int,int); 30 | private: 31 | QTime m_timer; 32 | int m_w,m_h, m_id; 33 | 34 | FBO *m_rtt; 35 | Scene *m_scene; 36 | int m_nbScene; 37 | int m_selectID; 38 | bool m_chanID; 39 | }; 40 | 41 | #endif // GLSCENE_H 42 | -------------------------------------------------------------------------------- /VisualLiveSystem/loadingwidget.cpp: -------------------------------------------------------------------------------- 1 | #include "loadingwidget.h" 2 | #include "ui_loadingwidget.h" 3 | 4 | LoadingWidget::LoadingWidget(QWidget *parent) : 5 | QWidget(parent), 6 | ui(new Ui::LoadingWidget) 7 | { 8 | ui->setupUi(this); 9 | } 10 | 11 | LoadingWidget::~LoadingWidget() 12 | { 13 | delete ui; 14 | } 15 | 16 | void LoadingWidget::set(int a) 17 | { 18 | ui->progressBar->setValue(a); 19 | } 20 | 21 | void LoadingWidget::setTitle(QString t) 22 | { 23 | ui->groupBox->setTitle(t); 24 | } 25 | -------------------------------------------------------------------------------- /VisualLiveSystem/loadingwidget.h: -------------------------------------------------------------------------------- 1 | #ifndef LOADINGWIDGET_H 2 | #define LOADINGWIDGET_H 3 | 4 | #include 5 | 6 | namespace Ui { 7 | class LoadingWidget; 8 | } 9 | 10 | class LoadingWidget : public QWidget 11 | { 12 | Q_OBJECT 13 | 14 | public: 15 | explicit LoadingWidget(QWidget *parent = 0); 16 | ~LoadingWidget(); 17 | 18 | void setTitle(QString t); 19 | void set(int a); 20 | private: 21 | Ui::LoadingWidget *ui; 22 | }; 23 | 24 | #endif // LOADINGWIDGET_H 25 | -------------------------------------------------------------------------------- /VisualLiveSystem/loadingwidget.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | LoadingWidget 4 | 5 | 6 | Qt::ApplicationModal 7 | 8 | 9 | 10 | 0 11 | 0 12 | 356 13 | 150 14 | 15 | 16 | 17 | Loading 18 | 19 | 20 | 21 | :/res/img/vls.png:/res/img/vls.png 22 | 23 | 24 | 25 | 26 | 27 | Loading .... 28 | 29 | 30 | 31 | 32 | 33 | 0 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | Qt::Horizontal 43 | 44 | 45 | 46 | 40 47 | 20 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | false 56 | 57 | 58 | Cancel 59 | 60 | 61 | false 62 | 63 | 64 | false 65 | 66 | 67 | 68 | 69 | 70 | 71 | Qt::Horizontal 72 | 73 | 74 | 75 | 40 76 | 20 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | -------------------------------------------------------------------------------- /VisualLiveSystem/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include "mainwindow.h" 5 | #include "core.h" 6 | 7 | #include 8 | #include 9 | 10 | int main(int argc, char *argv[]) 11 | { 12 | 13 | std::map apiMap; 14 | apiMap[RtAudio::MACOSX_CORE] = "OS-X Core Audio"; 15 | apiMap[RtAudio::WINDOWS_ASIO] = "Windows ASIO"; 16 | apiMap[RtAudio::WINDOWS_DS] = "Windows Direct Sound"; 17 | apiMap[RtAudio::WINDOWS_WASAPI] = "Windows WASAPI"; 18 | apiMap[RtAudio::UNIX_JACK] = "Jack Client"; 19 | apiMap[RtAudio::LINUX_ALSA] = "Linux ALSA"; 20 | apiMap[RtAudio::LINUX_PULSE] = "Linux PulseAudio"; 21 | apiMap[RtAudio::LINUX_OSS] = "Linux OSS"; 22 | apiMap[RtAudio::RTAUDIO_DUMMY] = "RtAudio Dummy"; 23 | std::vector< RtAudio::Api > apis; 24 | RtAudio :: getCompiledApi( apis ); 25 | 26 | std::cout << "\nRtAudio Version " << RtAudio::getVersion() << std::endl; 27 | 28 | std::cout << "\nCompiled APIs:\n"; 29 | for ( unsigned int i=0; isetupUi(this); 18 | 19 | Core::instance()->initAudio(); 20 | Core::instance()->initWidgets(); 21 | 22 | //Windows 23 | m_chan[0] = new ChannelWidget(0,ui->widget); 24 | m_chan[1] = new ChannelWidget(1,ui->widget); 25 | m_master = new MasterWidget(ui->widget); 26 | m_visualManager = new VisualManager(); 27 | m_proj = new ProjectorWidget(ui->widget); 28 | //m_soundManager = new SoundManager(*(Core::instance()->audioPipe)); 29 | m_midiManager = new MidiWindow(); 30 | 31 | addDockWidget(Qt::LeftDockWidgetArea, m_chan[0]); 32 | addDockWidget(Qt::RightDockWidgetArea, m_chan[1]); 33 | addDockWidget(Qt::BottomDockWidgetArea, m_master); 34 | 35 | //Tool bar 36 | ui->toolBar->addAction(ui->actionSound_manager); 37 | ui->toolBar->addAction(ui->actionVisual_Manager); 38 | ui->toolBar->addAction(ui->actionControllers_manager); 39 | ui->toolBar->addSeparator(); 40 | ui->toolBar->addAction(ui->actionProjector); 41 | //ui->toolBar->addSeparator(); 42 | //ui->toolBar->addAction(ui->actionPreferences); 43 | /* 44 | //Connections 45 | connect(ui->actionVisual_Manager, SIGNAL(triggered()), m_visualManager, SLOT(show())); 46 | connect(ui->actionProjector, SIGNAL(triggered()), m_proj, SLOT(show())); 47 | connect(ui->actionControllers_manager, SIGNAL(triggered()), m_midiManager, SLOT(show())); 48 | connect(m_visualManager, SIGNAL(newListFX(QList)), ui->widget, SLOT(loadPostEffects(QList))); 49 | connect(m_visualManager, SIGNAL(newListChanA(QList)), m_chan[0], SLOT(updateList(QList))); 50 | connect(m_visualManager, SIGNAL(newListChanB(QList)), m_chan[1], SLOT(updateList(QList))); 51 | connect(ui->actionSound_manager, SIGNAL(triggered()), m_soundManager, SLOT(show())); 52 | 53 | connect(m_master, SIGNAL(finalPostFXDataChanged(float,float,float,float,float,float,float)), 54 | ui->widget, SLOT(updateFinalPostFXData(float,float,float,float,float,float,float))); 55 | 56 | connect(Core::instance()->audioPipe, SIGNAL(inLive(bool)), m_master, SLOT(inLive(bool))); 57 | connect(m_master, SIGNAL(transition()), ui->widget, SLOT(transition())); 58 | connect(Core::instance(), SIGNAL(channelSwitched()), m_chan[0], SLOT(Switch())); 59 | connect(Core::instance(), SIGNAL(channelSwitched()), m_chan[1], SLOT(Switch())); 60 | 61 | //Midi mapping 62 | connect(m_midiManager, SIGNAL(gammaValueChanged(int)), m_master, SLOT(gammaChanged(int))); 63 | connect(m_midiManager, SIGNAL(brightnessValueChanged(int)), m_master, SLOT(brightnessChanged(int))); 64 | connect(m_midiManager, SIGNAL(contrastValueChanged(int)), m_master, SLOT(contrastChanged(int))); 65 | connect(m_midiManager, SIGNAL(desaturateValueChanged(int)), m_master, SLOT(desaturateChanged(int))); 66 | connect(m_midiManager, SIGNAL(blackFadeValueChanged(int)), m_master, SLOT(blackFadeChanged(int))); 67 | connect(m_midiManager, SIGNAL(timeSpeedValueChanged(int)), m_master, SLOT(timeSpeedChanged(int))); 68 | connect(m_midiManager, SIGNAL(bassTimeSpeedValueChanged(int)), m_master, SLOT(bassTimeSpeedChanged(int))); 69 | 70 | connect(m_midiManager, SIGNAL(CC1Changed(int,float)), m_chan[0], SLOT(CCChanged(int,float))); 71 | connect(m_midiManager, SIGNAL(CC2Changed(int,float)), m_chan[1], SLOT(CCChanged(int,float))); 72 | 73 | connect(m_midiManager, SIGNAL(sceneUp()), m_chan[0], SLOT(sceneUp())); 74 | connect(m_midiManager, SIGNAL(sceneUp()), m_chan[1], SLOT(sceneUp())); 75 | connect(m_midiManager, SIGNAL(sceneDown()), m_chan[0], SLOT(sceneDown())); 76 | connect(m_midiManager, SIGNAL(sceneDown()), m_chan[1], SLOT(sceneDown())); 77 | 78 | connect(m_midiManager, SIGNAL(transitionUp()), m_master, SLOT(transitionUp())); 79 | connect(m_midiManager, SIGNAL(transitionDown()), m_master, SLOT(transitionDown())); 80 | 81 | connect(m_midiManager, SIGNAL(switchDisplay()), ui->widget, SLOT(transition())); 82 | 83 | 84 | Core::instance()->audioPipe->prepare(); 85 | Core::instance()->audioPipe->start();*/ 86 | } 87 | 88 | MainWindow::~MainWindow() 89 | { 90 | delete ui; 91 | } 92 | 93 | -------------------------------------------------------------------------------- /VisualLiveSystem/mainwindow.h: -------------------------------------------------------------------------------- 1 | #ifndef MAINWINDOW_H 2 | #define MAINWINDOW_H 3 | 4 | #include 5 | 6 | namespace Ui { 7 | class MainWindow; 8 | } 9 | 10 | class ChannelWidget; 11 | class MasterWidget; 12 | class VisualManager; 13 | class ProjectorWidget; 14 | class SoundManager; 15 | class MidiWindow; 16 | 17 | class MainWindow : public QMainWindow 18 | { 19 | Q_OBJECT 20 | 21 | public: 22 | explicit MainWindow(QWidget *parent = 0); 23 | ~MainWindow(); 24 | 25 | private: 26 | Ui::MainWindow *ui; 27 | ChannelWidget *m_chan[2]; 28 | VisualManager *m_visualManager; 29 | MasterWidget *m_master; 30 | ProjectorWidget *m_proj; 31 | SoundManager *m_soundManager; 32 | MidiWindow *m_midiManager; 33 | }; 34 | 35 | #endif // MAINWINDOW_H 36 | -------------------------------------------------------------------------------- /VisualLiveSystem/mainwindow.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | MainWindow 4 | 5 | 6 | 7 | 0 8 | 0 9 | 893 10 | 597 11 | 12 | 13 | 14 | Visual Live System 15 | 16 | 17 | 18 | :/res/img/vls.png:/res/img/vls.png 19 | 20 | 21 | 22 | 23 | 2 24 | 25 | 26 | 2 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 0 37 | 0 38 | 893 39 | 25 40 | 41 | 42 | 43 | 44 | File 45 | 46 | 47 | 48 | 49 | 50 | 51 | Window 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | toolBar 67 | 68 | 69 | TopToolBarArea 70 | 71 | 72 | false 73 | 74 | 75 | 76 | 77 | 78 | :/res/img/music.png:/res/img/music.png 79 | 80 | 81 | Sound manager 82 | 83 | 84 | 85 | 86 | 87 | :/res/img/micro.png:/res/img/micro.png 88 | 89 | 90 | Open micro record... 91 | 92 | 93 | 94 | 95 | Quit 96 | 97 | 98 | 99 | 100 | 101 | :/res/img/setting.png:/res/img/setting.png 102 | 103 | 104 | Preferences 105 | 106 | 107 | 108 | 109 | 110 | :/res/img/projector.png:/res/img/projector.png 111 | 112 | 113 | Projector 114 | 115 | 116 | 117 | 118 | 119 | :/res/img/setting_visual.png:/res/img/setting_visual.png 120 | 121 | 122 | Visual manager 123 | 124 | 125 | 126 | 127 | 128 | :/res/img/setting2.png:/res/img/setting2.png 129 | 130 | 131 | Controllers manager 132 | 133 | 134 | 135 | 136 | 137 | 138 | RenderWidget 139 | QWidget 140 |
renderwidget.h
141 | 1 142 |
143 |
144 | 145 | 146 | 147 | 148 |
149 | -------------------------------------------------------------------------------- /VisualLiveSystem/masterwidget.h: -------------------------------------------------------------------------------- 1 | #ifndef MASTERWIDGET_H 2 | #define MASTERWIDGET_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include "audiovisualizer.h" 8 | 9 | namespace Ui { 10 | class MasterWidget; 11 | } 12 | 13 | class MasterWidget : public QDockWidget 14 | { 15 | Q_OBJECT 16 | 17 | public: 18 | explicit MasterWidget(QGLWidget *share, QWidget *parent = 0); 19 | ~MasterWidget(); 20 | signals: 21 | void finalPostFXDataChanged(float,float,float,float,float,float,float); 22 | void transition(); 23 | 24 | public slots: 25 | void inLive(bool t); 26 | void gammaChanged(int v); 27 | void brightnessChanged(int v); 28 | void contrastChanged(int v); 29 | void desaturateChanged(int v); 30 | void blackFadeChanged(int v); 31 | void timeSpeedChanged(int v); 32 | void bassTimeSpeedChanged(int v); 33 | void transitionUp(); 34 | void transitionDown(); 35 | void Switch(); 36 | void updateInfo(); 37 | 38 | private slots: 39 | void postProcessingChanged(); 40 | void sliderChanged(); 41 | void transitionChanged(int n); 42 | void basscutOffChanged(int i); 43 | void pow2Changed(unsigned int p); 44 | 45 | private: 46 | Ui::MasterWidget *ui; 47 | AudioVisualizer *m_audiovisu; 48 | QTime m_timer; 49 | }; 50 | 51 | #endif // MASTERWIDGET_H 52 | -------------------------------------------------------------------------------- /VisualLiveSystem/midiwindow.h: -------------------------------------------------------------------------------- 1 | #ifndef MIDIWINDOW_H 2 | #define MIDIWINDOW_H 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #include "qmidisequencer.h" 9 | 10 | namespace Ui { 11 | class MidiWindow; 12 | } 13 | 14 | class MidiWindow : public QWidget 15 | { 16 | Q_OBJECT 17 | 18 | public: 19 | explicit MidiWindow(QWidget *parent = 0); 20 | ~MidiWindow(); 21 | 22 | private: 23 | void saveConf(); 24 | Ui::MidiWindow *ui; 25 | bool isLearning; 26 | 27 | QSpinBox* learningCC; 28 | QSpinBox* learningNote; 29 | QMidiSequencer *m_sequencer; 30 | 31 | public slots: 32 | void readConf(); 33 | void addProfil(); 34 | 35 | void getNewNoteValue(int channel, int note, int velocity); 36 | void getNewControllerValue(int ccId, int value); 37 | 38 | void learnTimeSpeedCC(); 39 | void learnBassTimeSpeedCC(); 40 | void learnGammaCC(); 41 | void learnBrightnessCC(); 42 | void learnContrastCC(); 43 | void learnDesaturateCC(); 44 | void learnBlackFade(); 45 | 46 | void learn1Effect1CC(); 47 | void learn1Effect2CC(); 48 | void learn1Effect3CC(); 49 | void learn1Effect4CC(); 50 | 51 | void learn2Effect1CC(); 52 | void learn2Effect2CC(); 53 | void learn2Effect3CC(); 54 | void learn2Effect4CC(); 55 | 56 | void learnSwitchDisplay(); 57 | void learnSceneUp(); 58 | void learnSceneDown(); 59 | void learnTransitionUp(); 60 | void learnTransitionDown(); 61 | 62 | void setProgressSpectrum(int); 63 | void setProgressGamma(int); 64 | void setProgressWhite(int); 65 | void setCloneFader(); 66 | 67 | void refreshHardware(); 68 | void newMidiSequencer(int id); 69 | 70 | signals: 71 | void timeSpeedValueChanged(int newValue); 72 | void bassTimeSpeedValueChanged(int newValue); 73 | void gammaValueChanged(int newValue); 74 | void brightnessValueChanged(int newValue); 75 | void contrastValueChanged(int newValue); 76 | void desaturateValueChanged(int newValue); 77 | void blackFadeValueChanged(int newValue); 78 | void CC1Changed(int a,float b); 79 | void CC2Changed(int a,float b); 80 | void switchDisplay(); 81 | void sceneUp(); 82 | void sceneDown(); 83 | void transitionUp(); 84 | void transitionDown(); 85 | 86 | }; 87 | 88 | #endif // MIDIWINDOW_H 89 | -------------------------------------------------------------------------------- /VisualLiveSystem/projectorwidget.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include "core.h" 5 | #include "fast2dquad.h" 6 | #include "projectorwidget.h" 7 | 8 | ProjectorWidget::ProjectorWidget(QGLWidget *share) : 9 | QGLWidget(NULL, share) 10 | { 11 | m_fullscreen = false; 12 | QTimer *timer = new QTimer(this); 13 | connect(timer, SIGNAL(timeout()), this, SLOT(updateGL())); 14 | timer->start(1); 15 | 16 | this->setWindowTitle("Projector"); 17 | this->setWindowIcon( QIcon(QString(":/res/img/projector.png")) ); 18 | } 19 | 20 | //----------------------------------------------------------------------------- 21 | // initializeGL 22 | //----------------------------------------------------------------------------- 23 | void ProjectorWidget::initializeGL() 24 | { 25 | 26 | } 27 | 28 | void ProjectorWidget::mouseDoubleClickEvent(QMouseEvent *event) 29 | { 30 | if(m_fullscreen) 31 | { 32 | this->setCursor( QCursor(Qt::ArrowCursor) ); 33 | showNormal(); 34 | } 35 | else 36 | { 37 | this->setCursor( QCursor(Qt::BlankCursor) ); 38 | showFullScreen(); 39 | } 40 | m_fullscreen=!m_fullscreen; 41 | } 42 | 43 | //----------------------------------------------------------------------------- 44 | // paintGL 45 | //----------------------------------------------------------------------------- 46 | void ProjectorWidget::paintGL() 47 | { 48 | if(Core::instance()->getFBOChan(Core::instance()->getCurrentChannel())) 49 | { 50 | glEnable(GL_TEXTURE_2D); 51 | glBindTexture(GL_TEXTURE_2D, Core::instance()->getFBOFinal()->getColor()); 52 | Fast2DQuadDraw(); 53 | glFinish(); 54 | } 55 | } 56 | 57 | //----------------------------------------------------------------------------- 58 | // resizeGL 59 | //----------------------------------------------------------------------------- 60 | void ProjectorWidget::resizeGL(int width, int height) 61 | { 62 | m_w = width; 63 | m_h = height; 64 | glViewport(0,0,m_w,m_h); 65 | } 66 | -------------------------------------------------------------------------------- /VisualLiveSystem/projectorwidget.h: -------------------------------------------------------------------------------- 1 | #ifndef PROJECTORWIDGET_H 2 | #define PROJECTORWIDGET_H 3 | 4 | 5 | #include 6 | #include 7 | #include 8 | 9 | #include "fbo.h" 10 | 11 | class ProjectorWidget : public QGLWidget 12 | { 13 | Q_OBJECT 14 | public: 15 | ProjectorWidget(QGLWidget *share); 16 | void initializeGL(); 17 | void paintGL(); 18 | void resizeGL(int width, int height); 19 | void mouseDoubleClickEvent(QMouseEvent *event); 20 | private: 21 | QTime m_timer; 22 | int m_w,m_h; 23 | bool m_fullscreen; 24 | }; 25 | 26 | #endif // PROJECTORWIDGET_H 27 | -------------------------------------------------------------------------------- /VisualLiveSystem/qdarkstyle/rc/Hmovetoolbar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XT95/VisualLiveSystem/e8b5b97718f294cf4d6fa001ff98e0e6d7cbcf74/VisualLiveSystem/qdarkstyle/rc/Hmovetoolbar.png -------------------------------------------------------------------------------- /VisualLiveSystem/qdarkstyle/rc/Hsepartoolbar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XT95/VisualLiveSystem/e8b5b97718f294cf4d6fa001ff98e0e6d7cbcf74/VisualLiveSystem/qdarkstyle/rc/Hsepartoolbar.png -------------------------------------------------------------------------------- /VisualLiveSystem/qdarkstyle/rc/Vmovetoolbar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XT95/VisualLiveSystem/e8b5b97718f294cf4d6fa001ff98e0e6d7cbcf74/VisualLiveSystem/qdarkstyle/rc/Vmovetoolbar.png -------------------------------------------------------------------------------- /VisualLiveSystem/qdarkstyle/rc/Vsepartoolbar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XT95/VisualLiveSystem/e8b5b97718f294cf4d6fa001ff98e0e6d7cbcf74/VisualLiveSystem/qdarkstyle/rc/Vsepartoolbar.png -------------------------------------------------------------------------------- /VisualLiveSystem/qdarkstyle/rc/branch_closed-on.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XT95/VisualLiveSystem/e8b5b97718f294cf4d6fa001ff98e0e6d7cbcf74/VisualLiveSystem/qdarkstyle/rc/branch_closed-on.png -------------------------------------------------------------------------------- /VisualLiveSystem/qdarkstyle/rc/branch_closed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XT95/VisualLiveSystem/e8b5b97718f294cf4d6fa001ff98e0e6d7cbcf74/VisualLiveSystem/qdarkstyle/rc/branch_closed.png -------------------------------------------------------------------------------- /VisualLiveSystem/qdarkstyle/rc/branch_open-on.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XT95/VisualLiveSystem/e8b5b97718f294cf4d6fa001ff98e0e6d7cbcf74/VisualLiveSystem/qdarkstyle/rc/branch_open-on.png -------------------------------------------------------------------------------- /VisualLiveSystem/qdarkstyle/rc/branch_open.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XT95/VisualLiveSystem/e8b5b97718f294cf4d6fa001ff98e0e6d7cbcf74/VisualLiveSystem/qdarkstyle/rc/branch_open.png -------------------------------------------------------------------------------- /VisualLiveSystem/qdarkstyle/rc/checkbox.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XT95/VisualLiveSystem/e8b5b97718f294cf4d6fa001ff98e0e6d7cbcf74/VisualLiveSystem/qdarkstyle/rc/checkbox.png -------------------------------------------------------------------------------- /VisualLiveSystem/qdarkstyle/rc/close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XT95/VisualLiveSystem/e8b5b97718f294cf4d6fa001ff98e0e6d7cbcf74/VisualLiveSystem/qdarkstyle/rc/close.png -------------------------------------------------------------------------------- /VisualLiveSystem/qdarkstyle/rc/down_arrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XT95/VisualLiveSystem/e8b5b97718f294cf4d6fa001ff98e0e6d7cbcf74/VisualLiveSystem/qdarkstyle/rc/down_arrow.png -------------------------------------------------------------------------------- /VisualLiveSystem/qdarkstyle/rc/down_arrow_disabled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XT95/VisualLiveSystem/e8b5b97718f294cf4d6fa001ff98e0e6d7cbcf74/VisualLiveSystem/qdarkstyle/rc/down_arrow_disabled.png -------------------------------------------------------------------------------- /VisualLiveSystem/qdarkstyle/rc/left_arrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XT95/VisualLiveSystem/e8b5b97718f294cf4d6fa001ff98e0e6d7cbcf74/VisualLiveSystem/qdarkstyle/rc/left_arrow.png -------------------------------------------------------------------------------- /VisualLiveSystem/qdarkstyle/rc/left_arrow_disabled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XT95/VisualLiveSystem/e8b5b97718f294cf4d6fa001ff98e0e6d7cbcf74/VisualLiveSystem/qdarkstyle/rc/left_arrow_disabled.png -------------------------------------------------------------------------------- /VisualLiveSystem/qdarkstyle/rc/right_arrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XT95/VisualLiveSystem/e8b5b97718f294cf4d6fa001ff98e0e6d7cbcf74/VisualLiveSystem/qdarkstyle/rc/right_arrow.png -------------------------------------------------------------------------------- /VisualLiveSystem/qdarkstyle/rc/right_arrow_disabled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XT95/VisualLiveSystem/e8b5b97718f294cf4d6fa001ff98e0e6d7cbcf74/VisualLiveSystem/qdarkstyle/rc/right_arrow_disabled.png -------------------------------------------------------------------------------- /VisualLiveSystem/qdarkstyle/rc/sizegrip.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XT95/VisualLiveSystem/e8b5b97718f294cf4d6fa001ff98e0e6d7cbcf74/VisualLiveSystem/qdarkstyle/rc/sizegrip.png -------------------------------------------------------------------------------- /VisualLiveSystem/qdarkstyle/rc/stylesheet-branch-end.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XT95/VisualLiveSystem/e8b5b97718f294cf4d6fa001ff98e0e6d7cbcf74/VisualLiveSystem/qdarkstyle/rc/stylesheet-branch-end.png -------------------------------------------------------------------------------- /VisualLiveSystem/qdarkstyle/rc/stylesheet-branch-more.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XT95/VisualLiveSystem/e8b5b97718f294cf4d6fa001ff98e0e6d7cbcf74/VisualLiveSystem/qdarkstyle/rc/stylesheet-branch-more.png -------------------------------------------------------------------------------- /VisualLiveSystem/qdarkstyle/rc/stylesheet-vline.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XT95/VisualLiveSystem/e8b5b97718f294cf4d6fa001ff98e0e6d7cbcf74/VisualLiveSystem/qdarkstyle/rc/stylesheet-vline.png -------------------------------------------------------------------------------- /VisualLiveSystem/qdarkstyle/rc/transparent.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XT95/VisualLiveSystem/e8b5b97718f294cf4d6fa001ff98e0e6d7cbcf74/VisualLiveSystem/qdarkstyle/rc/transparent.png -------------------------------------------------------------------------------- /VisualLiveSystem/qdarkstyle/rc/undock.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XT95/VisualLiveSystem/e8b5b97718f294cf4d6fa001ff98e0e6d7cbcf74/VisualLiveSystem/qdarkstyle/rc/undock.png -------------------------------------------------------------------------------- /VisualLiveSystem/qdarkstyle/rc/up_arrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XT95/VisualLiveSystem/e8b5b97718f294cf4d6fa001ff98e0e6d7cbcf74/VisualLiveSystem/qdarkstyle/rc/up_arrow.png -------------------------------------------------------------------------------- /VisualLiveSystem/qdarkstyle/rc/up_arrow_disabled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XT95/VisualLiveSystem/e8b5b97718f294cf4d6fa001ff98e0e6d7cbcf74/VisualLiveSystem/qdarkstyle/rc/up_arrow_disabled.png -------------------------------------------------------------------------------- /VisualLiveSystem/qdarkstyle/style.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | rc/up_arrow_disabled.png 4 | rc/Hmovetoolbar.png 5 | rc/stylesheet-branch-end.png 6 | rc/branch_closed-on.png 7 | rc/stylesheet-vline.png 8 | rc/branch_closed.png 9 | rc/branch_open-on.png 10 | rc/transparent.png 11 | rc/right_arrow_disabled.png 12 | rc/sizegrip.png 13 | rc/close.png 14 | rc/down_arrow.png 15 | rc/Vmovetoolbar.png 16 | rc/left_arrow.png 17 | rc/stylesheet-branch-more.png 18 | rc/up_arrow.png 19 | rc/right_arrow.png 20 | rc/left_arrow_disabled.png 21 | rc/Hsepartoolbar.png 22 | rc/checkbox.png 23 | rc/branch_open.png 24 | rc/Vsepartoolbar.png 25 | rc/down_arrow_disabled.png 26 | rc/undock.png 27 | 28 | 29 | style.qss 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /VisualLiveSystem/qmidisequencer.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "qmidisequencer.h" 4 | 5 | #include 6 | 7 | #define INPUT_BUFFER_SIZE 4096 8 | #define DRIVER_INFO NULL 9 | #define TIME_PROC ((int32_t (*)(void *)) Pt_Time) 10 | #define TIME_INFO NULL 11 | #define TIME_START Pt_Start(1, 0, 0) /* timer started w/millisecond accuracy */ 12 | 13 | QMidiSequencer::QMidiSequencer(QString clientName, int device, QObject *parent) : 14 | QThread(parent) 15 | {; 16 | TIME_START; 17 | Pm_OpenInput(&m_midi, 18 | device, 19 | DRIVER_INFO, 20 | INPUT_BUFFER_SIZE, 21 | TIME_PROC, 22 | TIME_INFO); 23 | //Pm_SetFilter(m_midi, PM_FILT_ACTIVE | PM_FILT_CLOCK | PM_FILT_SYSEX); 24 | } 25 | QMidiSequencer::~QMidiSequencer() 26 | { 27 | Pm_Close(m_midi); 28 | } 29 | 30 | void QMidiSequencer::run() 31 | { 32 | while(true) 33 | { 34 | if (Pm_Poll(m_midi) == TRUE) 35 | { 36 | int size = Pm_Read(m_midi,m_buffer, 256); 37 | for(int i=0; imsleep(10); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /VisualLiveSystem/qmidisequencer.h: -------------------------------------------------------------------------------- 1 | #ifndef QMIDISEQUENCER_H 2 | #define QMIDISEQUENCER_H 3 | 4 | 5 | #include 6 | #include 7 | #include 8 | 9 | class QMidiSequencer : public QThread 10 | { 11 | Q_OBJECT 12 | public: 13 | QMidiSequencer(QString clientName, int device, QObject* parent = 0); 14 | ~QMidiSequencer(); 15 | private: 16 | PmStream *m_midi; 17 | PmEvent m_buffer[256]; 18 | void run(); 19 | 20 | signals: 21 | void clientConnected(int clientId, int clientPort); 22 | void clientParted(int clientId, int clientPort); 23 | 24 | void controllerValueChanged(int ccId, int newValue); 25 | 26 | void noteOn(int channel, int note, int velocity); 27 | void noteOff(int channel, int note); 28 | 29 | public slots: 30 | 31 | }; 32 | 33 | #endif // QMIDISEQUENCER_H 34 | -------------------------------------------------------------------------------- /VisualLiveSystem/renderwidget.h: -------------------------------------------------------------------------------- 1 | #ifndef RENDERWIDGET_H 2 | #define RENDERWIDGET_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | #include "soundmanager.h" 11 | #include "fbo.h" 12 | #include "shader.h" 13 | #include "transition.h" 14 | 15 | class RenderWidget : public QGLWidget 16 | { 17 | Q_OBJECT 18 | 19 | public: 20 | RenderWidget(QWidget *parent = 0); 21 | ~RenderWidget(); 22 | 23 | public slots: 24 | void loadPostEffects( QList list ); 25 | void resolutionChanged(int x,int y); 26 | //void updateTextureSpectrumChannel2(fftw_complex *out); 27 | void updateFinalPostFXData(float black, float motion, float c, float g, float d, float b, float f); 28 | void transition(); 29 | 30 | protected: 31 | void updateTextureSpectrum(); 32 | virtual void initializeGL(); 33 | virtual void paintGL(); 34 | virtual void resizeGL(int width, int height); 35 | 36 | QTime m_timer; 37 | QTime m_time; 38 | QTime m_fpsTime; 39 | int m_w,m_h; 40 | 41 | Shader *m_postFX,*m_finalPostFX; 42 | int m_nbPostFX; 43 | FBO *m_rtt[2],*m_finalRtt; 44 | bool m_swap; 45 | 46 | float m_black,m_motionBlur,m_contrast,m_gamma,m_desaturate,m_brightness, m_fisheye; 47 | 48 | Transition *m_transition; 49 | }; 50 | 51 | #endif // RENDERWIDGET_H 52 | -------------------------------------------------------------------------------- /VisualLiveSystem/res.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | res/img/micro.png 4 | res/img/music.png 5 | res/img/new.png 6 | res/img/open.png 7 | res/img/save.png 8 | res/img/setting.png 9 | res/img/setting2.png 10 | res/img/setting_visual.png 11 | res/img/vls.png 12 | res/img/projector.png 13 | res/shaders/open.glsl 14 | res/shaders/postprocess.glsl 15 | res/shaders/audiovisualizer.glsl 16 | 17 | 18 | -------------------------------------------------------------------------------- /VisualLiveSystem/res/img/micro.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XT95/VisualLiveSystem/e8b5b97718f294cf4d6fa001ff98e0e6d7cbcf74/VisualLiveSystem/res/img/micro.png -------------------------------------------------------------------------------- /VisualLiveSystem/res/img/music.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XT95/VisualLiveSystem/e8b5b97718f294cf4d6fa001ff98e0e6d7cbcf74/VisualLiveSystem/res/img/music.png -------------------------------------------------------------------------------- /VisualLiveSystem/res/img/new.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XT95/VisualLiveSystem/e8b5b97718f294cf4d6fa001ff98e0e6d7cbcf74/VisualLiveSystem/res/img/new.png -------------------------------------------------------------------------------- /VisualLiveSystem/res/img/open.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XT95/VisualLiveSystem/e8b5b97718f294cf4d6fa001ff98e0e6d7cbcf74/VisualLiveSystem/res/img/open.png -------------------------------------------------------------------------------- /VisualLiveSystem/res/img/projector.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XT95/VisualLiveSystem/e8b5b97718f294cf4d6fa001ff98e0e6d7cbcf74/VisualLiveSystem/res/img/projector.png -------------------------------------------------------------------------------- /VisualLiveSystem/res/img/save.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XT95/VisualLiveSystem/e8b5b97718f294cf4d6fa001ff98e0e6d7cbcf74/VisualLiveSystem/res/img/save.png -------------------------------------------------------------------------------- /VisualLiveSystem/res/img/setting.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XT95/VisualLiveSystem/e8b5b97718f294cf4d6fa001ff98e0e6d7cbcf74/VisualLiveSystem/res/img/setting.png -------------------------------------------------------------------------------- /VisualLiveSystem/res/img/setting2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XT95/VisualLiveSystem/e8b5b97718f294cf4d6fa001ff98e0e6d7cbcf74/VisualLiveSystem/res/img/setting2.png -------------------------------------------------------------------------------- /VisualLiveSystem/res/img/setting_visual.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XT95/VisualLiveSystem/e8b5b97718f294cf4d6fa001ff98e0e6d7cbcf74/VisualLiveSystem/res/img/setting_visual.png -------------------------------------------------------------------------------- /VisualLiveSystem/res/img/vls.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XT95/VisualLiveSystem/e8b5b97718f294cf4d6fa001ff98e0e6d7cbcf74/VisualLiveSystem/res/img/vls.png -------------------------------------------------------------------------------- /VisualLiveSystem/res/logo.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XT95/VisualLiveSystem/e8b5b97718f294cf4d6fa001ff98e0e6d7cbcf74/VisualLiveSystem/res/logo.ico -------------------------------------------------------------------------------- /VisualLiveSystem/res/shaders/audiovisualizer.glsl: -------------------------------------------------------------------------------- 1 | varying vec2 v; 2 | uniform float bassCutoff; 3 | //uniform float time,bass,bassTime, 4 | uniform sampler1D spectrum; 5 | 6 | void main() 7 | { 8 | ///vec2 uv = abs(v); 9 | vec2 mv = v + vec2(1,1); //-> -1 1 to 0 2 10 | mv = mv*0.5; // -> 0 2 to 0 1 11 | float coord = mv.x*0.19; // -> 22100 Hz to 4200Hz 12 | 13 | //Attention normalisé pour pour FFT entre 0 et 1.0 SANS symétrie 14 | if((1 + 1.5*coord)*texture1D(spectrum, coord).x > mv.y ) { 15 | if (coord < bassCutoff) 16 | gl_FragColor = vec4(0.7+0.3*mv.y,(1.-mv.y)*.75,0.3,1.); 17 | else 18 | gl_FragColor = vec4(mv.y,(1.-mv.y)*.75,(1.-mv.y)*.1,1.); 19 | } 20 | else 21 | gl_FragColor = vec4(48.,47.,47.,255.)/255.; 22 | 23 | /* if( uv.x >.95 ) 24 | { 25 | 26 | if(bass > uv.y ) 27 | gl_FragColor = vec4(uv.y,(1.-uv.y)*.75,(1.-uv.y)*.1,1.); 28 | else 29 | gl_FragColor = vec4(48.,47.,47.,255.)/255.; 30 | }*/ 31 | } 32 | 33 | 34 | -------------------------------------------------------------------------------- /VisualLiveSystem/res/shaders/postprocess.glsl: -------------------------------------------------------------------------------- 1 | varying vec2 v; 2 | uniform sampler2D texture; 3 | uniform float white,black,motionBlur, 4 | gamma,contrast,desaturate,brightness, fisheye; 5 | 6 | void main() 7 | { 8 | vec2 tmp = gl_TexCoord[0].xy*2.-1.; 9 | vec2 uv = tmp; 10 | uv.x /= sqrt(sin((tmp.y * 0.5 + 0.5) * 3.14) * fisheye + 1.0); 11 | uv.y /= sqrt(sin((tmp.x * 0.5 + 0.5) * 3.14) * fisheye + 1.0); 12 | uv = uv * 0.5 + 0.5; 13 | 14 | 15 | vec3 col = texture2D(texture,uv); 16 | col = pow( col, vec3(gamma) ); 17 | vec3 gray = vec3(dot(col,vec3(0.33))); 18 | col *= 1.+brightness; 19 | col = mix(gray, col, 1.+contrast); 20 | col = mix( col, gray, desaturate ); 21 | 22 | gl_FragColor.rgb = col*(1.-black)+white; 23 | gl_FragColor.a = 1.-motionBlur; 24 | } 25 | -------------------------------------------------------------------------------- /VisualLiveSystem/ressource.rc: -------------------------------------------------------------------------------- 1 | IDI_ICON1 ICON DISCARDABLE "res/logo.ico" -------------------------------------------------------------------------------- /VisualLiveSystem/scene.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XT95/VisualLiveSystem/e8b5b97718f294cf4d6fa001ff98e0e6d7cbcf74/VisualLiveSystem/scene.cpp -------------------------------------------------------------------------------- /VisualLiveSystem/scene.h: -------------------------------------------------------------------------------- 1 | #ifndef SCENE_H 2 | #define SCENE_H 3 | 4 | #include "texture.h" 5 | #include "shader.h" 6 | #include "fbo.h" 7 | #include 8 | #include 9 | 10 | 11 | typedef enum {DEFAULT, BLEND_ALPHA, BLEND_ADD, NONE} Mode; 12 | typedef struct 13 | { 14 | Shader *shader; 15 | FBO *buffer, *backBuffer, *tmpBuffer; 16 | int width, height; 17 | Mode mode; 18 | QString name; 19 | Texture *channel[4]; 20 | QString channelName[4]; 21 | }Layer; 22 | 23 | 24 | //Structure décrivant une scene et permettant de les charger depuisun fichier 25 | class Scene 26 | { 27 | public: 28 | Scene(); 29 | ~Scene(); 30 | 31 | void read(const char *filename = NULL); // Must be call where we are an OGL context 32 | void resetTime(); 33 | void compute(); 34 | void draw(); 35 | 36 | void setChannel(int channel) { m_id = channel; } 37 | void setPreview(bool t); 38 | QString getParamName(int a) { return m_param[a]; } 39 | private: 40 | Layer *m_layer; 41 | int m_nbLayer; 42 | QString m_param[4]; 43 | 44 | QTime m_QTime; 45 | float m_time; 46 | int m_id; 47 | }; 48 | 49 | #endif // SCENE_H 50 | -------------------------------------------------------------------------------- /VisualLiveSystem/shader.cpp: -------------------------------------------------------------------------------- 1 | #include "shader.h" 2 | #include 3 | 4 | 5 | 6 | //----------------------------------------------------------------------------- 7 | // Constructor 8 | //----------------------------------------------------------------------------- 9 | Shader::Shader() 10 | { 11 | 12 | } 13 | //----------------------------------------------------------------------------- 14 | // Destructor 15 | //----------------------------------------------------------------------------- 16 | Shader::~Shader() 17 | { 18 | 19 | } 20 | 21 | //----------------------------------------------------------------------------- 22 | // enable/disable 23 | //----------------------------------------------------------------------------- 24 | void Shader::enable() 25 | { 26 | glUseProgramObjectARB(m_program); 27 | } 28 | void Shader::disable() 29 | { 30 | glUseProgramObjectARB(0); 31 | } 32 | 33 | 34 | //----------------------------------------------------------------------------- 35 | // send uniform 36 | //----------------------------------------------------------------------------- 37 | void Shader::sendi(const char *name, int x) 38 | { 39 | glUniform1i(glGetUniformLocation(m_program,name), x); 40 | } 41 | void Shader::sendf(const char *name, float x) 42 | { 43 | glUniform1f(glGetUniformLocation(m_program,name), x); 44 | } 45 | void Shader::sendf(const char *name, float x, float y) 46 | { 47 | glUniform2f(glGetUniformLocation(m_program,name), x,y); 48 | } 49 | void Shader::sendf(const char *name, float x, float y, float z) 50 | { 51 | glUniform3f(glGetUniformLocation(m_program,name), x,y,z); 52 | } 53 | void Shader::sendf(const char *name, float x, float y, float z, float w) 54 | { 55 | glUniform4f(glGetUniformLocation(m_program,name), x,y,z,w); 56 | } 57 | 58 | 59 | //----------------------------------------------------------------------------- 60 | // compil 61 | //----------------------------------------------------------------------------- 62 | int Shader::compil( const char *vertex, const char *fragment ) 63 | { 64 | m_program = glCreateProgramObjectARB(); 65 | if( !makeShader(vertex, GL_VERTEX_SHADER_ARB) ) 66 | { 67 | QMessageBox::critical(NULL, "Error", "Can't compil the vertex shader !"); 68 | return SHADER_VERTEX_ERROR; 69 | } 70 | if( !makeShader(fragment, GL_FRAGMENT_SHADER_ARB) ) 71 | { 72 | QMessageBox::critical(NULL, "Error", "Can't compil this pixel shader !"); 73 | return SHADER_FRAGMENT_ERROR; 74 | } 75 | 76 | glLinkProgram(m_program); 77 | 78 | return SHADER_SUCCESS; 79 | } 80 | 81 | bool Shader::makeShader(const char *txt, GLuint type) 82 | { 83 | GLuint object = glCreateShaderObjectARB(type); 84 | glShaderSource(object, 1, (const GLchar**)(&txt), NULL); 85 | glCompileShader(object); 86 | 87 | //Check 88 | GLint ok = false; 89 | glGetObjectParameterivARB(object, GL_OBJECT_COMPILE_STATUS_ARB, &ok); 90 | 91 | glAttachObjectARB(m_program, object); 92 | glDeleteObjectARB(object); 93 | 94 | return ok; 95 | } 96 | 97 | 98 | 99 | 100 | 101 | 102 | -------------------------------------------------------------------------------- /VisualLiveSystem/shader.h: -------------------------------------------------------------------------------- 1 | #ifndef DEF_SHADER 2 | #define DEF_SHADER 3 | 4 | 5 | #include 6 | 7 | #define SHADER_SUCCESS 1 8 | #define SHADER_VERTEX_ERROR 2 9 | #define SHADER_FRAGMENT_ERROR 3 10 | 11 | class Shader 12 | { 13 | public: 14 | Shader(); 15 | ~Shader(); 16 | 17 | int compil(const char *vertex, const char *fragment); 18 | 19 | void enable(); 20 | void disable(); 21 | 22 | void sendi(const char *name, int x); 23 | void sendf(const char *name, float x); 24 | void sendf(const char *name, float x, float y); 25 | void sendf(const char *name, float x, float y, float z); 26 | void sendf(const char *name, float x, float y, float z, float w); 27 | private: 28 | bool makeShader(const char *txt, GLuint type); 29 | GLuint m_program; 30 | }; 31 | 32 | 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /VisualLiveSystem/signal/audiopipe.hpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | Nom ......... : audiopipe.hpp 3 | Role ........ : Déclare une classe gérant le thread de calcul du son et les 4 | objets Signals 5 | Auteur ...... : Julien DE LOOR 6 | Version ..... : V1.0 olol 7 | Licence ..... : © Copydown™ 8 | ****************************************************************************/ 9 | 10 | #ifndef AUDIOPIPE_HPP 11 | #define AUDIOPIPE_HPP 12 | 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | 20 | #include "signal/signal.hpp" 21 | 22 | QString RtAudioApiToQString(RtAudio::Api api); 23 | RtAudio::Api QStringToRtAudioApi(const QString& api); 24 | 25 | class AudioPipe : public QThread 26 | { 27 | Q_OBJECT 28 | public: 29 | explicit AudioPipe(QObject *parent = 0); 30 | void setApi(RtAudio::Api api); //Ceci reset entièrement RtAudio avec l'API voulue renvoie 31 | //faux si c'est un echec, il n'y alors aucune API de chargée 32 | //L'AudioPipe passe en STOP ! 33 | 34 | bool setInputDeviceId(int id); //Change for this device next restart 35 | bool setOutputDeviceId(int id); //Change for this device 36 | void setMixer(AbstractStereoSignalMixer* mixer); //Mixer input/output 37 | 38 | 39 | //Relais RtAudio (inutile de passer en stop) 40 | inline RtAudio::Api getCurrentApi() { return _driver->getCurrentApi(); } 41 | inline unsigned int getDeviceCount() { return _driver->getDeviceCount(); } 42 | inline RtAudio::DeviceInfo getDeviceInfo(unsigned int device) { return _driver->getDeviceInfo(device); } 43 | 44 | inline QMutex& getMixerMutex() {return _mutexMixer;} 45 | 46 | 47 | 48 | signals: 49 | void inLive(bool); //Vrai si le driver est actif, faux sinon 50 | void critical_error(QString title, QString error); 51 | void computedLatency(unsigned int); 52 | 53 | public slots: 54 | void stop(); //Stop RtAudio et le thread de calcul, DOIT être appelé avant de modifier quelque chose 55 | //sur la configuration de l'OBJET 56 | void prepare(); 57 | 58 | void setLatenyTime(float sec); 59 | 60 | 61 | 62 | protected: 63 | //Thread de calcul (peut être lent) 64 | virtual void run(); 65 | 66 | private slots: 67 | void show_critical(QString caption, QString error); 68 | 69 | private: 70 | inline long getStreamLatency() { return _driver->getStreamLatency(); } 71 | 72 | std::vector _latencySignalsR; 73 | std::vector _latencySignalsL; 74 | int _latencyTimeBuffer; 75 | int _latencyCurrentBuffer; 76 | 77 | //Callback RtAudio (doit être le plus rapide possible) 78 | static int rtaudio_callback( void *outputBuffer, void *inputBuffer, unsigned int nBufferFrames, double streamTime, RtAudioStreamStatus status, void *data ); 79 | 80 | int _deviceOutId; //-1 = pas d'output 81 | int _deviceInId; //-1 = pas d'input 82 | RtAudio* _driver; //Driver Audio en dehors d'un appel à "setApi" _driver est toujours alloué 83 | AbstractStereoSignalMixer* _mixer; 84 | 85 | volatile bool _stopThread; //Signale au thread qu'il doit s'arreter 86 | 87 | Signal _leftOut; 88 | Signal _rightOut; 89 | Signal _leftIn; 90 | Signal _rightIn; 91 | 92 | QMutex _mutexIO; 93 | QMutex _mutexMixer; 94 | QWaitCondition _contidionIO; 95 | 96 | }; 97 | 98 | #endif // AUDIOPIPE_HPP 99 | -------------------------------------------------------------------------------- /VisualLiveSystem/signal/basserrorhandler.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "signal/basserrorhandler.hpp" 3 | 4 | std::string handleBassInitError() 5 | { 6 | switch (BASS_ErrorGetCode()) 7 | { 8 | case BASS_ERROR_DX: return "DirectX (or ALSA on Linux or OpenSL ES on Android) is not installed."; 9 | case BASS_ERROR_DEVICE: return "device is invalid."; 10 | case BASS_ERROR_ALREADY: return "The device has already been initialized. BASS_Free must be called before it can be initialized again."; 11 | case BASS_ERROR_DRIVER: return "There is no available device driver. The device may already be in use."; 12 | case BASS_ERROR_FORMAT: return "The specified format is not supported by the device. Try changing the freq and flags parameters."; 13 | case BASS_ERROR_MEM: return "There is insufficient memory."; 14 | case BASS_ERROR_NO3D: return "Could not initialize 3D support."; 15 | case BASS_ERROR_UNKNOWN: return "Some other mystery problem!"; 16 | default: return ""; 17 | } 18 | } 19 | 20 | std::string handleBassStreamCreateError() 21 | { 22 | switch (BASS_ErrorGetCode()) 23 | { 24 | case BASS_ERROR_INIT: return "BASS_Init has not been successfully called."; 25 | case BASS_ERROR_NOTAVAIL: return "Only decoding channels (BASS_STREAM_DECODE) are allowed when using the 'no sound' device. The BASS_STREAM_AUTOFREE flag is also unavailable to decoding channels."; 26 | case BASS_ERROR_FORMAT: return "The sample format is not supported by the device/drivers. If the stream is more than stereo or the BASS_SAMPLE_FLOAT flag is used, it could be that they are not supported."; 27 | case BASS_ERROR_SPEAKER: return "The specified SPEAKER flags are invalid. The device/drivers do not support them, they are attempting to assign a stereo stream to a mono speaker or 3D functionality is enabled."; 28 | case BASS_ERROR_MEM: return "There is insufficient memory."; 29 | case BASS_ERROR_NO3D: return "Could not initialize 3D support."; 30 | case BASS_ERROR_UNKNOWN: return "Some other mystery problem!"; 31 | default: return ""; 32 | } 33 | } 34 | 35 | std::string handleBassChannelPlayError() 36 | { 37 | switch (BASS_ErrorGetCode()) 38 | { 39 | case BASS_ERROR_HANDLE: return "handle is not a valid channel."; 40 | case BASS_ERROR_START: return "The output is paused/stopped, use BASS_Start to start it."; 41 | case BASS_ERROR_DECODE: return "The channel is not playable; it is a 'decoding channel'."; 42 | case BASS_ERROR_BUFLOST: return "Should not happen... check that a valid window handle was used with BASS_Init."; 43 | case BASS_ERROR_NOHW: return "No hardware voices are available (HCHANNEL only). This only occurs if the sample was loaded/created with the BASS_SAMPLE_VAM flag and BASS_VAM_HARDWARE is set in the sample's VAM mode, and there are no hardware voices available to play it."; 44 | default: return ""; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /VisualLiveSystem/signal/basserrorhandler.hpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include "signal/bass.h" 4 | 5 | #if defined(COMPILE_WINDOWS) 6 | #include 7 | std::string handleBassAsioInitError(); 8 | std::string handleBassAsioStartError(); 9 | #endif 10 | 11 | std::string handleBassInitError(); 12 | std::string handleBassStreamCreateError(); 13 | std::string handleBassChannelPlayError(); 14 | -------------------------------------------------------------------------------- /VisualLiveSystem/signal/bassflac.h: -------------------------------------------------------------------------------- 1 | /* 2 | BASSFLAC 2.4 C/C++ header file 3 | Copyright (c) 2004-2013 Un4seen Developments Ltd. 4 | 5 | See the BASSFLAC.CHM file for more detailed documentation 6 | */ 7 | 8 | #ifndef BASSFLAC_H 9 | #define BASSFLAC_H 10 | 11 | #include "bass.h" 12 | 13 | #if BASSVERSION!=0x204 14 | #error conflicting BASS and BASSFLAC versions 15 | #endif 16 | 17 | #ifdef __cplusplus 18 | extern "C" { 19 | #endif 20 | 21 | #ifndef BASSFLACDEF 22 | #define BASSFLACDEF(f) WINAPI f 23 | #endif 24 | 25 | // BASS_CHANNELINFO type 26 | #define BASS_CTYPE_STREAM_FLAC 0x10900 27 | #define BASS_CTYPE_STREAM_FLAC_OGG 0x10901 28 | 29 | // Additional tag types 30 | #define BASS_TAG_FLAC_CUE 12 // cuesheet : TAG_FLAC_CUE structure 31 | #define BASS_TAG_FLAC_PICTURE 0x12000 // + index #, picture : TAG_FLAC_PICTURE structure 32 | 33 | typedef struct { 34 | DWORD apic; // ID3v2 "APIC" picture type 35 | const char *mime; // mime type 36 | const char *desc; // description 37 | DWORD width; 38 | DWORD height; 39 | DWORD depth; 40 | DWORD colors; 41 | DWORD length; // data length 42 | const void *data; 43 | } TAG_FLAC_PICTURE; 44 | 45 | typedef struct { 46 | QWORD offset; // index offset relative to track offset (samples) 47 | DWORD number; // index number 48 | } TAG_FLAC_CUE_TRACK_INDEX; 49 | 50 | typedef struct { 51 | QWORD offset; // track offset (samples) 52 | DWORD number; // track number 53 | const char *isrc; // ISRC 54 | DWORD flags; 55 | DWORD nindexes; // number of indexes 56 | const TAG_FLAC_CUE_TRACK_INDEX *indexes; // the indexes 57 | } TAG_FLAC_CUE_TRACK; 58 | 59 | typedef struct { 60 | const char *catalog; // media catalog number 61 | DWORD leadin; // lead-in (samples) 62 | BOOL iscd; // a CD? 63 | DWORD ntracks; // number of tracks 64 | const TAG_FLAC_CUE_TRACK *tracks; // the tracks 65 | } TAG_FLAC_CUE; 66 | 67 | // TAG_FLAC_CUE_TRACK flags 68 | #define TAG_FLAC_CUE_TRACK_DATA 1 // data track 69 | #define TAG_FLAC_CUE_TRACK_PRE 2 // pre-emphasis 70 | 71 | HSTREAM BASSFLACDEF(BASS_FLAC_StreamCreateFile)(BOOL mem, const void *file, QWORD offset, QWORD length, DWORD flags); 72 | HSTREAM BASSFLACDEF(BASS_FLAC_StreamCreateURL)(const char *url, DWORD offset, DWORD flags, DOWNLOADPROC *proc, void *user); 73 | HSTREAM BASSFLACDEF(BASS_FLAC_StreamCreateFileUser)(DWORD system, DWORD flags, const BASS_FILEPROCS *procs, void *user); 74 | 75 | #ifdef __cplusplus 76 | } 77 | 78 | #ifdef _WIN32 79 | static inline HSTREAM BASS_FLAC_StreamCreateFile(BOOL mem, const WCHAR *file, QWORD offset, QWORD length, DWORD flags) 80 | { 81 | return BASS_FLAC_StreamCreateFile(mem, (const void*)file, offset, length, flags|BASS_UNICODE); 82 | } 83 | 84 | static inline HSTREAM BASS_FLAC_StreamCreateURL(const WCHAR *url, DWORD offset, DWORD flags, DOWNLOADPROC *proc, void *user) 85 | { 86 | return BASS_FLAC_StreamCreateURL((const char*)url, offset, flags|BASS_UNICODE, proc, user); 87 | } 88 | #endif 89 | #endif 90 | 91 | #endif 92 | -------------------------------------------------------------------------------- /VisualLiveSystem/signal/decoder.cpp: -------------------------------------------------------------------------------- 1 | #include "signal/decoder.hpp" 2 | #include "signal/basserrorhandler.hpp" 3 | 4 | #include 5 | 6 | #include 7 | 8 | BassDecoder::BassDecoder(QObject* parent): 9 | Decoder(parent), 10 | _music(0), 11 | _mod(false), 12 | _ended(true), 13 | _bytesStep(0), 14 | _samplesForSignals(0) 15 | { 16 | if (!BASS_Init(0,Signal::frequency,0,0,0)) 17 | { 18 | std::cerr << "error : " << handleBassInitError() << std::endl; 19 | QMessageBox::critical(0,QString("BASS Error"),QString::fromStdString(handleBassInitError()),QMessageBox::Ok,QMessageBox::Ok); 20 | exit(0xdead); 21 | } 22 | } 23 | 24 | BassDecoder::~BassDecoder() 25 | { 26 | reset(); 27 | 28 | if (_music) 29 | { 30 | if (_mod) BASS_MusicFree((HMUSIC) _music); 31 | else BASS_StreamFree((HSTREAM) _music); 32 | } 33 | if (_samplesForSignals) 34 | free(_samplesForSignals); 35 | BASS_Free(); 36 | } 37 | 38 | void BassDecoder::reset() 39 | { 40 | if (_music) { 41 | if (_mod) BASS_MusicFree((HMUSIC) _music); 42 | else BASS_StreamFree((HSTREAM) _music); 43 | _music = 0; 44 | } 45 | _ended=true; 46 | } 47 | 48 | bool BassDecoder::open(QString filename) 49 | { 50 | reset(); 51 | if (_music=(HANDLE)BASS_MusicLoad(FALSE, (void*) filename.toStdString().c_str(), 0,0,BASS_MUSIC_PRESCAN | BASS_MUSIC_DECODE | BASS_SAMPLE_FLOAT,Signal::frequency)) 52 | { 53 | _mod=true; 54 | } 55 | else if (_music=(HANDLE)BASS_StreamCreateFile(FALSE, (void*) filename.toStdString().c_str(), 0,0,BASS_STREAM_PRESCAN |BASS_STREAM_DECODE | BASS_SAMPLE_FLOAT)) 56 | { 57 | _mod=false; 58 | } 59 | else if (_music=(HANDLE)BASS_FLAC_StreamCreateFile(FALSE, (void*) filename.toStdString().c_str(), 0,0,BASS_STREAM_PRESCAN | BASS_STREAM_DECODE | BASS_SAMPLE_FLOAT)) 60 | { 61 | _mod=false; 62 | } 63 | else if (_music=(HANDLE)BASS_StreamCreateURL(filename.toStdString().c_str(),0,BASS_STREAM_DECODE | BASS_SAMPLE_FLOAT, (DOWNLOADPROC*) 0,(void*)0)) 64 | { 65 | _mod=false; 66 | } 67 | else if (_music=(HANDLE)BASS_FLAC_StreamCreateURL(filename.toStdString().c_str(),0,BASS_STREAM_DECODE | BASS_SAMPLE_FLOAT, (DOWNLOADPROC*) 0,(void*)0)) 68 | { 69 | _mod=false; 70 | } 71 | if (_music) 72 | { 73 | BASS_ChannelGetInfo((DWORD)_music,&_infos); 74 | _bytesStep= sizeof(float)*Signal::size*_infos.chans; 75 | _samplesForSignals = (float*) realloc(_samplesForSignals,_bytesStep); 76 | if (_infos.freq != Signal::frequency) 77 | std::cout << "warning : file rate (" << _infos.freq << "Hz) is different of " << Signal::frequency << "Hz" << std::endl; 78 | _ended=false; 79 | } 80 | 81 | return (_music); 82 | } 83 | 84 | unsigned int BassDecoder::nextFrame(Signal& left, Signal& right){ 85 | if (_music) 86 | { 87 | DWORD readed; 88 | BASS_ChannelGetInfo((DWORD)_music,&_infos); 89 | _bytesStep= sizeof(float)*Signal::size*_infos.chans; 90 | readed=BASS_ChannelGetData((DWORD)_music, (void*)_samplesForSignals, _bytesStep); 91 | 92 | if(readed==-1 && BASS_ErrorGetCode() == BASS_ERROR_ENDED) { 93 | left.reset(); 94 | right.reset(); 95 | _ended=true; 96 | emit trackFinished(); 97 | return 0; 98 | } 99 | 100 | if (readed < _bytesStep) 101 | { 102 | for (unsigned int i=readed; i< _bytesStep ;i++) 103 | ((char*)_samplesForSignals)[i]=0; 104 | } 105 | if (_infos.chans>=2) 106 | { 107 | unsigned int k=0; 108 | for (unsigned int i=0; i < Signal::size;) 109 | { 110 | left.samples[i]=_samplesForSignals[k++]; 111 | right.samples[i++]=_samplesForSignals[k++]; 112 | k+=_infos.chans-2; 113 | } 114 | } 115 | else if (_infos.chans==1) //mono 116 | { 117 | unsigned int k=0; 118 | for (unsigned int i=0; i < Signal::size;) 119 | { 120 | left.samples[i]=_samplesForSignals[k]; 121 | right.samples[i++]=_samplesForSignals[k++]; 122 | } 123 | } 124 | return readed; 125 | } 126 | return 0; 127 | } 128 | 129 | 130 | void BassDecoder::rewind() 131 | { 132 | if (_music) 133 | { 134 | if (_mod) 135 | { 136 | BASS_ChannelSetPosition((DWORD) _music,0,BASS_MUSIC_POSRESETEX|BASS_MUSIC_POSRESET); 137 | } 138 | else 139 | BASS_ChannelSetPosition((DWORD) _music,0,0); 140 | _ended=false; 141 | } 142 | } 143 | 144 | unsigned int BassDecoder::frames() 145 | { 146 | if (_music) 147 | { 148 | rewind(); 149 | unsigned int frames=1; 150 | Signal left,right; 151 | DWORD ret; 152 | while ((ret=BASS_ChannelGetData((DWORD)_music, (void*)_samplesForSignals, _bytesStep)) == _bytesStep) { 153 | if (ret==-1 && BASS_ErrorGetCode() == BASS_ERROR_ENDED) 154 | break; 155 | frames++; 156 | if (frames>108000) break; 157 | } 158 | rewind(); 159 | return frames; 160 | } 161 | return 0; 162 | } 163 | 164 | 165 | PlaylistMixer::PlaylistMixer(Decoder& decoder): 166 | _decoder(&decoder) 167 | { 168 | 169 | } 170 | 171 | void PlaylistMixer::step(const Signal& inleft, const Signal& inright, Signal& outleft, Signal& outright) 172 | { 173 | if (!_decoder->nextFrame(outleft,outright)) 174 | { 175 | outleft = inleft; 176 | outright = inright; 177 | } 178 | else { 179 | outleft.add(&inleft); 180 | outright.add(&inright); 181 | } 182 | outleft.saturate(-1,1); 183 | outright.saturate(-1,1); 184 | } 185 | -------------------------------------------------------------------------------- /VisualLiveSystem/signal/decoder.hpp: -------------------------------------------------------------------------------- 1 | 2 | 3 | #ifndef DECODER___ 4 | #define DECODER___ 5 | 6 | #include "signal/signal.hpp" 7 | #include 8 | #include 9 | 10 | class Decoder : public QObject 11 | { 12 | Q_OBJECT 13 | 14 | public: 15 | Decoder(QObject* parent) : 16 | QObject(parent) 17 | { 18 | } 19 | 20 | virtual ~Decoder() { 21 | } 22 | 23 | virtual unsigned int frames() = 0; 24 | inline virtual QString name() { return ""; } 25 | inline virtual QString artist() { return ""; } 26 | inline virtual QString album() { return ""; } 27 | inline virtual QString gene() { return ""; } 28 | virtual unsigned int nextFrame(Signal& left, Signal& right)=0; 29 | virtual bool ended() = 0; 30 | 31 | public slots: 32 | virtual bool open(QString filename)=0; 33 | virtual void rewind() = 0; 34 | signals: 35 | void trackFinished(); 36 | 37 | }; 38 | 39 | #include "signal/bass.h" 40 | #include "signal/bassflac.h" 41 | 42 | class BassDecoder : public Decoder 43 | { 44 | Q_OBJECT 45 | 46 | public: 47 | BassDecoder(QObject* parent=0); 48 | virtual ~BassDecoder(); 49 | 50 | inline virtual bool ended() {return _ended;} 51 | virtual unsigned int frames(); 52 | virtual unsigned int nextFrame(Signal& left, Signal& right); 53 | 54 | public slots: 55 | virtual bool open(QString filename); 56 | virtual void rewind(); 57 | void reset(); 58 | 59 | 60 | protected: 61 | HANDLE _music; 62 | bool _mod; 63 | bool _ended; 64 | BASS_CHANNELINFO _infos; 65 | unsigned _bytesStep; 66 | float* _samplesForSignals; 67 | 68 | }; 69 | 70 | class PlaylistMixer : public QObject, public AbstractStereoSignalMixer 71 | { 72 | Q_OBJECT 73 | public: 74 | PlaylistMixer(Decoder& decoder); 75 | virtual void step(const Signal& inleft, const Signal& inright, Signal& outleft, Signal& outright); 76 | 77 | private: 78 | Decoder* _decoder; 79 | }; 80 | 81 | 82 | #endif 83 | -------------------------------------------------------------------------------- /VisualLiveSystem/signal/fft.hpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | Nom ......... : fft.hpp 3 | Role ........ : Déclare une classe permettant de faire une transformé de 4 | fourrier continue... 5 | Auteur ...... : Kwon-Young CHOI & Julien DE LOOR 6 | Version ..... : V1.7 olol 7 | Licence ..... : © Copydown™ 8 | ****************************************************************************/ 9 | 10 | #ifndef __FASTFURIOUS8TRANSFORM 11 | #define __FASTFURIOUS8TRANSFORM 12 | 13 | #include "signal/signal.hpp" 14 | #include 15 | #include 16 | 17 | 18 | class FFT 19 | { 20 | public: 21 | FFT(unsigned int size); 22 | ~FFT(); 23 | 24 | inline unsigned int size() { 25 | return _size; 26 | } 27 | 28 | //get nearest inferior power of 2 29 | static unsigned short getInfPow2(unsigned int v); 30 | 31 | //get nearest superior power of 2 32 | static unsigned short getSupPow2(unsigned int v); 33 | 34 | //push signal and compute when have enough samples 35 | void pushSignal(const Signal &s); 36 | 37 | 38 | //Direct immediate compute from samples (with truncate or zero padding...) 39 | void compute(const sample* s, unsigned int size); 40 | void compute(const Signal &s); 41 | 42 | //Realloc 43 | void realloc(unsigned int size); 44 | 45 | inline sample* getReal() { 46 | return _real; 47 | } 48 | inline sample* getImaginary() { 49 | return _imaginary; 50 | } 51 | 52 | inline sample* getModule() { 53 | return _module; 54 | } 55 | 56 | //Compute module if needed ! 57 | void computeModule(); 58 | 59 | QMutex mutex; 60 | 61 | private: 62 | sample* _input; //Real input buffer; 63 | sample* _real; 64 | sample* _imaginary; 65 | sample* _module; 66 | unsigned int* _indexTable; 67 | sample* _twidleFactor; 68 | sample* _twidleFactorI; 69 | unsigned int _size; 70 | unsigned int _inputOffset; 71 | unsigned short _pow2; 72 | 73 | 74 | }; 75 | 76 | 77 | #endif 78 | 79 | -------------------------------------------------------------------------------- /VisualLiveSystem/signal/signal.hpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | Nom ......... : signal.hpp 3 | Role ........ : Déclare une classe gérant une unité de son (classe Signal) 4 | Ainsi que des modeles abstrait pour le générer ce son... 5 | Auteur ...... : Julien DE LOOR 6 | Version ..... : V1.0 olol 7 | Licence ..... : © Copydown™ 8 | ****************************************************************************/ 9 | 10 | #ifndef __SIGNAL 11 | #define __SIGNAL 12 | 13 | #include 14 | #include //old malloc 15 | #include //memset 16 | #include 17 | #include 18 | 19 | typedef float sample; //type pour un echantillon 20 | 21 | class Signal 22 | { 23 | public: 24 | Signal(); 25 | Signal(const Signal& s); 26 | virtual ~Signal(); 27 | 28 | //Signal take care of allocation of this 29 | sample* samples; 30 | 31 | void mix(const Signal*, unsigned int n=1); 32 | void add(const Signal*, unsigned int n=1); 33 | void addOffset(sample offset); 34 | void scale(sample scale); 35 | void constant(sample constant); 36 | void saturate(sample min, sample max); 37 | sample energy(); 38 | inline double power() { 39 | return energy()/(sample)Signal::size; 40 | } 41 | 42 | sample level(); 43 | void normalize(sample coeff); 44 | void normalize(); 45 | 46 | void tfd(Signal& out_tfd); 47 | 48 | inline void reset() 49 | { 50 | memset((void*) samples,0,Signal::byteSize); 51 | } 52 | 53 | 54 | Signal& operator=(const Signal&); 55 | 56 | //Constants for all signals 57 | volatile static unsigned int frequency; //Fe 58 | volatile static float refreshRate; //Le but c'est d'avoir 50 ici ! le plus possible sera le mieux 59 | volatile static unsigned int size; 60 | volatile static unsigned int byteSize; 61 | volatile static bool isPow2; 62 | 63 | // /!\ Signal::refreshRate n'est qu'une valeur indicative ! 64 | 65 | 66 | //be sure to lock ALL instances of Signals before do theses 67 | static void globalConfigurationFromFramerate( unsigned int f, float r); 68 | static void globalConfigurationFromPow2(unsigned int f, unsigned short pow2); 69 | 70 | private: 71 | void _reset(); 72 | static std::set _instances; 73 | 74 | }; 75 | 76 | class AbstractSignalModifier 77 | { 78 | public: 79 | virtual ~AbstractSignalModifier() {} 80 | virtual void step(Signal* inout) = 0; 81 | }; 82 | 83 | class AbstractStereoSignalMixer 84 | { 85 | public: 86 | virtual ~AbstractStereoSignalMixer() {} 87 | virtual void step(const Signal& inleft, const Signal& inright, Signal& outleft, Signal& outright) = 0; 88 | }; 89 | 90 | class AbstractSignalGenerator : public AbstractSignalModifier 91 | { 92 | public: 93 | AbstractSignalGenerator() : _time(0) {} 94 | virtual ~AbstractSignalGenerator() {} 95 | 96 | virtual void step(Signal* output) = 0; 97 | 98 | inline Signal* generate() 99 | { 100 | this->step(&_output); 101 | return &_output; 102 | } 103 | 104 | virtual inline void resetTime() 105 | { 106 | _time=0; 107 | } 108 | 109 | protected: 110 | Signal _output; 111 | unsigned int _time; //in (1/fe) secondes 112 | }; 113 | 114 | class VisualSignal 115 | { 116 | public: 117 | VisualSignal(); 118 | virtual ~VisualSignal(); 119 | 120 | void update(const Signal& signal); 121 | 122 | int noise; 123 | int clean; 124 | int distord; 125 | int linear; 126 | int triangles; 127 | 128 | protected: 129 | int samples[1024]; //samples scaled from 0 to 100 130 | int previous; 131 | int previous2; 132 | int dprevious; 133 | int dprevious2; 134 | }; 135 | 136 | 137 | #endif 138 | -------------------------------------------------------------------------------- /VisualLiveSystem/soundmanager.h: -------------------------------------------------------------------------------- 1 | #ifndef SOUNDMANAGER_H 2 | #define SOUNDMANAGER_H 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | #include 14 | #include "FFTAnalyzer.h" 15 | 16 | #include "signal/audiopipe.hpp" 17 | #include 18 | 19 | #include 20 | 21 | namespace Ui { 22 | class SoundManager; 23 | } 24 | 25 | class PlaylistWidget : public QListWidget 26 | { 27 | Q_OBJECT 28 | public: 29 | PlaylistWidget(QWidget* parent=0); 30 | 31 | protected: 32 | virtual bool dropMimeData(int index,const QMimeData* data, Qt::DropAction action ); 33 | virtual QStringList mimeTypes() const; 34 | 35 | 36 | }; 37 | 38 | 39 | class SoundManager : public QWidget 40 | { 41 | Q_OBJECT 42 | public: 43 | explicit SoundManager(AudioPipe& pipe, QWidget *parent = 0); 44 | ~SoundManager(); 45 | 46 | void setAudioPipe(AudioPipe& pipe); 47 | void refreshApis(); 48 | 49 | public slots: 50 | void startRecord(); 51 | void apiChanged(QString api); 52 | void ackApply(); 53 | void receivedLatency(unsigned int); 54 | void pow2SizeChanged(); 55 | 56 | private slots: 57 | void cancel(); 58 | void apply(); 59 | void ok(); 60 | void refreshDeviceList(); 61 | void enableMixer(bool e); 62 | void nextTrack(); 63 | void playTrack(); 64 | 65 | void audioThreadRunning(); 66 | void audioThreadStopped(); 67 | 68 | private: 69 | AudioPipe* _pipe; 70 | Ui::SoundManager *ui; 71 | QList _inputTable; 72 | QList _outputTable; 73 | 74 | }; 75 | 76 | #endif // SOUNDMANAGER_H 77 | -------------------------------------------------------------------------------- /VisualLiveSystem/texture.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include "texture.h" 9 | 10 | Texture::Texture() 11 | { 12 | m_id=-1; 13 | } 14 | Texture::~Texture() 15 | { 16 | glDeleteTextures( 1, &m_id ); 17 | } 18 | 19 | void Texture::bind() 20 | { 21 | glBindTexture(GL_TEXTURE_2D, m_id); 22 | } 23 | 24 | void Texture::load(const std::string &path) 25 | { 26 | if(m_id != -1) 27 | glDeleteTextures( 1, &m_id ); 28 | 29 | QImage t; 30 | QImage b; 31 | 32 | if( !b.load( path.c_str() ) ) 33 | { 34 | QMessageBox::critical(NULL, "Error", QString(QString("Can't load image ")+path.c_str()) ); 35 | } 36 | t = QGLWidget::convertToGLFormat( b ); 37 | 38 | 39 | glGenTextures( 1, &m_id ); 40 | glBindTexture( GL_TEXTURE_2D, m_id ); 41 | glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP_SGIS, GL_TRUE); 42 | glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_LINEAR); 43 | glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); 44 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); 45 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); 46 | glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, t.width(), t.height(), 0, GL_RGBA, GL_UNSIGNED_BYTE, t.bits() ); 47 | } 48 | -------------------------------------------------------------------------------- /VisualLiveSystem/texture.h: -------------------------------------------------------------------------------- 1 | #ifndef TEXTURE_H 2 | #define TEXTURE_H 3 | 4 | #include 5 | #include 6 | 7 | 8 | class Texture 9 | { 10 | public: 11 | Texture(); 12 | ~Texture(); 13 | 14 | void load(const std::string &path); 15 | virtual void bind(); 16 | private: 17 | GLuint m_id; 18 | }; 19 | 20 | #endif // TEXTURE_H 21 | -------------------------------------------------------------------------------- /VisualLiveSystem/transition.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include "core.h" 6 | #include "fast2dquad.h" 7 | #include "transition.h" 8 | 9 | Transition::Transition() 10 | { 11 | m_shader = NULL; 12 | m_backBuffer = NULL; 13 | m_time.restart(); 14 | 15 | m_totalTime = 1.f; 16 | m_switchTime = 0.f; 17 | m_switched = false; 18 | } 19 | 20 | Transition::~Transition() 21 | { 22 | if(m_backBuffer) 23 | delete m_backBuffer; 24 | if(m_shader) 25 | delete m_shader; 26 | } 27 | 28 | void Transition::read(const char *filename) 29 | { 30 | QString path = QString("./data/transitions/")+QString(filename)+QString("/"); 31 | 32 | //Parsing XML document. 33 | QDomDocument dom("config"); 34 | QFile xml_doc(path+"config.xml"); 35 | if(!xml_doc.open(QIODevice::ReadOnly)) 36 | { 37 | QMessageBox::warning(NULL, QString("Error"), QString("Can't open the file config.xml of ")+filename); 38 | return; 39 | } 40 | if (!dom.setContent(&xml_doc)) 41 | { 42 | xml_doc.close(); 43 | QMessageBox::warning(NULL, QString("Error"), QString("Can't parse : ")+filename); 44 | return; 45 | } 46 | QDomNode node = dom.documentElement().firstChild(); 47 | while(!node.isNull()) 48 | { 49 | QDomElement element = node.toElement(); 50 | 51 | if(element.tagName() == "time") 52 | { 53 | m_totalTime = element.attribute("total", "1").toFloat(); 54 | m_switchTime = element.attribute("switch", "0").toFloat(); 55 | } 56 | else if(element.tagName() == "pass") 57 | { 58 | //Compute shader 59 | QString filePath = element.attribute("value", "none"); 60 | int ok; 61 | if(filePath != "none") 62 | { 63 | QFile file(path+filePath); 64 | QString strings; 65 | if (file.open(QIODevice::ReadOnly | QIODevice::Text)) 66 | { 67 | QTextStream in(&file); 68 | while (!in.atEnd()) { 69 | strings += in.readLine()+"\n"; 70 | } 71 | } 72 | m_shader = new Shader(); 73 | ok = m_shader->compil(Core::instance()->getVertexShader(),strings.toStdString().c_str()); 74 | } 75 | 76 | 77 | //Generate buffers ! 78 | if(ok == SHADER_SUCCESS) 79 | { 80 | if(element.attribute("backbuffer", "false") == "true") 81 | { 82 | m_backBuffer = new FBO(); 83 | m_backBuffer->setSize(Core::instance()->getResX(), Core::instance()->getResY()); 84 | } 85 | } 86 | else 87 | { 88 | return; 89 | delete m_shader; 90 | } 91 | } 92 | node = node.nextSibling(); 93 | } 94 | } 95 | 96 | void Transition::start() 97 | { 98 | m_time.restart(); 99 | m_switched = false; 100 | } 101 | 102 | void Transition::draw() 103 | { 104 | float time = float(m_time.elapsed())/1000.f; 105 | 106 | glEnable(GL_TEXTURE_1D); 107 | if(time < m_totalTime) 108 | { 109 | m_shader->enable(); 110 | if(time < m_switchTime) 111 | { 112 | glActiveTexture(GL_TEXTURE0); 113 | glBindTexture(GL_TEXTURE_2D, Core::instance()->getFBOChan(Core::instance()->getCurrentChannel())->getColor()); 114 | m_shader->sendi("first",0); 115 | glActiveTexture(GL_TEXTURE1); 116 | glBindTexture(GL_TEXTURE_2D, Core::instance()->getFBOChan(!Core::instance()->getCurrentChannel())->getColor()); 117 | m_shader->sendi("second",1); 118 | } 119 | else 120 | { 121 | if(!m_switched) 122 | { 123 | m_switched = true; 124 | Core::instance()->Switch(); 125 | } 126 | glActiveTexture(GL_TEXTURE0); 127 | glBindTexture(GL_TEXTURE_2D, Core::instance()->getFBOChan(!Core::instance()->getCurrentChannel())->getColor()); 128 | m_shader->sendi("first",0); 129 | glActiveTexture(GL_TEXTURE1); 130 | glBindTexture(GL_TEXTURE_2D, Core::instance()->getFBOChan(Core::instance()->getCurrentChannel())->getColor()); 131 | m_shader->sendi("second",1); 132 | } 133 | 134 | glActiveTexture(GL_TEXTURE2); 135 | Core::instance()->bindTextureSpectrum(); 136 | m_shader->sendi("spectrum",2); 137 | 138 | m_shader->sendf("bass",Core::instance()->getBass()); 139 | m_shader->sendf("bassTime",Core::instance()->getBassTime()); 140 | m_shader->sendf("time",time); 141 | 142 | 143 | Fast2DQuadDraw(); 144 | 145 | glActiveTexture(GL_TEXTURE2); 146 | glBindTexture(GL_TEXTURE_1D, 0); 147 | glActiveTexture(GL_TEXTURE1); 148 | glBindTexture(GL_TEXTURE_2D, 0); 149 | glActiveTexture(GL_TEXTURE0); 150 | glBindTexture(GL_TEXTURE_2D, 0); 151 | 152 | m_shader->disable(); 153 | } 154 | else 155 | { 156 | glActiveTexture(GL_TEXTURE0); 157 | glBindTexture(GL_TEXTURE_2D, Core::instance()->getFBOChan(Core::instance()->getCurrentChannel())->getColor()); 158 | Fast2DQuadDraw(); 159 | } 160 | } 161 | -------------------------------------------------------------------------------- /VisualLiveSystem/transition.h: -------------------------------------------------------------------------------- 1 | #ifndef TRANSITION_H 2 | #define TRANSITION_H 3 | 4 | #include "texture.h" 5 | #include "shader.h" 6 | #include "fbo.h" 7 | #include 8 | #include 9 | 10 | class Transition 11 | { 12 | public: 13 | Transition(); 14 | ~Transition(); 15 | 16 | void read(const char *filename = NULL); // Must be call where we are an OGL context 17 | void start(); 18 | void draw(); 19 | 20 | private: 21 | Shader *m_shader; 22 | FBO *m_backBuffer; 23 | //Texture m_texture[4]; 24 | float m_totalTime,m_switchTime; 25 | QTime m_time; 26 | bool m_switched; 27 | }; 28 | 29 | 30 | #endif // TRANSITION_H 31 | -------------------------------------------------------------------------------- /VisualLiveSystem/visualmanager.cpp: -------------------------------------------------------------------------------- 1 | #include "visualmanager.h" 2 | #include "ui_visualmanager.h" 3 | #include "core.h" 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | 13 | VisualManager::VisualManager(QWidget *parent) : 14 | QWidget(parent), 15 | ui(new Ui::VisualManager) 16 | { 17 | ui->setupUi(this); 18 | 19 | 20 | getSceneList(); 21 | getPostFXList(); 22 | 23 | //Connections 24 | connect(ui->cancelButton, SIGNAL(clicked()), this, SLOT(hide())); 25 | connect(ui->applyButton, SIGNAL(clicked()), this, SLOT(apply())); 26 | connect(ui->okButton, SIGNAL(clicked()), this, SLOT(apply())); 27 | connect(ui->okButton, SIGNAL(clicked()), this, SLOT(hide())); 28 | connect(ui->deleteAButton, SIGNAL(clicked()), this, SLOT(delToA())); 29 | connect(ui->deleteBButton, SIGNAL(clicked()), this, SLOT(delToB())); 30 | connect(ui->deletePostButton, SIGNAL(clicked()), this, SLOT(delPost())); 31 | connect(ui->spinBox, SIGNAL(valueChanged(int)), this, SLOT(resolutionChanged())); 32 | connect(ui->spinBox_2, SIGNAL(valueChanged(int)), this, SLOT(resolutionChanged())); 33 | connect(ui->refreshScene, SIGNAL(clicked()), this, SLOT(getSceneList())); 34 | connect(ui->refreshPostFX, SIGNAL(clicked()), this, SLOT(getPostFXList())); 35 | } 36 | 37 | VisualManager::~VisualManager() 38 | { 39 | delete ui; 40 | } 41 | 42 | void VisualManager::resolutionChanged() 43 | { 44 | Core::instance()->setResolution( ui->spinBox->value(),ui->spinBox_2->value()); 45 | } 46 | 47 | void VisualManager::delToA() 48 | { 49 | delete ui->chanAList->currentItem() ; 50 | } 51 | 52 | 53 | void VisualManager::delToB() 54 | { 55 | delete ui->chanBList->currentItem() ; 56 | } 57 | 58 | void VisualManager::delPost() 59 | { 60 | delete ui->FXList->currentItem() ; 61 | } 62 | 63 | void VisualManager::getSceneList() 64 | { 65 | ui->sceneList->clear(); 66 | 67 | QDir dir("./data/scenes"); 68 | QStringList files = dir.entryList(); 69 | for(int i=0; isceneList->addItem(item); 76 | } 77 | } 78 | 79 | } 80 | 81 | void VisualManager::getPostFXList() 82 | { 83 | ui->postFXList->clear(); 84 | 85 | QDir dir("./data/postFX"); 86 | QStringList files = dir.entryList(); 87 | for(int i=0; ipostFXList->addItem(item); 94 | } 95 | } 96 | } 97 | 98 | void VisualManager::apply() 99 | { 100 | QList list; 101 | for(int i=0; ichanAList->count(); i++) 102 | { 103 | list.push_back(ui->chanAList->item(i)); 104 | } 105 | emit newListChanA(list); 106 | 107 | list.clear(); 108 | for(int i=0; ichanBList->count(); i++) 109 | { 110 | list.push_back(ui->chanBList->item(i)); 111 | } 112 | emit newListChanB(list); 113 | 114 | list.clear(); 115 | for(int i=0; iFXList->count(); i++) 116 | { 117 | list.push_back(ui->FXList->item(i)); 118 | } 119 | emit newListFX(list); 120 | 121 | Core::instance()->Switch(); 122 | if(Core::instance()->getCurrentChannel() != 0) 123 | Core::instance()->Switch(); 124 | } 125 | -------------------------------------------------------------------------------- /VisualLiveSystem/visualmanager.h: -------------------------------------------------------------------------------- 1 | #ifndef VISUALMANAGER_H 2 | #define VISUALMANAGER_H 3 | 4 | #include 5 | #include 6 | 7 | namespace Ui { 8 | class VisualManager; 9 | } 10 | 11 | class VisualManager : public QWidget 12 | { 13 | Q_OBJECT 14 | 15 | public: 16 | explicit VisualManager(QWidget *parent = 0); 17 | ~VisualManager(); 18 | 19 | signals: 20 | void newListChanA( QList list ); 21 | void newListChanB( QList list ); 22 | void newListFX( QList list ); 23 | 24 | 25 | private slots: 26 | void delToA(); 27 | void delToB(); 28 | void delPost(); 29 | void apply(); 30 | void resolutionChanged(); 31 | void getSceneList(); 32 | void getPostFXList(); 33 | 34 | private: 35 | Ui::VisualManager *ui; 36 | }; 37 | 38 | #endif // VISUALMANAGER_H 39 | -------------------------------------------------------------------------------- /release/data/config/midi/Akai LPD8.conf: -------------------------------------------------------------------------------- 1 | 252 1770 1830 1820 1760 1232 1239 1246 1253 1260 1267 1274 1281 0 -------------------------------------------------------------------------------- /release/data/config/midi/Akai MPK Mini.conf: -------------------------------------------------------------------------------- 1 | 48 1 2 3 4 5 6 7 8 9 10 11 12 1 -------------------------------------------------------------------------------- /release/data/postFX/Invert.glsl: -------------------------------------------------------------------------------- 1 | uniform sampler2D tex; 2 | uniform vec2 screen; 3 | void main(void) 4 | { 5 | gl_FragColor = vec4(1.)-texture2D(tex,gl_TexCoord[0].xy); 6 | } 7 | -------------------------------------------------------------------------------- /release/data/postFX/Vignetting.glsl: -------------------------------------------------------------------------------- 1 | uniform sampler2D tex; 2 | uniform vec2 screen; 3 | void main(void) 4 | { 5 | vec4 color = texture2D(tex,gl_TexCoord[0].xy); 6 | vec2 v = gl_TexCoord[0].xy*2.-1.; 7 | 8 | 9 | color *= clamp(pow(clamp(1.-length(v*v*v)*.75,0.,1.)*1.5, 1.5)*2.5,0.,1.); 10 | gl_FragColor = color; 11 | 12 | } 13 | -------------------------------------------------------------------------------- /release/data/postFX/green-pink blur.glsl: -------------------------------------------------------------------------------- 1 | uniform sampler2D tex; 2 | uniform vec2 screen; 3 | void main(void) 4 | { 5 | vec2 uv = (gl_TexCoord[0].xy-.5); 6 | vec2 offset = normalize(uv)*pow(length(uv),4.)/50.; 7 | vec2 offset2 = uv/70.; 8 | vec4 c = vec4(0.); 9 | for(int i=0; i<16; i++) 10 | { 11 | //RGB distortion 12 | c.r += texture2D(tex,gl_TexCoord[0].xy+offset*float(i)-offset2).r; 13 | c.g += texture2D(tex,gl_TexCoord[0].xy+offset*float(i)+offset2).g; 14 | c.b += texture2D(tex,gl_TexCoord[0].xy+offset*float(i)-offset2).b; 15 | } 16 | c /= 16.; 17 | gl_FragColor = c; 18 | gl_FragColor.a = 1.; 19 | } 20 | -------------------------------------------------------------------------------- /release/data/postFX/red-blue blur.glsl: -------------------------------------------------------------------------------- 1 | uniform sampler2D tex; 2 | uniform vec2 screen; 3 | void main(void) 4 | { 5 | vec2 uv = (gl_TexCoord[0].xy-.5); 6 | vec2 offset = normalize(uv)*pow(length(uv),4.)/50.; 7 | vec2 offset2 = uv/70.; 8 | vec4 c = vec4(0.); 9 | for(int i=0; i<16; i++) 10 | { 11 | //RGB distortion 12 | c.r += texture2D(tex,gl_TexCoord[0].xy+offset*float(i)+offset2).r; 13 | c.g += texture2D(tex,gl_TexCoord[0].xy+offset*float(i)).g; 14 | c.b += texture2D(tex,gl_TexCoord[0].xy+offset*float(i)-offset2).b; 15 | } 16 | c /= 16.; 17 | gl_FragColor = c; 18 | gl_FragColor.a = 1.; 19 | } 20 | -------------------------------------------------------------------------------- /release/data/postFX/vertical_minibar.glsl: -------------------------------------------------------------------------------- 1 | uniform sampler2D tex; 2 | uniform float bass; 3 | uniform vec2 screen; 4 | void main(void) 5 | { 6 | vec4 color = texture2D(tex,gl_TexCoord[0].xy); 7 | color += pow( texture2D(tex, gl_TexCoord[0].xy*vec2(1.,0.)).grba + texture2D(tex, gl_TexCoord[0].xy*vec2(1.,0.)+vec2(0.,1.)).bgra ,vec4(4.) )*30.*(.5+bass); 8 | gl_FragColor = color; 9 | 10 | } 11 | -------------------------------------------------------------------------------- /release/data/scenes/Open/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /release/data/scenes/Open/open.glsl: -------------------------------------------------------------------------------- 1 | 2 | varying vec2 v; 3 | uniform float time; 4 | uniform float noise_lvl; 5 | uniform float bass; 6 | 7 | const int rays_hits=9; 8 | const float epsilon=0.001; 9 | vec3 vertical=vec3(sin(0.8*time),1.0,0.0); 10 | 11 | vec3 sphere1=vec3(0.0,0.0+noise_lvl,-2.0); 12 | vec3 sphere2=vec3(0.0,sin(time),0.0); 13 | vec3 sphere3=vec3(1.0,1.0-bass*0.8,1.0); 14 | 15 | vec3 back(vec3 rd) 16 | { 17 | float s=pow(dot(rd,vertical),0.68);//Sky 18 | float f=dot(rd,-vertical);//floor 19 | vec3 sc=s*vec3(66.0/255.0,111.0/255.0,169.0/255.0); 20 | vec3 fc=f*vec3(185./255.,122./255.,87./255.); 21 | return max(sc,fc); 22 | } 23 | 24 | float sphere(vec3 ray, vec3 dir, vec3 center, float radius, float closed_hit, out vec3 normal) 25 | { 26 | vec3 rc = ray-center; 27 | float c = dot(rc, rc) - (radius*radius); 28 | float b = dot(dir, rc); 29 | float d = b*b - c; 30 | float t = -b - sqrt(abs(d)); 31 | if (d < 0.0 || t < 0.0 || t > closed_hit) 32 | return closed_hit; 33 | else { 34 | normal = center-(ray+dir*t); 35 | return t; 36 | } 37 | 38 | } 39 | 40 | float scene(vec3 ro, vec3 rd, out vec3 normal, float max_dist) 41 | { 42 | float dist=max_dist; 43 | dist=sphere(ro,rd,sphere1,0.7,dist,normal); 44 | dist=sphere(ro,rd,sphere2,0.5,dist,normal); 45 | dist=sphere(ro,rd,sphere3,0.88,dist,normal); 46 | return dist; 47 | } 48 | 49 | 50 | mat2 rotate2D(float a) 51 | { 52 | return mat2(cos(a), -sin(a), 53 | sin(a), cos(a)); 54 | } 55 | 56 | vec2 rotateY(vec2 v, float a) 57 | { 58 | return v*rotate2D(a); 59 | } 60 | 61 | void main() 62 | { 63 | vec3 light = vec3(0.0); // How much light hits the eye through the ray. 64 | vec3 transmit = vec3(1.0); // How much light the ray lets through. 65 | vec3 ro=vec3(3.0*cos(time),0.0,3.0*sin(time))+vertical; //origin 66 | vec2 vd=normalize(vec3(0.0,0.0,0.0) - ro).xz; //View direction 67 | float va=atan(vd.y,vd.x); 68 | vec2 r2d=rotateY(vec2(1.0,v.x),va); 69 | vec3 rd=normalize(vec3(r2d.x,v.y,r2d.y)); //direction 70 | 71 | for (int r=0;r < rays_hits; r++) 72 | { 73 | vec3 normal; 74 | float max_dist=1000.0; 75 | float dist=scene(ro,rd,normal,max_dist); 76 | if (dist < max_dist) 77 | { 78 | //Here modify ray transmition with transmit 79 | transmit*=0.9; 80 | ro += rd*dist; 81 | rd =reflect(rd,normalize(normal));//Here modify ray direction (mirror exemple) 82 | ro += rd*epsilon; //force undo collision 83 | } 84 | else { //Hit infinite (or default object) 85 | light += transmit*back(rd); //here background fonction 86 | break; 87 | } 88 | } 89 | gl_FragColor = vec4(light, 1.0); // Set pixel color to the amount of light seen. 90 | } -------------------------------------------------------------------------------- /release/data/textures/noise.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XT95/VisualLiveSystem/e8b5b97718f294cf4d6fa001ff98e0e6d7cbcf74/release/data/textures/noise.png -------------------------------------------------------------------------------- /release/data/textures/noise16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XT95/VisualLiveSystem/e8b5b97718f294cf4d6fa001ff98e0e6d7cbcf74/release/data/textures/noise16.png -------------------------------------------------------------------------------- /release/data/textures/noise256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XT95/VisualLiveSystem/e8b5b97718f294cf4d6fa001ff98e0e6d7cbcf74/release/data/textures/noise256.png -------------------------------------------------------------------------------- /release/data/textures/sky.tga.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XT95/VisualLiveSystem/e8b5b97718f294cf4d6fa001ff98e0e6d7cbcf74/release/data/textures/sky.tga.png -------------------------------------------------------------------------------- /release/data/textures/sprite.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XT95/VisualLiveSystem/e8b5b97718f294cf4d6fa001ff98e0e6d7cbcf74/release/data/textures/sprite.png -------------------------------------------------------------------------------- /release/data/textures/sprite2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XT95/VisualLiveSystem/e8b5b97718f294cf4d6fa001ff98e0e6d7cbcf74/release/data/textures/sprite2.png -------------------------------------------------------------------------------- /release/data/textures/water.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XT95/VisualLiveSystem/e8b5b97718f294cf4d6fa001ff98e0e6d7cbcf74/release/data/textures/water.png -------------------------------------------------------------------------------- /release/data/transitions/Black fade/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /release/data/transitions/Black fade/transition.glsl: -------------------------------------------------------------------------------- 1 | varying vec2 v; 2 | uniform sampler2D first,second; 3 | uniform sampler1D spectrum1, spectrum2; 4 | uniform float time; 5 | 6 | void main() 7 | { 8 | vec2 uv = v*.5+.5; 9 | vec3 col = texture2D(first,uv).rgb*max(1.-time*2.,0.); 10 | col += texture2D(second,uv).rgb*max((time)*2.-1.,0.); 11 | gl_FragColor = vec4(col, 1.); 12 | } 13 | -------------------------------------------------------------------------------- /release/data/transitions/Black flash/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /release/data/transitions/Black flash/transition.glsl: -------------------------------------------------------------------------------- 1 | varying vec2 v; 2 | uniform sampler2D first,second; 3 | uniform sampler1D spectrum1, spectrum2; 4 | uniform float time; 5 | 6 | void main() 7 | { 8 | vec2 uv = v*.5+.5; 9 | vec3 col = texture2D(second,uv).rgb*time; 10 | gl_FragColor = vec4(col, 1.); 11 | } 12 | -------------------------------------------------------------------------------- /release/data/transitions/Fade/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /release/data/transitions/Fade/transition.glsl: -------------------------------------------------------------------------------- 1 | varying vec2 v; 2 | uniform sampler2D first,second; 3 | uniform sampler1D spectrum1, spectrum2; 4 | uniform float time; 5 | 6 | void main() 7 | { 8 | vec2 uv = v*.5+.5; 9 | vec3 col = mix(texture2D(first,uv).rgb, texture2D(second,uv).rgb, time); 10 | gl_FragColor = vec4(col, time); 11 | } 12 | -------------------------------------------------------------------------------- /release/data/transitions/None/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /release/data/transitions/None/transition.glsl: -------------------------------------------------------------------------------- 1 | varying vec2 v; 2 | uniform sampler2D first,second; 3 | uniform sampler1D spectrum1, spectrum2; 4 | uniform float time; 5 | 6 | void main() 7 | { 8 | vec3 col = texture2D(second, v*vec2(.5,-.5)+.5).rgb*time; 9 | gl_FragColor = vec4(col, 1.); 10 | } -------------------------------------------------------------------------------- /release/data/transitions/Pyramid/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /release/data/transitions/Pyramid/transition.glsl: -------------------------------------------------------------------------------- 1 | varying vec2 v; 2 | uniform sampler2D first,second; 3 | uniform sampler1D spectrum1, spectrum2; 4 | uniform float time; 5 | 6 | void main() 7 | { 8 | vec2 uv = v*.5+.5; 9 | vec3 col = texture2D(first,uv).rgb; 10 | 11 | 12 | 13 | float t = time; 14 | 15 | 16 | if(t>3.) 17 | col = texture2D(second,uv).rgb + clamp((5.-t)*.5,0.,1.); 18 | 19 | if(uv.x3.) 27 | col = mix(col, texture2D(second,uv).rgb, (time-4.)); 28 | 29 | 30 | gl_FragColor = vec4(col, 1.); 31 | } 32 | -------------------------------------------------------------------------------- /release/data/transitions/White fade/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /release/data/transitions/White fade/transition.glsl: -------------------------------------------------------------------------------- 1 | varying vec2 v; 2 | uniform sampler2D first,second; 3 | uniform sampler1D spectrum1, spectrum2; 4 | uniform float time; 5 | 6 | void main() 7 | { 8 | vec2 uv = v*.5+.5; 9 | vec3 col = texture2D(first,uv).rgb + vec3(1.)*mix(0.,1.,time*2.); 10 | if(time>.6) 11 | col = texture2D(second,uv).rgb + vec3(1.)*mix(1.,0.,(time-.6)*2.5); 12 | gl_FragColor = vec4(col, 1.); 13 | } 14 | -------------------------------------------------------------------------------- /release/data/transitions/White flash/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /release/data/transitions/White flash/transition.glsl: -------------------------------------------------------------------------------- 1 | varying vec2 v; 2 | uniform sampler2D first,second; 3 | uniform sampler1D spectrum1, spectrum2; 4 | uniform float time; 5 | 6 | void main() 7 | { 8 | vec2 uv = v*.5+.5; 9 | vec3 col = texture2D(second,uv).rgb+vec3(1.-time); 10 | gl_FragColor = vec4(col, 1.); 11 | } 12 | -------------------------------------------------------------------------------- /release/settings.ini: -------------------------------------------------------------------------------- 1 | [Audio] 2 | DeviceInId=0 3 | DeviceOutId=0 4 | Driver=DirectSound 5 | 6 | [Signal] 7 | UseFramerateMethod=false 8 | RefreshRate=60 9 | Pow2Size=256 10 | --------------------------------------------------------------------------------