mirror of
https://github.com/JupiterBroadcasting/CasterSoundboard.git
synced 2025-10-29 11:36:26 +00:00
Fixing merge conflicts by accepting all incoming changes and ditching ours
This commit is contained in:
commit
57c5c224c7
1
.gitignore
vendored
1
.gitignore
vendored
@ -7,3 +7,4 @@
|
||||
|
||||
# Build directories
|
||||
build-CasterSoundboard-Desktop_Qt_5_8_0_GCC_64bit-Debug/
|
||||
build-CasterSoundboard-Desktop_Qt_5_8_0_clang_64bit-Debug/
|
||||
|
||||
30
.travis.yml
Normal file
30
.travis.yml
Normal file
@ -0,0 +1,30 @@
|
||||
language: cpp
|
||||
compiler: gcc
|
||||
sudo: require
|
||||
dist: trusty
|
||||
|
||||
before_install:
|
||||
- sudo add-apt-repository ppa:beineri/opt-qt593-trusty -y
|
||||
- sudo apt-get update -qq
|
||||
|
||||
install:
|
||||
- sudo apt-get -y install qt59base qt59declarative qt59multimedia libgl1-mesa-dev
|
||||
- source /opt/qt*/bin/qt*-env.sh
|
||||
|
||||
script:
|
||||
- cd ./CasterSoundboard/
|
||||
- qmake CONFIG+=release PREFIX=/usr
|
||||
- make -j$(nproc)
|
||||
- make INSTALL_ROOT=appdir -j$(nproc) install ; find appdir/
|
||||
- wget -c -nv "https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-x86_64.AppImage"
|
||||
- chmod a+x linuxdeployqt-continuous-x86_64.AppImage
|
||||
- ./linuxdeployqt-continuous-x86_64.AppImage appdir/usr/share/applications/*.desktop -appimage
|
||||
|
||||
after_success:
|
||||
- wget -c https://github.com/probonopd/uploadtool/raw/master/upload.sh
|
||||
- bash upload.sh Caster*.AppImage*
|
||||
|
||||
branches:
|
||||
except:
|
||||
- # Do not build tags that we create when we upload to GitHub Releases
|
||||
- /^(?i:continuous)/
|
||||
22
CONTRIBUTING.md
Normal file
22
CONTRIBUTING.md
Normal file
@ -0,0 +1,22 @@
|
||||
# How to Contribute to CasterSoundboard
|
||||
|
||||
CasterSoundboard is a volunteer-run project, built and maintained by many contributors. We welcome new team members, and value feedback from users using CastrerSoundboard.
|
||||
|
||||
The following is a set of guidelines for contributing to CasterSoundboard, which are hosted in the Jupiter Broadcasting Organization on GitHub. These are just guidelines, not rules. Use your best judgment, and feel free to propose changes to this document in a pull request.
|
||||
|
||||
### Reporting a Bug Report or Requesting a Feature
|
||||
We utilize a template to keep our issue tracker organized. Please fill it out and remove areas that are not related to your Bug Report or Feature Request. Also keep these guidelines in mind as well:
|
||||
|
||||
* Search before posing to avoid duplicates
|
||||
* Please keep the topic of the issue or feature request to **ONE** problem or request.
|
||||
* This will help our contributors keep the issues tracker organized.
|
||||
* Please fill out the areas of the template you are using. Delete the parts you are not using.
|
||||
* Make sure title is short but useful. It should echo the description.
|
||||
* `Add a "New Data not saved" confirmation` is a good example of a title.
|
||||
* Tell us how to reproduce the bug in clear, numbered steps.
|
||||
* If we can't reproduce your bug, we will have to ask more questions. Please answer promptly, otherwise your Bug Report may stall.
|
||||
* For Feature Requests, Ask yourself these questions before you post:
|
||||
* What are the advantages to having this Feature?
|
||||
* How will it benefit CasterSoundboard's work flow?
|
||||
* What will be the challenges to adding this feature?
|
||||
* Do you have any mockups or examples from other programs which implement this?
|
||||
8
CasterSoundboard/.gitignore
vendored
Normal file
8
CasterSoundboard/.gitignore
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
CasterSoundboard.pro.*
|
||||
.qmake.stash
|
||||
*.o
|
||||
CasterSoundboard
|
||||
*.app
|
||||
Makefile
|
||||
moc_*
|
||||
qrc_*
|
||||
@ -21,9 +21,11 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
#include "CSS.h"
|
||||
#include <math.h>
|
||||
#include <cmath>
|
||||
#include <QString>
|
||||
|
||||
using std::abs;
|
||||
|
||||
QString Generate_CSS(HSL_C hsl_color)
|
||||
{
|
||||
RGB_C rgb_color = RGB_C(0,0,0);
|
||||
@ -270,6 +272,7 @@ HSL_C::HSL_C(RGB_C rgb_color)
|
||||
h = 60 * ( ( r - g ) / d + 4.0 );
|
||||
break;
|
||||
default:
|
||||
h = 0.0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -27,6 +27,7 @@
|
||||
#include <QFile>
|
||||
#include <QDataStream>
|
||||
#include <QString>
|
||||
#include "libs/osc/composer/OscMessageComposer.h"
|
||||
|
||||
//Constructor=============================================
|
||||
CasterBoard::CasterBoard(QWidget* parent) : QWidget(parent)
|
||||
@ -37,703 +38,161 @@ CasterBoard::CasterBoard(QWidget* parent) : QWidget(parent)
|
||||
soundBoardName = new QString("No Name");
|
||||
profileFilePath = new QString("");
|
||||
|
||||
//WIDGETS
|
||||
player1 = new CasterPlayerWidget;
|
||||
player1->setHotKeyLetter("1");
|
||||
player2 = new CasterPlayerWidget;
|
||||
player2->setHotKeyLetter("2");
|
||||
player3 = new CasterPlayerWidget;
|
||||
player3->setHotKeyLetter("3");
|
||||
player4 = new CasterPlayerWidget;
|
||||
player4->setHotKeyLetter("4");
|
||||
player5 = new CasterPlayerWidget;
|
||||
player5->setHotKeyLetter("5");
|
||||
player6 = new CasterPlayerWidget;
|
||||
player6->setHotKeyLetter("6");
|
||||
player7 = new CasterPlayerWidget;
|
||||
player7->setHotKeyLetter("7");
|
||||
player8 = new CasterPlayerWidget;
|
||||
player8->setHotKeyLetter("8");
|
||||
// MAPs
|
||||
// int_to_player_key
|
||||
int_to_player_key = new QMap<int,QString>
|
||||
{
|
||||
{0, "1"},{1,"2"},{2,"3"},{3,"4"},{4,"5"},{5,"6"},{6,"7"},{7,"8"},
|
||||
{8, "Q"},{9,"W"},{10,"E"},{11,"R"},{12,"T"},{13,"Y"},{14,"U"},{15,"I"},
|
||||
{16,"A"},{17,"S"},{18,"D"},{19,"F"},{20,"G"},{21,"H"},{22,"J"},{23,"K"},
|
||||
{24,"Z"},{25,"X"},{26,"C"},{27,"V"},{28,"B"},{29,"N"},{30,"M"},{31,","}
|
||||
};
|
||||
// keyboard_key_to_player_key
|
||||
keyboard_key_to_player_key = new QMap<int,QString>
|
||||
{
|
||||
{Qt::Key_1,"1"},{Qt::Key_2,"2"},{Qt::Key_3,"3"},{Qt::Key_4,"4"},{Qt::Key_5,"5"},{Qt::Key_6,"6"},{Qt::Key_7,"7"},{Qt::Key_8,"8"},
|
||||
{Qt::Key_Q, "Q"},{Qt::Key_W,"W"},{Qt::Key_E,"E"},{Qt::Key_R,"R"},{Qt::Key_T,"T"},{Qt::Key_Y,"Y"},{Qt::Key_U,"U"},{Qt::Key_I,"I"},
|
||||
{Qt::Key_A,"A"},{Qt::Key_S,"S"},{Qt::Key_D,"D"},{Qt::Key_F,"F"},{Qt::Key_G,"G"},{Qt::Key_H,"H"},{Qt::Key_J,"J"},{Qt::Key_K,"K"},
|
||||
{Qt::Key_Z,"Z"},{Qt::Key_X,"X"},{Qt::Key_C,"C"},{Qt::Key_V,"V"},{Qt::Key_B,"B"},{Qt::Key_N,"N"},{Qt::Key_M,"M"},{Qt::Key_Comma,","}
|
||||
};
|
||||
// players
|
||||
players = new QMap<QString, CasterPlayerWidget*>();
|
||||
|
||||
playerQ = new CasterPlayerWidget;
|
||||
playerQ->setHotKeyLetter("Q");
|
||||
playerW = new CasterPlayerWidget;
|
||||
playerW->setHotKeyLetter("W");
|
||||
playerE = new CasterPlayerWidget;
|
||||
playerE->setHotKeyLetter("E");
|
||||
playerR = new CasterPlayerWidget;
|
||||
playerR->setHotKeyLetter("R");
|
||||
playerT = new CasterPlayerWidget;
|
||||
playerT->setHotKeyLetter("T");
|
||||
playerY = new CasterPlayerWidget;
|
||||
playerY->setHotKeyLetter("Y");
|
||||
playerU = new CasterPlayerWidget;
|
||||
playerU->setHotKeyLetter("U");
|
||||
playerI = new CasterPlayerWidget;
|
||||
playerI->setHotKeyLetter("I");
|
||||
/* Create Players */
|
||||
int _board_column = 0; int _board_row = 0;
|
||||
for(int i=0; i < int_to_player_key->count(); i++){
|
||||
// Initialize player
|
||||
players->insert(int_to_player_key->value(i), new CasterPlayerWidget);
|
||||
players->value(int_to_player_key->value(i))->setHotKeyLetter(int_to_player_key->value(i));
|
||||
|
||||
playerA = new CasterPlayerWidget;
|
||||
playerA->setHotKeyLetter("A");
|
||||
playerS = new CasterPlayerWidget;
|
||||
playerS->setHotKeyLetter("S");
|
||||
playerD = new CasterPlayerWidget;
|
||||
playerD->setHotKeyLetter("D");
|
||||
playerF = new CasterPlayerWidget;
|
||||
playerF->setHotKeyLetter("F");
|
||||
playerG = new CasterPlayerWidget;
|
||||
playerG->setHotKeyLetter("G");
|
||||
playerH = new CasterPlayerWidget;
|
||||
playerH->setHotKeyLetter("H");
|
||||
playerJ = new CasterPlayerWidget;
|
||||
playerJ->setHotKeyLetter("J");
|
||||
playerK = new CasterPlayerWidget;
|
||||
playerK->setHotKeyLetter("K");
|
||||
// Connect OSC Events
|
||||
connect(players->value(int_to_player_key->value(i)),SIGNAL(updateOSCClient(OscMessageComposer*)),this,SLOT(notifyApplicationAboutOSCMessage(OscMessageComposer*)));
|
||||
|
||||
playerZ = new CasterPlayerWidget;
|
||||
playerZ->setHotKeyLetter("Z");
|
||||
playerX = new CasterPlayerWidget;
|
||||
playerX->setHotKeyLetter("X");
|
||||
playerC = new CasterPlayerWidget;
|
||||
playerC->setHotKeyLetter("C");
|
||||
playerV = new CasterPlayerWidget;
|
||||
playerV->setHotKeyLetter("V");
|
||||
playerB = new CasterPlayerWidget;
|
||||
playerB->setHotKeyLetter("B");
|
||||
playerN = new CasterPlayerWidget;
|
||||
playerN->setHotKeyLetter("N");
|
||||
playerM = new CasterPlayerWidget;
|
||||
playerM->setHotKeyLetter("M");
|
||||
playerCOMMA = new CasterPlayerWidget;
|
||||
playerCOMMA->setHotKeyLetter(",");
|
||||
// Add to layout
|
||||
boardLayout->addWidget(players->value(int_to_player_key->value(i)), _board_row, _board_column);
|
||||
|
||||
//ADD TO LAYOUT
|
||||
boardLayout->addWidget(player1, 0,0);
|
||||
boardLayout->addWidget(player2, 0,1);
|
||||
boardLayout->addWidget(player3, 0,2);
|
||||
boardLayout->addWidget(player4, 0,3);
|
||||
boardLayout->addWidget(player5, 0,4);
|
||||
boardLayout->addWidget(player6, 0,5);
|
||||
boardLayout->addWidget(player7, 0,6);
|
||||
boardLayout->addWidget(player8, 0,7);
|
||||
|
||||
boardLayout->addWidget(playerQ, 1,0);
|
||||
boardLayout->addWidget(playerW, 1,1);
|
||||
boardLayout->addWidget(playerE, 1,2);
|
||||
boardLayout->addWidget(playerR, 1,3);
|
||||
boardLayout->addWidget(playerT, 1,4);
|
||||
boardLayout->addWidget(playerY, 1,5);
|
||||
boardLayout->addWidget(playerU, 1,6);
|
||||
boardLayout->addWidget(playerI, 1,7);
|
||||
|
||||
boardLayout->addWidget(playerA, 2,0);
|
||||
boardLayout->addWidget(playerS, 2,1);
|
||||
boardLayout->addWidget(playerD, 2,2);
|
||||
boardLayout->addWidget(playerF, 2,3);
|
||||
boardLayout->addWidget(playerG, 2,4);
|
||||
boardLayout->addWidget(playerH, 2,5);
|
||||
boardLayout->addWidget(playerJ, 2,6);
|
||||
boardLayout->addWidget(playerK, 2,7);
|
||||
|
||||
boardLayout->addWidget(playerZ, 3,0);
|
||||
boardLayout->addWidget(playerX, 3,1);
|
||||
boardLayout->addWidget(playerC, 3,2);
|
||||
boardLayout->addWidget(playerV, 3,3);
|
||||
boardLayout->addWidget(playerB, 3,4);
|
||||
boardLayout->addWidget(playerN, 3,5);
|
||||
boardLayout->addWidget(playerM, 3,6);
|
||||
boardLayout->addWidget(playerCOMMA, 3,7);
|
||||
// Update Next Layout
|
||||
_board_column += 1;
|
||||
if(_board_column > 7){
|
||||
_board_row += 1;
|
||||
_board_column = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
//PUBLIC
|
||||
void CasterBoard::stopAllSounds()
|
||||
{
|
||||
//WIDGETS
|
||||
player1->stopSound();
|
||||
player2->stopSound();
|
||||
player3->stopSound();
|
||||
player4->stopSound();
|
||||
player5->stopSound();
|
||||
player6->stopSound();
|
||||
player7->stopSound();
|
||||
player8->stopSound();
|
||||
|
||||
playerQ->stopSound();
|
||||
playerW->stopSound();
|
||||
playerE->stopSound();
|
||||
playerR->stopSound();
|
||||
playerT->stopSound();
|
||||
playerY->stopSound();
|
||||
playerU->stopSound();
|
||||
playerI->stopSound();
|
||||
|
||||
playerA->stopSound();
|
||||
playerS->stopSound();
|
||||
playerD->stopSound();
|
||||
playerF->stopSound();
|
||||
playerG->stopSound();
|
||||
playerH->stopSound();
|
||||
playerJ->stopSound();
|
||||
playerK->stopSound();
|
||||
|
||||
playerZ->stopSound();
|
||||
playerX->stopSound();
|
||||
playerC->stopSound();
|
||||
playerV->stopSound();
|
||||
playerB->stopSound();
|
||||
playerN->stopSound();
|
||||
playerM->stopSound();
|
||||
playerCOMMA->stopSound();
|
||||
// Iterate through players
|
||||
foreach(QString _letter, players->keys()){
|
||||
players->value(_letter)->stopSound();
|
||||
}
|
||||
}
|
||||
|
||||
void CasterBoard::setAllAudioDuckingStates(int state)
|
||||
{
|
||||
// Iterate through players
|
||||
foreach(QString _letter, players->keys()){
|
||||
players->value(_letter)->setAudioDuckState(state);
|
||||
}
|
||||
}
|
||||
|
||||
void CasterBoard::notifyApplicationAboutOSCMessage(OscMessageComposer* message){
|
||||
if(this->isCurrentBoard)
|
||||
emit this->_updateOSCClient(message);
|
||||
}
|
||||
|
||||
void CasterBoard::syncWithOSCClient()
|
||||
{
|
||||
// Update Tab Name
|
||||
OscMessageComposer* msg = writeOSCMessage("/glo/m/label/tab_name", *soundBoardName);
|
||||
emit this->_updateOSCClient(msg);
|
||||
|
||||
// Iterate through players
|
||||
foreach(QString _letter, players->keys()){
|
||||
players->value(_letter)->syncWithOSCClient();
|
||||
}
|
||||
}
|
||||
|
||||
// PROTECTED
|
||||
void CasterBoard::keyReleaseEvent(QKeyEvent *event)
|
||||
{
|
||||
//Handles All Hot Key Behavior
|
||||
//BOARD 1
|
||||
if(event->key() == Qt::Key_1)
|
||||
{
|
||||
if(player1->player->state() == QMediaPlayer::PlayingState)
|
||||
{
|
||||
player1->stopSound();
|
||||
}
|
||||
else if (player1->player->state() == QMediaPlayer::PausedState)
|
||||
{
|
||||
player1->playSound();
|
||||
}
|
||||
else if (player1->player->state() == QMediaPlayer::StoppedState)
|
||||
{
|
||||
player1->playSound();
|
||||
}
|
||||
}
|
||||
else if(event->key() == Qt::Key_2)
|
||||
{
|
||||
if(player2->player->state() == QMediaPlayer::PlayingState)
|
||||
{
|
||||
player2->stopSound();
|
||||
}
|
||||
else if (player2->player->state() == QMediaPlayer::PausedState)
|
||||
{
|
||||
player2->playSound();
|
||||
}
|
||||
else if (player2->player->state() == QMediaPlayer::StoppedState)
|
||||
{
|
||||
player2->playSound();
|
||||
}
|
||||
}
|
||||
else if(event->key() == Qt::Key_3)
|
||||
{
|
||||
if(player3->player->state() == QMediaPlayer::PlayingState)
|
||||
{
|
||||
player3->stopSound();
|
||||
}
|
||||
else if (player3->player->state() == QMediaPlayer::PausedState)
|
||||
{
|
||||
player3->playSound();
|
||||
}
|
||||
else if (player3->player->state() == QMediaPlayer::StoppedState)
|
||||
{
|
||||
player3->playSound();
|
||||
}
|
||||
}
|
||||
else if(event->key() == Qt::Key_4)
|
||||
{
|
||||
if(player4->player->state() == QMediaPlayer::PlayingState)
|
||||
{
|
||||
player4->stopSound();
|
||||
}
|
||||
else if (player4->player->state() == QMediaPlayer::PausedState)
|
||||
{
|
||||
player4->playSound();
|
||||
}
|
||||
else if (player4->player->state() == QMediaPlayer::StoppedState)
|
||||
{
|
||||
player4->playSound();
|
||||
}
|
||||
}
|
||||
else if(event->key() == Qt::Key_5)
|
||||
{
|
||||
if(player5->player->state() == QMediaPlayer::PlayingState)
|
||||
{
|
||||
player5->stopSound();
|
||||
}
|
||||
else if (player5->player->state() == QMediaPlayer::PausedState)
|
||||
{
|
||||
player5->playSound();
|
||||
}
|
||||
else if (player5->player->state() == QMediaPlayer::StoppedState)
|
||||
{
|
||||
player5->playSound();
|
||||
}
|
||||
}
|
||||
else if(event->key() == Qt::Key_6)
|
||||
{
|
||||
if(player6->player->state() == QMediaPlayer::PlayingState)
|
||||
{
|
||||
player6->stopSound();
|
||||
}
|
||||
else if (player6->player->state() == QMediaPlayer::PausedState)
|
||||
{
|
||||
player6->playSound();
|
||||
}
|
||||
else if (player6->player->state() == QMediaPlayer::StoppedState)
|
||||
{
|
||||
player6->playSound();
|
||||
}
|
||||
}
|
||||
else if(event->key() == Qt::Key_7)
|
||||
{
|
||||
if(player7->player->state() == QMediaPlayer::PlayingState)
|
||||
{
|
||||
player7->stopSound();
|
||||
}
|
||||
else if (player7->player->state() == QMediaPlayer::PausedState)
|
||||
{
|
||||
player7->playSound();
|
||||
}
|
||||
else if (player7->player->state() == QMediaPlayer::StoppedState)
|
||||
{
|
||||
player7->playSound();
|
||||
}
|
||||
}
|
||||
else if(event->key() == Qt::Key_8)
|
||||
{
|
||||
if(player8->player->state() == QMediaPlayer::PlayingState)
|
||||
{
|
||||
player8->stopSound();
|
||||
}
|
||||
else if (player8->player->state() == QMediaPlayer::PausedState)
|
||||
{
|
||||
player8->playSound();
|
||||
}
|
||||
else if (player8->player->state() == QMediaPlayer::StoppedState)
|
||||
{
|
||||
player8->playSound();
|
||||
}
|
||||
}
|
||||
//BOARD 2
|
||||
else if(event->key() == Qt::Key_Q)
|
||||
{
|
||||
if(playerQ->player->state() == QMediaPlayer::PlayingState)
|
||||
{
|
||||
playerQ->stopSound();
|
||||
}
|
||||
else if (playerQ->player->state() == QMediaPlayer::PausedState)
|
||||
{
|
||||
playerQ->playSound();
|
||||
}
|
||||
else if (playerQ->player->state() == QMediaPlayer::StoppedState)
|
||||
{
|
||||
playerQ->playSound();
|
||||
}
|
||||
}
|
||||
else if(event->key() == Qt::Key_W)
|
||||
{
|
||||
if(playerW->player->state() == QMediaPlayer::PlayingState)
|
||||
{
|
||||
playerW->stopSound();
|
||||
}
|
||||
else if (playerW->player->state() == QMediaPlayer::PausedState)
|
||||
{
|
||||
playerW->playSound();
|
||||
}
|
||||
else if (playerW->player->state() == QMediaPlayer::StoppedState)
|
||||
{
|
||||
playerW->playSound();
|
||||
}
|
||||
}
|
||||
else if(event->key() == Qt::Key_E)
|
||||
{
|
||||
if(playerE->player->state() == QMediaPlayer::PlayingState)
|
||||
{
|
||||
playerE->stopSound();
|
||||
}
|
||||
else if (playerE->player->state() == QMediaPlayer::PausedState)
|
||||
{
|
||||
playerE->playSound();
|
||||
}
|
||||
else if (playerE->player->state() == QMediaPlayer::StoppedState)
|
||||
{
|
||||
playerE->playSound();
|
||||
}
|
||||
}
|
||||
else if(event->key() == Qt::Key_R)
|
||||
{
|
||||
if(playerR->player->state() == QMediaPlayer::PlayingState)
|
||||
{
|
||||
playerR->stopSound();
|
||||
}
|
||||
else if (playerR->player->state() == QMediaPlayer::PausedState)
|
||||
{
|
||||
playerR->playSound();
|
||||
}
|
||||
else if (playerR->player->state() == QMediaPlayer::StoppedState)
|
||||
{
|
||||
playerR->playSound();
|
||||
}
|
||||
}
|
||||
else if(event->key() == Qt::Key_T)
|
||||
{
|
||||
if(playerT->player->state() == QMediaPlayer::PlayingState)
|
||||
{
|
||||
playerT->stopSound();
|
||||
}
|
||||
else if (playerT->player->state() == QMediaPlayer::PausedState)
|
||||
{
|
||||
playerT->playSound();
|
||||
}
|
||||
else if (playerT->player->state() == QMediaPlayer::StoppedState)
|
||||
{
|
||||
playerT->playSound();
|
||||
}
|
||||
}
|
||||
else if(event->key() == Qt::Key_Y)
|
||||
{
|
||||
if(playerY->player->state() == QMediaPlayer::PlayingState)
|
||||
{
|
||||
playerY->stopSound();
|
||||
}
|
||||
else if (playerY->player->state() == QMediaPlayer::PausedState)
|
||||
{
|
||||
playerY->playSound();
|
||||
}
|
||||
else if (playerY->player->state() == QMediaPlayer::StoppedState)
|
||||
{
|
||||
playerY->playSound();
|
||||
}
|
||||
}
|
||||
else if(event->key() == Qt::Key_U)
|
||||
{
|
||||
if(playerU->player->state() == QMediaPlayer::PlayingState)
|
||||
{
|
||||
playerU->stopSound();
|
||||
}
|
||||
else if (playerU->player->state() == QMediaPlayer::PausedState)
|
||||
{
|
||||
playerU->playSound();
|
||||
}
|
||||
else if (playerU->player->state() == QMediaPlayer::StoppedState)
|
||||
{
|
||||
playerU->playSound();
|
||||
}
|
||||
}
|
||||
else if(event->key() == Qt::Key_I)
|
||||
{
|
||||
if(playerI->player->state() == QMediaPlayer::PlayingState)
|
||||
{
|
||||
playerI->stopSound();
|
||||
}
|
||||
else if (playerI->player->state() == QMediaPlayer::PausedState)
|
||||
{
|
||||
playerI->playSound();
|
||||
}
|
||||
else if (playerI->player->state() == QMediaPlayer::StoppedState)
|
||||
{
|
||||
playerI->playSound();
|
||||
}
|
||||
}
|
||||
//BOARD 3
|
||||
else if(event->key() == Qt::Key_A)
|
||||
{
|
||||
if(playerA->player->state() == QMediaPlayer::PlayingState)
|
||||
{
|
||||
playerA->stopSound();
|
||||
}
|
||||
else if (playerA->player->state() == QMediaPlayer::PausedState)
|
||||
{
|
||||
playerA->playSound();
|
||||
}
|
||||
else if (playerA->player->state() == QMediaPlayer::StoppedState)
|
||||
{
|
||||
playerA->playSound();
|
||||
}
|
||||
}
|
||||
else if(event->key() == Qt::Key_S)
|
||||
{
|
||||
if(playerS->player->state() == QMediaPlayer::PlayingState)
|
||||
{
|
||||
playerS->stopSound();
|
||||
}
|
||||
else if (playerS->player->state() == QMediaPlayer::PausedState)
|
||||
{
|
||||
playerS->playSound();
|
||||
}
|
||||
else if (playerS->player->state() == QMediaPlayer::StoppedState)
|
||||
{
|
||||
playerS->playSound();
|
||||
}
|
||||
}
|
||||
else if(event->key() == Qt::Key_D)
|
||||
{
|
||||
if(playerD->player->state() == QMediaPlayer::PlayingState)
|
||||
{
|
||||
playerD->stopSound();
|
||||
}
|
||||
else if (playerD->player->state() == QMediaPlayer::PausedState)
|
||||
{
|
||||
playerD->playSound();
|
||||
}
|
||||
else if (playerD->player->state() == QMediaPlayer::StoppedState)
|
||||
{
|
||||
playerD->playSound();
|
||||
}
|
||||
}
|
||||
else if(event->key() == Qt::Key_F)
|
||||
{
|
||||
if(playerF->player->state() == QMediaPlayer::PlayingState)
|
||||
{
|
||||
playerF->stopSound();
|
||||
}
|
||||
else if (playerF->player->state() == QMediaPlayer::PausedState)
|
||||
{
|
||||
playerF->playSound();
|
||||
}
|
||||
else if (playerF->player->state() == QMediaPlayer::StoppedState)
|
||||
{
|
||||
playerF->playSound();
|
||||
}
|
||||
}
|
||||
else if(event->key() == Qt::Key_G)
|
||||
{
|
||||
if(playerG->player->state() == QMediaPlayer::PlayingState)
|
||||
{
|
||||
playerG->stopSound();
|
||||
}
|
||||
else if (playerG->player->state() == QMediaPlayer::PausedState)
|
||||
{
|
||||
playerG->playSound();
|
||||
}
|
||||
else if (playerG->player->state() == QMediaPlayer::StoppedState)
|
||||
{
|
||||
playerG->playSound();
|
||||
}
|
||||
}
|
||||
else if(event->key() == Qt::Key_H)
|
||||
{
|
||||
if(playerH->player->state() == QMediaPlayer::PlayingState)
|
||||
{
|
||||
playerH->stopSound();
|
||||
}
|
||||
else if (playerH->player->state() == QMediaPlayer::PausedState)
|
||||
{
|
||||
playerH->playSound();
|
||||
}
|
||||
else if (playerH->player->state() == QMediaPlayer::StoppedState)
|
||||
{
|
||||
playerH->playSound();
|
||||
}
|
||||
}
|
||||
else if(event->key() == Qt::Key_J)
|
||||
{
|
||||
if(playerJ->player->state() == QMediaPlayer::PlayingState)
|
||||
{
|
||||
playerJ->stopSound();
|
||||
}
|
||||
else if (playerJ->player->state() == QMediaPlayer::PausedState)
|
||||
{
|
||||
playerJ->playSound();
|
||||
}
|
||||
else if (playerJ->player->state() == QMediaPlayer::StoppedState)
|
||||
{
|
||||
playerJ->playSound();
|
||||
}
|
||||
}
|
||||
else if(event->key() == Qt::Key_K)
|
||||
{
|
||||
if(playerK->player->state() == QMediaPlayer::PlayingState)
|
||||
{
|
||||
playerK->stopSound();
|
||||
}
|
||||
else if (playerK->player->state() == QMediaPlayer::PausedState)
|
||||
{
|
||||
playerK->playSound();
|
||||
}
|
||||
else if (playerK->player->state() == QMediaPlayer::StoppedState)
|
||||
{
|
||||
playerK->playSound();
|
||||
}
|
||||
}
|
||||
//BOARD 4
|
||||
else if(event->key() == Qt::Key_Z)
|
||||
{
|
||||
if(playerZ->player->state() == QMediaPlayer::PlayingState)
|
||||
{
|
||||
playerZ->stopSound();
|
||||
}
|
||||
else if (playerZ->player->state() == QMediaPlayer::PausedState)
|
||||
{
|
||||
playerZ->playSound();
|
||||
}
|
||||
else if (playerZ->player->state() == QMediaPlayer::StoppedState)
|
||||
{
|
||||
playerZ->playSound();
|
||||
}
|
||||
}
|
||||
else if(event->key() == Qt::Key_X)
|
||||
{
|
||||
if(playerX->player->state() == QMediaPlayer::PlayingState)
|
||||
{
|
||||
playerX->stopSound();
|
||||
}
|
||||
else if (playerX->player->state() == QMediaPlayer::PausedState)
|
||||
{
|
||||
playerX->playSound();
|
||||
}
|
||||
else if (playerX->player->state() == QMediaPlayer::StoppedState)
|
||||
{
|
||||
playerX->playSound();
|
||||
}
|
||||
}
|
||||
else if(event->key() == Qt::Key_C)
|
||||
{
|
||||
if(playerC->player->state() == QMediaPlayer::PlayingState)
|
||||
{
|
||||
playerC->stopSound();
|
||||
}
|
||||
else if (playerC->player->state() == QMediaPlayer::PausedState)
|
||||
{
|
||||
playerC->playSound();
|
||||
}
|
||||
else if (playerC->player->state() == QMediaPlayer::StoppedState)
|
||||
{
|
||||
playerC->playSound();
|
||||
}
|
||||
}
|
||||
else if(event->key() == Qt::Key_V)
|
||||
{
|
||||
if(playerV->player->state() == QMediaPlayer::PlayingState)
|
||||
{
|
||||
playerV->stopSound();
|
||||
}
|
||||
else if (playerV->player->state() == QMediaPlayer::PausedState)
|
||||
{
|
||||
playerV->playSound();
|
||||
}
|
||||
else if (playerV->player->state() == QMediaPlayer::StoppedState)
|
||||
{
|
||||
playerV->playSound();
|
||||
}
|
||||
}
|
||||
else if(event->key() == Qt::Key_B)
|
||||
{
|
||||
if(playerB->player->state() == QMediaPlayer::PlayingState)
|
||||
{
|
||||
playerB->stopSound();
|
||||
}
|
||||
else if (playerB->player->state() == QMediaPlayer::PausedState)
|
||||
{
|
||||
playerB->playSound();
|
||||
}
|
||||
else if (playerB->player->state() == QMediaPlayer::StoppedState)
|
||||
{
|
||||
playerB->playSound();
|
||||
}
|
||||
}
|
||||
else if(event->key() == Qt::Key_N)
|
||||
{
|
||||
if(playerN->player->state() == QMediaPlayer::PlayingState)
|
||||
{
|
||||
playerN->stopSound();
|
||||
}
|
||||
else if (playerN->player->state() == QMediaPlayer::PausedState)
|
||||
{
|
||||
playerN->playSound();
|
||||
}
|
||||
else if (playerN->player->state() == QMediaPlayer::StoppedState)
|
||||
{
|
||||
playerN->playSound();
|
||||
}
|
||||
}
|
||||
else if(event->key() == Qt::Key_M)
|
||||
{
|
||||
if(playerM->player->state() == QMediaPlayer::PlayingState)
|
||||
{
|
||||
playerM->stopSound();
|
||||
}
|
||||
else if (playerM->player->state() == QMediaPlayer::PausedState)
|
||||
{
|
||||
playerM->playSound();
|
||||
}
|
||||
else if (playerM->player->state() == QMediaPlayer::StoppedState)
|
||||
{
|
||||
playerM->playSound();
|
||||
}
|
||||
}
|
||||
else if(event->key() == Qt::Key_Comma)
|
||||
{
|
||||
if(playerCOMMA->player->state() == QMediaPlayer::PlayingState)
|
||||
{
|
||||
playerCOMMA->stopSound();
|
||||
}
|
||||
else if (playerCOMMA->player->state() == QMediaPlayer::PausedState)
|
||||
{
|
||||
playerCOMMA->playSound();
|
||||
}
|
||||
else if (playerCOMMA->player->state() == QMediaPlayer::StoppedState)
|
||||
{
|
||||
playerCOMMA->playSound();
|
||||
if(keyboard_key_to_player_key->contains(event->key())){
|
||||
if(players->contains(keyboard_key_to_player_key->value(event->key()))){
|
||||
// Play or stop sound based on player's play state
|
||||
if(players->value(keyboard_key_to_player_key->value(event->key()))->player->state() == QMediaPlayer::PlayingState)
|
||||
players->value(keyboard_key_to_player_key->value(event->key()))->stopSound();
|
||||
else if (players->value(keyboard_key_to_player_key->value(event->key()))->player->state() == QMediaPlayer::PausedState)
|
||||
players->value(keyboard_key_to_player_key->value(event->key()))->playSound();
|
||||
else if (players->value(keyboard_key_to_player_key->value(event->key()))->player->state() == QMediaPlayer::StoppedState)
|
||||
players->value(keyboard_key_to_player_key->value(event->key()))->playSound();
|
||||
}
|
||||
} else {
|
||||
// Delegates global hotkeys to MainWIndow
|
||||
emit globalHotKeyReleasedEvent(event);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//Public Methods
|
||||
void CasterBoard::reloadBoardFromPlayerStates()
|
||||
{
|
||||
this->player1->reloadFromPlayerState();
|
||||
this->player2->reloadFromPlayerState();
|
||||
this->player3->reloadFromPlayerState();
|
||||
this->player4->reloadFromPlayerState();
|
||||
this->player5->reloadFromPlayerState();
|
||||
this->player6->reloadFromPlayerState();
|
||||
this->player7->reloadFromPlayerState();
|
||||
this->player8->reloadFromPlayerState();
|
||||
|
||||
this->playerQ->reloadFromPlayerState();
|
||||
this->playerW->reloadFromPlayerState();
|
||||
this->playerE->reloadFromPlayerState();
|
||||
this->playerR->reloadFromPlayerState();
|
||||
this->playerT->reloadFromPlayerState();
|
||||
this->playerY->reloadFromPlayerState();
|
||||
this->playerU->reloadFromPlayerState();
|
||||
this->playerI->reloadFromPlayerState();
|
||||
|
||||
this->playerA->reloadFromPlayerState();
|
||||
this->playerS->reloadFromPlayerState();
|
||||
this->playerD->reloadFromPlayerState();
|
||||
this->playerF->reloadFromPlayerState();
|
||||
this->playerG->reloadFromPlayerState();
|
||||
this->playerH->reloadFromPlayerState();
|
||||
this->playerJ->reloadFromPlayerState();
|
||||
this->playerK->reloadFromPlayerState();
|
||||
|
||||
this->playerZ->reloadFromPlayerState();
|
||||
this->playerX->reloadFromPlayerState();
|
||||
this->playerC->reloadFromPlayerState();
|
||||
this->playerV->reloadFromPlayerState();
|
||||
this->playerB->reloadFromPlayerState();
|
||||
this->playerN->reloadFromPlayerState();
|
||||
this->playerM->reloadFromPlayerState();
|
||||
this->playerCOMMA->reloadFromPlayerState();
|
||||
// Iterate through players
|
||||
foreach(QString _letter, players->keys()){
|
||||
players->value(_letter)->reloadFromPlayerState();
|
||||
}
|
||||
|
||||
this->update();
|
||||
}
|
||||
|
||||
//========================================================
|
||||
//==========OSC Composer Methods=====
|
||||
OscMessageComposer* CasterBoard::writeOSCMessage(QString address, int value){
|
||||
// Compose OSC Message
|
||||
OscMessageComposer* msg = new OscMessageComposer(address);
|
||||
msg->pushInt32((qint32)value);
|
||||
return msg;
|
||||
}
|
||||
|
||||
OscMessageComposer* CasterBoard::writeOSCMessage(QString address, float value){
|
||||
// Compose OSC Message
|
||||
OscMessageComposer* msg = new OscMessageComposer(address);
|
||||
msg->pushFloat(value);
|
||||
return msg;
|
||||
}
|
||||
|
||||
OscMessageComposer* CasterBoard::writeOSCMessage(QString address, QString value){
|
||||
// Compose OSC Message
|
||||
OscMessageComposer* msg = new OscMessageComposer(address);
|
||||
msg->pushString(value.toUtf8());
|
||||
return msg;
|
||||
}
|
||||
|
||||
//================================================
|
||||
|
||||
|
||||
//Operator Overloading
|
||||
QDataStream &operator<<(QDataStream &ds, const CasterBoard &cb)
|
||||
{
|
||||
return ds << *cb.soundBoardName
|
||||
<< *cb.player1->playerState << *cb.player2->playerState << *cb.player3->playerState << *cb.player4->playerState << *cb.player5->playerState << *cb.player6->playerState << *cb.player7->playerState << *cb.player8->playerState
|
||||
<< *cb.playerQ->playerState << *cb.playerW->playerState << *cb.playerE->playerState << *cb.playerR->playerState << *cb.playerT->playerState << *cb.playerY->playerState << *cb.playerU->playerState << *cb.playerI->playerState
|
||||
<< *cb.playerA->playerState << *cb.playerS->playerState << *cb.playerD->playerState << *cb.playerF->playerState << *cb.playerG->playerState << *cb.playerH->playerState << *cb.playerJ->playerState << *cb.playerK->playerState
|
||||
<< *cb.playerZ->playerState << *cb.playerX->playerState << *cb.playerC->playerState << *cb.playerV->playerState << *cb.playerB->playerState << *cb.playerN->playerState << *cb.playerM->playerState << *cb.playerCOMMA->playerState;
|
||||
/* Properties */
|
||||
ds << *cb.soundBoardName;
|
||||
/* All Player Properties */
|
||||
// Iterate through players
|
||||
foreach(QString _letter, cb.players->keys()){
|
||||
ds << *cb.players->value(_letter)->playerState;
|
||||
}
|
||||
return ds;
|
||||
}
|
||||
|
||||
|
||||
QDataStream &operator>>(QDataStream &ds, CasterBoard &cb)
|
||||
{
|
||||
return ds >> *cb.soundBoardName
|
||||
>> *cb.player1->playerState >> *cb.player2->playerState >> *cb.player3->playerState >> *cb.player4->playerState >> *cb.player5->playerState >> *cb.player6->playerState >> *cb.player7->playerState >> *cb.player8->playerState
|
||||
>> *cb.playerQ->playerState >> *cb.playerW->playerState >> *cb.playerE->playerState >> *cb.playerR->playerState >> *cb.playerT->playerState >> *cb.playerY->playerState >> *cb.playerU->playerState >> *cb.playerI->playerState
|
||||
>> *cb.playerA->playerState >> *cb.playerS->playerState >> *cb.playerD->playerState >> *cb.playerF->playerState >> *cb.playerG->playerState >> *cb.playerH->playerState >> *cb.playerJ->playerState >> *cb.playerK->playerState
|
||||
>> *cb.playerZ->playerState >> *cb.playerX->playerState >> *cb.playerC->playerState >> *cb.playerV->playerState >> *cb.playerB->playerState >> *cb.playerN->playerState >> *cb.playerM->playerState >> *cb.playerCOMMA->playerState;
|
||||
/* Properties */
|
||||
ds >> *cb.soundBoardName;
|
||||
/* All Player Properties */
|
||||
// Iterate through players
|
||||
foreach(QString _letter, cb.players->keys()){
|
||||
ds >> *cb.players->value(_letter)->playerState;
|
||||
}
|
||||
return ds;
|
||||
}
|
||||
|
||||
@ -25,6 +25,8 @@
|
||||
#include <QWidget>
|
||||
#include <QDataStream>
|
||||
#include <QString>
|
||||
#include <QMap>
|
||||
#include "libs/osc/composer/OscMessageComposer.h"
|
||||
|
||||
//forward declarations
|
||||
class CasterPlayerWidget;
|
||||
@ -39,49 +41,18 @@ public:
|
||||
CasterBoard(QWidget* parent = 0); //don't forget to pass the parent
|
||||
|
||||
//Properties
|
||||
bool isCurrentBoard = false;
|
||||
QString *soundBoardName;
|
||||
QString *profileFilePath;
|
||||
|
||||
//WIDGETS
|
||||
CasterPlayerWidget *player1;
|
||||
CasterPlayerWidget *player2;
|
||||
CasterPlayerWidget *player3;
|
||||
CasterPlayerWidget *player4;
|
||||
CasterPlayerWidget *player5;
|
||||
CasterPlayerWidget *player6;
|
||||
CasterPlayerWidget *player7;
|
||||
CasterPlayerWidget *player8;
|
||||
|
||||
CasterPlayerWidget *playerQ;
|
||||
CasterPlayerWidget *playerW;
|
||||
CasterPlayerWidget *playerE;
|
||||
CasterPlayerWidget *playerR;
|
||||
CasterPlayerWidget *playerT;
|
||||
CasterPlayerWidget *playerY;
|
||||
CasterPlayerWidget *playerU;
|
||||
CasterPlayerWidget *playerI;
|
||||
|
||||
CasterPlayerWidget *playerA;
|
||||
CasterPlayerWidget *playerS;
|
||||
CasterPlayerWidget *playerD;
|
||||
CasterPlayerWidget *playerF;
|
||||
CasterPlayerWidget *playerG;
|
||||
CasterPlayerWidget *playerH;
|
||||
CasterPlayerWidget *playerJ;
|
||||
CasterPlayerWidget *playerK;
|
||||
|
||||
CasterPlayerWidget *playerZ;
|
||||
CasterPlayerWidget *playerX;
|
||||
CasterPlayerWidget *playerC;
|
||||
CasterPlayerWidget *playerV;
|
||||
CasterPlayerWidget *playerB;
|
||||
CasterPlayerWidget *playerN;
|
||||
CasterPlayerWidget *playerM;
|
||||
CasterPlayerWidget *playerCOMMA;
|
||||
QMap<int,QString> *int_to_player_key;
|
||||
QMap<int,QString> *keyboard_key_to_player_key;
|
||||
QMap<QString, CasterPlayerWidget*> *players;
|
||||
|
||||
//Methods
|
||||
void stopAllSounds();
|
||||
void reloadBoardFromPlayerStates();
|
||||
void setAllAudioDuckingStates(int state);
|
||||
void syncWithOSCClient();//Refeshes UI on OSC Client
|
||||
|
||||
|
||||
protected:
|
||||
@ -90,12 +61,19 @@ protected:
|
||||
|
||||
private:
|
||||
//Private Methods
|
||||
//OSC Composer Methods
|
||||
OscMessageComposer* writeOSCMessage(QString address, int value);
|
||||
OscMessageComposer* writeOSCMessage(QString address, float value);
|
||||
OscMessageComposer* writeOSCMessage(QString address, QString value);
|
||||
|
||||
signals:
|
||||
//SIGNALS
|
||||
void globalHotKeyReleasedEvent(QKeyEvent *event);//Use by mainwindow to perform actions on all sound boads. Needed because of how focus works in qt.
|
||||
void _updateOSCClient(OscMessageComposer* message);
|
||||
|
||||
public slots:
|
||||
//SLOTS
|
||||
void notifyApplicationAboutOSCMessage(OscMessageComposer* message);
|
||||
|
||||
};
|
||||
|
||||
|
||||
@ -158,6 +158,7 @@ void CasterCuePicker::button_Cancel_Clicked()
|
||||
//=======Protected=======
|
||||
void CasterCuePicker::closeEvent(QCloseEvent *event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
player->stop();
|
||||
button_Preview->setText("Preview");
|
||||
}
|
||||
|
||||
@ -1,2 +0,0 @@
|
||||
|
||||
|
||||
@ -200,6 +200,7 @@ void CasterLabelColorPicker::set_slider_L_Value(int L_Value)
|
||||
//SLOTS
|
||||
void CasterLabelColorPicker::slider_HSL_valueChanged(int value)
|
||||
{
|
||||
Q_UNUSED(value);
|
||||
label_H_Value->setText(QString::number(slider_H->value()));
|
||||
label_S_Value->setText(QString::number(slider_S->value()).append("%"));
|
||||
label_L_Value->setText(QString::number(slider_L->value()).append("%"));
|
||||
|
||||
200
CasterSoundboard/CasterOSCServerConfigPicker.cpp
Normal file
200
CasterSoundboard/CasterOSCServerConfigPicker.cpp
Normal file
@ -0,0 +1,200 @@
|
||||
#include "CasterOSCServerConfigPicker.h"
|
||||
#include <QMediaPlayer>
|
||||
#include <QHBoxLayout>
|
||||
#include <QVBoxLayout>
|
||||
#include <QSlider>
|
||||
#include <QLineEdit>
|
||||
#include <QPushButton>
|
||||
#include <QLabel>
|
||||
#include <QMessageBox>
|
||||
#include <QRegExp>
|
||||
#include <QRegExpValidator>
|
||||
#include <QHostAddress>
|
||||
|
||||
|
||||
CasterOSCServerConfigPicker::CasterOSCServerConfigPicker(QString _inbound_ipv4, int _inbound_port, QString _outbound_ipv4, int _outbound_port)
|
||||
{
|
||||
// Main Settings
|
||||
this->setMinimumWidth(400);
|
||||
this->setWindowTitle("Open Sound Control Server Settings");
|
||||
ok = false;
|
||||
this->inbound_ipv4 = &_inbound_ipv4;
|
||||
this->inbound_port = _inbound_port;
|
||||
this->outbound_ipv4 = &_outbound_ipv4;
|
||||
this->outbound_port = _outbound_port;
|
||||
|
||||
// Validators
|
||||
// IPv4 Validator
|
||||
QRegExpValidator *validator_ip = new QRegExpValidator(this);
|
||||
QRegExp rx_ip("((1{0,1}[0-9]{0,2}|2[0-4]{1,1}[0-9]{1,1}|25[0-5]{1,1})\\.){3,3}(1{0,1}[0-9]{0,2}|2[0-4]{1,1}[0-9]{1,1}|25[0-5]{1,1})");
|
||||
validator_ip->setRegExp(rx_ip);
|
||||
// Port Number Validator
|
||||
QRegExpValidator *validator_port = new QRegExpValidator(this);
|
||||
QRegExp rx_port("^([0-9]{1,4}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5])$");
|
||||
validator_port->setRegExp(rx_port);
|
||||
|
||||
// UI
|
||||
label_General = new QLabel("Open Sound Control server with one-way and two-way communication.\nTouchOSC app is recommended for two-way communication.\n(NOT AFFILIATED with TouchOSC).\n OSC api will be documented in the repo's wiki.");
|
||||
label_Inbound = new QLabel("Inbound Traffic:");
|
||||
label_Outbound = new QLabel("Outbound Traffic:");
|
||||
textBox_Inbound_IPv4 = new QLineEdit;
|
||||
textBox_Inbound_IPv4->setText(inbound_ipv4->toUtf8());
|
||||
textBox_Inbound_IPv4->setPlaceholderText("IP Address");
|
||||
textBox_Inbound_IPv4->setReadOnly(true);
|
||||
textBox_Inbound_Port = new QLineEdit;
|
||||
textBox_Inbound_Port->setText(QString::number(inbound_port).toUtf8());
|
||||
textBox_Inbound_Port->setPlaceholderText("Port");
|
||||
textBox_Inbound_Port->setValidator(validator_port);
|
||||
textBox_Outbound_IPv4 = new QLineEdit;
|
||||
textBox_Outbound_IPv4->setText(outbound_ipv4->toUtf8());
|
||||
textBox_Outbound_IPv4->setPlaceholderText("OSC Client IP Address");
|
||||
textBox_Outbound_IPv4->setValidator(validator_ip);
|
||||
textBox_Outbound_Port = new QLineEdit;
|
||||
textBox_Outbound_Port->setText(QString::number(outbound_port).toUtf8());
|
||||
textBox_Outbound_Port->setPlaceholderText("Port");
|
||||
textBox_Outbound_Port->setValidator(validator_port);
|
||||
button_Cancel = new QPushButton("Cancel");
|
||||
button_ToggleServer = new QPushButton("Start");
|
||||
|
||||
|
||||
// Layouts
|
||||
layout_main = new QVBoxLayout(this);
|
||||
layout_general_info = new QHBoxLayout;
|
||||
layout_inbound_info = new QHBoxLayout;
|
||||
layout_inbound_controls = new QHBoxLayout;
|
||||
layout_outbound_info = new QHBoxLayout;
|
||||
layout_outbound_controls = new QHBoxLayout;
|
||||
layout_buttons = new QHBoxLayout;
|
||||
|
||||
// Set Layouts
|
||||
layout_general_info->addWidget(label_General);
|
||||
layout_inbound_info->addWidget(label_Inbound);
|
||||
layout_inbound_controls->addWidget(textBox_Inbound_IPv4);
|
||||
layout_inbound_controls->addWidget(textBox_Inbound_Port);
|
||||
layout_outbound_info->addWidget(label_Outbound);
|
||||
layout_outbound_controls->addWidget(textBox_Outbound_IPv4);
|
||||
layout_outbound_controls->addWidget(textBox_Outbound_Port);
|
||||
layout_buttons->addWidget(button_Cancel);
|
||||
layout_buttons->addWidget(button_ToggleServer);
|
||||
|
||||
// Set Overall Layout
|
||||
layout_main->addLayout(layout_general_info);
|
||||
layout_main->addLayout(layout_inbound_info);
|
||||
layout_main->addLayout(layout_inbound_controls);
|
||||
layout_main->addLayout(layout_outbound_info);
|
||||
layout_main->addLayout(layout_outbound_controls);
|
||||
layout_main->addLayout(layout_buttons);
|
||||
|
||||
//Connect Sub-Widget Events
|
||||
connect(button_Cancel,SIGNAL(clicked()),this,SLOT(button_Cancel_Clicked()));
|
||||
connect(button_ToggleServer,SIGNAL(clicked()),this,SLOT(button_ToggleServer_Clicked()));
|
||||
}
|
||||
|
||||
//=======Protected=======
|
||||
void CasterOSCServerConfigPicker::closeEvent(QCloseEvent *event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
}
|
||||
|
||||
//======Public Slots======
|
||||
|
||||
//SLOTS
|
||||
void CasterOSCServerConfigPicker::button_ToggleServer_Clicked(){
|
||||
if(server_is_running){
|
||||
ok = true;
|
||||
Result = CasterOSCServerConfigPicker::Action_Kill_Server;
|
||||
textBox_Inbound_Port->setReadOnly(false);
|
||||
textBox_Outbound_IPv4->setReadOnly(false);
|
||||
textBox_Outbound_Port->setReadOnly(false);
|
||||
button_ToggleServer->setText("Start");
|
||||
this->close();
|
||||
} else {
|
||||
if(textBox_Inbound_Port->text().toUtf8() != ""
|
||||
&& textBox_Outbound_IPv4->text().toUtf8() != ""
|
||||
&& textBox_Outbound_Port->text().toUtf8() != ""){
|
||||
inbound_port = textBox_Inbound_Port->text().toInt();
|
||||
outbound_ipv4 = new QString(textBox_Outbound_IPv4->text().toUtf8());
|
||||
outbound_port = textBox_Outbound_Port->text().toInt();
|
||||
ok = true;
|
||||
Result = CasterOSCServerConfigPicker::Action_Start_Server;
|
||||
textBox_Inbound_Port->setReadOnly(true);
|
||||
textBox_Outbound_IPv4->setReadOnly(true);
|
||||
textBox_Outbound_Port->setReadOnly(true);
|
||||
button_ToggleServer->setText("Stop");
|
||||
this->close();
|
||||
} else {
|
||||
QString *temp = new QString("IP and Port numbers can not be empty!");
|
||||
QMessageBox msgBox;
|
||||
msgBox.setText(temp->toUtf8() + "\n");
|
||||
msgBox.setStandardButtons(QMessageBox::Close);
|
||||
msgBox.setDefaultButton(QMessageBox::Close);
|
||||
msgBox.setModal(true);
|
||||
msgBox.setWindowTitle("Input Error");
|
||||
msgBox.setWindowIcon(QIcon(":/res/img/about.png"));
|
||||
msgBox.exec();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CasterOSCServerConfigPicker::button_Cancel_Clicked(){
|
||||
this->close();
|
||||
}
|
||||
|
||||
|
||||
//======Public Properties======
|
||||
//Inbound
|
||||
void CasterOSCServerConfigPicker::setInBoundIPv4(QString *ip){
|
||||
inbound_ipv4 = ip;
|
||||
textBox_Inbound_IPv4->setText(*ip);
|
||||
}
|
||||
|
||||
void CasterOSCServerConfigPicker::setInBoundPort(int port){
|
||||
inbound_port = port;
|
||||
textBox_Inbound_Port->setText(QString::number(inbound_port).toUtf8());
|
||||
}
|
||||
|
||||
int CasterOSCServerConfigPicker::getInboundPort(){
|
||||
return inbound_port;
|
||||
}
|
||||
|
||||
//Outbound
|
||||
void CasterOSCServerConfigPicker::setOutBoundIPv4(QString *ip){
|
||||
outbound_ipv4 = ip;
|
||||
textBox_Outbound_IPv4->setText(*ip);
|
||||
}
|
||||
|
||||
QString CasterOSCServerConfigPicker::getOutboundIPv4(){
|
||||
return *outbound_ipv4;
|
||||
}
|
||||
|
||||
void CasterOSCServerConfigPicker::setOutBoundPort(int port){
|
||||
outbound_port = port;
|
||||
textBox_Outbound_Port->setText(QString::number(outbound_port).toUtf8());
|
||||
}
|
||||
|
||||
int CasterOSCServerConfigPicker::getOutboundPort(){
|
||||
return outbound_port;
|
||||
}
|
||||
|
||||
// MISC
|
||||
|
||||
void CasterOSCServerConfigPicker::setIsServerRunning(bool isRunning)
|
||||
{\
|
||||
this->server_is_running = isRunning;
|
||||
if(server_is_running){
|
||||
textBox_Inbound_Port->setReadOnly(true);
|
||||
textBox_Outbound_IPv4->setReadOnly(true);
|
||||
textBox_Outbound_Port->setReadOnly(true);
|
||||
button_ToggleServer->setText("Stop");
|
||||
} else {
|
||||
textBox_Inbound_Port->setReadOnly(false);
|
||||
textBox_Outbound_IPv4->setReadOnly(false);
|
||||
textBox_Outbound_Port->setReadOnly(false);
|
||||
button_ToggleServer->setText("Start");
|
||||
}
|
||||
}
|
||||
|
||||
bool CasterOSCServerConfigPicker::getIsServerRunning()
|
||||
{
|
||||
return server_is_running;
|
||||
}
|
||||
101
CasterSoundboard/CasterOSCServerConfigPicker.h
Normal file
101
CasterSoundboard/CasterOSCServerConfigPicker.h
Normal file
@ -0,0 +1,101 @@
|
||||
#ifndef CASTEROSCSERVERCONFIGPICKER_H
|
||||
#define CASTEROSCSERVERCONFIGPICKER_H
|
||||
#include <QDialog>
|
||||
|
||||
//forward declarations
|
||||
class QWidget;
|
||||
class QSlider;
|
||||
class QLineEdit;
|
||||
class QPushButton;
|
||||
class QLabel;
|
||||
class QString;
|
||||
class QVBoxLayout;
|
||||
class QHBoxLayout;
|
||||
class QHostAddress;
|
||||
|
||||
|
||||
|
||||
class CasterOSCServerConfigPicker : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
// Static
|
||||
static const int Action_Neutral = 0;
|
||||
static const int Action_Start_Server = 1;
|
||||
static const int Action_Kill_Server = 2;
|
||||
|
||||
//Constructor
|
||||
CasterOSCServerConfigPicker(QString _inbound_ipv4, int _inbound_port, QString _outbound_ipv4, int _outbound_port);
|
||||
|
||||
|
||||
//PROPERTIES
|
||||
bool ok;//DiagResult
|
||||
int Result = 0;
|
||||
|
||||
//METHODS
|
||||
//Inbound
|
||||
void setInBoundIPv4(QString *ip);
|
||||
void setInBoundPort(int port);
|
||||
int getInboundPort();
|
||||
|
||||
//Outbound
|
||||
void setOutBoundIPv4(QString *ip);
|
||||
QString getOutboundIPv4();
|
||||
void setOutBoundPort(int port);
|
||||
int getOutboundPort();
|
||||
|
||||
//MISC
|
||||
void setIsServerRunning(bool isRunning);
|
||||
bool getIsServerRunning();
|
||||
|
||||
//WIDGETS
|
||||
|
||||
|
||||
protected:
|
||||
//PROPERTIES
|
||||
|
||||
//METHODS
|
||||
void closeEvent(QCloseEvent *event);
|
||||
|
||||
//WIDGETS
|
||||
|
||||
private:
|
||||
//PROPERTIES
|
||||
bool server_is_running = false;
|
||||
QString *inbound_ipv4;
|
||||
int inbound_port = 8000;
|
||||
QString *outbound_ipv4;
|
||||
int outbound_port = 9000;
|
||||
|
||||
//METHODS
|
||||
|
||||
//WIDGETS
|
||||
QLabel *label_General;
|
||||
QLabel *label_Inbound;
|
||||
QLabel *label_Outbound;
|
||||
QLineEdit *textBox_Inbound_IPv4;
|
||||
QLineEdit *textBox_Inbound_Port;
|
||||
QLineEdit *textBox_Outbound_IPv4;
|
||||
QLineEdit *textBox_Outbound_Port;
|
||||
QPushButton *button_Cancel;
|
||||
QPushButton *button_ToggleServer;
|
||||
|
||||
QVBoxLayout *layout_main;
|
||||
QHBoxLayout *layout_general_info;
|
||||
QHBoxLayout *layout_inbound_info;
|
||||
QHBoxLayout *layout_inbound_controls;
|
||||
QHBoxLayout *layout_outbound_info;
|
||||
QHBoxLayout *layout_outbound_controls;
|
||||
QHBoxLayout *layout_buttons;
|
||||
|
||||
signals:
|
||||
//SIGNALS
|
||||
|
||||
public slots:
|
||||
//SLOTS
|
||||
void button_ToggleServer_Clicked();
|
||||
void button_Cancel_Clicked();
|
||||
|
||||
};
|
||||
|
||||
#endif // CASTEROSCSERVERCONFIGPICKER_H
|
||||
@ -47,24 +47,30 @@
|
||||
#include <QLinearGradient>
|
||||
#include <QGraphicsDropShadowEffect>
|
||||
#include <QFileDialog>
|
||||
#include "libs/osc/composer/OscMessageComposer.h"
|
||||
|
||||
//Constructor
|
||||
CasterPlayerWidget::CasterPlayerWidget(QWidget* parent) : QWidget(parent)
|
||||
{
|
||||
// ID
|
||||
id = new QString("");
|
||||
|
||||
//Set Widget Defaults
|
||||
this->setAcceptDrops(true);
|
||||
|
||||
//Init Player
|
||||
player = new QMediaPlayer();
|
||||
player = new QMediaPlayer(this);
|
||||
playStateImage = new QImage;
|
||||
playStateImage->load(":/res/img/playState_playing.png");
|
||||
//Init Properties
|
||||
playerState = new CasterPlayerState;
|
||||
soundFilePath = new QString("");
|
||||
hotKeyLetter = new QString("1");
|
||||
progress = 0.0;
|
||||
volume = 100;
|
||||
playerState->volume = 100;
|
||||
trackBarWasChangedByPlayer = false;
|
||||
playerState = new CasterPlayerState;
|
||||
|
||||
isAudioDucked = false;
|
||||
|
||||
//Diag
|
||||
cuePicker = new CasterCuePicker(0, 0);
|
||||
@ -100,17 +106,17 @@ CasterPlayerWidget::CasterPlayerWidget(QWidget* parent) : QWidget(parent)
|
||||
/* Open File Button */
|
||||
openFileButton = new QPushButton("");
|
||||
openFileButton->setIcon(QIcon(":/res/img/openMusic.png"));
|
||||
openFileButton->setIconSize(QSize(32,32));
|
||||
openFileButton->setIconSize(QSize(28,28));
|
||||
openFileButton->setFlat(true);
|
||||
/* Set Cue Button */
|
||||
setCueButton = new QPushButton("");
|
||||
setCueButton->setIcon(QIcon(":/res/img/cue.png"));
|
||||
setCueButton->setIconSize(QSize(32,32));
|
||||
setCueButton->setIconSize(QSize(28,28));
|
||||
setCueButton->setFlat(true);
|
||||
/* Toggle Loop Button */
|
||||
toggleLoopButton = new QPushButton("");
|
||||
toggleLoopButton->setIcon(QIcon(":/res/img/no_loop"));
|
||||
toggleLoopButton->setIconSize(QSize(32,32));
|
||||
toggleLoopButton->setIconSize(QSize(28,28));
|
||||
toggleLoopButton->setFlat(true);
|
||||
/* Sub Menu Button */
|
||||
colorPickerButton = new QPushButton("");
|
||||
@ -121,7 +127,7 @@ CasterPlayerWidget::CasterPlayerWidget(QWidget* parent) : QWidget(parent)
|
||||
/* Edit Notes Button */
|
||||
editNotesButton = new QPushButton("");
|
||||
editNotesButton->setIcon(QIcon(":/res/img/notes.png"));
|
||||
editNotesButton->setIconSize(QSize(32,32));
|
||||
editNotesButton->setIconSize(QSize(28,28));
|
||||
editNotesButton->setFlat(true);
|
||||
/* Volume Slider */
|
||||
volumeSlider = new QSlider(Qt::Vertical);
|
||||
@ -223,6 +229,46 @@ CasterPlayerWidget::CasterPlayerWidget(QWidget* parent) : QWidget(parent)
|
||||
void CasterPlayerWidget::setHotKeyLetter(QString hotKey)
|
||||
{
|
||||
hotKeyLabel->setText(hotKey);
|
||||
this->id = new QString(hotKey.toUtf8());
|
||||
}
|
||||
|
||||
void CasterPlayerWidget::syncWithOSCClient()
|
||||
{
|
||||
//Update Volume
|
||||
OscMessageComposer* msg1 = writeOSCMessage("/cbp/" + this->id->toUtf8() + "/m/vol", (float)(volumeSlider->value()/100.0) );
|
||||
emit updateOSCClient(msg1);
|
||||
|
||||
//Update Track Position
|
||||
OscMessageComposer* msg2 = writeOSCMessage("/cbp/" + this->id->toUtf8() + "/m/t_p_p", (float)((float)trackBar->value()/100.0) );
|
||||
emit updateOSCClient(msg2);
|
||||
|
||||
//Update Title
|
||||
OscMessageComposer* msg3 = writeOSCMessage("/cbp/" + this->id->toUtf8() + "/m/label/tr_name", this->soundNameLabel->text());
|
||||
emit updateOSCClient(msg3);
|
||||
|
||||
//Update Loop State
|
||||
OscMessageComposer* msg4 = writeOSCMessage("/cbp/" + this->id->toUtf8() + "/m/l_s", (int)(playerState->loop));
|
||||
emit updateOSCClient(msg4);
|
||||
|
||||
//Update Time
|
||||
QStringList times = this->timeLabel->text().split("\n");
|
||||
OscMessageComposer* msg5 = writeOSCMessage("/cbp/" + this->id->toUtf8() + "/m/label/time", times.value(0) + times.value(1));
|
||||
emit updateOSCClient(msg5);
|
||||
|
||||
//Update Play State
|
||||
if(player->state() == QMediaPlayer::PlayingState){
|
||||
OscMessageComposer* msg6 = writeOSCMessage("/cbp/" + this->id->toUtf8() + "/m/label/p_s", "Playing");
|
||||
emit updateOSCClient(msg6);
|
||||
}
|
||||
else if(player->state() == QMediaPlayer::PausedState){
|
||||
OscMessageComposer* msg6 = writeOSCMessage("/cbp/" + this->id->toUtf8() + "/m/label/p_s", "Paused");
|
||||
emit updateOSCClient(msg6);
|
||||
}
|
||||
else if (player->state() == QMediaPlayer::StoppedState){
|
||||
OscMessageComposer* msg6 = writeOSCMessage("/cbp/" + this->id->toUtf8() + "/m/label/p_s", "Stopped");
|
||||
emit updateOSCClient(msg6);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//----SIGNALS----
|
||||
@ -231,7 +277,7 @@ void CasterPlayerWidget::setHotKeyLetter(QString hotKey)
|
||||
void CasterPlayerWidget::playerToggle()
|
||||
{
|
||||
//CURRENT PLAY STATE TOGGLE LOGIC
|
||||
player->setVolume(volume);
|
||||
volumeSlider->setValue(playerState->volume);
|
||||
if(player->state() == QMediaPlayer::PlayingState)
|
||||
{
|
||||
player->stop();
|
||||
@ -250,12 +296,16 @@ void CasterPlayerWidget::playerToggle()
|
||||
|
||||
void CasterPlayerWidget::volumeChanged(int value)
|
||||
{
|
||||
//Update volume change
|
||||
volume = value;
|
||||
player->setVolume(volume);
|
||||
|
||||
//Update Player Save State
|
||||
playerState->volume = volume;
|
||||
playerState->volume = value;
|
||||
if(isAudioDucked)
|
||||
player->setVolume(playerState->volume * 0.33);
|
||||
else
|
||||
player->setVolume(playerState->volume);
|
||||
|
||||
//Update OSC Client
|
||||
OscMessageComposer* msg = writeOSCMessage("/cbp/" + this->id->toUtf8() + "/m/vol", (float)(playerState->volume/100.0) );
|
||||
emit updateOSCClient(msg);
|
||||
}
|
||||
|
||||
/* Track Barn Position Changed */
|
||||
@ -267,6 +317,10 @@ void CasterPlayerWidget::trackBarChanged(int value)
|
||||
player->setPosition(position);
|
||||
}
|
||||
|
||||
//Update OSC Client
|
||||
OscMessageComposer* msg = writeOSCMessage("/cbp/" + this->id->toUtf8() + "/m/t_p_p", (float)((float)trackBar->value()/100.0) );
|
||||
emit updateOSCClient(msg);
|
||||
|
||||
}
|
||||
|
||||
/* Load Sound From Dialog */
|
||||
@ -347,9 +401,17 @@ void CasterPlayerWidget::toggleLooping()
|
||||
if(playerState->loop == true){
|
||||
toggleLoopButton->setIcon(QIcon(":/res/img/no_loop"));
|
||||
playerState->loop = false;
|
||||
|
||||
//Update OSC Client
|
||||
OscMessageComposer* msg = writeOSCMessage("/cbp/" + this->id->toUtf8() + "/m/l_s", 0);
|
||||
emit updateOSCClient(msg);
|
||||
} else {
|
||||
toggleLoopButton->setIcon(QIcon(":/res/img/loop"));
|
||||
playerState->loop = true;
|
||||
|
||||
//Update OSC Client
|
||||
OscMessageComposer* msg = writeOSCMessage("/cbp/" + this->id->toUtf8() + "/m/l_s", 1);
|
||||
emit updateOSCClient(msg);
|
||||
}
|
||||
}
|
||||
|
||||
@ -379,6 +441,10 @@ void CasterPlayerWidget::playerPositionChanged(qint64 position)
|
||||
trackBarWasChangedByPlayer = false;
|
||||
this->update();
|
||||
|
||||
//Update OSC Client
|
||||
OscMessageComposer* msg = writeOSCMessage("/cbp/" + this->id->toUtf8() + "/m/label/time", currentTime + "/" + timeRemaining);
|
||||
emit updateOSCClient(msg);
|
||||
|
||||
/* Enforce Start Time And Stop And Looping */
|
||||
if(position >= playerState->stopTime)
|
||||
{
|
||||
@ -405,15 +471,27 @@ void CasterPlayerWidget::playerStateChanged(QMediaPlayer::State state)
|
||||
if(state == QMediaPlayer::PlayingState)
|
||||
{
|
||||
playStateButton->setIcon(QIcon(":/res/img/play.png"));
|
||||
|
||||
//Update OSC Client
|
||||
OscMessageComposer* msg = writeOSCMessage("/cbp/" + this->id->toUtf8() + "/m/label/p_s", "Playing");
|
||||
emit updateOSCClient(msg);
|
||||
}
|
||||
else if(state == QMediaPlayer::PausedState)
|
||||
{
|
||||
playStateButton->setIcon(QIcon(":/res/img/pause.png"));
|
||||
|
||||
//Update OSC Client
|
||||
OscMessageComposer* msg = writeOSCMessage("/cbp/" + this->id->toUtf8() + "/m/label/p_s", "Paused");
|
||||
emit updateOSCClient(msg);
|
||||
}
|
||||
else if (state == QMediaPlayer::StoppedState)
|
||||
{
|
||||
playStateButton->setIcon(QIcon(":/res/img/stop.png"));
|
||||
|
||||
//Update OSC Client
|
||||
OscMessageComposer* msg = writeOSCMessage("/cbp/" + this->id->toUtf8() + "/m/label/p_s", "Stopped");
|
||||
emit updateOSCClient(msg);
|
||||
|
||||
progress = 0;
|
||||
int timeLeft = player->duration();
|
||||
int seconds = (int) (timeLeft / 1000) % 60 ;
|
||||
@ -434,11 +512,19 @@ void CasterPlayerWidget::playerMetaDataChanged()
|
||||
{
|
||||
//Use metadata title
|
||||
soundNameLabel->setText(player->metaData(QMediaMetaData::Title).toString());
|
||||
|
||||
//Update OSC Client
|
||||
OscMessageComposer* msg = writeOSCMessage("/cbp/" + this->id->toUtf8() + "/m/label/tr_name", player->metaData(QMediaMetaData::Title).toString());
|
||||
emit updateOSCClient(msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
//Use filename as title
|
||||
soundNameLabel->setText(fi.baseName());
|
||||
|
||||
//Update OSC Client
|
||||
OscMessageComposer* msg = writeOSCMessage("/cbp/" + this->id->toUtf8() + "/m/label/tr_name", fi.baseName());
|
||||
emit updateOSCClient(msg);
|
||||
}
|
||||
|
||||
//Hack solution to prevent playing when when meadia loaded.
|
||||
@ -484,16 +570,95 @@ int CasterPlayerWidget::getProgressWidth()
|
||||
//===============Player Methods=================
|
||||
void CasterPlayerWidget::playSound()
|
||||
{
|
||||
player->setVolume(volume);
|
||||
volumeSlider->setValue(playerState->volume);
|
||||
player->setPosition(playerState->startTime);
|
||||
player->play();
|
||||
}
|
||||
|
||||
void CasterPlayerWidget::resumeSound()
|
||||
{
|
||||
volumeSlider->setValue(playerState->volume);
|
||||
player->play();
|
||||
}
|
||||
|
||||
void CasterPlayerWidget::pauseSound()
|
||||
{
|
||||
volumeSlider->setValue(playerState->volume);
|
||||
player->pause();
|
||||
}
|
||||
|
||||
void CasterPlayerWidget::stopSound()
|
||||
{
|
||||
player->setVolume(volume);
|
||||
volumeSlider->setValue(playerState->volume);
|
||||
player->stop();
|
||||
}
|
||||
|
||||
void CasterPlayerWidget::play_stop_toggle()
|
||||
{
|
||||
// Toggle play state
|
||||
// Play/Pause
|
||||
//CURRENT PLAY STATE TOGGLE LOGIC
|
||||
volumeSlider->setValue(playerState->volume);
|
||||
if(player->state() == QMediaPlayer::PlayingState)
|
||||
{
|
||||
player->stop();
|
||||
}
|
||||
else if (player->state() == QMediaPlayer::StoppedState)
|
||||
{
|
||||
player->setPosition(playerState->startTime);
|
||||
player->play();
|
||||
}
|
||||
else if(player->state() == QMediaPlayer::PausedState)
|
||||
{
|
||||
player->setPosition(playerState->startTime);
|
||||
player->play();
|
||||
}
|
||||
}
|
||||
|
||||
void CasterPlayerWidget::resume_pause_toggle()
|
||||
{
|
||||
// Toggle play state
|
||||
// Play/Pause
|
||||
//CURRENT PLAY STATE TOGGLE LOGIC
|
||||
volumeSlider->setValue(playerState->volume);
|
||||
if(player->state() == QMediaPlayer::PlayingState)
|
||||
{
|
||||
player->pause();
|
||||
}
|
||||
else if (player->state() == QMediaPlayer::StoppedState)
|
||||
{
|
||||
player->setPosition(playerState->startTime);
|
||||
player->play();
|
||||
}
|
||||
else if(player->state() == QMediaPlayer::PausedState)
|
||||
{
|
||||
player->play();
|
||||
}
|
||||
}
|
||||
|
||||
void CasterPlayerWidget::setLoopState(int state)
|
||||
{
|
||||
if(state == 0){
|
||||
toggleLoopButton->setIcon(QIcon(":/res/img/no_loop"));
|
||||
playerState->loop = false;
|
||||
} else if(state == 1) {
|
||||
toggleLoopButton->setIcon(QIcon(":/res/img/loop"));
|
||||
playerState->loop = true;
|
||||
}
|
||||
}
|
||||
|
||||
void CasterPlayerWidget::setAudioDuckState(int state)
|
||||
{
|
||||
if(state == 0){
|
||||
isAudioDucked = false;
|
||||
player->setVolume(playerState->volume);
|
||||
} else if(state == 1) {
|
||||
isAudioDucked = true;
|
||||
player->setVolume(playerState->volume * 0.33);
|
||||
}
|
||||
this->update();
|
||||
}
|
||||
|
||||
//==================================================
|
||||
|
||||
//Protected Methods
|
||||
@ -541,6 +706,7 @@ void CasterPlayerWidget::dropEvent(QDropEvent *event)
|
||||
msgBox.setDefaultButton(QMessageBox::Close);
|
||||
msgBox.setModal(true);
|
||||
int ret = msgBox.exec();
|
||||
Q_UNUSED(ret);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -563,7 +729,7 @@ bool CasterPlayerWidget::openFiles(const QStringList& pathList)
|
||||
fi.suffix() == "wmv")
|
||||
{
|
||||
soundFilePath = new QString(pathList[0]);//Sets File Path
|
||||
player->setVolume(volume);
|
||||
volumeSlider->setValue(playerState->volume);
|
||||
player->setMedia(QUrl::fromLocalFile(soundFilePath->toUtf8().constData()));
|
||||
newMediaLoaded = true;
|
||||
|
||||
@ -584,10 +750,11 @@ bool CasterPlayerWidget::openFiles(const QStringList& pathList)
|
||||
/* When user touches wiget it toggles the player state (Play/Pause/Stop) */
|
||||
void CasterPlayerWidget::mousePressEvent(QMouseEvent *event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
// Toggle play state
|
||||
// Play/Pause
|
||||
//CURRENT PLAY STATE TOGGLE LOGIC
|
||||
player->setVolume(volume);
|
||||
volumeSlider->setValue(playerState->volume);
|
||||
if(player->state() == QMediaPlayer::PlayingState)
|
||||
{
|
||||
player->pause();
|
||||
@ -608,12 +775,14 @@ void CasterPlayerWidget::mousePressEvent(QMouseEvent *event)
|
||||
//===========Focus Event===========
|
||||
void CasterPlayerWidget::mouseMoveEvent(QMouseEvent *event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
this->setFocus();
|
||||
}
|
||||
|
||||
//===========Paint Event===========
|
||||
void CasterPlayerWidget::paintEvent(QPaintEvent *event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
//Make widget render it's own style sheet.
|
||||
QStyleOption opt;
|
||||
opt.init(this);
|
||||
@ -670,6 +839,12 @@ void CasterPlayerWidget::paintEvent(QPaintEvent *event)
|
||||
// Draw Play State
|
||||
p.drawImage(this->width()/2 - playStateImage->width()/2, this->height()/2 - playStateImage->height()/2, *playStateImage);
|
||||
|
||||
// Draw Audio Ducking Indicator
|
||||
if(isAudioDucked){
|
||||
playStateImage->load(":/res/img/33_percent.png");
|
||||
p.drawImage(this->width()/2 - playStateImage->scaled(64,64).width()/2, this->height()/2 - playStateImage->scaled(64,64).height()/2, playStateImage->scaled(64,64));
|
||||
}
|
||||
|
||||
}
|
||||
//====================================
|
||||
|
||||
@ -693,8 +868,31 @@ void CasterPlayerWidget::reloadFromPlayerState()
|
||||
pathList.append(playerState->filePath->toUtf8());
|
||||
newMediaLoadedFromProfile = true;
|
||||
openFiles(pathList);
|
||||
player->setVolume(playerState->volume);
|
||||
volumeSlider->setValue(playerState->volume);
|
||||
newMediaLoadedFromProfile = false;
|
||||
|
||||
}
|
||||
|
||||
|
||||
//========================================================
|
||||
//==========OSC Composer Methods=====
|
||||
OscMessageComposer* CasterPlayerWidget::writeOSCMessage(QString address, int value){
|
||||
// Compose OSC Message
|
||||
OscMessageComposer* msg = new OscMessageComposer(address);
|
||||
msg->pushInt32((qint32)value);
|
||||
return msg;
|
||||
}
|
||||
|
||||
OscMessageComposer* CasterPlayerWidget::writeOSCMessage(QString address, float value){
|
||||
// Compose OSC Message
|
||||
OscMessageComposer* msg = new OscMessageComposer(address);
|
||||
msg->pushFloat(value);
|
||||
return msg;
|
||||
}
|
||||
|
||||
OscMessageComposer* CasterPlayerWidget::writeOSCMessage(QString address, QString value){
|
||||
// Compose OSC Message
|
||||
OscMessageComposer* msg = new OscMessageComposer(address);
|
||||
msg->pushString(value.toUtf8());
|
||||
return msg;
|
||||
}
|
||||
|
||||
@ -25,6 +25,7 @@
|
||||
#include <QWidget>
|
||||
#include <QDropEvent>
|
||||
#include <QtMultimedia/QMediaPlayer>
|
||||
#include "libs/osc/composer/OscMessageComposer.h"
|
||||
|
||||
//forward declarations
|
||||
class QMediaPlayer;
|
||||
@ -48,44 +49,12 @@ public:
|
||||
|
||||
//Set Properties
|
||||
void setHotKeyLetter(QString hotKey);
|
||||
void syncWithOSCClient();
|
||||
|
||||
//Media Player
|
||||
QMediaPlayer *player;
|
||||
QImage *playStateImage;
|
||||
|
||||
//Player Methhods
|
||||
void playSound();//Plays sound
|
||||
void stopSound();//Stops sound
|
||||
|
||||
//Properties
|
||||
QString *soundFilePath;
|
||||
QString *hotKeyLetter;
|
||||
float progress;
|
||||
int volume;
|
||||
bool trackBarWasChangedByPlayer;// Used to prevent player from tiggering track bar progress changed event
|
||||
CasterPlayerState *playerState;
|
||||
|
||||
//Methods
|
||||
void reloadFromPlayerState();
|
||||
|
||||
protected:
|
||||
//Focus Event
|
||||
void mouseMoveEvent(QMouseEvent *event);
|
||||
//Paint Event
|
||||
void paintEvent(QPaintEvent *event); //Overide Paint Event
|
||||
//Drag-N-Drop Events
|
||||
void dragEnterEvent(QDragEnterEvent *event);
|
||||
void dragMoveEvent(QDragMoveEvent *event);
|
||||
void dragLeaveEvent(QDragLeaveEvent *event);
|
||||
void dropEvent(QDropEvent *event);
|
||||
bool openFiles(const QStringList& pathList);
|
||||
// Press/Touch Events
|
||||
void mousePressEvent(QMouseEvent *event);
|
||||
|
||||
private:
|
||||
//Private Methods
|
||||
int getProgressWidth(); //Use to compute width of progress bar
|
||||
|
||||
//contained widgets:
|
||||
QVBoxLayout *mainLayout;
|
||||
QHBoxLayout *subMainLayoutH;
|
||||
@ -107,6 +76,49 @@ private:
|
||||
QSlider *trackBar;
|
||||
QSlider *volumeSlider;
|
||||
|
||||
//Player Methhods
|
||||
void playSound();//Plays sound
|
||||
void resumeSound();//Plays from where it left off sound
|
||||
void pauseSound();//Pauses sound
|
||||
void stopSound();//Stops sound
|
||||
void play_stop_toggle();
|
||||
void resume_pause_toggle();
|
||||
void setLoopState(int state);//Sets loop state
|
||||
void setAudioDuckState(int state);//Set duck state
|
||||
|
||||
//Properties
|
||||
QString *soundFilePath;
|
||||
QString *hotKeyLetter;
|
||||
float progress;
|
||||
bool trackBarWasChangedByPlayer;// Used to prevent player from tiggering track bar progress changed event
|
||||
CasterPlayerState *playerState;
|
||||
|
||||
//Methods
|
||||
void reloadFromPlayerState();
|
||||
|
||||
protected:
|
||||
//Focus Event
|
||||
void mouseMoveEvent(QMouseEvent *event);
|
||||
//Paint Event
|
||||
void paintEvent(QPaintEvent *event); //Overide Paint Event
|
||||
//Drag-N-Drop Events
|
||||
void dragEnterEvent(QDragEnterEvent *event);
|
||||
void dragMoveEvent(QDragMoveEvent *event);
|
||||
void dragLeaveEvent(QDragLeaveEvent *event);
|
||||
void dropEvent(QDropEvent *event);
|
||||
bool openFiles(const QStringList& pathList);
|
||||
// Press/Touch Events
|
||||
void mousePressEvent(QMouseEvent *event);
|
||||
|
||||
private:
|
||||
//Proeprties
|
||||
QString *id;
|
||||
bool isAudioDucked;
|
||||
|
||||
//Private Methods
|
||||
int getProgressWidth(); //Use to compute width of progress bar
|
||||
|
||||
|
||||
// Diag
|
||||
CasterCuePicker *cuePicker;
|
||||
CasterLabelColorPicker *colorPicker;
|
||||
@ -115,8 +127,15 @@ private:
|
||||
bool newMediaLoaded;
|
||||
bool newMediaLoadedFromProfile;
|
||||
|
||||
//METHODS
|
||||
//OSC Composer Methods
|
||||
OscMessageComposer* writeOSCMessage(QString address, int value);
|
||||
OscMessageComposer* writeOSCMessage(QString address, float value);
|
||||
OscMessageComposer* writeOSCMessage(QString address, QString value);
|
||||
|
||||
signals:
|
||||
//MyWidget's signals....
|
||||
void updateOSCClient(OscMessageComposer* message);
|
||||
|
||||
public slots:
|
||||
void playerToggle();
|
||||
|
||||
@ -4,15 +4,30 @@
|
||||
#
|
||||
#-------------------------------------------------
|
||||
|
||||
linux {
|
||||
isEmpty(PREFIX) {
|
||||
PREFIX = /usr/local
|
||||
}
|
||||
BINDIR = $$PREFIX/bin
|
||||
DATADIR = $$PREFIX/share
|
||||
}
|
||||
|
||||
QT += core gui multimedia
|
||||
macx {
|
||||
isEmpty(PREFIX) {
|
||||
PREFIX = ~
|
||||
}
|
||||
BINDIR = $$PREFIX/Applications
|
||||
DATADIR = $$PREFIX/Library/Application\ Support/CasterSoundboard
|
||||
}
|
||||
|
||||
CONFIG += c++11
|
||||
QT += core gui multimedia network
|
||||
|
||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||||
|
||||
TARGET = CasterSoundboard
|
||||
TEMPLATE = app
|
||||
|
||||
|
||||
SOURCES += main.cpp\
|
||||
CasterPlayer.cpp \
|
||||
CasterBoard.cpp \
|
||||
@ -20,7 +35,39 @@ SOURCES += main.cpp\
|
||||
CasterLabelColorPicker.cpp \
|
||||
CSS.cpp \
|
||||
CasterPlayerState.cpp \
|
||||
CasterCuePicker.cpp
|
||||
CasterCuePicker.cpp \
|
||||
libs/osc/composer/OscBundleComposer.cpp \
|
||||
libs/osc/composer/OscContentComposer.cpp \
|
||||
libs/osc/composer/OscMessageComposer.cpp \
|
||||
libs/osc/reader/types/OscAddress.cpp \
|
||||
libs/osc/reader/types/OscArrayBegin.cpp \
|
||||
libs/osc/reader/types/OscArrayEnd.cpp \
|
||||
libs/osc/reader/types/OscBlob.cpp \
|
||||
libs/osc/reader/types/OscChar.cpp \
|
||||
libs/osc/reader/types/OscDouble.cpp \
|
||||
libs/osc/reader/types/OscFalse.cpp \
|
||||
libs/osc/reader/types/OscFloat.cpp \
|
||||
libs/osc/reader/types/OscInfinitum.cpp \
|
||||
libs/osc/reader/types/OscInteger.cpp \
|
||||
libs/osc/reader/types/OscLong.cpp \
|
||||
libs/osc/reader/types/OscMidi.cpp \
|
||||
libs/osc/reader/types/OscNil.cpp \
|
||||
libs/osc/reader/types/OscRGBA.cpp \
|
||||
libs/osc/reader/types/OscString.cpp \
|
||||
libs/osc/reader/types/OscSymbol.cpp \
|
||||
libs/osc/reader/types/OscTags.cpp \
|
||||
libs/osc/reader/types/OscTimeTag.cpp \
|
||||
libs/osc/reader/types/OscTrue.cpp \
|
||||
libs/osc/reader/OscBundle.cpp \
|
||||
libs/osc/reader/OscContent.cpp \
|
||||
libs/osc/reader/OscMessage.cpp \
|
||||
libs/osc/reader/OscReader.cpp \
|
||||
libs/osc/reader/OscValue.cpp \
|
||||
libs/osc/OscPatternMatching.cpp \
|
||||
libs/tools/ByteBuffer.cpp \
|
||||
libs/tools/ByteOrder.cpp \
|
||||
libs/tools/NtpTimestamp.cpp \
|
||||
CasterOSCServerConfigPicker.cpp
|
||||
|
||||
HEADERS += \
|
||||
CasterPlayer.h \
|
||||
@ -29,9 +76,87 @@ HEADERS += \
|
||||
MainWindow.h \
|
||||
CasterLabelColorPicker.h \
|
||||
CasterPlayerState.h \
|
||||
CasterCuePicker.h
|
||||
CasterCuePicker.h \
|
||||
libs/osc/composer/OscBundleComposer.h \
|
||||
libs/osc/composer/OscContentComposer.h \
|
||||
libs/osc/composer/OscMessageComposer.h \
|
||||
libs/osc/exceptions/BooleanConversionException.h \
|
||||
libs/osc/exceptions/BytesConversionException.h \
|
||||
libs/osc/exceptions/CharConversionException.h \
|
||||
libs/osc/exceptions/DoubleConversionException.h \
|
||||
libs/osc/exceptions/FloatConversionException.h \
|
||||
libs/osc/exceptions/GetBundleException.h \
|
||||
libs/osc/exceptions/GetMessageException.h \
|
||||
libs/osc/exceptions/IntegerConversionException.h \
|
||||
libs/osc/exceptions/LongConversionException.h \
|
||||
libs/osc/exceptions/MalformedArrayException.h \
|
||||
libs/osc/exceptions/MalformedBundleException.h \
|
||||
libs/osc/exceptions/MidiConversionException.h \
|
||||
libs/osc/exceptions/OSC_ALL_EXCEPTIONS.h \
|
||||
libs/osc/exceptions/OutOfBoundsReadException.h \
|
||||
libs/osc/exceptions/ReadMessageException.h \
|
||||
libs/osc/exceptions/RgbaConversionException.h \
|
||||
libs/osc/exceptions/StringConversionException.h \
|
||||
libs/osc/exceptions/SymbolConversionException.h \
|
||||
libs/osc/exceptions/TimetagConversionException.h \
|
||||
libs/osc/exceptions/UnknownTagException.h \
|
||||
libs/osc/reader/types/Midi.h \
|
||||
libs/osc/reader/types/OscAddress.h \
|
||||
libs/osc/reader/types/OscArrayBegin.h \
|
||||
libs/osc/reader/types/OscArrayEnd.h \
|
||||
libs/osc/reader/types/OscBlob.h \
|
||||
libs/osc/reader/types/OscChar.h \
|
||||
libs/osc/reader/types/OscDouble.h \
|
||||
libs/osc/reader/types/OscFalse.h \
|
||||
libs/osc/reader/types/OscFloat.h \
|
||||
libs/osc/reader/types/OscInfinitum.h \
|
||||
libs/osc/reader/types/OscInteger.h \
|
||||
libs/osc/reader/types/OscLong.h \
|
||||
libs/osc/reader/types/OscMidi.h \
|
||||
libs/osc/reader/types/OscNil.h \
|
||||
libs/osc/reader/types/OscRGBA.h \
|
||||
libs/osc/reader/types/OscString.h \
|
||||
libs/osc/reader/types/OscSymbol.h \
|
||||
libs/osc/reader/types/OscTags.h \
|
||||
libs/osc/reader/types/OscTimetag.h \
|
||||
libs/osc/reader/types/OscTrue.h \
|
||||
libs/osc/reader/types/OscValue.h \
|
||||
libs/osc/reader/types/RGBA.h \
|
||||
libs/osc/reader/types/Symbol.h \
|
||||
libs/osc/reader/OscBundle.h \
|
||||
libs/osc/reader/OscContent.h \
|
||||
libs/osc/reader/OscMessage.h \
|
||||
libs/osc/reader/OscReader.h \
|
||||
libs/osc/OscAPI.h \
|
||||
libs/osc/OscPatternMatching.h \
|
||||
libs/osc/OscVersion.h \
|
||||
libs/tools/exceptions/BufferOverflowException.h \
|
||||
libs/tools/exceptions/BufferUnderflowException.h \
|
||||
libs/tools/exceptions/IllegalArgumentException.h \
|
||||
libs/tools/exceptions/IndexOutOfBoundsException.h \
|
||||
libs/tools/ByteBuffer.h \
|
||||
libs/tools/ByteOrder.h \
|
||||
libs/tools/NtpTimestamp.h \
|
||||
CasterOSCServerConfigPicker.h
|
||||
|
||||
FORMS +=
|
||||
RESOURCES += res.qrc
|
||||
|
||||
RESOURCES += \
|
||||
res.qrc
|
||||
linux {
|
||||
appdata.files = ../dist/linux/CasterSoundboard.appdata.xml
|
||||
appdata.path = $$DATADIR/appdata/
|
||||
|
||||
desktop.files = ../dist/linux/CasterSoundboard.desktop
|
||||
desktop.path = $$DATADIR/applications/
|
||||
|
||||
pixmap.files = ../dist/linux/CasterSoundboard.png
|
||||
pixmap.path = $$DATADIR/pixmaps/
|
||||
|
||||
INSTALLS += appdata desktop pixmap
|
||||
}
|
||||
|
||||
macx {
|
||||
ICON = ../dist/macos/CasterSoundboard.icns
|
||||
}
|
||||
|
||||
target.path = $$BINDIR
|
||||
INSTALLS += target
|
||||
|
||||
@ -1,336 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE QtCreatorProject>
|
||||
<!-- Written by QtCreator 4.2.2, 2017-05-10T01:41:19. -->
|
||||
<qtcreator>
|
||||
<data>
|
||||
<variable>EnvironmentId</variable>
|
||||
<value type="QByteArray">{50358eb3-48cf-418f-8201-244c0b8cf771}</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.ActiveTarget</variable>
|
||||
<value type="int">0</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.EditorSettings</variable>
|
||||
<valuemap type="QVariantMap">
|
||||
<value type="bool" key="EditorConfiguration.AutoIndent">true</value>
|
||||
<value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
|
||||
<value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value>
|
||||
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
|
||||
<value type="QString" key="language">Cpp</value>
|
||||
<valuemap type="QVariantMap" key="value">
|
||||
<value type="QByteArray" key="CurrentPreferences">CppGlobal</value>
|
||||
</valuemap>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
|
||||
<value type="QString" key="language">QmlJS</value>
|
||||
<valuemap type="QVariantMap" key="value">
|
||||
<value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value>
|
||||
</valuemap>
|
||||
</valuemap>
|
||||
<value type="int" key="EditorConfiguration.CodeStyle.Count">2</value>
|
||||
<value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value>
|
||||
<value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
|
||||
<value type="int" key="EditorConfiguration.IndentSize">4</value>
|
||||
<value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>
|
||||
<value type="int" key="EditorConfiguration.MarginColumn">80</value>
|
||||
<value type="bool" key="EditorConfiguration.MouseHiding">true</value>
|
||||
<value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
|
||||
<value type="int" key="EditorConfiguration.PaddingMode">1</value>
|
||||
<value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
|
||||
<value type="bool" key="EditorConfiguration.ShowMargin">false</value>
|
||||
<value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>
|
||||
<value type="bool" key="EditorConfiguration.SmartSelectionChanging">true</value>
|
||||
<value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
|
||||
<value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
|
||||
<value type="int" key="EditorConfiguration.TabSize">8</value>
|
||||
<value type="bool" key="EditorConfiguration.UseGlobal">true</value>
|
||||
<value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
|
||||
<value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
|
||||
<value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
|
||||
<value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
|
||||
<value type="bool" key="EditorConfiguration.inEntireDocument">false</value>
|
||||
</valuemap>
|
||||
</data>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.PluginSettings</variable>
|
||||
<valuemap type="QVariantMap"/>
|
||||
</data>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.Target.0</variable>
|
||||
<valuemap type="QVariantMap">
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop Qt 5.8.0 GCC 64bit</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop Qt 5.8.0 GCC 64bit</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">qt.58.gcc_64_kit</value>
|
||||
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
|
||||
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
|
||||
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/oscar/Documents/GIT/CasterSoundboard/build-CasterSoundboard-Desktop_Qt_5_8_0_GCC_64bit-Debug</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">true</value>
|
||||
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">false</value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">false</value>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
||||
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
|
||||
<value type="QString">-w</value>
|
||||
<value type="QString">-r</value>
|
||||
</valuelist>
|
||||
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
||||
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
|
||||
<value type="QString">-w</value>
|
||||
<value type="QString">-r</value>
|
||||
</valuelist>
|
||||
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
|
||||
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
|
||||
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Debug</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
|
||||
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
|
||||
<value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/oscar/Documents/GIT/CasterSoundboard/build-CasterSoundboard-Desktop_Qt_5_8_0_GCC_64bit-Release</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
|
||||
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">false</value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">false</value>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
||||
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
|
||||
<value type="QString">-w</value>
|
||||
<value type="QString">-r</value>
|
||||
</valuelist>
|
||||
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
||||
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
|
||||
<value type="QString">-w</value>
|
||||
<value type="QString">-r</value>
|
||||
</valuelist>
|
||||
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
|
||||
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
|
||||
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
|
||||
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
|
||||
<value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.2">
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/oscar/Documents/GIT/CasterSoundboard/build-CasterSoundboard-Desktop_Qt_5_8_0_GCC_64bit-Profile</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">true</value>
|
||||
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">true</value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">false</value>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
||||
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
|
||||
<value type="QString">-w</value>
|
||||
<value type="QString">-r</value>
|
||||
</valuelist>
|
||||
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
||||
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
|
||||
<value type="QString">-w</value>
|
||||
<value type="QString">-r</value>
|
||||
</valuelist>
|
||||
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
|
||||
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
|
||||
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Profile</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
|
||||
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
|
||||
<value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">3</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy locally</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
|
||||
<value type="bool" key="Analyzer.QmlProfiler.AggregateTraces">false</value>
|
||||
<value type="bool" key="Analyzer.QmlProfiler.FlushEnabled">false</value>
|
||||
<value type="uint" key="Analyzer.QmlProfiler.FlushInterval">1000</value>
|
||||
<value type="QString" key="Analyzer.QmlProfiler.LastTraceFile"></value>
|
||||
<value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value>
|
||||
<valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
|
||||
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
|
||||
<value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
|
||||
<value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
|
||||
<value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value>
|
||||
<value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
|
||||
<valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
|
||||
<value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
|
||||
<value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
|
||||
<valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
|
||||
<value type="int">0</value>
|
||||
<value type="int">1</value>
|
||||
<value type="int">2</value>
|
||||
<value type="int">3</value>
|
||||
<value type="int">4</value>
|
||||
<value type="int">5</value>
|
||||
<value type="int">6</value>
|
||||
<value type="int">7</value>
|
||||
<value type="int">8</value>
|
||||
<value type="int">9</value>
|
||||
<value type="int">10</value>
|
||||
<value type="int">11</value>
|
||||
<value type="int">12</value>
|
||||
<value type="int">13</value>
|
||||
<value type="int">14</value>
|
||||
</valuelist>
|
||||
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
|
||||
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">CasterSoundboard</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/home/oscar/Documents/GIT/CasterSoundboard/CasterSoundboard/CasterSoundboard.pro</value>
|
||||
<value type="bool" key="QmakeProjectManager.QmakeRunConfiguration.UseLibrarySearchPath">true</value>
|
||||
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value>
|
||||
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">CasterSoundboard.pro</value>
|
||||
<value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value>
|
||||
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value>
|
||||
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory.default">/home/oscar/Documents/GIT/CasterSoundboard/build-CasterSoundboard-Desktop_Qt_5_8_0_GCC_64bit-Debug</value>
|
||||
<value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
|
||||
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
|
||||
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
|
||||
<value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
|
||||
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
|
||||
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
|
||||
</valuemap>
|
||||
</data>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.TargetCount</variable>
|
||||
<value type="int">1</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.Updater.FileVersion</variable>
|
||||
<value type="int">18</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>Version</variable>
|
||||
<value type="int">18</value>
|
||||
</data>
|
||||
</qtcreator>
|
||||
@ -1,256 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE QtCreatorProject>
|
||||
<!-- Written by QtCreator 2.7.1, 2013-06-05T10:07:54. -->
|
||||
<qtcreator>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.ActiveTarget</variable>
|
||||
<value type="int">0</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.EditorSettings</variable>
|
||||
<valuemap type="QVariantMap">
|
||||
<value type="bool" key="EditorConfiguration.AutoIndent">true</value>
|
||||
<value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
|
||||
<value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value>
|
||||
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
|
||||
<value type="QByteArray" key="language">Cpp</value>
|
||||
<valuemap type="QVariantMap" key="value">
|
||||
<value type="QString" key="CurrentPreferences">CppGlobal</value>
|
||||
</valuemap>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
|
||||
<value type="QByteArray" key="language">QmlJS</value>
|
||||
<valuemap type="QVariantMap" key="value">
|
||||
<value type="QString" key="CurrentPreferences">QmlJSGlobal</value>
|
||||
</valuemap>
|
||||
</valuemap>
|
||||
<value type="int" key="EditorConfiguration.CodeStyle.Count">2</value>
|
||||
<value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value>
|
||||
<value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
|
||||
<value type="int" key="EditorConfiguration.IndentSize">4</value>
|
||||
<value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>
|
||||
<value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
|
||||
<value type="int" key="EditorConfiguration.PaddingMode">1</value>
|
||||
<value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
|
||||
<value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>
|
||||
<value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
|
||||
<value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
|
||||
<value type="int" key="EditorConfiguration.TabSize">8</value>
|
||||
<value type="bool" key="EditorConfiguration.UseGlobal">true</value>
|
||||
<value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
|
||||
<value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
|
||||
<value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
|
||||
<value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
|
||||
<value type="bool" key="EditorConfiguration.inEntireDocument">false</value>
|
||||
</valuemap>
|
||||
</data>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.PluginSettings</variable>
|
||||
<valuemap type="QVariantMap"/>
|
||||
</data>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.Target.0</variable>
|
||||
<valuemap type="QVariantMap">
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop</value>
|
||||
<value type="QByteArray" key="ProjectExplorer.ProjectConfiguration.Id">{9bf0fa5d-dc1c-4228-bcea-48de4389f998}</value>
|
||||
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">1</value>
|
||||
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
|
||||
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QByteArray" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value>
|
||||
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QByteArray" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
||||
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
|
||||
<value type="QString">-w</value>
|
||||
<value type="QString">-r</value>
|
||||
</valuelist>
|
||||
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QByteArray" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QByteArray" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
||||
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
|
||||
<value type="QString">-w</value>
|
||||
<value type="QString">-r</value>
|
||||
</valuelist>
|
||||
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QByteArray" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
|
||||
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
|
||||
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Debug</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QByteArray" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
|
||||
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
|
||||
<value type="QString" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory">/home/oscar/QT-Projects/build-CasterSoundboard-Desktop-Debug</value>
|
||||
<value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QByteArray" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value>
|
||||
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QByteArray" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
||||
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
|
||||
<value type="QString">-w</value>
|
||||
<value type="QString">-r</value>
|
||||
</valuelist>
|
||||
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QByteArray" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QByteArray" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
||||
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
|
||||
<value type="QString">-w</value>
|
||||
<value type="QString">-r</value>
|
||||
</valuelist>
|
||||
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
|
||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QByteArray" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
|
||||
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
|
||||
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QByteArray" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
|
||||
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
|
||||
<value type="QString" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory">/home/oscar/QT-Projects/build-CasterSoundboard-Desktop-Release</value>
|
||||
<value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">2</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QByteArray" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy locally</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QByteArray" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
|
||||
<value type="bool" key="Analyzer.Project.UseGlobal">true</value>
|
||||
<valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
|
||||
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
|
||||
<value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
|
||||
<value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
|
||||
<value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
|
||||
<valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
|
||||
<value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
|
||||
<value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
|
||||
<valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
|
||||
<value type="int">0</value>
|
||||
<value type="int">1</value>
|
||||
<value type="int">2</value>
|
||||
<value type="int">3</value>
|
||||
<value type="int">4</value>
|
||||
<value type="int">5</value>
|
||||
<value type="int">6</value>
|
||||
<value type="int">7</value>
|
||||
<value type="int">8</value>
|
||||
<value type="int">9</value>
|
||||
<value type="int">10</value>
|
||||
<value type="int">11</value>
|
||||
<value type="int">12</value>
|
||||
<value type="int">13</value>
|
||||
<value type="int">14</value>
|
||||
</valuelist>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">CasterSoundboard</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QByteArray" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/home/oscar/QT-Projects/CasterSoundboard/CasterSoundboard.pro</value>
|
||||
<value type="int" key="Qt4ProjectManager.Qt4RunConfiguration.BaseEnvironmentBase">2</value>
|
||||
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value>
|
||||
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">CasterSoundboard.pro</value>
|
||||
<value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value>
|
||||
<value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">false</value>
|
||||
<valuelist type="QVariantList" key="Qt4ProjectManager.Qt4RunConfiguration.UserEnvironmentChanges"/>
|
||||
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value>
|
||||
<value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
|
||||
<value type="bool" key="RunConfiguration.UseCppDebugger">true</value>
|
||||
<value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
|
||||
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
|
||||
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
|
||||
</valuemap>
|
||||
</data>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.TargetCount</variable>
|
||||
<value type="int">1</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.Updater.EnvironmentId</variable>
|
||||
<value type="QString">{f58cfa53-7051-4cd5-9297-7b90ec352035}</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.Updater.FileVersion</variable>
|
||||
<value type="int">12</value>
|
||||
</data>
|
||||
</qtcreator>
|
||||
@ -1,60 +0,0 @@
|
||||
#include "ColorConversion.h"
|
||||
#include <cstdlib>
|
||||
#include <cmath>
|
||||
|
||||
int *getRGB_fromHLS(int H, int S, int L){
|
||||
int *ret = new int[3];
|
||||
|
||||
H = H % 360;
|
||||
double S_ = S / 100.0;
|
||||
double L_ = L / 100.0;
|
||||
|
||||
double C = (1.0 - abs(2.0*L_-1.0)) * S_;
|
||||
double X = C * (1.0 - abs(fmodf(H/60.0, 2.0)-1.0));
|
||||
double m = L_ - C/2.0;
|
||||
|
||||
double R_, G_, B_;
|
||||
|
||||
if(0 <= H && H < 60)
|
||||
{
|
||||
R_ = C;
|
||||
G_ = X;
|
||||
B_ = 0.0;
|
||||
}
|
||||
else if (60 <= H && H < 120)
|
||||
{
|
||||
R_ = X;
|
||||
G_ = C;
|
||||
B_ = 0.0;
|
||||
}
|
||||
else if (120 <= H && H < 180)
|
||||
{
|
||||
R_ = 0.0;
|
||||
G_ = C;
|
||||
B_ = X;
|
||||
}
|
||||
else if (180 <= H && H < 240)
|
||||
{
|
||||
R_ = 0.0;
|
||||
G_ = X;
|
||||
B_ = C;
|
||||
}
|
||||
else if (240 <= H && H < 300)
|
||||
{
|
||||
R_ = X;
|
||||
G_ = 0.0;
|
||||
B_ = C;
|
||||
}
|
||||
else if (300 <= H && H < 360)
|
||||
{
|
||||
R_ = C;
|
||||
G_ = 0.0;
|
||||
B_ = X;
|
||||
}
|
||||
|
||||
ret[0] = (int)(255.0*(R_+m));
|
||||
ret[1] = (int)(255.0*(G_+m));
|
||||
ret[2] = (int)(255.0*(B_+m));
|
||||
|
||||
return ret;
|
||||
}
|
||||
@ -1,186 +0,0 @@
|
||||
#ifndef COLORCONVERSION_H
|
||||
#define COLORCONVERSION_H
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
struct RGB {
|
||||
uint r;
|
||||
uint g;
|
||||
uint b;
|
||||
} ;
|
||||
|
||||
struct HSL {
|
||||
uint h;
|
||||
uint s;
|
||||
uint l;
|
||||
} ;
|
||||
|
||||
void HSLtoRGB_Subfunction(uint& c, const double& temp1, const double& temp2, const double& temp3);
|
||||
|
||||
// This function extracts the hue, saturation, and luminance from "color"
|
||||
// and places these values in h, s, and l respectively.
|
||||
HSL RGBtoHSL(const RGB& rgb)
|
||||
{
|
||||
HSL hsl;
|
||||
|
||||
uint r = rgb.r;
|
||||
uint g = rgb.g;
|
||||
uint b = rgb.b;
|
||||
|
||||
double r_percent = ((double)r)/255;
|
||||
double g_percent = ((double)g)/255;
|
||||
double b_percent = ((double)b)/255;
|
||||
|
||||
double max_color = 0;
|
||||
if((r_percent >= g_percent) && (r_percent >= b_percent))
|
||||
max_color = r_percent;
|
||||
if((g_percent >= r_percent) && (g_percent >= b_percent))
|
||||
max_color = g_percent;
|
||||
if((b_percent >= r_percent) && (b_percent >= g_percent))
|
||||
max_color = b_percent;
|
||||
|
||||
double min_color = 0;
|
||||
if((r_percent <= g_percent) && (r_percent <= b_percent))
|
||||
min_color = r_percent;
|
||||
if((g_percent <= r_percent) && (g_percent <= b_percent))
|
||||
min_color = g_percent;
|
||||
if((b_percent <= r_percent) && (b_percent <= g_percent))
|
||||
min_color = b_percent;
|
||||
|
||||
double L = 0;
|
||||
double S = 0;
|
||||
double H = 0;
|
||||
|
||||
L = (max_color + min_color)/2;
|
||||
|
||||
if(max_color == min_color)
|
||||
{
|
||||
S = 0;
|
||||
H = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(L < .50)
|
||||
{
|
||||
S = (max_color - min_color)/(max_color + min_color);
|
||||
}
|
||||
else
|
||||
{
|
||||
S = (max_color - min_color)/(2 - max_color - min_color);
|
||||
}
|
||||
if(max_color == r_percent)
|
||||
{
|
||||
H = (g_percent - b_percent)/(max_color - min_color);
|
||||
}
|
||||
if(max_color == g_percent)
|
||||
{
|
||||
H = 2 + (b_percent - r_percent)/(max_color - min_color);
|
||||
}
|
||||
if(max_color == b_percent)
|
||||
{
|
||||
H = 4 + (r_percent - g_percent)/(max_color - min_color);
|
||||
}
|
||||
}
|
||||
hsl.s = (uint)(S*100);
|
||||
hsl.l = (uint)(L*100);
|
||||
H = H*60;
|
||||
if(H < 0)
|
||||
H += 360;
|
||||
hsl.h = (uint)H;
|
||||
}
|
||||
|
||||
// This function converts the "color" object to the equivalent RGB values of
|
||||
// the hue, saturation, and luminance passed as h, s, and l respectively
|
||||
RGB HSLtoRGB(const HSL& hsl)
|
||||
{
|
||||
RGB rgb;
|
||||
|
||||
uint r = 0;
|
||||
uint g = 0;
|
||||
uint b = 0;
|
||||
|
||||
uint h = hsl.h;
|
||||
uint s = hsl.s;
|
||||
uint l = hsl.l;
|
||||
|
||||
double L = ((double)hsl.l)/100;
|
||||
double S = ((double)hsl.s)/100;
|
||||
double H = ((double)hsl.h)/360;
|
||||
|
||||
if(s == 0)
|
||||
{
|
||||
r = l;
|
||||
g = l;
|
||||
b = l;
|
||||
}
|
||||
else
|
||||
{
|
||||
double temp1 = 0;
|
||||
if(L < .50)
|
||||
{
|
||||
temp1 = L*(1 + S);
|
||||
}
|
||||
else
|
||||
{
|
||||
temp1 = L + S - (L*S);
|
||||
}
|
||||
|
||||
double temp2 = 2*L - temp1;
|
||||
|
||||
double temp3 = 0;
|
||||
for(int i = 0 ; i < 3 ; i++)
|
||||
{
|
||||
switch(i)
|
||||
{
|
||||
case 0: // red
|
||||
{
|
||||
temp3 = H + .33333;
|
||||
if(temp3 > 1)
|
||||
temp3 -= 1;
|
||||
HSLtoRGB_Subfunction(r,temp1,temp2,temp3);
|
||||
break;
|
||||
}
|
||||
case 1: // green
|
||||
{
|
||||
temp3 = H;
|
||||
HSLtoRGB_Subfunction(g,temp1,temp2,temp3);
|
||||
break;
|
||||
}
|
||||
case 2: // blue
|
||||
{
|
||||
temp3 = H - .33333;
|
||||
if(temp3 < 0)
|
||||
temp3 += 1;
|
||||
HSLtoRGB_Subfunction(b,temp1,temp2,temp3);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
rgb.r = (uint)((((double)r)/100)*255);
|
||||
rgb.g = (uint)((((double)g)/100)*255);
|
||||
rgb.b = (uint)((((double)b)/100)*255);
|
||||
}
|
||||
|
||||
// This is a subfunction of HSLtoRGB
|
||||
void HSLtoRGB_Subfunction(uint& c, const double& temp1, const double& temp2, const double& temp3)
|
||||
{
|
||||
if((temp3 * 6) < 1)
|
||||
c = (uint)((temp2 + (temp1 - temp2)*6*temp3)*100);
|
||||
else
|
||||
if((temp3 * 2) < 1)
|
||||
c = (uint)(temp1*100);
|
||||
else
|
||||
if((temp3 * 3) < 2)
|
||||
c = (uint)((temp2 + (temp1 - temp2)*(.66666 - temp3)*6)*100);
|
||||
else
|
||||
c = (uint)(temp2*100);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
#endif // COLORCONVERSION_H
|
||||
@ -24,6 +24,7 @@
|
||||
#include "CasterBoard.h"
|
||||
#include "CasterPlayer.h"
|
||||
#include "CasterPlayerState.h"
|
||||
#include <QObject>
|
||||
#include <QMessageBox>
|
||||
#include <QInputDialog>
|
||||
#include <QToolBar>
|
||||
@ -31,13 +32,35 @@
|
||||
#include <QTableWidget>
|
||||
#include <QGridLayout>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <QFile>
|
||||
#include <QDataStream>
|
||||
#include <QFileDialog>
|
||||
#include <QStatusBar>
|
||||
#include <QUdpSocket>
|
||||
#include <QByteArray>
|
||||
#include <QNetworkInterface>
|
||||
#include "CasterOSCServerConfigPicker.h"
|
||||
#include "libs/osc/reader/OscReader.h"
|
||||
#include "libs/osc/reader/OscMessage.h"
|
||||
#include "libs/osc/reader/OscBundle.h"
|
||||
#include "libs/osc/composer/OscMessageComposer.h"
|
||||
#include "libs/osc/OscPatternMatching.h"
|
||||
#include "libs/osc/reader/types/OscAddress.h"
|
||||
#include "libs/osc/reader/types/OscValue.h"
|
||||
|
||||
|
||||
|
||||
//CONSTRUCTOR
|
||||
MainWindow::MainWindow(QWidget *parent) : QWidget(parent)
|
||||
{
|
||||
// UDP Socket
|
||||
socket = new QUdpSocket(this);
|
||||
|
||||
// OSC Config Picker
|
||||
outbound_ipv4 = new QString("0.0.0.0");
|
||||
oscConfigPicker = new CasterOSCServerConfigPicker("0.0.0.0", inbound_port, *outbound_ipv4, outbound_port);
|
||||
|
||||
//SET WINDOW PROPETIES
|
||||
this->setWindowTitle("CasterSoundboard");
|
||||
this->setWindowIcon(QIcon(":/res/img/app.png"));
|
||||
@ -50,6 +73,7 @@ MainWindow::MainWindow(QWidget *parent) : QWidget(parent)
|
||||
addNewTabButton = new QPushButton;
|
||||
addNewTabButton->setIcon(QIcon(":/res/img/newTab.png"));
|
||||
addNewTabButton->setIconSize(QSize(40,40));
|
||||
addNewTabButton->setToolTip("New Tab");
|
||||
//addNewTabButton->setFixedSize(30,30);
|
||||
//layout->addWidget(addNewTabButton,0,2, Qt::AlignRight);
|
||||
|
||||
@ -57,34 +81,52 @@ MainWindow::MainWindow(QWidget *parent) : QWidget(parent)
|
||||
openTabButton = new QPushButton;
|
||||
openTabButton->setIcon(QIcon(":/res/img/open.png"));
|
||||
openTabButton->setIconSize(QSize(40,40));
|
||||
openTabButton->setToolTip("Open Tab");
|
||||
//openTabButton->setFixedSize(30,30);
|
||||
|
||||
//~~Save Tab~~
|
||||
saveTabButton = new QPushButton;
|
||||
saveTabButton->setIcon(QIcon(":/res/img/save.png"));
|
||||
saveTabButton->setIconSize(QSize(40,40));
|
||||
saveTabButton->setToolTip("Save Tab");
|
||||
//saveTabButton->setFixedSize(30,30);
|
||||
|
||||
//~~Save As Tab~~
|
||||
saveAsTabButton = new QPushButton;
|
||||
saveAsTabButton->setIcon(QIcon(":/res/img/save_as.png"));
|
||||
saveAsTabButton->setIconSize(QSize(40,40));
|
||||
saveAsTabButton->setToolTip("Save Tab As");
|
||||
//saveAsTabButton->setFixedSize(40,40);
|
||||
|
||||
//~~Stop ALL Sounds~~
|
||||
stopAllSoundsButton = new QPushButton;
|
||||
stopAllSoundsButton->setIcon(QIcon(":/res/img/stopAll.png"));
|
||||
stopAllSoundsButton->setIconSize(QSize(40,40));
|
||||
stopAllSoundsButton->setToolTip("Stop All Sounds");
|
||||
|
||||
//~~Toogle Ducking~~
|
||||
toggleAudioDuckingButton = new QPushButton;
|
||||
toggleAudioDuckingButton->setIcon(QIcon(":/res/img/duck.png"));
|
||||
toggleAudioDuckingButton->setIconSize(QSize(40,40));
|
||||
toggleAudioDuckingButton->setToolTip("Toggle Ducking");
|
||||
|
||||
//~~Rename Tab~~
|
||||
renameCurrentTabButton = new QPushButton;
|
||||
renameCurrentTabButton->setIcon(QIcon(":/res/img/rename.png"));
|
||||
renameCurrentTabButton->setIconSize(QSize(40,40));
|
||||
renameCurrentTabButton->setToolTip("Rename Tab");
|
||||
|
||||
//~~OSC Settings~~
|
||||
openSoundControlButton = new QPushButton;
|
||||
openSoundControlButton->setIcon(QIcon(":/res/img/open_sound_control.png"));
|
||||
openSoundControlButton->setIconSize(QSize(40,40));
|
||||
openSoundControlButton->setToolTip("OSC Settings");
|
||||
|
||||
//~~About Button~~
|
||||
aboutButton = new QPushButton;
|
||||
aboutButton->setIcon(QIcon(":/res/img/about.png"));
|
||||
aboutButton->setIconSize(QSize(40,40));
|
||||
aboutButton->setToolTip("About");
|
||||
//aboutButton->setFixedSize(30,30);
|
||||
//layout->addWidget(aboutButton,0,0, Qt::AlignLeft);
|
||||
|
||||
@ -97,6 +139,8 @@ MainWindow::MainWindow(QWidget *parent) : QWidget(parent)
|
||||
mainToolbar->addWidget(saveAsTabButton);
|
||||
mainToolbar->addWidget(renameCurrentTabButton);
|
||||
mainToolbar->addWidget(stopAllSoundsButton);
|
||||
mainToolbar->addWidget(toggleAudioDuckingButton);
|
||||
mainToolbar->addWidget(openSoundControlButton);
|
||||
mainToolbar->addWidget(aboutButton);
|
||||
// Add toolbar to layout
|
||||
layout->addWidget(mainToolbar, 0, 0, Qt::AlignLeft);
|
||||
@ -106,6 +150,11 @@ MainWindow::MainWindow(QWidget *parent) : QWidget(parent)
|
||||
mainTabContainer->setTabsClosable(true);
|
||||
layout->addWidget(mainTabContainer,1,0, 2, 0);
|
||||
|
||||
// Status Bar
|
||||
main_statusbar = new QStatusBar;
|
||||
main_statusbar->setMaximumHeight(15);
|
||||
layout->addWidget(main_statusbar);
|
||||
|
||||
//SET LAYOUT
|
||||
this->setLayout(layout);
|
||||
|
||||
@ -113,22 +162,76 @@ MainWindow::MainWindow(QWidget *parent) : QWidget(parent)
|
||||
connect(aboutButton,SIGNAL(clicked()),this,SLOT(aboutBox()));
|
||||
connect(addNewTabButton,SIGNAL(clicked()),this,SLOT(addNewTab()));
|
||||
connect(mainTabContainer,SIGNAL(tabCloseRequested(int)),this,SLOT(mainTabContainerTabClosedRequested(int)));
|
||||
connect(mainTabContainer,SIGNAL(currentChanged(int)),this,SLOT(currentTabWasChanged(int)));
|
||||
connect(saveTabButton,SIGNAL(clicked()),this,SLOT(saveTab()));
|
||||
connect(saveAsTabButton,SIGNAL(clicked()),this,SLOT(saveAsTab()));
|
||||
connect(openTabButton,SIGNAL(clicked()),this,SLOT(openProfile()));
|
||||
connect(renameCurrentTabButton,SIGNAL(clicked()),this,SLOT(renameCurrentTab()));
|
||||
connect(stopAllSoundsButton,SIGNAL(clicked()),this,SLOT(stopAllSounds()));
|
||||
connect(toggleAudioDuckingButton,SIGNAL(clicked()),this,SLOT(toggleAudioDucking()));
|
||||
connect(openSoundControlButton, SIGNAL(clicked()), this, SLOT(openOSCSettings()) );
|
||||
|
||||
// Properties
|
||||
|
||||
}
|
||||
|
||||
//SLOTS
|
||||
void MainWindow::mainTabContainerTabClosedRequested(int tabIndex)
|
||||
{
|
||||
//CONFIRM TAB CLOSE
|
||||
QMessageBox msgBox;
|
||||
msgBox.setText("Are you sure you want to close this tab");
|
||||
msgBox.setWindowIcon(QIcon(":/res/img/app.png"));
|
||||
msgBox.setStandardButtons(QMessageBox::No | QMessageBox::Yes);
|
||||
msgBox.setDefaultButton(QMessageBox::No);
|
||||
msgBox.setModal(true);
|
||||
if(msgBox.exec() == QMessageBox::Yes)
|
||||
{
|
||||
CasterBoard *toBeDeleted = dynamic_cast<CasterBoard*>(mainTabContainer->widget(tabIndex));
|
||||
//CLOSE REQUESTED TAB
|
||||
disconnect(toBeDeleted, SIGNAL(globalHotKeyReleasedEvent(QKeyEvent*)),this,SLOT(handleGlobalHotKeyEventFromCurrentWidget(QKeyEvent*)));
|
||||
disconnect(toBeDeleted, SIGNAL(_updateOSCClient(OscMessageComposer)),this,SLOT(sendOSCMessageToClient(OscMessageComposer)));
|
||||
mainTabContainer->removeTab(tabIndex);
|
||||
if(toBeDeleted) {
|
||||
delete toBeDeleted;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::currentTabWasChanged(int tabIndex)
|
||||
{
|
||||
this->updateCurrentOSCTab(tabIndex);
|
||||
}
|
||||
|
||||
void MainWindow::updateCurrentOSCTab(int tabIndex)
|
||||
{
|
||||
// Update Current Board & Previous Board Status
|
||||
if(0 <= previous_tab_index
|
||||
&& previous_tab_index < mainTabContainer->count()
|
||||
&& previous_tab_index != tabIndex){
|
||||
//Keep track in tab indicies
|
||||
dynamic_cast<CasterBoard*>(mainTabContainer->widget(previous_tab_index))->isCurrentBoard = false;
|
||||
dynamic_cast<CasterBoard*>(mainTabContainer->widget(tabIndex))->isCurrentBoard = true;
|
||||
previous_tab_index = tabIndex;
|
||||
|
||||
// Update OSC Client
|
||||
dynamic_cast<CasterBoard*>(mainTabContainer->widget(tabIndex))->syncWithOSCClient();
|
||||
} else if(0 <= previous_tab_index
|
||||
&& previous_tab_index < mainTabContainer->count()
|
||||
&& previous_tab_index == tabIndex){
|
||||
//Update Current tab (even if redundant)
|
||||
dynamic_cast<CasterBoard*>(mainTabContainer->widget(tabIndex))->isCurrentBoard = true;
|
||||
|
||||
// Update OSC Client
|
||||
dynamic_cast<CasterBoard*>(mainTabContainer->widget(tabIndex))->syncWithOSCClient();
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::aboutBox()
|
||||
{
|
||||
QMessageBox msgBox;
|
||||
msgBox.setText("CasterSoundboard (v1.0) BETA\nAuthor: Oscar Cerna\ne-mail: covarianttensor@gmail.com\nLicense: LGPL v3\n© 2013-2017 Oscar Cerna");
|
||||
msgBox.setInformativeText("Special Note:\nDeveloped for Chris Fisher & Jupiter Broadcasting, because he's awesome!\nVisit www.jupiterbroadcasting.com.\nNOT AFFILIATED with Chris Fisher or Jupiter Broadcasting.");
|
||||
msgBox.setText("CasterSoundboard (v1.0) BETA<br>Author: <a href=""https://github.com/covarianttensor"">Oscar Cerna</a><br>e-mail: <a href=mailto:covarianttensor@gmail.com>covarianttensor@gmail.com</a><br>License: <a href=""https://github.com/JupiterBroadcasting/CasterSoundboard/blob/master/LICENSE"">LGPL v3</a><br>© 2013-2017 Oscar Cerna");
|
||||
msgBox.setInformativeText("Special Note:<br>Developed for Chris Fisher & Jupiter Broadcasting, because he's awesome!<br>Visit <a href=""http://www.jupiterbroadcasting.com"">jupiterbroadcasting.com</a>.<br>NOT AFFILIATED with Chris Fisher or Jupiter Broadcasting.");
|
||||
msgBox.setStandardButtons(QMessageBox::Close);
|
||||
msgBox.setDefaultButton(QMessageBox::Close);
|
||||
msgBox.setModal(true);
|
||||
@ -152,6 +255,10 @@ void MainWindow::addNewTab()
|
||||
{
|
||||
//CREATE REQUESTED TABS
|
||||
CasterBoard *cb = new CasterBoard;
|
||||
cb->setAllAudioDuckingStates(audio_duck_state);
|
||||
connect(cb, SIGNAL(globalHotKeyReleasedEvent(QKeyEvent*)),this,SLOT(handleGlobalHotKeyEventFromCurrentWidget(QKeyEvent*)));
|
||||
connect(cb, SIGNAL(_updateOSCClient(OscMessageComposer*)),this,SLOT(sendOSCMessageToClient(OscMessageComposer*)));
|
||||
|
||||
if(text != "")
|
||||
{
|
||||
cb->soundBoardName = new QString(text);
|
||||
@ -164,108 +271,6 @@ void MainWindow::addNewTab()
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void MainWindow::mainTabContainerTabClosedRequested(int tabIndex)
|
||||
{
|
||||
//CONFIRM TAB CLOSE
|
||||
QMessageBox msgBox;
|
||||
msgBox.setText("Are you sure you want to close this tab");
|
||||
msgBox.setWindowIcon(QIcon(":/res/img/app.png"));
|
||||
msgBox.setStandardButtons(QMessageBox::No | QMessageBox::Yes);
|
||||
msgBox.setDefaultButton(QMessageBox::No);
|
||||
msgBox.setModal(true);
|
||||
if(msgBox.exec() == QMessageBox::Yes)
|
||||
{
|
||||
//CLOSE REQUESTED TAB
|
||||
mainTabContainer->removeTab(tabIndex);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::saveTab()
|
||||
{
|
||||
if(mainTabContainer->count() > 0)
|
||||
{
|
||||
if(dynamic_cast<CasterBoard*>(mainTabContainer->currentWidget())->profileFilePath->toUtf8() != ""){
|
||||
/* Save */
|
||||
QFile file;
|
||||
QDataStream out;
|
||||
|
||||
file.setFileName(dynamic_cast<CasterBoard*>(mainTabContainer->currentWidget())->profileFilePath->toUtf8());
|
||||
file.open(QIODevice::WriteOnly);
|
||||
out.setDevice(&file);
|
||||
out.setVersion(QDataStream::Qt_5_8);
|
||||
out << *dynamic_cast<CasterBoard*>(mainTabContainer->currentWidget());
|
||||
file.flush();
|
||||
file.close();
|
||||
} else {
|
||||
/* Save As.. */
|
||||
QString _filePath = QFileDialog::getSaveFileName(this, "Save Sound Board Profile As...", "",
|
||||
"Sound Board Profile (*.caster)");
|
||||
|
||||
if (!_filePath.isNull())
|
||||
{
|
||||
/* Save Profile As... */
|
||||
QFile file;
|
||||
QDataStream out;
|
||||
|
||||
file.setFileName(_filePath.toUtf8() + ".caster");
|
||||
file.open(QIODevice::WriteOnly);
|
||||
out.setDevice(&file);
|
||||
out.setVersion(QDataStream::Qt_5_8);
|
||||
out << *dynamic_cast<CasterBoard*>(mainTabContainer->currentWidget());
|
||||
file.flush();
|
||||
file.close();
|
||||
|
||||
//Set Save Path
|
||||
dynamic_cast<CasterBoard*>(mainTabContainer->currentWidget())->profileFilePath = new QString(_filePath.toUtf8() + ".caster");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void MainWindow::saveAsTab()
|
||||
{
|
||||
//Debug
|
||||
/*
|
||||
QString *temp = dynamic_cast<CasterBoard*>(mainTabContainer->currentWidget())->player1->playerState->filePath;
|
||||
QMessageBox msgBox;
|
||||
msgBox.setText("File Path: " + temp->toUtf8() );
|
||||
msgBox.setStandardButtons(QMessageBox::Close);
|
||||
msgBox.setDefaultButton(QMessageBox::Close);
|
||||
msgBox.setModal(true);
|
||||
msgBox.setWindowTitle("About");
|
||||
msgBox.setWindowIcon(QIcon(":/res/img/about.png"));
|
||||
msgBox.exec();
|
||||
*/
|
||||
|
||||
if(mainTabContainer->count() > 0)
|
||||
{
|
||||
QString _filePath = QFileDialog::getSaveFileName(this, "Save Sound Board Profile As...", "",
|
||||
"Sound Board Profile (*.caster)");
|
||||
|
||||
if (!_filePath.isNull())
|
||||
{
|
||||
/* Save Profile As... */
|
||||
QFile file;
|
||||
QDataStream out;
|
||||
|
||||
file.setFileName(_filePath.toUtf8() + ".caster");
|
||||
file.open(QIODevice::WriteOnly);
|
||||
out.setDevice(&file);
|
||||
out.setVersion(QDataStream::Qt_5_8);
|
||||
out << *dynamic_cast<CasterBoard*>(mainTabContainer->currentWidget());
|
||||
file.flush();
|
||||
file.close();
|
||||
|
||||
//Set Save Path
|
||||
dynamic_cast<CasterBoard*>(mainTabContainer->currentWidget())->profileFilePath = new QString(_filePath.toUtf8() + ".caster");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
void MainWindow::openProfile()
|
||||
@ -284,7 +289,7 @@ void MainWindow::openProfile()
|
||||
file.setFileName(_filePath);
|
||||
file.open(QIODevice::ReadOnly);
|
||||
in.setDevice(&file);
|
||||
in.setVersion(QDataStream::Qt_5_8);
|
||||
in.setVersion(QDataStream::Qt_DefaultCompiledVersion);
|
||||
in >> *cb;
|
||||
file.close();
|
||||
|
||||
@ -293,17 +298,86 @@ void MainWindow::openProfile()
|
||||
|
||||
// Load Profile Into New Board
|
||||
cb->reloadBoardFromPlayerStates();
|
||||
cb->setAllAudioDuckingStates(audio_duck_state);
|
||||
connect(cb, SIGNAL(globalHotKeyReleasedEvent(QKeyEvent*)),this,SLOT(handleGlobalHotKeyEventFromCurrentWidget(QKeyEvent*)));
|
||||
connect(cb, SIGNAL(_updateOSCClient(OscMessageComposer*)),this,SLOT(sendOSCMessageToClient(OscMessageComposer*)));
|
||||
mainTabContainer->addTab(cb, cb->soundBoardName->toUtf8());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void MainWindow::stopAllSounds()
|
||||
void MainWindow::saveTab()
|
||||
{
|
||||
for(int i = 0; i < mainTabContainer->count(); i++)
|
||||
if(mainTabContainer->count() > 0)
|
||||
{
|
||||
dynamic_cast<CasterBoard*>(mainTabContainer->widget(i))->stopAllSounds();
|
||||
if(dynamic_cast<CasterBoard*>(mainTabContainer->currentWidget())->profileFilePath->toUtf8() != ""){
|
||||
/* Save */
|
||||
QFile file;
|
||||
QDataStream out;
|
||||
|
||||
file.setFileName(dynamic_cast<CasterBoard*>(mainTabContainer->currentWidget())->profileFilePath->toUtf8());
|
||||
file.open(QIODevice::WriteOnly);
|
||||
out.setDevice(&file);
|
||||
out.setVersion(QDataStream::Qt_DefaultCompiledVersion);
|
||||
out << *dynamic_cast<CasterBoard*>(mainTabContainer->currentWidget());
|
||||
file.flush();
|
||||
file.close();
|
||||
} else {
|
||||
/* Save As.. */
|
||||
QString _filePath = QFileDialog::getSaveFileName(this, "Save Sound Board Profile As...", "",
|
||||
"Sound Board Profile (*.caster)");
|
||||
|
||||
if (!_filePath.isNull())
|
||||
{
|
||||
/* Save Profile As... */
|
||||
QFile file;
|
||||
QDataStream out;
|
||||
|
||||
file.setFileName(_filePath.toUtf8() + ".caster");
|
||||
file.open(QIODevice::WriteOnly);
|
||||
out.setDevice(&file);
|
||||
out.setVersion(QDataStream::Qt_DefaultCompiledVersion);
|
||||
out << *dynamic_cast<CasterBoard*>(mainTabContainer->currentWidget());
|
||||
file.flush();
|
||||
file.close();
|
||||
|
||||
//Set Save Path
|
||||
dynamic_cast<CasterBoard*>(mainTabContainer->currentWidget())->profileFilePath = new QString(_filePath.toUtf8() + ".caster");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void MainWindow::saveAsTab()
|
||||
{
|
||||
|
||||
if(mainTabContainer->count() > 0)
|
||||
{
|
||||
QString _filePath = QFileDialog::getSaveFileName(this, "Save Sound Board Profile As...", "",
|
||||
"Sound Board Profile (*.caster)");
|
||||
|
||||
if (!_filePath.isNull())
|
||||
{
|
||||
/* Save Profile As... */
|
||||
QFile file;
|
||||
QDataStream out;
|
||||
|
||||
file.setFileName(_filePath.toUtf8() + ".caster");
|
||||
file.open(QIODevice::WriteOnly);
|
||||
out.setDevice(&file);
|
||||
out.setVersion(QDataStream::Qt_DefaultCompiledVersion);
|
||||
out << *dynamic_cast<CasterBoard*>(mainTabContainer->currentWidget());
|
||||
file.flush();
|
||||
file.close();
|
||||
|
||||
//Set Save Path
|
||||
dynamic_cast<CasterBoard*>(mainTabContainer->currentWidget())->profileFilePath = new QString(_filePath.toUtf8() + ".caster");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
void MainWindow::renameCurrentTab()
|
||||
@ -331,3 +405,552 @@ void MainWindow::renameCurrentTab()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void MainWindow::stopAllSounds()
|
||||
{
|
||||
// Iterate through boards
|
||||
for(int i = 0; i < mainTabContainer->count(); i++)
|
||||
{
|
||||
dynamic_cast<CasterBoard*>(mainTabContainer->widget(i))->stopAllSounds();
|
||||
}
|
||||
|
||||
// Give current board keyboard focus again
|
||||
if(mainTabContainer->count() > 0 )
|
||||
dynamic_cast<CasterBoard*>(mainTabContainer->currentWidget())->setFocus();
|
||||
}
|
||||
|
||||
void MainWindow::toggleAudioDucking()
|
||||
{
|
||||
if(audio_duck_state == 0){
|
||||
audio_duck_state = 1;
|
||||
toggleAudioDuckingButton->setIcon(QIcon(":/res/img/unduck.png"));
|
||||
} else {
|
||||
audio_duck_state = 0;
|
||||
toggleAudioDuckingButton->setIcon(QIcon(":/res/img/duck.png"));
|
||||
}
|
||||
// Iterate through boards
|
||||
for(int i = 0; i < mainTabContainer->count(); i++)
|
||||
{
|
||||
dynamic_cast<CasterBoard*>(mainTabContainer->widget(i))->setAllAudioDuckingStates(audio_duck_state);
|
||||
}
|
||||
|
||||
// Give current board keyboard focus again
|
||||
if(mainTabContainer->count() > 0 )
|
||||
dynamic_cast<CasterBoard*>(mainTabContainer->currentWidget())->setFocus();
|
||||
|
||||
//Update OSC Client
|
||||
OscMessageComposer* msg = writeOSCMessage("/glo/m/audio_d_s", audio_duck_state);
|
||||
this->sendOSCMessageToClient(msg);
|
||||
}
|
||||
|
||||
// Tab Switching
|
||||
void MainWindow::switchToNextTab()
|
||||
{
|
||||
if(mainTabContainer->count() > 0){
|
||||
int next_tab_index = mainTabContainer->currentIndex() + 1;
|
||||
if(next_tab_index < mainTabContainer->count()){
|
||||
// Change Tabs
|
||||
mainTabContainer->setCurrentIndex(next_tab_index);
|
||||
mainTabContainer->currentWidget()->setFocus();//Give Keyboard Focus (Hot Keying)
|
||||
|
||||
//Update OSC Client
|
||||
dynamic_cast<CasterBoard*>(mainTabContainer->currentWidget())->syncWithOSCClient();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::switchToPrevTab()
|
||||
{
|
||||
if(mainTabContainer->count() > 0){
|
||||
int prev_tab_index = mainTabContainer->currentIndex() - 1;
|
||||
if(prev_tab_index >= 0){
|
||||
// Change Tabs
|
||||
mainTabContainer->setCurrentIndex(prev_tab_index);
|
||||
mainTabContainer->currentWidget()->setFocus();//Give Keyboard Focus (Hot Keying)
|
||||
|
||||
//Update OSC Client
|
||||
dynamic_cast<CasterBoard*>(mainTabContainer->currentWidget())->syncWithOSCClient();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Board Signa Emissions Handlers
|
||||
void MainWindow::hotKeyExecution(QKeyEvent *event)
|
||||
{
|
||||
if(event->key() == Qt::Key_Shift){
|
||||
// Toogle Audio Ducking //
|
||||
this->toggleAudioDucking();
|
||||
} else if(event->key() == Qt::Key_Space){
|
||||
// Stop All Sounds //
|
||||
this->stopAllSounds();
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::handleGlobalHotKeyEventFromCurrentWidget(QKeyEvent *event)
|
||||
{
|
||||
this->hotKeyExecution(event);
|
||||
}
|
||||
|
||||
// PROTECTED
|
||||
void MainWindow::keyReleaseEvent(QKeyEvent *event)
|
||||
{
|
||||
this->hotKeyExecution(event);
|
||||
}
|
||||
|
||||
// OSC Server
|
||||
|
||||
void MainWindow::openOSCSettings()
|
||||
{
|
||||
// Set Local IP
|
||||
if(get_local_ip() != 0){
|
||||
QString* ip = new QString(get_local_ip().toUtf8());
|
||||
oscConfigPicker->setInBoundIPv4(ip);
|
||||
}
|
||||
|
||||
// Run Seeting Diag
|
||||
oscConfigPicker->exec();
|
||||
if(oscConfigPicker->ok == true)
|
||||
{
|
||||
if(oscConfigPicker->Result == CasterOSCServerConfigPicker::Action_Start_Server){
|
||||
// Attempt To Start Server
|
||||
inbound_port = oscConfigPicker->getInboundPort();
|
||||
outbound_ipv4 = new QString(oscConfigPicker->getOutboundIPv4().toUtf8());
|
||||
outbound_port = oscConfigPicker->getOutboundPort();
|
||||
bool bind_success = socket->bind(QHostAddress::Any, inbound_port);
|
||||
if(bind_success){
|
||||
// Notify User
|
||||
QString *temp = new QString("Success!! OSC server running on port " + QString::number(inbound_port).toUtf8());
|
||||
QMessageBox msgBox;
|
||||
msgBox.setText(temp->toUtf8() + "\n");
|
||||
msgBox.setStandardButtons(QMessageBox::Close);
|
||||
msgBox.setDefaultButton(QMessageBox::Close);
|
||||
msgBox.setModal(true);
|
||||
msgBox.setWindowTitle("Connection Successful");
|
||||
msgBox.setWindowIcon(QIcon(":/res/img/about.png"));
|
||||
msgBox.exec();
|
||||
|
||||
// Connect Listener Server
|
||||
connect(socket, SIGNAL(readyRead()), this, SLOT(executeOSCCommand()));
|
||||
|
||||
//Update Diag
|
||||
oscConfigPicker->setIsServerRunning(true);
|
||||
|
||||
// Reset Result
|
||||
oscConfigPicker->ok = false;
|
||||
oscConfigPicker->Result = CasterOSCServerConfigPicker::Action_Neutral;
|
||||
|
||||
// Synchronize UI Info
|
||||
if(mainTabContainer->count() > 0 ){
|
||||
dynamic_cast<CasterBoard*>(mainTabContainer->currentWidget())->syncWithOSCClient();
|
||||
}
|
||||
this->syncWithOSCClient();
|
||||
} else {
|
||||
QString *temp = new QString("Sorry, inbound port " + QString::number(inbound_port).toUtf8() + " appears to be in use.\nPlease try another port." );
|
||||
QMessageBox msgBox;
|
||||
msgBox.setText(temp->toUtf8() + "\n");
|
||||
msgBox.setStandardButtons(QMessageBox::Close);
|
||||
msgBox.setDefaultButton(QMessageBox::Close);
|
||||
msgBox.setModal(true);
|
||||
msgBox.setWindowTitle("Port Connection Error");
|
||||
msgBox.setWindowIcon(QIcon(":/res/img/about.png"));
|
||||
msgBox.exec();
|
||||
|
||||
//Update Diag
|
||||
oscConfigPicker->setIsServerRunning(false);
|
||||
|
||||
// Reset Result
|
||||
oscConfigPicker->ok = false;
|
||||
oscConfigPicker->Result = CasterOSCServerConfigPicker::Action_Neutral;
|
||||
}
|
||||
|
||||
} else if (oscConfigPicker->Result == CasterOSCServerConfigPicker::Action_Kill_Server ){
|
||||
// Disconnect Listener Server
|
||||
disconnect(socket, SIGNAL(readyRead()), this, SLOT(executeOSCCommand()));
|
||||
// Unbind socket from port
|
||||
socket->close();
|
||||
|
||||
//Update Diag
|
||||
oscConfigPicker->setIsServerRunning(false);
|
||||
|
||||
// Reset Result
|
||||
oscConfigPicker->ok = false;
|
||||
oscConfigPicker->Result = CasterOSCServerConfigPicker::Action_Neutral;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::executeOSCCommand()
|
||||
{
|
||||
// Get UDP Datagram //
|
||||
QByteArray datagram;
|
||||
datagram.resize(socket->pendingDatagramSize());
|
||||
QHostAddress sender;
|
||||
quint16 senderPort;
|
||||
socket->readDatagram(datagram.data(), datagram.size(), &sender, &senderPort);
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
// Read OSC Packet //
|
||||
OscReader reader(&datagram);
|
||||
// Check if direct message (we are ignoring bundles)
|
||||
if(reader.getMessage() != 0){
|
||||
// Get Message //
|
||||
OscMessage* msg = reader.getMessage();
|
||||
QString address = msg->getAddress();
|
||||
QStringList address_params = address.split("/");
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
// Print OSC Command //
|
||||
QString values("");
|
||||
for(int i = 0; i < (int)msg->getNumValues(); i++){
|
||||
if(i == 0){ values = msg->getValue(i)->toString(); } else { values += " | " + msg->getValue(i)->toString(); }
|
||||
}
|
||||
main_statusbar->showMessage("[OSC Message] Address: " + address.toUtf8() + " Value(s): " + values.toUtf8() , 500);
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
// Resolve OSC Address //
|
||||
if(address_params.value(1) == "castersoundboard")
|
||||
{
|
||||
// Is One-Way Address
|
||||
this->executeOneWayOSCCommand(msg, address_params);
|
||||
}//END_IF CASTERSOUNDBOARD
|
||||
else {//TWO WAY ADDRESS
|
||||
this->executeTwoWayOSCCommand(msg, address_params);
|
||||
}
|
||||
delete msg; return;//EXIT
|
||||
}//END_IF DIRECT MESSAGE
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
}
|
||||
|
||||
void MainWindow::executeOneWayOSCCommand(OscMessage *msg, QStringList address_params)
|
||||
{
|
||||
// Route OSC Message //
|
||||
// Is Board Address
|
||||
if(address_params.value(2) == "board")
|
||||
{
|
||||
// Is A Board Name
|
||||
if(address_params.value(3) != 0 && address_params.value(3) != "")
|
||||
{
|
||||
//==================================
|
||||
// Check If Board Exists
|
||||
bool _boardWasFound = false;
|
||||
int _board_index = 0;
|
||||
for(int i=0; i < mainTabContainer->count(); i++){
|
||||
// Is Board Name Found?
|
||||
if(dynamic_cast<CasterBoard*>(mainTabContainer->widget(i))->soundBoardName == address_params.value(3))
|
||||
{
|
||||
_boardWasFound = true;
|
||||
_board_index = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Finish if board was not found
|
||||
if(!_boardWasFound)
|
||||
return;//Board Not Found
|
||||
//==================================
|
||||
|
||||
// Is Player Address
|
||||
if(address_params.value(4) == "player")
|
||||
{
|
||||
// Is Player Name
|
||||
if(address_params.value(5) != 0 && address_params.value(5) != "")
|
||||
{
|
||||
//==================================
|
||||
// Check If Player Does NOT Exist
|
||||
if(!dynamic_cast<CasterBoard*>(mainTabContainer->widget(_board_index))->players->contains(address_params.value(5))){
|
||||
return;//Player does not exist on board.
|
||||
}
|
||||
|
||||
QString _player_key(address_params.value(5));
|
||||
//==================================
|
||||
|
||||
// Is Action Address
|
||||
if(address_params.value(6) == "modify")
|
||||
{
|
||||
// Is Interface Address
|
||||
//~~~~Execute Decoded Command~~~~
|
||||
if(address_params.value(7) == "volume"
|
||||
&& msg->getNumValues() == 1
|
||||
&& address_params.value(8) == 0){
|
||||
try{// Perform Action
|
||||
int _volume = 100 * msg->getValue(0)->toFloat();
|
||||
dynamic_cast<CasterBoard*>(mainTabContainer->widget(_board_index))->players->value(_player_key)->volumeSlider->setValue(_volume);
|
||||
} catch(...) {}// Type Casting Exception Most Likely
|
||||
} else if (address_params.value(7) == "track_position_percent"
|
||||
&& msg->getNumValues() == 1
|
||||
&& address_params.value(8) == 0){
|
||||
try{// Perform Action
|
||||
int _position = 100 * msg->getValue(0)->toFloat();
|
||||
dynamic_cast<CasterBoard*>(mainTabContainer->widget(_board_index))->players->value(_player_key)->trackBar->setValue(_position);
|
||||
} catch(...) {}// Type Casting Exception Most Likely
|
||||
} else if (address_params.value(7) == "play_state"
|
||||
&& msg->getNumValues() == 1
|
||||
&& address_params.value(8) != 0){// Is Player State Address
|
||||
if(address_params.value(8) == "play" && address_params.value(9) == 0){
|
||||
try{// Perform Action
|
||||
if(msg->getValue(0)->toInteger() == 1)
|
||||
dynamic_cast<CasterBoard*>(mainTabContainer->widget(_board_index))->players->value(_player_key)->playSound();
|
||||
} catch(...){}// Type Casting Exception Most Likely
|
||||
} else if(address_params.value(8) == "resume" && address_params.value(9) == 0){
|
||||
try{// Perform Action
|
||||
if(msg->getValue(0)->toInteger() == 1)
|
||||
dynamic_cast<CasterBoard*>(mainTabContainer->widget(_board_index))->players->value(_player_key)->resumeSound();
|
||||
} catch(...){}// Type Casting Exception Most Likely
|
||||
} else if(address_params.value(8) == "pause" && address_params.value(9) == 0){
|
||||
try{// Perform Action
|
||||
if(msg->getValue(0)->toInteger() == 1)
|
||||
dynamic_cast<CasterBoard*>(mainTabContainer->widget(_board_index))->players->value(_player_key)->pauseSound();
|
||||
} catch(...){}// Type Casting Exception Most Likely
|
||||
} else if(address_params.value(8) == "stop" && address_params.value(9) == 0){
|
||||
try{// Perform Action
|
||||
if(msg->getValue(0)->toInteger() == 1)
|
||||
dynamic_cast<CasterBoard*>(mainTabContainer->widget(_board_index))->players->value(_player_key)->stopSound();
|
||||
} catch(...){}// Type Casting Exception Most Likely
|
||||
}
|
||||
} else if (address_params.value(7) == "loop_state"
|
||||
&& msg->getNumValues() == 1
|
||||
&& address_params.value(8) == 0){
|
||||
try{// Perform Action (0 = no loop, 1 = loop)
|
||||
dynamic_cast<CasterBoard*>(mainTabContainer->widget(_board_index))->players->value(_player_key)->setLoopState(msg->getValue(0)->toInteger());
|
||||
} catch(...){}// Type Casting Exception Most Likely
|
||||
}
|
||||
//~~~~Execute Decoded Command End~~~~
|
||||
return;//EXIT
|
||||
}//END_IF ACTION
|
||||
|
||||
}//END_IF PLAYER NAME
|
||||
|
||||
}//END_IF PLAYER
|
||||
|
||||
}//END_IF BOARD NAME
|
||||
|
||||
//END_IF BOARD ADDRESS
|
||||
} else if(address_params.value(2) == "global"){
|
||||
if(address_params.value(3) == "modify"){
|
||||
// Is Interface Address
|
||||
//~~~~Execute Decoded Command~~~~
|
||||
if (address_params.value(4) == "all_play_states"
|
||||
&& msg->getNumValues() == 1
|
||||
&& address_params.value(5) != 0){// Is Global Player States Address
|
||||
if(address_params.value(5) == "stop" && address_params.value(6) == 0){
|
||||
try{// Perform Action
|
||||
if(msg->getValue(0)->toInteger() == 1)
|
||||
this->stopAllSounds();
|
||||
} catch(...){}// Type Casting Exception Most Likely
|
||||
}
|
||||
} else if (address_params.value(4) == "audio_ducking_state"
|
||||
&& msg->getNumValues() == 1
|
||||
&& address_params.value(5) == 0){
|
||||
try{// Perform Action (0 = no duck, 1 = duck)
|
||||
audio_duck_state = msg->getValue(0)->toInteger();
|
||||
if(audio_duck_state == 0){
|
||||
toggleAudioDuckingButton->setIcon(QIcon(":/res/img/duck.png"));
|
||||
} else {
|
||||
audio_duck_state = 1;
|
||||
toggleAudioDuckingButton->setIcon(QIcon(":/res/img/unduck.png"));
|
||||
}
|
||||
|
||||
// Iterate through boards
|
||||
for(int i = 0; i < mainTabContainer->count(); i++)
|
||||
{
|
||||
dynamic_cast<CasterBoard*>(mainTabContainer->widget(i))->setAllAudioDuckingStates(audio_duck_state);
|
||||
}
|
||||
|
||||
// Give current board keyboard focus again
|
||||
if(mainTabContainer->count() > 0 )
|
||||
dynamic_cast<CasterBoard*>(mainTabContainer->currentWidget())->setFocus();
|
||||
} catch(...){}// Type Casting Exception Most Likely
|
||||
}
|
||||
//~~~~Execute Decoded Command End~~~~
|
||||
return;//EXIT
|
||||
}
|
||||
}//END_ELSE_IF GLOBAL ADDRESS
|
||||
}
|
||||
|
||||
void MainWindow::executeTwoWayOSCCommand(OscMessage *msg, QStringList address_params)
|
||||
{
|
||||
// Route OSC Message //
|
||||
// Is Current Board Player Address
|
||||
if(address_params.value(1) == "cbp")// cbp = Current Board Player
|
||||
{
|
||||
//==================================
|
||||
// Check If Current Board Does NOT Exist
|
||||
if(mainTabContainer->count() <= 0)
|
||||
return;//No current board exists.
|
||||
|
||||
// Is A Player Name
|
||||
if(address_params.value(2) != 0 && address_params.value(2) != "")
|
||||
{
|
||||
//==================================
|
||||
// Check If Player Does NOT Exist
|
||||
if(!dynamic_cast<CasterBoard*>(mainTabContainer->currentWidget())->players->contains(address_params.value(2)))
|
||||
return;//Player does not exist on current board.
|
||||
QString _player_key(address_params.value(2));
|
||||
//==================================
|
||||
|
||||
// Is Action Address
|
||||
if(address_params.value(3) == "m")// m = modify
|
||||
{
|
||||
// Is Interface Address
|
||||
//~~~~Execute Decoded Command~~~~
|
||||
if(address_params.value(4) == "vol"
|
||||
&& msg->getNumValues() == 1
|
||||
&& address_params.value(5) == 0){//vol = volume
|
||||
try{// Perform Action
|
||||
int _volume = 100 * msg->getValue(0)->toFloat();
|
||||
dynamic_cast<CasterBoard*>(mainTabContainer->currentWidget())->players->value(_player_key)->volumeSlider->setValue(_volume);
|
||||
} catch(...) {}// Type Casting Exception Most Likely
|
||||
} else if (address_params.value(4) == "t_p_p"
|
||||
&& msg->getNumValues() == 1
|
||||
&& address_params.value(5) == 0){//t_p_p = track_position_percent
|
||||
try{// Perform Action
|
||||
int _position = 100 * msg->getValue(0)->toFloat();
|
||||
dynamic_cast<CasterBoard*>(mainTabContainer->currentWidget())->players->value(_player_key)->trackBar->setValue(_position);
|
||||
} catch(...) {}// Type Casting Exception Most Likely
|
||||
} else if (address_params.value(4) == "p_s"
|
||||
&& msg->getNumValues() == 1
|
||||
&& address_params.value(5) != 0){//p_s = play_state // Is Player State Address
|
||||
if(address_params.value(5) == "play_stop" && address_params.value(6) == 0){//
|
||||
try{// Perform Action
|
||||
if(msg->getValue(0)->toInteger() == 1)
|
||||
dynamic_cast<CasterBoard*>(mainTabContainer->currentWidget())->players->value(_player_key)->play_stop_toggle();
|
||||
} catch(...){}// Type Casting Exception Most Likely
|
||||
} else if(address_params.value(5) == "resume_pause" && address_params.value(6) == 0){
|
||||
try{// Perform Action
|
||||
if(msg->getValue(0)->toInteger() == 1)
|
||||
dynamic_cast<CasterBoard*>(mainTabContainer->currentWidget())->players->value(_player_key)->resume_pause_toggle();
|
||||
} catch(...){}// Type Casting Exception Most Likely
|
||||
}
|
||||
} else if (address_params.value(4) == "l_s"
|
||||
&& msg->getNumValues() == 1
|
||||
&& address_params.value(5) == 0){//l_s = loop_state
|
||||
try{// Perform Action (0 = no loop, 1 = loop)
|
||||
dynamic_cast<CasterBoard*>(mainTabContainer->currentWidget())->players->value(_player_key)->setLoopState(msg->getValue(0)->toInteger());
|
||||
} catch(...){}// Type Casting Exception Most Likely
|
||||
}
|
||||
//~~~~Execute Decoded Command End~~~~
|
||||
return;//EXIT
|
||||
}//END_IF ACTION ADDRESS
|
||||
|
||||
}//END_IF PLAYER NAME
|
||||
|
||||
//END_IF CURRENT BOARD PLAYER ADDRESS
|
||||
} else if(address_params.value(1) == "glo"){//glo = global
|
||||
if(address_params.value(2) == "m"){//m = modify
|
||||
// Is Interface Address
|
||||
//~~~~Execute Decoded Command~~~~
|
||||
if (address_params.value(3) == "all_p_s"
|
||||
&& msg->getNumValues() == 1
|
||||
&& address_params.value(4) != 0){//all_p_s = all_play_states // Is Global Player States Address
|
||||
if(address_params.value(4) == "stop" && address_params.value(5) == 0){
|
||||
try{// Perform Action
|
||||
if(msg->getValue(0)->toInteger() == 1)
|
||||
this->stopAllSounds();
|
||||
} catch(...){}// Type Casting Exception Most Likely
|
||||
}
|
||||
} else if (address_params.value(3) == "audio_d_s"
|
||||
&& msg->getNumValues() == 1
|
||||
&& address_params.value(4) == 0){//audio_d_s = audio_ducking_state
|
||||
try{// Perform Action (0 = no duck, 1 = duck)
|
||||
audio_duck_state = msg->getValue(0)->toInteger();
|
||||
if(audio_duck_state == 0){
|
||||
toggleAudioDuckingButton->setIcon(QIcon(":/res/img/duck.png"));
|
||||
} else {
|
||||
audio_duck_state = 1;
|
||||
toggleAudioDuckingButton->setIcon(QIcon(":/res/img/unduck.png"));
|
||||
}
|
||||
|
||||
// Iterate through boards
|
||||
for(int i = 0; i < mainTabContainer->count(); i++)
|
||||
{
|
||||
dynamic_cast<CasterBoard*>(mainTabContainer->widget(i))->setAllAudioDuckingStates(audio_duck_state);
|
||||
}
|
||||
|
||||
// Give current board keyboard focus again
|
||||
if(mainTabContainer->count() > 0 )
|
||||
dynamic_cast<CasterBoard*>(mainTabContainer->currentWidget())->setFocus();
|
||||
} catch(...){}// Type Casting Exception Most Likely
|
||||
} else if (address_params.value(3) == "current_tab"
|
||||
&& msg->getNumValues() == 1
|
||||
&& address_params.value(4) != 0){
|
||||
if(address_params.value(4) == "next" && address_params.value(5) == 0){
|
||||
try{// Perform Action
|
||||
if(msg->getValue(0)->toInteger() == 1)
|
||||
this->switchToNextTab();
|
||||
} catch(...){}// Type Casting Exception Most Likely
|
||||
} else if(address_params.value(4) == "prev" && address_params.value(5) == 0){
|
||||
try{// Perform Action
|
||||
if(msg->getValue(0)->toInteger() == 1)
|
||||
this->switchToPrevTab();
|
||||
} catch(...){}// Type Casting Exception Most Likely
|
||||
}
|
||||
}
|
||||
//~~~~Execute Decoded Command End~~~~
|
||||
return;//EXIT
|
||||
} else if(address_params.value(2) == "sync"){// Triggers Client UI Syncing
|
||||
try{// Perform Action
|
||||
if(msg->getValue(0)->toInteger() == 1)
|
||||
// Synchronize UI Info
|
||||
if(mainTabContainer->count() > 0 ){
|
||||
this->syncWithOSCClient();
|
||||
dynamic_cast<CasterBoard*>(mainTabContainer->currentWidget())->syncWithOSCClient();
|
||||
}
|
||||
} catch(...){}// Type Casting Exception Most Likely
|
||||
}
|
||||
}//END_ELSE_IF GLOBAL ADDRESS
|
||||
}
|
||||
|
||||
void MainWindow::sendOSCMessageToClient(OscMessageComposer* message)
|
||||
{
|
||||
// Send OSC Message
|
||||
try{
|
||||
if(oscConfigPicker->getIsServerRunning()){
|
||||
QByteArray* oscDatagram = message->getBytes();
|
||||
QHostAddress oscClientAddress(*outbound_ipv4);
|
||||
socket->writeDatagram(*oscDatagram, oscClientAddress, outbound_port);
|
||||
}
|
||||
} catch(...) { }
|
||||
|
||||
delete message;
|
||||
}
|
||||
|
||||
//========================================================
|
||||
//==========OSC Composer Methods=====
|
||||
OscMessageComposer* MainWindow::writeOSCMessage(QString address, int value){
|
||||
// Compose OSC Message
|
||||
OscMessageComposer* msg = new OscMessageComposer(address);
|
||||
msg->pushInt32((qint32)value);
|
||||
return msg;
|
||||
}
|
||||
|
||||
OscMessageComposer* MainWindow::writeOSCMessage(QString address, float value){
|
||||
// Compose OSC Message
|
||||
OscMessageComposer* msg = new OscMessageComposer(address);
|
||||
msg->pushFloat(value);
|
||||
return msg;
|
||||
}
|
||||
|
||||
OscMessageComposer* MainWindow::writeOSCMessage(QString address, QString value){
|
||||
// Compose OSC Message
|
||||
OscMessageComposer* msg = new OscMessageComposer(address);
|
||||
msg->pushString(value.toUtf8());
|
||||
return msg;
|
||||
}
|
||||
|
||||
//=========================================================
|
||||
//===Utility Methods====
|
||||
QString MainWindow::get_local_ip(){
|
||||
foreach (const QHostAddress &address, QNetworkInterface::allAddresses()) {
|
||||
if (address.protocol() == QAbstractSocket::IPv4Protocol && address != QHostAddress(QHostAddress::LocalHost))
|
||||
return address.toString();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void MainWindow::syncWithOSCClient(){
|
||||
//Update Audio Ducking
|
||||
OscMessageComposer* msg = writeOSCMessage("/glo/m/audio_d_s", audio_duck_state);
|
||||
this->sendOSCMessageToClient(msg);
|
||||
}
|
||||
|
||||
@ -23,12 +23,19 @@
|
||||
#ifndef MAINWINDOW_H
|
||||
#define MAINWINDOW_H
|
||||
#include <QWidget>
|
||||
#include "libs/osc/composer/OscMessageComposer.h"
|
||||
|
||||
//forward declarations
|
||||
class QObject;
|
||||
class CasterBoard;
|
||||
class QTabWidget;
|
||||
class QPushButton;
|
||||
class QToolBar;
|
||||
class QStatusBar;
|
||||
class QUdpSocket;
|
||||
class QByteArray;
|
||||
class OscMessage;
|
||||
class CasterOSCServerConfigPicker;
|
||||
|
||||
class MainWindow : public QWidget //inherit from QWidget
|
||||
{
|
||||
@ -48,13 +55,28 @@ protected:
|
||||
//PROPERTIES
|
||||
|
||||
//METHODS
|
||||
void keyReleaseEvent(QKeyEvent *event);//Capture Hot Keys
|
||||
|
||||
//WIDGETS
|
||||
|
||||
private:
|
||||
//PROPERTIES
|
||||
int audio_duck_state = 0;
|
||||
int previous_tab_index = 0;
|
||||
CasterOSCServerConfigPicker *oscConfigPicker;
|
||||
|
||||
// OSC Server Settings
|
||||
int inbound_port = 5051;
|
||||
QString *outbound_ipv4;
|
||||
int outbound_port = 9000;
|
||||
|
||||
//METHODS
|
||||
//OSC Composer Methods
|
||||
OscMessageComposer* writeOSCMessage(QString address, int value);
|
||||
OscMessageComposer* writeOSCMessage(QString address, float value);
|
||||
OscMessageComposer* writeOSCMessage(QString address, QString value);
|
||||
//Utility
|
||||
QString get_local_ip();
|
||||
|
||||
//WIDGETS
|
||||
//Toolbar
|
||||
@ -64,11 +86,17 @@ private:
|
||||
QPushButton *openTabButton;
|
||||
QPushButton *saveTabButton;
|
||||
QPushButton *saveAsTabButton;
|
||||
QPushButton *stopAllSoundsButton;
|
||||
QPushButton *renameCurrentTabButton;
|
||||
QPushButton *stopAllSoundsButton;
|
||||
QPushButton *toggleAudioDuckingButton;
|
||||
QPushButton *openSoundControlButton;
|
||||
QPushButton *aboutButton;
|
||||
//Lower window area
|
||||
QTabWidget *mainTabContainer;
|
||||
// Bottom
|
||||
QStatusBar *main_statusbar;
|
||||
// UDP Server
|
||||
QUdpSocket *socket;
|
||||
|
||||
|
||||
signals:
|
||||
@ -84,6 +112,22 @@ public slots:
|
||||
void openProfile();
|
||||
void stopAllSounds();
|
||||
void renameCurrentTab();
|
||||
void toggleAudioDucking();
|
||||
// Tab Switching
|
||||
void switchToNextTab();
|
||||
void switchToPrevTab();
|
||||
void currentTabWasChanged(int tabIndex);
|
||||
void updateCurrentOSCTab(int tabIndex);
|
||||
// Board Signal Emissions Handlers
|
||||
void hotKeyExecution(QKeyEvent * event);
|
||||
void handleGlobalHotKeyEventFromCurrentWidget(QKeyEvent *event);
|
||||
//OSC Server
|
||||
void openOSCSettings();
|
||||
void executeOSCCommand();
|
||||
void executeOneWayOSCCommand(OscMessage* msg, QStringList address_params);
|
||||
void executeTwoWayOSCCommand(OscMessage* msg, QStringList address_params);
|
||||
void sendOSCMessageToClient(OscMessageComposer* message);
|
||||
void syncWithOSCClient();
|
||||
|
||||
};
|
||||
|
||||
|
||||
56
CasterSoundboard/libs/osc/OscAPI.h
Normal file
56
CasterSoundboard/libs/osc/OscAPI.h
Normal file
@ -0,0 +1,56 @@
|
||||
/*
|
||||
* Copyright (c) 2014 MUGEN SAS
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef _OSC_API_H_
|
||||
#define _OSC_API_H_
|
||||
|
||||
#include <QtGlobal>
|
||||
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
||||
#ifdef Q_OS_WIN
|
||||
// Define to export or import depending if we are building or using the library.
|
||||
// OSC_EXPORT should only be defined when building.
|
||||
#if defined(OSC_EXPORT)
|
||||
#define OSC_API __declspec(dllexport)
|
||||
#else
|
||||
#define OSC_API __declspec(dllimport)
|
||||
#endif
|
||||
#else
|
||||
// Define empty for other platforms
|
||||
#define OSC_API
|
||||
#endif
|
||||
#else
|
||||
#ifdef Q_WS_WIN
|
||||
// Define to export or import depending if we are building or using the library.
|
||||
// OSC_EXPORT should only be defined when building.
|
||||
#if defined(OSC_EXPORT)
|
||||
#define OSC_API __declspec(dllexport)
|
||||
#else
|
||||
#define OSC_API __declspec(dllimport)
|
||||
#endif
|
||||
#else
|
||||
// Define empty for other platforms
|
||||
#define OSC_API
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif // _OSC_API_H_
|
||||
395
CasterSoundboard/libs/osc/OscPatternMatching.cpp
Normal file
395
CasterSoundboard/libs/osc/OscPatternMatching.cpp
Normal file
@ -0,0 +1,395 @@
|
||||
/*
|
||||
Written by John MacCallum, The Center for New Music and Audio Technologies,
|
||||
University of California, Berkeley. Copyright (c) 2009, The Regents of
|
||||
the University of California (Regents).
|
||||
Permission to use, copy, modify, distribute, and distribute modified versions
|
||||
of this software and its documentation without fee and without a signed
|
||||
licensing agreement, is hereby granted, provided that the above copyright
|
||||
notice, this paragraph and the following two paragraphs appear in all copies,
|
||||
modifications, and distributions.
|
||||
|
||||
IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
|
||||
SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING
|
||||
OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF REGENTS HAS
|
||||
BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED
|
||||
HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE
|
||||
MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||
*/
|
||||
|
||||
#include <libs/osc/OscPatternMatching.h>
|
||||
#include <string.h>
|
||||
|
||||
/**
|
||||
* Switch this off to disable matching against a pattern with 2 stars
|
||||
*/
|
||||
//#define OSC_MATCH_ENABLE_2STARS 1
|
||||
/**
|
||||
* Switch this off to disable matching against a pattern with more than 2 stars which will
|
||||
* be done recursively.
|
||||
*/
|
||||
//#define OSC_MATCH_ENABLE_NSTARS 1
|
||||
|
||||
static int osc_match_star(const char *pattern, const char *address);
|
||||
#if (OSC_MATCH_ENABLE_NSTARS == 1)
|
||||
static int osc_match_star_r(const char *pattern, const char *address);
|
||||
#endif
|
||||
static int osc_match_single_char(const char *pattern, const char *address);
|
||||
static int osc_match_bracket(const char *pattern, const char *address);
|
||||
static int osc_match_curly_brace(const char *pattern, const char *address);
|
||||
|
||||
int OSCPatternMatching::osc_match(const char *pattern, const char *address, int *pattern_offset, int *address_offset)
|
||||
{
|
||||
if(!strcmp(pattern, address))
|
||||
{
|
||||
*pattern_offset = (int)strlen(pattern);
|
||||
*address_offset = (int)strlen(address);
|
||||
return OSC_MATCH_ADDRESS_COMPLETE | OSC_MATCH_PATTERN_COMPLETE;
|
||||
}
|
||||
|
||||
const char *pattern_start;
|
||||
const char *address_start;
|
||||
|
||||
pattern_start = pattern;
|
||||
address_start = address;
|
||||
|
||||
*pattern_offset = 0;
|
||||
*address_offset = 0;
|
||||
|
||||
while(*address != '\0' && *pattern != '\0')
|
||||
{
|
||||
if(*pattern == '*')
|
||||
{
|
||||
if(!osc_match_star(pattern, address))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
while(*pattern != '/' && *pattern != '\0')
|
||||
{
|
||||
pattern++;
|
||||
}
|
||||
while(*address != '/' && *address != '\0')
|
||||
{
|
||||
address++;
|
||||
}
|
||||
}
|
||||
else if(*address == '*')
|
||||
{
|
||||
while(*pattern != '/' && *pattern != '\0')
|
||||
{
|
||||
pattern++;
|
||||
}
|
||||
while(*address != '/' && *address != '\0')
|
||||
{
|
||||
address++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int n = 0;
|
||||
if(!(n = osc_match_single_char(pattern, address)))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
if(*pattern == '[')
|
||||
{
|
||||
while(*pattern != ']')
|
||||
{
|
||||
pattern++;
|
||||
}
|
||||
pattern++;
|
||||
address++;
|
||||
}
|
||||
else if(*pattern == '{')
|
||||
{
|
||||
while(*pattern != '}')
|
||||
{
|
||||
pattern++;
|
||||
}
|
||||
pattern++;
|
||||
address += n;
|
||||
}
|
||||
else
|
||||
{
|
||||
pattern++;
|
||||
address++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
*pattern_offset = pattern - pattern_start;
|
||||
*address_offset = address - address_start;
|
||||
|
||||
int r = 0;
|
||||
|
||||
if(*address == '\0')
|
||||
{
|
||||
r |= OSC_MATCH_ADDRESS_COMPLETE;
|
||||
}
|
||||
|
||||
if(*pattern == '\0')
|
||||
{
|
||||
r |= OSC_MATCH_PATTERN_COMPLETE;
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
static int osc_match_star(const char *pattern, const char *address)
|
||||
{
|
||||
#if (OSC_MATCH_ENABLE_2STARS == 1)
|
||||
const char *address_start = address;
|
||||
const char *pattern_start = pattern;
|
||||
#endif
|
||||
int num_stars = 0;
|
||||
if(*address == '\0')
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
while(*address != '/' && *address != '\0')
|
||||
{
|
||||
address++;
|
||||
}
|
||||
while(*pattern != '/' && *pattern != '\0')
|
||||
{
|
||||
if(*pattern == '*')
|
||||
{
|
||||
num_stars++;
|
||||
}
|
||||
pattern++;
|
||||
}
|
||||
pattern--;
|
||||
address--;
|
||||
switch(num_stars)
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
const char *pp = pattern, *aa = address;
|
||||
while(*pp != '*')
|
||||
{
|
||||
if(!(osc_match_single_char(pp, aa)))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
if(*pp == ']' || *pp == '}'){
|
||||
while(*pp != '[' && *pp != '{')
|
||||
{
|
||||
pp--;
|
||||
}
|
||||
}
|
||||
pp--;
|
||||
aa--;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
#if (OSC_MATCH_ENABLE_2STARS == 1)
|
||||
{
|
||||
const char *pp = pattern, *aa = address;
|
||||
while(*pp != '*')
|
||||
{
|
||||
if(!(osc_match_single_char(pp, aa)))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
if(*pp == ']' || *pp == '}')
|
||||
{
|
||||
while(*pp != '[' && *pp != '{')
|
||||
{
|
||||
pp--;
|
||||
}
|
||||
}
|
||||
pp--;
|
||||
aa--;
|
||||
}
|
||||
aa++; // we want to start one character forward to allow the star to match nothing
|
||||
const char *star2 = pp;
|
||||
const char *test = aa;
|
||||
int i = 0;
|
||||
while(test > address_start)
|
||||
{
|
||||
pp = star2 - 1;
|
||||
aa = test - 1;
|
||||
i++;
|
||||
while(*pp != '*')
|
||||
{
|
||||
if(!osc_match_single_char(pp, aa))
|
||||
{
|
||||
break;
|
||||
}
|
||||
if(*pp == ']' || *pp == '}')
|
||||
{
|
||||
while(*pp != '[' && *pp != '{')
|
||||
{
|
||||
pp--;
|
||||
}
|
||||
}
|
||||
pp--;
|
||||
aa--;
|
||||
}
|
||||
if(pp == pattern_start)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
test--;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
default:
|
||||
#if (OSC_MATCH_ENABLE_NSTARS == 1)
|
||||
return osc_match_star_r(pattern_start, address_start);
|
||||
break;
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
#if (OSC_MATCH_ENABLE_NSTARS == 1)
|
||||
static int osc_match_star_r(const char *pattern, const char *address)
|
||||
{
|
||||
if(*address == '/' || *address == '\0')
|
||||
{
|
||||
if(*pattern == '/' || *pattern == '\0' || (*pattern == '*' && ((*(pattern + 1) == '/') || *(pattern + 1) == '\0')))
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
if(*pattern == '*')
|
||||
{
|
||||
if(osc_match_star_r(pattern + 1, address))
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return osc_match_star_r(pattern, address + 1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!osc_match_single_char(pattern, address))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
if(*pattern == '[' || *pattern == '{')
|
||||
{
|
||||
while(*pattern != ']' && *pattern != '}')
|
||||
{
|
||||
pattern++;
|
||||
}
|
||||
}
|
||||
return osc_match_star_r(pattern + 1, address + 1);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static int osc_match_single_char(const char *pattern, const char *address)
|
||||
{
|
||||
switch(*pattern)
|
||||
{
|
||||
case '[':
|
||||
return osc_match_bracket(pattern, address);
|
||||
case ']':
|
||||
while(*pattern != '[')
|
||||
{
|
||||
pattern--;
|
||||
}
|
||||
return osc_match_bracket(pattern, address);
|
||||
case '{':
|
||||
return osc_match_curly_brace(pattern, address);
|
||||
case '}':
|
||||
while(*pattern != '{')
|
||||
{
|
||||
pattern--;
|
||||
}
|
||||
return osc_match_curly_brace(pattern, address);
|
||||
case '?':
|
||||
return 1;
|
||||
default:
|
||||
if(*pattern == *address)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int osc_match_bracket(const char *pattern, const char *address)
|
||||
{
|
||||
pattern++;
|
||||
int val = 1;
|
||||
if(*pattern == '!')
|
||||
{
|
||||
pattern++;
|
||||
val = 0;
|
||||
}
|
||||
int matched = !val;
|
||||
while(*pattern != ']' && *pattern != '\0')
|
||||
{
|
||||
// the character we're on now is the beginning of a range
|
||||
if(*(pattern + 1) == '-')
|
||||
{
|
||||
if(*address >= *pattern && *address <= *(pattern + 2))
|
||||
{
|
||||
matched = val;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
pattern += 3;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// just test the character
|
||||
if(*pattern == *address)
|
||||
{
|
||||
matched = val;
|
||||
break;
|
||||
}
|
||||
pattern++;
|
||||
}
|
||||
}
|
||||
return matched;
|
||||
}
|
||||
|
||||
int osc_match_curly_brace(const char *pattern, const char *address)
|
||||
{
|
||||
pattern++;
|
||||
const char *ptr = pattern;
|
||||
while(*ptr != '}' && *ptr != '\0' && *ptr != '/')
|
||||
{
|
||||
while(*ptr != '}' && *ptr != '\0' && *ptr != '/' && *ptr != ',')
|
||||
{
|
||||
ptr++;
|
||||
}
|
||||
int n = ptr - pattern;
|
||||
if(!strncmp(pattern, address, n))
|
||||
{
|
||||
return n;
|
||||
}
|
||||
else
|
||||
{
|
||||
ptr++;
|
||||
pattern = ptr;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
63
CasterSoundboard/libs/osc/OscPatternMatching.h
Normal file
63
CasterSoundboard/libs/osc/OscPatternMatching.h
Normal file
@ -0,0 +1,63 @@
|
||||
/*
|
||||
Written by John MacCallum, The Center for New Music and Audio Technologies,
|
||||
University of California, Berkeley. Copyright (c) 2009, The Regents of
|
||||
the University of California (Regents).
|
||||
Permission to use, copy, modify, distribute, and distribute modified versions
|
||||
of this software and its documentation without fee and without a signed
|
||||
licensing agreement, is hereby granted, provided that the above copyright
|
||||
notice, this paragraph and the following two paragraphs appear in all copies,
|
||||
modifications, and distributions.
|
||||
|
||||
IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
|
||||
SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING
|
||||
OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF REGENTS HAS
|
||||
BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED
|
||||
HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE
|
||||
MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||
*/
|
||||
|
||||
#ifndef OSC_PATTERN_MATCHING_H_
|
||||
#define OSC_PATTERN_MATCHING_H_
|
||||
|
||||
#include <libs/osc/OscAPI.h>
|
||||
|
||||
/*! \class OSCPatternMatching
|
||||
* \brief Class which provides OSC messages pattern matching
|
||||
*
|
||||
* This class provides a static method for OSC messages pattern matching
|
||||
*/
|
||||
class OSC_API OSCPatternMatching
|
||||
{
|
||||
public:
|
||||
|
||||
enum Type {
|
||||
/**
|
||||
* Return code for osc_match() that indicates that the entire address was successfully matched
|
||||
*/
|
||||
OSC_MATCH_ADDRESS_COMPLETE = 1,
|
||||
/**
|
||||
* Return code for osc_match() that indicates that the entire pattern was successfully matched
|
||||
*/
|
||||
OSC_MATCH_PATTERN_COMPLETE = 2
|
||||
};
|
||||
|
||||
/**
|
||||
* Match a pattern against an address. In the case of a partial match, pattern_offset
|
||||
* and address_offset will contain the number of bytes into their respective strings
|
||||
* where the match failed.
|
||||
*
|
||||
* @param pattern The pattern to match
|
||||
* @param address The address to match
|
||||
* @param pattern_offset The number of bytes into the pattern that were matched successfully
|
||||
* @param address_offset The number of bytes into the address that were matched successfully
|
||||
* @return 0 if the match failed altogether, or an or'd combination of OSC_MATCH_ADDRESS_COMPLETE and
|
||||
* OSC_MATCH_PATTERN_COMPLETE.
|
||||
*/
|
||||
static int osc_match(const char *pattern, const char *address, int *pattern_offset, int *address_offset);
|
||||
};
|
||||
|
||||
#endif // OSC_PATTERN_MATCHING_H_
|
||||
37
CasterSoundboard/libs/osc/OscVersion.h
Normal file
37
CasterSoundboard/libs/osc/OscVersion.h
Normal file
@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Copyright (c) 2014 MUGEN SAS
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef OSC_VERSION_H_
|
||||
#define OSC_VERSION_H_
|
||||
|
||||
#include <libs/osc/OscAPI.h>
|
||||
|
||||
class OscVersion
|
||||
{
|
||||
public:
|
||||
enum Version
|
||||
{
|
||||
OSC_10, OSC_11
|
||||
};
|
||||
};
|
||||
|
||||
#endif // OSC_VERSION_H_
|
||||
172
CasterSoundboard/libs/osc/composer/OscBundleComposer.cpp
Normal file
172
CasterSoundboard/libs/osc/composer/OscBundleComposer.cpp
Normal file
@ -0,0 +1,172 @@
|
||||
/*
|
||||
* Copyright (c) 2014 MUGEN SAS
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <libs/osc/composer/OscBundleComposer.h>
|
||||
#include <libs/tools/ByteBuffer.h>
|
||||
#include <libs/tools/NtpTimestamp.h>
|
||||
|
||||
/**
|
||||
* Build a new OSC Bundle.
|
||||
*
|
||||
* @param timetag
|
||||
* The long value that applies as a time tag to this bundle.
|
||||
*/
|
||||
OscBundleComposer::OscBundleComposer(QDateTime timetag) :
|
||||
OscContentComposer()
|
||||
{
|
||||
mData = NULL;
|
||||
QString bundle("#bundle");
|
||||
try
|
||||
{
|
||||
QByteArray bundleByteArray(bundle.toLocal8Bit());
|
||||
mHeaderByteBuffer->put(&bundleByteArray);
|
||||
mHeaderByteBuffer->put( '\0' );
|
||||
}
|
||||
catch (const QException& e)
|
||||
{
|
||||
throw e;
|
||||
}
|
||||
//delete bundleArray;
|
||||
NtpTimestamp ntp = NtpTimestamp::fromDateTime(timetag);
|
||||
mHeaderByteBuffer->putInt( (qint32)ntp.seconds() );
|
||||
mHeaderByteBuffer->putInt( (qint32)ntp.fraction() );
|
||||
}
|
||||
|
||||
OscBundleComposer::~OscBundleComposer() {
|
||||
for (qint32 i = 0; i < mContentList.size(); i++)
|
||||
delete mContentList[i];
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends a new message to the current bundle.
|
||||
*
|
||||
* @param address
|
||||
* @return the new message to compose.
|
||||
*/
|
||||
OscMessageComposer* OscBundleComposer::pushMessage(QString& address)
|
||||
{
|
||||
OscMessageComposer* message = new OscMessageComposer(address);
|
||||
mContentList.push_back(message);
|
||||
return message;
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends a previously built message to the current bundle being composed.
|
||||
*
|
||||
* @param message
|
||||
* The message to add to this bundle.
|
||||
*/
|
||||
void OscBundleComposer::pushMessage(OscMessageComposer* message)
|
||||
{
|
||||
mContentList.push_back(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends a new message to the current bundle.
|
||||
*
|
||||
* @param timeTag
|
||||
* The time tag to apply to the new bundle.
|
||||
* @return the new bundle to compose.
|
||||
*/
|
||||
OscBundleComposer* OscBundleComposer::pushBundle(QDateTime timeTag)
|
||||
{
|
||||
OscBundleComposer* bundle = new OscBundleComposer(timeTag);
|
||||
mContentList.push_back(bundle);
|
||||
return bundle;
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends a previously built bundle to the current bundle being composed.
|
||||
*
|
||||
* @param bundle
|
||||
* The bundle to add to this bundle.
|
||||
*/
|
||||
void OscBundleComposer::pushBundle(OscBundleComposer* bundle)
|
||||
{
|
||||
mContentList.push_back(bundle);
|
||||
}
|
||||
|
||||
/*
|
||||
* @see com.cocon.osc.OscComposer#computeSize()
|
||||
*/
|
||||
qint32 OscBundleComposer::computeSize()
|
||||
{
|
||||
qint32 size = mHeaderByteBuffer->getPosition(); // Do not call ::computeSize() because we don't want to align/fill with 0
|
||||
|
||||
// Compute whole bundle size
|
||||
for (qint32 i = 0; i < mContentList.size(); i++)
|
||||
{
|
||||
size += 4; // reserve space to write this content size
|
||||
size += mContentList[i]->computeSize(); // get this content size
|
||||
}
|
||||
return size;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the complete OSC bundle for the current bundle being composed.
|
||||
*
|
||||
* @return the current OscMessage data.
|
||||
*/
|
||||
QByteArray* OscBundleComposer::getBytes(/*OscVersion::Version aVersion*/)
|
||||
{
|
||||
qint32 size = computeSize();
|
||||
|
||||
// Allocate the bundle buffer
|
||||
mData = new QByteArray(size, 0);
|
||||
|
||||
// First, copy this bundle header
|
||||
try
|
||||
{
|
||||
ByteBuffer* writeBufferHelper = ByteBuffer::wrap(mData);
|
||||
writeBufferHelper->putInt(0, size);
|
||||
fillByteBuffer(writeBufferHelper);
|
||||
return new QByteArray(*mData);
|
||||
}
|
||||
catch (const QException& e)
|
||||
{
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* @see com.cocon.osc.OscComposer#fillByteBuffer(java.nio.ByteBuffer)
|
||||
*/
|
||||
void OscBundleComposer::fillByteBuffer(ByteBuffer* byteBuffer)
|
||||
{
|
||||
try
|
||||
{
|
||||
OscContentComposer::fillByteBuffer(byteBuffer);
|
||||
|
||||
// Then, loop over all the contents to copy data in the buffer
|
||||
for (qint32 i = 0; i < mContentList.size(); i++)
|
||||
{
|
||||
// Write content size
|
||||
OscContentComposer* c = mContentList[i];
|
||||
byteBuffer->putInt(c->computeSize());
|
||||
c->fillByteBuffer(byteBuffer);
|
||||
}
|
||||
}
|
||||
catch (const QException& e)
|
||||
{
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
101
CasterSoundboard/libs/osc/composer/OscBundleComposer.h
Normal file
101
CasterSoundboard/libs/osc/composer/OscBundleComposer.h
Normal file
@ -0,0 +1,101 @@
|
||||
/*
|
||||
* Copyright (c) 2014 MUGEN SAS
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef OSC_BUNDLE_COMPOSER_H_
|
||||
#define OSC_BUNDLE_COMPOSER_H_
|
||||
|
||||
#include <libs/osc/composer/OscContentComposer.h>
|
||||
#include <libs/osc/composer/OscMessageComposer.h>
|
||||
|
||||
class OSC_API OscBundleComposer : public OscContentComposer
|
||||
{
|
||||
private:
|
||||
QByteArray* mData;
|
||||
public:
|
||||
/**
|
||||
* Build a new OSC Bundle.
|
||||
*
|
||||
* @param timetag
|
||||
* The long value that applies as a time tag to this bundle.
|
||||
*/
|
||||
OscBundleComposer(QDateTime timetag);
|
||||
|
||||
/** Destructor. */
|
||||
virtual ~OscBundleComposer();
|
||||
|
||||
/**
|
||||
* Appends a new message to the current bundle.
|
||||
*
|
||||
* @param address
|
||||
* @return the new message to compose.
|
||||
*/
|
||||
OscMessageComposer* pushMessage(QString& address);
|
||||
|
||||
/**
|
||||
* Appends a previously built message to the current bundle being composed.
|
||||
*
|
||||
* @param message
|
||||
* The message to add to this bundle.
|
||||
*/
|
||||
void pushMessage(OscMessageComposer* message);
|
||||
|
||||
/**
|
||||
* Appends a new message to the current bundle.
|
||||
*
|
||||
* @param timeTag
|
||||
* The time tag to apply to the new bundle.
|
||||
* @return the new bundle to compose.
|
||||
*/
|
||||
OscBundleComposer* pushBundle(QDateTime timeTag = NtpTimestamp::IMMEDIATE);
|
||||
|
||||
/**
|
||||
* Appends a previously built bundle to the current bundle being composed.
|
||||
*
|
||||
* @param bundle
|
||||
* The bundle to add to this bundle.
|
||||
*/
|
||||
void pushBundle(OscBundleComposer* bundle);
|
||||
|
||||
/**
|
||||
* Gets the complete OSC bundle for the current bundle being composed.
|
||||
*
|
||||
* @return the current OscMessage data.
|
||||
*/
|
||||
virtual QByteArray* getBytes(/*OscVersion::Version aVersion*/);
|
||||
|
||||
protected:
|
||||
/*
|
||||
* @see com.cocon.osc.OscComposer#computeSize()
|
||||
*/
|
||||
virtual qint32 computeSize();
|
||||
|
||||
/*
|
||||
* @see com.cocon.osc.OscComposer#fillByteBuffer()
|
||||
*/
|
||||
virtual void fillByteBuffer(ByteBuffer* byteBuffer);
|
||||
|
||||
protected:
|
||||
/** List of all messages or bundles to compose to build the whole Bundle. */
|
||||
QVector<OscContentComposer*> mContentList;
|
||||
};
|
||||
|
||||
#endif // OSC_BUNDLE_COMPOSER_H_
|
||||
99
CasterSoundboard/libs/osc/composer/OscContentComposer.cpp
Normal file
99
CasterSoundboard/libs/osc/composer/OscContentComposer.cpp
Normal file
@ -0,0 +1,99 @@
|
||||
/*
|
||||
* Copyright (c) 2014 MUGEN SAS
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <libs/osc/composer/OscContentComposer.h>
|
||||
#include <libs/tools/ByteBuffer.h>
|
||||
#include <math.h>
|
||||
|
||||
qint32 OscContentComposer::mHeaderBufferSize = 128;
|
||||
QByteArray OscContentComposer::mBlank(4, 0);
|
||||
|
||||
OscContentComposer::OscContentComposer()
|
||||
{
|
||||
mHeaderBuffer = new QByteArray(mHeaderBufferSize, 0);
|
||||
mHeaderByteBuffer = ByteBuffer::wrap(mHeaderBuffer, true);
|
||||
}
|
||||
|
||||
OscContentComposer::~OscContentComposer()
|
||||
{
|
||||
// No Need to delete since buffer is owned by ByteBuffer
|
||||
// delete mHeaderBuffer;
|
||||
|
||||
delete mHeaderByteBuffer;
|
||||
}
|
||||
|
||||
qint32 OscContentComposer::computeSize()
|
||||
{
|
||||
// Be sure to align type tags ending
|
||||
if (mHeaderByteBuffer->get(mHeaderByteBuffer->getPosition() - 1) != 0)
|
||||
{
|
||||
mHeaderByteBuffer = checkBufferSize(mHeaderByteBuffer, 1);
|
||||
mHeaderByteBuffer->put((char)0);
|
||||
}
|
||||
fillAlignment(mHeaderByteBuffer);
|
||||
return mHeaderByteBuffer->getPosition();
|
||||
}
|
||||
|
||||
ByteBuffer* OscContentComposer::checkBufferSize(ByteBuffer* aBuffer, size_t aSize)
|
||||
{
|
||||
if (aBuffer->getPosition() + (qint32)aSize > aBuffer->getCapacity())
|
||||
{
|
||||
qint32 newDataBufferSize = aBuffer->getCapacity() + (qint32)pow(2, ceil(log((aSize)) / log(2)));
|
||||
ByteBuffer* newDataByteBuffer = ByteBuffer::allocate(newDataBufferSize);
|
||||
if (aBuffer->getPosition() > 0)
|
||||
newDataByteBuffer->put(aBuffer->getByteArray(), 0, aBuffer->getPosition());
|
||||
delete aBuffer;
|
||||
|
||||
return newDataByteBuffer;
|
||||
}
|
||||
else
|
||||
return aBuffer;
|
||||
}
|
||||
|
||||
void OscContentComposer::fillByteBuffer(ByteBuffer* dst)
|
||||
{
|
||||
try
|
||||
{
|
||||
dst->put(mHeaderByteBuffer->getByteArray(), 0, mHeaderByteBuffer->getPosition());
|
||||
}
|
||||
catch (const QException& e)
|
||||
{
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
void OscContentComposer::fillAlignment(ByteBuffer*& dst)
|
||||
{
|
||||
qint32 size = 4 - (dst->getPosition() & 0x3);
|
||||
if (size != 4)
|
||||
{
|
||||
try
|
||||
{
|
||||
dst = checkBufferSize(dst, size);
|
||||
dst->put(&mBlank, 0, size);
|
||||
}
|
||||
catch (const QException& e)
|
||||
{
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
82
CasterSoundboard/libs/osc/composer/OscContentComposer.h
Normal file
82
CasterSoundboard/libs/osc/composer/OscContentComposer.h
Normal file
@ -0,0 +1,82 @@
|
||||
/*
|
||||
* Copyright (c) 2014 MUGEN SAS
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef OSC_COMPOSER_H_
|
||||
#define OSC_COMPOSER_H_
|
||||
|
||||
#include <libs/osc/OscVersion.h>
|
||||
#include <QtCore/QByteArray>
|
||||
#include <QtCore/QVector>
|
||||
|
||||
class ByteBuffer;
|
||||
|
||||
class OSC_API OscContentComposer
|
||||
{
|
||||
protected:
|
||||
virtual ~OscContentComposer();
|
||||
|
||||
/**
|
||||
* Returns the size of the current OscContentComposer.
|
||||
*
|
||||
* @return the current message size
|
||||
*/
|
||||
virtual qint32 computeSize();
|
||||
|
||||
/**
|
||||
* Copy current message buffers to passed ByteBuffer
|
||||
*
|
||||
* @param dst
|
||||
* The ByteBuffer where to copy current data.
|
||||
*/
|
||||
virtual void fillByteBuffer(ByteBuffer* dst);
|
||||
|
||||
/**
|
||||
* Complete passed ByteBuffer to the next 4-bytes alignment.
|
||||
*
|
||||
* @param dst
|
||||
* The ByteBuffer to complete
|
||||
*/
|
||||
static void fillAlignment(ByteBuffer*& dst);
|
||||
|
||||
ByteBuffer* mHeaderByteBuffer;
|
||||
|
||||
virtual QByteArray* getBytes(/*OscVersion::Version aVersion */) = 0;
|
||||
|
||||
/**
|
||||
* Build a new Composer. By default, bytes are written in BIG_ENDIAN style.
|
||||
*/
|
||||
OscContentComposer();
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
static ByteBuffer* checkBufferSize(ByteBuffer* aBuffer, size_t aSize);
|
||||
|
||||
private:
|
||||
QByteArray* mHeaderBuffer;
|
||||
static qint32 mHeaderBufferSize;
|
||||
static QByteArray mBlank;
|
||||
|
||||
friend class OscBundleComposer;
|
||||
};
|
||||
|
||||
#endif // OSC_COMPOSER_H_
|
||||
543
CasterSoundboard/libs/osc/composer/OscMessageComposer.cpp
Normal file
543
CasterSoundboard/libs/osc/composer/OscMessageComposer.cpp
Normal file
@ -0,0 +1,543 @@
|
||||
/*
|
||||
* Copyright (c) 2014 MUGEN SAS
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <libs/osc/composer/OscMessageComposer.h>
|
||||
#include <libs/osc/OscVersion.h>
|
||||
#include <libs/tools/ByteBuffer.h>
|
||||
|
||||
#include <libs/tools/ByteOrder.h>
|
||||
#include <cstring>
|
||||
#include <new>
|
||||
|
||||
qint32 OscMessageComposer::mDataBufferSize = 128;
|
||||
|
||||
OscMessageComposer::OscMessageComposer(const QString& address)
|
||||
: OscContentComposer(), mArrayLevel(0)
|
||||
{
|
||||
init(address);
|
||||
}
|
||||
|
||||
OscMessageComposer::OscMessageComposer(const char* str)
|
||||
: OscContentComposer(), mArrayLevel(0)
|
||||
{
|
||||
QString s(str);
|
||||
init(s);
|
||||
}
|
||||
|
||||
void
|
||||
OscMessageComposer::init(const QString& address)
|
||||
{
|
||||
try
|
||||
{
|
||||
mHeaderByteBuffer = checkBufferSize(mHeaderByteBuffer, address.length() + 1);
|
||||
QByteArray addressByteArray(address.toLocal8Bit());
|
||||
mHeaderByteBuffer->put(&addressByteArray);
|
||||
mHeaderByteBuffer->put((char)0);
|
||||
fillAlignment(mHeaderByteBuffer);
|
||||
|
||||
mHeaderByteBuffer = checkBufferSize(mHeaderByteBuffer, 1);
|
||||
mHeaderByteBuffer->put((char) ',');
|
||||
}
|
||||
catch (const QException& e)
|
||||
{
|
||||
throw e;
|
||||
}
|
||||
|
||||
mDataBuffer = new QByteArray(mDataBufferSize, 0);
|
||||
mDataByteBuffer = ByteBuffer::wrap(mDataBuffer, true);
|
||||
mDataByteBuffer->setOrder(ByteOrder::BIG_ENDIAN_DATA);
|
||||
}
|
||||
|
||||
OscMessageComposer::~OscMessageComposer()
|
||||
{
|
||||
// No Need to delete since buffer is owned by ByteBuffer
|
||||
// delete mDataBuffer;
|
||||
|
||||
delete mDataByteBuffer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the complete OSC message for the current message being composed.
|
||||
*
|
||||
* @return the current OscMessage data.
|
||||
*/
|
||||
QByteArray* OscMessageComposer::getBytes(/*OscVersion::Version aVersion*/)
|
||||
{
|
||||
// Be sure to end all opened arrays
|
||||
while (mArrayLevel != 0)
|
||||
{
|
||||
pushArrayEnd();
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
fillAlignment(mHeaderByteBuffer);
|
||||
}
|
||||
catch (const QException& e)
|
||||
{
|
||||
throw e;
|
||||
}
|
||||
|
||||
qint32 size = computeSize();
|
||||
|
||||
qint32 offset = 0;
|
||||
QByteArray* tempData;
|
||||
/*if (aVersion == OscVersion::OSC_10) {
|
||||
offset = 4;
|
||||
tempData = new QByteArray(size + 4, 0);
|
||||
ByteBuffer* bb = ByteBuffer::wrap(tempData);
|
||||
bb->putInt(size);
|
||||
delete bb;
|
||||
}
|
||||
else {*/
|
||||
tempData = new QByteArray(size, 0);
|
||||
/*}*/
|
||||
|
||||
memcpy(offset + tempData->data(), mHeaderByteBuffer->getByteArray()->data(), mHeaderByteBuffer->getPosition());
|
||||
memcpy(offset + tempData->data() + mHeaderByteBuffer->getPosition(), mDataByteBuffer->getByteArray()->data(), mDataByteBuffer->getPosition());
|
||||
|
||||
return tempData;
|
||||
}
|
||||
|
||||
qint32 OscMessageComposer::computeSize()
|
||||
{
|
||||
return OscContentComposer::computeSize() + mDataByteBuffer->getPosition();
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates the beginning of an array in the OscMessage being composed.
|
||||
*/
|
||||
void OscMessageComposer::pushArrayBegin()
|
||||
{
|
||||
try
|
||||
{
|
||||
mHeaderByteBuffer = checkBufferSize(mHeaderByteBuffer, 1);
|
||||
mHeaderByteBuffer->put((char) '[');
|
||||
mArrayLevel++;
|
||||
}
|
||||
catch (const QException& e)
|
||||
{
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Indicates the end of an array in the OscMessage being composed.
|
||||
*
|
||||
* Does nothing if no array has been started.
|
||||
*/
|
||||
void OscMessageComposer::pushArrayEnd()
|
||||
{
|
||||
if (mArrayLevel > 0)
|
||||
{
|
||||
try
|
||||
{
|
||||
mHeaderByteBuffer = checkBufferSize(mHeaderByteBuffer, 1);
|
||||
mHeaderByteBuffer->put((char) ']');
|
||||
mArrayLevel--;
|
||||
}
|
||||
catch (const QException& e)
|
||||
{
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Pushes the whole, or part of, bytes array into this message.
|
||||
*
|
||||
* @param src
|
||||
* The array from which bytes are to be read
|
||||
* @param offset
|
||||
* The offset within the array of the first byte to be read; must
|
||||
* be non-negative and no larger than array.length
|
||||
* @param length
|
||||
* The number of bytes to be read from the given array; must be
|
||||
* non-negative and no larger than array.length - offset
|
||||
*/
|
||||
void OscMessageComposer::pushBlob(QByteArray* src, qint32 offset, qint32 length)
|
||||
{
|
||||
try
|
||||
{
|
||||
mHeaderByteBuffer = checkBufferSize(mHeaderByteBuffer, 1);
|
||||
mHeaderByteBuffer->put((char) 'b');
|
||||
|
||||
mDataByteBuffer = checkBufferSize(mDataByteBuffer, 4);
|
||||
mDataByteBuffer->putInt(length);
|
||||
|
||||
mDataByteBuffer = checkBufferSize(mDataByteBuffer, length);
|
||||
mDataByteBuffer->put(src, offset, length);
|
||||
|
||||
fillAlignment(mDataByteBuffer);
|
||||
}
|
||||
catch (const QException& e)
|
||||
{
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
OscMessageComposer::pushBlob(const QByteArray& src)
|
||||
{
|
||||
pushBlob((QByteArray*) &src, 0, src.size());
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends a <i>True</i> or <i>False</i> flag to OscMessage being composed,
|
||||
* respectively to the passed boolean value.
|
||||
*
|
||||
* @param b
|
||||
* The boolean value to add to the message
|
||||
*/
|
||||
void OscMessageComposer::pushBool(bool b)
|
||||
{
|
||||
try
|
||||
{
|
||||
mHeaderByteBuffer = checkBufferSize(mHeaderByteBuffer, 1);
|
||||
mHeaderByteBuffer->put((char)(b ? 'T' : 'F'));
|
||||
}
|
||||
catch (const QException& e)
|
||||
{
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends a <i>ASCII character</i> value to OscMessage being composed.
|
||||
*
|
||||
* @param c
|
||||
* The ASCII character value to add to the message.
|
||||
*/
|
||||
void OscMessageComposer::pushChar(char c)
|
||||
{
|
||||
try
|
||||
{
|
||||
mHeaderByteBuffer = checkBufferSize(mHeaderByteBuffer, 1);
|
||||
mHeaderByteBuffer->put((char) 'c');
|
||||
|
||||
mDataByteBuffer = checkBufferSize(mDataByteBuffer, 4);
|
||||
mDataByteBuffer->putInt(c);
|
||||
}
|
||||
catch (const QException& e)
|
||||
{
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends a <i>double</i> value to OscMessage being composed.
|
||||
*
|
||||
* @param d
|
||||
* The double value to add to the message.
|
||||
*/
|
||||
void OscMessageComposer::pushDouble(double d)
|
||||
{
|
||||
try
|
||||
{
|
||||
mHeaderByteBuffer = checkBufferSize(mHeaderByteBuffer, 1);
|
||||
mHeaderByteBuffer->put((char) 'd');
|
||||
|
||||
mDataByteBuffer = checkBufferSize(mDataByteBuffer, 8);
|
||||
mDataByteBuffer->putDouble(d);
|
||||
}
|
||||
catch (const QException& e)
|
||||
{
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends a <i>False</i> flag to OscMessage being composed.
|
||||
*/
|
||||
void OscMessageComposer::pushFalse()
|
||||
{
|
||||
try
|
||||
{
|
||||
mHeaderByteBuffer = checkBufferSize(mHeaderByteBuffer, 1);
|
||||
mHeaderByteBuffer->put((char) 'F');
|
||||
}
|
||||
catch (const QException& e)
|
||||
{
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends a <i>32-bit float</i> value to OscMessage being composed.
|
||||
*
|
||||
* @param f
|
||||
* The float value to add to the message.
|
||||
*/
|
||||
void OscMessageComposer::pushFloat(float f)
|
||||
{
|
||||
try
|
||||
{
|
||||
mHeaderByteBuffer = checkBufferSize(mHeaderByteBuffer, 1);
|
||||
mHeaderByteBuffer->put((char) 'f');
|
||||
|
||||
mDataByteBuffer = checkBufferSize(mDataByteBuffer, 4);
|
||||
mDataByteBuffer->putFloat(f);
|
||||
}
|
||||
catch (const QException& e)
|
||||
{
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends an <i>Infinitum</i> flag to OscMessage being composed.
|
||||
*/
|
||||
void OscMessageComposer::pushInfinitum()
|
||||
{
|
||||
try
|
||||
{
|
||||
mHeaderByteBuffer = checkBufferSize(mHeaderByteBuffer, 1);
|
||||
mHeaderByteBuffer->put((char) 'I');
|
||||
}
|
||||
catch (const QException& e)
|
||||
{
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends a <i>32-bit integer</i> value to OscMessage being composed.
|
||||
*
|
||||
* @param i
|
||||
* The int32 value to add to the message.
|
||||
*/
|
||||
void OscMessageComposer::pushInt32(qint32 i)
|
||||
{
|
||||
try
|
||||
{
|
||||
mHeaderByteBuffer = checkBufferSize(mHeaderByteBuffer, 1);
|
||||
mHeaderByteBuffer->put((char) 'i');
|
||||
|
||||
mDataByteBuffer = checkBufferSize(mDataByteBuffer, 4);
|
||||
mDataByteBuffer->putInt(i);
|
||||
}
|
||||
catch (const QException& e)
|
||||
{
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends a <i>64-bit integer</i> value to OscMessage being composed.
|
||||
*
|
||||
* @param l
|
||||
* The long value to add to the message.
|
||||
*/
|
||||
void OscMessageComposer::pushLong(qint64 l)
|
||||
{
|
||||
try
|
||||
{
|
||||
mHeaderByteBuffer = checkBufferSize(mHeaderByteBuffer, 1);
|
||||
mHeaderByteBuffer->put((char) 'h');
|
||||
|
||||
mDataByteBuffer = checkBufferSize(mDataByteBuffer, 8);
|
||||
mDataByteBuffer->putLong(l);
|
||||
}
|
||||
catch (const QException& e)
|
||||
{
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends a <i>4-byte MIDI message</i> value to OscMessage being composed.
|
||||
*
|
||||
* @param m
|
||||
* The MIDI message value to add to the message.
|
||||
*/
|
||||
void OscMessageComposer::pushMidi(char port, char status, char data1, char data2)
|
||||
{
|
||||
try
|
||||
{
|
||||
mHeaderByteBuffer = checkBufferSize(mHeaderByteBuffer, 1);
|
||||
mHeaderByteBuffer->put((char) 'm');
|
||||
|
||||
mDataByteBuffer = checkBufferSize(mDataByteBuffer, 4);
|
||||
mDataByteBuffer->put(port);
|
||||
mDataByteBuffer->put(status);
|
||||
mDataByteBuffer->put(data1);
|
||||
mDataByteBuffer->put(data2);
|
||||
}
|
||||
catch (const QException& e)
|
||||
{
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends an <i>Nil</i> flag to OscMessage being composed.
|
||||
*/
|
||||
void OscMessageComposer::pushNil()
|
||||
{
|
||||
try
|
||||
{
|
||||
mHeaderByteBuffer = checkBufferSize(mHeaderByteBuffer, 1);
|
||||
mHeaderByteBuffer->put((char) 'N');
|
||||
}
|
||||
catch (const QException& e)
|
||||
{
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends a <i>32-bit RGBA color</i> value to OscMessage being composed.
|
||||
*
|
||||
* @param r
|
||||
* The RGBA color value to add to the message.
|
||||
*/
|
||||
void OscMessageComposer::pushRGBA(qint32 r)
|
||||
{
|
||||
try
|
||||
{
|
||||
mHeaderByteBuffer = checkBufferSize(mHeaderByteBuffer, 1);
|
||||
mHeaderByteBuffer->put((char) 'r');
|
||||
|
||||
mDataByteBuffer = checkBufferSize(mDataByteBuffer, 4);
|
||||
mDataByteBuffer->putInt(r);
|
||||
}
|
||||
catch (const QException& e)
|
||||
{
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends a <i>String</i> to OscMessage being composed.
|
||||
*
|
||||
* @param s
|
||||
* The string to add to the message.
|
||||
*/
|
||||
void OscMessageComposer::pushString(const QString& s)
|
||||
{
|
||||
try
|
||||
{
|
||||
mHeaderByteBuffer = checkBufferSize(mHeaderByteBuffer, 1);
|
||||
mHeaderByteBuffer->put((char) 's');
|
||||
|
||||
QByteArray sArray = s.toUtf8();
|
||||
mDataByteBuffer = checkBufferSize(mDataByteBuffer, sArray.length()+1);
|
||||
mDataByteBuffer->put(&sArray);
|
||||
mDataByteBuffer->put((char) '\0');
|
||||
|
||||
fillAlignment(mDataByteBuffer);
|
||||
}
|
||||
catch (const BufferUnderflowException& e)
|
||||
{
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends a <i>Symbol</i> to OscMessage being composed.
|
||||
*
|
||||
* @param S
|
||||
* The symbol to add to the message.
|
||||
*/
|
||||
void OscMessageComposer::pushSymbol(QString& S)
|
||||
{
|
||||
try
|
||||
{
|
||||
mHeaderByteBuffer = checkBufferSize(mHeaderByteBuffer, 1);
|
||||
mHeaderByteBuffer->put((char) 'S');
|
||||
|
||||
QByteArray sArray = S.toUtf8();
|
||||
mDataByteBuffer = checkBufferSize(mDataByteBuffer, sArray.length()+1);
|
||||
mDataByteBuffer->put(&sArray);
|
||||
mDataByteBuffer->put((char) '\0');
|
||||
|
||||
fillAlignment(mDataByteBuffer);
|
||||
}
|
||||
catch (const BufferUnderflowException& e)
|
||||
{
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends a <i>Time Tag</i> to OscMessage being composed.
|
||||
*
|
||||
* @param t
|
||||
* The time tag value as a long value to add to the message.
|
||||
*/
|
||||
void OscMessageComposer::pushTimeTag(QDateTime& t)
|
||||
{
|
||||
try
|
||||
{
|
||||
mHeaderByteBuffer = checkBufferSize(mHeaderByteBuffer, 1);
|
||||
mHeaderByteBuffer->put((char) 't');
|
||||
|
||||
mDataByteBuffer = checkBufferSize(mDataByteBuffer, 8);
|
||||
|
||||
NtpTimestamp ntp = NtpTimestamp::fromDateTime(t);
|
||||
QByteArray seconds(4,0);
|
||||
qint32 secs = ntp.rawSeconds();
|
||||
seconds.insert(0, (char*)&secs, 4);
|
||||
mDataByteBuffer->put( &seconds, 0, 4);
|
||||
|
||||
QByteArray fraction(4,0);
|
||||
qint32 frac = ntp.rawFraction();
|
||||
fraction.insert(0, (char*)&frac, 4 );
|
||||
mDataByteBuffer->put( &fraction, 0, 4 );
|
||||
|
||||
}
|
||||
catch (const BufferUnderflowException& e)
|
||||
{
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends a <i>True</i> flag to OscMessage being composed.
|
||||
*/
|
||||
void OscMessageComposer::pushTrue()
|
||||
{
|
||||
try
|
||||
{
|
||||
mHeaderByteBuffer = checkBufferSize(mHeaderByteBuffer, 1);
|
||||
mHeaderByteBuffer->put((char) 'T');
|
||||
}
|
||||
catch (const BufferUnderflowException& e)
|
||||
{
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* @see com.cocon.osc.OscComposer#fillByteBuffer(java.nio.ByteBuffer)
|
||||
*/
|
||||
void OscMessageComposer::fillByteBuffer(ByteBuffer* _byteBuffer)
|
||||
{
|
||||
try
|
||||
{
|
||||
OscContentComposer::fillByteBuffer(_byteBuffer);
|
||||
_byteBuffer->put(mDataByteBuffer->getByteArray(), 0, mDataByteBuffer->getPosition());
|
||||
}
|
||||
catch (const BufferUnderflowException& e)
|
||||
{
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
230
CasterSoundboard/libs/osc/composer/OscMessageComposer.h
Normal file
230
CasterSoundboard/libs/osc/composer/OscMessageComposer.h
Normal file
@ -0,0 +1,230 @@
|
||||
/*
|
||||
* Copyright (c) 2014 MUGEN SAS
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef OSC_MESSAGE_COMPOSER_H_
|
||||
#define OSC_MESSAGE_COMPOSER_H_
|
||||
|
||||
#include <libs/osc/composer/OscContentComposer.h>
|
||||
#include <QDateTime>
|
||||
#include <libs/osc/reader/types/OscTimetag.h>
|
||||
|
||||
class OSC_API OscMessageComposer : public OscContentComposer
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Build a new OSC message
|
||||
*
|
||||
* @param address
|
||||
* The address pattern to set to the message.
|
||||
*/
|
||||
OscMessageComposer(const QString& address);
|
||||
|
||||
/**
|
||||
* Build a new OSC message
|
||||
*
|
||||
* @param address
|
||||
* The address pattern to set to the message.
|
||||
*/
|
||||
OscMessageComposer(const char* str);
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
virtual ~OscMessageComposer();
|
||||
|
||||
/**
|
||||
* @brief init
|
||||
* @param address
|
||||
*/
|
||||
void init(const QString& address);
|
||||
|
||||
/**
|
||||
* Gets the complete OSC message for the current message being composed.
|
||||
*
|
||||
* @return the current OscMessage data.
|
||||
*/
|
||||
virtual QByteArray* getBytes(/*OscVersion::Version aVersion = OscVersion::OSC_10*/);
|
||||
|
||||
/**
|
||||
* Indicates the beginning of an array in the OscMessage being composed.
|
||||
*/
|
||||
void pushArrayBegin();
|
||||
|
||||
/**
|
||||
* Indicates the end of an array in the OscMessage being composed.
|
||||
*
|
||||
* Does nothing if no array has been started.
|
||||
*/
|
||||
void pushArrayEnd();
|
||||
|
||||
/**
|
||||
* Pushes the whole passed bytes array into this message.
|
||||
*
|
||||
* @param src
|
||||
* The array from which bytes are to be read
|
||||
*/
|
||||
void pushBlob(const QByteArray& src);
|
||||
|
||||
/**
|
||||
* Pushes the whole, or part of, bytes array into this message.
|
||||
*
|
||||
* @param src
|
||||
* The array from which bytes are to be read
|
||||
* @param offset
|
||||
* The offset within the array of the first byte to be read; must
|
||||
* be non-negative and no larger than array.length
|
||||
* @param length
|
||||
* The number of bytes to be read from the given array; must be
|
||||
* non-negative and no larger than array.length - offset
|
||||
*/
|
||||
void pushBlob(QByteArray* src, qint32 offset, qint32 length);
|
||||
|
||||
/**
|
||||
* Appends a <i>True</i> or <i>False</i> flag to OscMessage being composed,
|
||||
* respectively to the passed boolean value.
|
||||
*
|
||||
* @param b
|
||||
* The boolean value to add to the message
|
||||
*/
|
||||
void pushBool(bool b);
|
||||
|
||||
/**
|
||||
* Appends a <i>ASCII character</i> value to OscMessage being composed.
|
||||
*
|
||||
* @param c
|
||||
* The ASCII character value to add to the message.
|
||||
*/
|
||||
void pushChar(char c);
|
||||
|
||||
/**
|
||||
* Appends a <i>double</i> value to OscMessage being composed.
|
||||
*
|
||||
* @param d
|
||||
* The double value to add to the message.
|
||||
*/
|
||||
void pushDouble(double d);
|
||||
|
||||
/**
|
||||
* Appends a <i>False</i> flag to OscMessage being composed.
|
||||
*/
|
||||
void pushFalse();
|
||||
|
||||
/**
|
||||
* Appends a <i>32-bit float</i> value to OscMessage being composed.
|
||||
*
|
||||
* @param f
|
||||
* The float value to add to the message.
|
||||
*/
|
||||
void pushFloat(float f);
|
||||
|
||||
/**
|
||||
* Appends an <i>Infinitum</i> flag to OscMessage being composed.
|
||||
*/
|
||||
void pushInfinitum();
|
||||
|
||||
/**
|
||||
* Appends a <i>32-bit integer</i> value to OscMessage being composed.
|
||||
*
|
||||
* @param i
|
||||
* The int32 value to add to the message.
|
||||
*/
|
||||
void pushInt32(qint32 i);
|
||||
|
||||
/**
|
||||
* Appends a <i>64-bit integer</i> value to OscMessage being composed.
|
||||
*
|
||||
* @param l
|
||||
* The long value to add to the message.
|
||||
*/
|
||||
void pushLong(qint64 l);
|
||||
|
||||
/**
|
||||
* Appends a <i>4-byte MIDI message</i> value to OscMessage being composed.
|
||||
*
|
||||
* @param m
|
||||
* The MIDI message value to add to the message.
|
||||
*/
|
||||
void pushMidi(char port, char status, char data1, char data2);
|
||||
|
||||
/**
|
||||
* Appends an <i>Nil</i> flag to OscMessage being composed.
|
||||
*/
|
||||
void pushNil();
|
||||
|
||||
/**
|
||||
* Appends a <i>32-bit RGBA color</i> value to OscMessage being composed.
|
||||
*
|
||||
* @param r
|
||||
* The RGBA color value to add to the message.
|
||||
*/
|
||||
void pushRGBA(qint32 r);
|
||||
|
||||
/**
|
||||
* Appends a <i>String</i> to OscMessage being composed.
|
||||
*
|
||||
* @param s
|
||||
* The string to add to the message.
|
||||
*/
|
||||
void pushString(const QString& s);
|
||||
|
||||
/**
|
||||
* Appends a <i>Symbol</i> to OscMessage being composed.
|
||||
*
|
||||
* @param S
|
||||
* The symbol to add to the message.
|
||||
*/
|
||||
void pushSymbol(QString& S);
|
||||
|
||||
/**
|
||||
* Appends a <i>Time Tag</i> to OscMessage being composed.
|
||||
*
|
||||
* @param t
|
||||
* The time tag value as a long value to add to the message.
|
||||
*/
|
||||
void pushTimeTag(QDateTime& t );
|
||||
|
||||
/**
|
||||
* Appends a <i>True</i> flag to OscMessage being composed.
|
||||
*/
|
||||
void pushTrue();
|
||||
|
||||
protected:
|
||||
|
||||
/*
|
||||
* @see com.cocon.osc.OscComposer#fillByteBuffer(java.nio.ByteBuffer)
|
||||
*/
|
||||
virtual void fillByteBuffer(ByteBuffer* _byteBuffer);
|
||||
|
||||
/**
|
||||
* @see com.cocon.osc.OscComposer#getSize()
|
||||
*/
|
||||
virtual qint32 computeSize();
|
||||
|
||||
private:
|
||||
OscMessageComposer() {};
|
||||
qint32 mArrayLevel;
|
||||
QByteArray* mDataBuffer;
|
||||
static qint32 mDataBufferSize;
|
||||
ByteBuffer* mDataByteBuffer;
|
||||
};
|
||||
|
||||
#endif // OSC_MESSAGE_COMPOSER_H_
|
||||
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright (c) 2014 MUGEN SAS
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef OSC_BOOLEAN_CONVERSION_EXCEPTION_H_
|
||||
#define OSC_BOOLEAN_CONVERSION_EXCEPTION_H_
|
||||
|
||||
#include <QtCore/QException>
|
||||
|
||||
class BooleanConversionException : public QException
|
||||
{
|
||||
public:
|
||||
|
||||
virtual const char* what() const throw ()
|
||||
{
|
||||
return "Content does not match Bundle structure.";
|
||||
}
|
||||
};
|
||||
|
||||
#endif // OSC_BOOLEAN_CONVERSION_EXCEPTION_H_
|
||||
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright (c) 2014 MUGEN SAS
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef OSC_BYTES_CONVERSION_EXCEPTION_H_
|
||||
#define OSC_BYTES_CONVERSION_EXCEPTION_H_
|
||||
|
||||
#include <QtCore/QException>
|
||||
|
||||
class BytesConversionException : public QException
|
||||
{
|
||||
public:
|
||||
|
||||
virtual const char* what() const throw ()
|
||||
{
|
||||
return "Content does not match Bundle structure.";
|
||||
}
|
||||
};
|
||||
|
||||
#endif // OSC_BYTES_CONVERSION_EXCEPTION_H_
|
||||
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright (c) 2014 MUGEN SAS
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef OSC_CHAR_CONVERSION_EXCEPTION_H_
|
||||
#define OSC_CHAR_CONVERSION_EXCEPTION_H_
|
||||
|
||||
#include <QtCore/QException>
|
||||
|
||||
class CharConversionException : public QException
|
||||
{
|
||||
public:
|
||||
|
||||
virtual const char* what() const throw ()
|
||||
{
|
||||
return "Content does not match Bundle structure.";
|
||||
}
|
||||
};
|
||||
|
||||
#endif // OSC_CHAR_CONVERSION_EXCEPTION_H_
|
||||
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright (c) 2014 MUGEN SAS
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef OSC_DOUBLE_CONVERTION_EXCEPTION_H_
|
||||
#define OSC_DOUBLE_CONVERTION_EXCEPTION_H_
|
||||
|
||||
#include <QtCore/QException>
|
||||
|
||||
class DoubleConversionException : public QException
|
||||
{
|
||||
public:
|
||||
|
||||
virtual const char* what() const throw ()
|
||||
{
|
||||
return "Content does not match Bundle structure.";
|
||||
}
|
||||
};
|
||||
|
||||
#endif // OSC_DOUBLE_CONVERTION_EXCEPTION_H_
|
||||
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright (c) 2014 MUGEN SAS
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef OSC_FLOAT_CONVERSION_EXCEPTION_H_
|
||||
#define OSC_FLOAT_CONVERSION_EXCEPTION_H_
|
||||
|
||||
#include <QtCore/QException>
|
||||
|
||||
class FloatConversionException : public QException
|
||||
{
|
||||
public:
|
||||
|
||||
virtual const char* what() const throw ()
|
||||
{
|
||||
return "Content does not match Bundle structure.";
|
||||
}
|
||||
};
|
||||
|
||||
#endif // OSC_FLOAT_CONVERSION_EXCEPTION_H_
|
||||
39
CasterSoundboard/libs/osc/exceptions/GetBundleException.h
Normal file
39
CasterSoundboard/libs/osc/exceptions/GetBundleException.h
Normal file
@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copyright (c) 2014 MUGEN SAS
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef OSC_BUNDLE_EXCEPTION_H_
|
||||
#define OSC_BUNDLE_EXCEPTION_H_
|
||||
|
||||
#include <QtCore/QException>
|
||||
#include <QtCore/qstring.h>
|
||||
|
||||
class GetBundleException : public QException
|
||||
{
|
||||
public:
|
||||
|
||||
virtual const char* what() const throw ()
|
||||
{
|
||||
return "Content does not match Bundle structure.";
|
||||
}
|
||||
};
|
||||
|
||||
#endif // OSC_BUNDLE_EXCEPTION_H_
|
||||
38
CasterSoundboard/libs/osc/exceptions/GetMessageException.h
Normal file
38
CasterSoundboard/libs/osc/exceptions/GetMessageException.h
Normal file
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright (c) 2014 MUGEN SAS
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef OSC_MESSAGE_EXCEPTION_H_
|
||||
#define OSC_MESSAGE_EXCEPTION_H_
|
||||
|
||||
#include <QtCore/QException>
|
||||
|
||||
class GetMessageException : public QException
|
||||
{
|
||||
public:
|
||||
|
||||
virtual const char* what() const throw ()
|
||||
{
|
||||
return "Content does not match Message structure.";
|
||||
}
|
||||
};
|
||||
|
||||
#endif // OSC_MESSAGE_EXCEPTION_H_
|
||||
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright (c) 2014 MUGEN SAS
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef OSC_INTEGER_CONVERSION_EXCEPTION_H_
|
||||
#define OSC_INTEGER_CONVERSION_EXCEPTION_H_
|
||||
|
||||
#include <QtCore/QException>
|
||||
|
||||
class IntegerConversionException : public QException
|
||||
{
|
||||
public:
|
||||
|
||||
virtual const char* what() const throw ()
|
||||
{
|
||||
return "Content does not match Bundle structure.";
|
||||
}
|
||||
};
|
||||
|
||||
#endif // OSC_INTEGER_CONVERSION_EXCEPTION_H_
|
||||
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright (c) 2014 MUGEN SAS
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef OSC_LONG_CONVERSION_EXCEPTION_H_
|
||||
#define OSC_LONG_CONVERSION_EXCEPTION_H_
|
||||
|
||||
#include <QtCore/QException>
|
||||
|
||||
class LongConversionException : public QException
|
||||
{
|
||||
public:
|
||||
|
||||
virtual const char* what() const throw ()
|
||||
{
|
||||
return "Content does not match Bundle structure.";
|
||||
}
|
||||
};
|
||||
|
||||
#endif // OSC_LONG_CONVERSION_EXCEPTION_H_
|
||||
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright (c) 2014 MUGEN SAS
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef MALFORMED_ARRAY_EXCEPTION_H_
|
||||
#define MALFORMED_ARRAY_EXCEPTION_H_
|
||||
|
||||
#include <QtCore/QException>
|
||||
|
||||
class MalformedArrayException : public QException
|
||||
{
|
||||
public:
|
||||
|
||||
virtual const char* what() const throw ()
|
||||
{
|
||||
return "array was not terminated before end of message (expected ']' end of array tag)";
|
||||
}
|
||||
};
|
||||
|
||||
#endif // MALFORMED_ARRAY_EXCEPTION_H_
|
||||
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright (c) 2014 MUGEN SAS
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef OSC_MALFORMED_BUNDLE_EXCEPTION_H_
|
||||
#define OSC_MALFORMED_BUNDLE_EXCEPTION_H_
|
||||
|
||||
#include <QtCore/QException>
|
||||
|
||||
class OscMalformedBundleException : public QException
|
||||
{
|
||||
public:
|
||||
|
||||
virtual const char* what() const throw ()
|
||||
{
|
||||
return "Malformed bunble header";
|
||||
}
|
||||
};
|
||||
|
||||
#endif // OSC_MALFORMED_BUNDLE_EXCEPTION_H_
|
||||
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright (c) 2014 MUGEN SAS
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef OSC_MIDI_CONVERTION_EXCEPTION_H_
|
||||
#define OSC_MIDI_CONVERTION_EXCEPTION_H_
|
||||
|
||||
#include <QtCore/QException>
|
||||
|
||||
class MidiConversionException : public QException
|
||||
{
|
||||
public:
|
||||
|
||||
virtual const char* what() const throw ()
|
||||
{
|
||||
return "Content does not match Bundle structure.";
|
||||
}
|
||||
};
|
||||
|
||||
#endif // OSC_MIDI_CONVERTION_EXCEPTION_H_
|
||||
46
CasterSoundboard/libs/osc/exceptions/OSC_ALL_EXCEPTIONS.h
Normal file
46
CasterSoundboard/libs/osc/exceptions/OSC_ALL_EXCEPTIONS.h
Normal file
@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Copyright (c) 2014 MUGEN SAS
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef OSC_ALL_EXCEPTIONS_H_
|
||||
#define OSC_ALL_EXCEPTIONS_H_
|
||||
|
||||
#include <libs/osc/exceptions/BooleanConversionException.h>
|
||||
#include <libs/osc/exceptions/BytesConversionException.h>
|
||||
#include <libs/osc/exceptions/CharConversionException.h>
|
||||
#include <libs/osc/exceptions/DoubleConversionException.h>
|
||||
#include <libs/osc/exceptions/FloatConversionException.h>
|
||||
#include <libs/osc/exceptions/GetBundleException.h>
|
||||
#include <libs/osc/exceptions/GetMessageException.h>
|
||||
#include <libs/osc/exceptions/IntegerConversionException.h>
|
||||
#include <libs/osc/exceptions/LongConversionException.h>
|
||||
#include <libs/osc/exceptions/MalformedArrayException.h>
|
||||
#include <libs/osc/exceptions/MalformedBundleException.h>
|
||||
#include <libs/osc/exceptions/MidiConversionException.h>
|
||||
#include <libs/osc/exceptions/OutOfBoundsReadException.h>
|
||||
#include <libs/osc/exceptions/ReadMessageException.h>
|
||||
#include <libs/osc/exceptions/RgbaConversionException.h>
|
||||
#include <libs/osc/exceptions/StringConversionException.h>
|
||||
#include <libs/osc/exceptions/SymbolConversionException.h>
|
||||
#include <libs/osc/exceptions/TimetagConversionException.h>
|
||||
#include <libs/osc/exceptions/UnknownTagException.h>
|
||||
|
||||
#endif // OSC_ALL_EXCEPTIONS_H_
|
||||
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright (c) 2014 MUGEN SAS
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef OUT_OF_BOUNDS_READ_EXCEPTION_H_
|
||||
#define OUT_OF_BOUNDS_READ_EXCEPTION_H_
|
||||
|
||||
#include <QtCore/QException>
|
||||
|
||||
class OutOfBoundsReadException : public QException
|
||||
{
|
||||
public:
|
||||
|
||||
virtual const char* what() const throw ()
|
||||
{
|
||||
return "trying to read data beyond packet size limit";
|
||||
}
|
||||
};
|
||||
|
||||
#endif // OUT_OF_BOUNDS_READ_EXCEPTION_H_
|
||||
38
CasterSoundboard/libs/osc/exceptions/ReadMessageException.h
Normal file
38
CasterSoundboard/libs/osc/exceptions/ReadMessageException.h
Normal file
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright (c) 2014 MUGEN SAS
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef READ_MESSAGE_EXCEPTION_H_
|
||||
#define READ_MESSAGE_EXCEPTION_H_
|
||||
|
||||
#include <QtCore/QException>
|
||||
|
||||
class ReadMessageException : public QException
|
||||
{
|
||||
public:
|
||||
|
||||
virtual const char* what() const throw ()
|
||||
{
|
||||
return "Unable to read message because of error.";
|
||||
}
|
||||
};
|
||||
|
||||
#endif // READ_MESSAGE_EXCEPTION_H_
|
||||
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright (c) 2014 MUGEN SAS
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef OSC_RGBA_CONVERSION_EXCEPTION_H_
|
||||
#define OSC_RGBA_CONVERSION_EXCEPTION_H_
|
||||
|
||||
#include <QtCore/QException>
|
||||
|
||||
class RgbaConversionException : public QException
|
||||
{
|
||||
public:
|
||||
|
||||
virtual const char* what() const throw ()
|
||||
{
|
||||
return "Content does not match Bundle structure.";
|
||||
}
|
||||
};
|
||||
|
||||
#endif // OSC_RGBA_CONVERSION_EXCEPTION_H_
|
||||
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright (c) 2014 MUGEN SAS
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef OSC_STRING_CONVERSION_EXCEPTION_H_
|
||||
#define OSC_STRING_CONVERSION_EXCEPTION_H_
|
||||
|
||||
#include <QtCore/QException>
|
||||
|
||||
class StringConversionException : public QException
|
||||
{
|
||||
public:
|
||||
|
||||
virtual const char* what() const throw ()
|
||||
{
|
||||
return "Content does not match Bundle structure.";
|
||||
}
|
||||
};
|
||||
|
||||
#endif // OSC_STRING_CONVERSION_EXCEPTION_H_
|
||||
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright (c) 2014 MUGEN SAS
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef OSC_SYMBOL_CONVERSION_EXCEPTION_H_
|
||||
#define OSC_SYMBOL_CONVERSION_EXCEPTION_H_
|
||||
|
||||
#include <QtCore/QException>
|
||||
|
||||
class SymbolConversionException : public QException
|
||||
{
|
||||
public:
|
||||
|
||||
virtual const char* what() const throw ()
|
||||
{
|
||||
return "Content does not match Bundle structure.";
|
||||
}
|
||||
};
|
||||
|
||||
#endif // OSC_SYMBOL_CONVERSION_EXCEPTION_H_
|
||||
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright (c) 2014 MUGEN SAS
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef OSC_TIMETAG_CONVERSION_EXCEPTION_H_
|
||||
#define OSC_TIMETAG_CONVERSION_EXCEPTION_H_
|
||||
|
||||
#include <QtCore/QException>
|
||||
|
||||
class TimetagConversionException : public QException
|
||||
{
|
||||
public:
|
||||
|
||||
virtual const char* what() const throw ()
|
||||
{
|
||||
return "Content does not match Bundle structure.";
|
||||
}
|
||||
};
|
||||
|
||||
#endif // OSC_TIMETAG_CONVERSION_EXCEPTION_H_
|
||||
38
CasterSoundboard/libs/osc/exceptions/UnknownTagException.h
Normal file
38
CasterSoundboard/libs/osc/exceptions/UnknownTagException.h
Normal file
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright (c) 2014 MUGEN SAS
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef UNKNOWN_TAG_EXCEPTION_H_
|
||||
#define UNKNOWN_TAG_EXCEPTION_H_
|
||||
|
||||
#include <QtCore/QException>
|
||||
|
||||
class UnknownTagException : public QException
|
||||
{
|
||||
public:
|
||||
|
||||
virtual const char* what() const throw ()
|
||||
{
|
||||
return "unknown type tag";
|
||||
}
|
||||
};
|
||||
|
||||
#endif // UNKNOWN_TAG_EXCEPTION_H_
|
||||
109
CasterSoundboard/libs/osc/reader/OscBundle.cpp
Normal file
109
CasterSoundboard/libs/osc/reader/OscBundle.cpp
Normal file
@ -0,0 +1,109 @@
|
||||
/*
|
||||
* Copyright (c) 2014 MUGEN SAS
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <libs/osc/reader/OscBundle.h>
|
||||
#include <libs/tools/ByteBuffer.h>
|
||||
#include <libs/osc/reader/OscMessage.h>
|
||||
#include <libs/osc/exceptions/MalformedBundleException.h>
|
||||
#include <libs/osc/exceptions/GetBundleException.h>
|
||||
#include <libs/osc/exceptions/GetMessageException.h>
|
||||
#include <libs/tools/NtpTimestamp.h>
|
||||
|
||||
/**
|
||||
* Build a new OscBundle object.
|
||||
*
|
||||
* @param bufferSize
|
||||
* The size of the buffer containing the bundle to load.
|
||||
* @throws OscMalformedBundleException
|
||||
* The bundle cannot be read properly.
|
||||
* @throws OscMalformedMessageException
|
||||
* A contained message cannot be read properly.
|
||||
*/
|
||||
OscBundle::OscBundle(ByteBuffer* packet, qint32 bufferSize)
|
||||
: OscContent(packet)
|
||||
{
|
||||
if (mPacket->get() != '#' || mPacket->get() != 'b' || mPacket->get() != 'u' || mPacket->get() != 'n'
|
||||
|| mPacket->get() != 'd' || mPacket->get() != 'l' || mPacket->get() != 'e' || mPacket->get() != '\0')
|
||||
throw OscMalformedBundleException();
|
||||
|
||||
// Move Packet cursor after timeTag
|
||||
mPacket->getLong();
|
||||
|
||||
while (mPacket->getPosition() < mStartIdx + bufferSize)
|
||||
{
|
||||
qint32 contentSize = mPacket->getInt();
|
||||
if (mPacket->get(mPacket->getPosition()) == '#')
|
||||
mContentList.push_back(new OscBundle(packet, contentSize));
|
||||
else
|
||||
mContentList.push_back(new OscMessage(packet, contentSize));
|
||||
}
|
||||
}
|
||||
|
||||
OscBundle::~OscBundle()
|
||||
{
|
||||
delete mPacket;
|
||||
|
||||
for (qint32 i = 0; i < mContentList.size(); i++)
|
||||
{
|
||||
delete (mContentList[i]);
|
||||
}
|
||||
mContentList.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current bundle time tag as a 64-bit integer value
|
||||
*
|
||||
* @return the time tag as a long value.
|
||||
*/
|
||||
QDateTime OscBundle::getTimeTag()
|
||||
{
|
||||
NtpTimestamp ntp(mPacket->getInt(mStartIdx + 8), mPacket->getInt(mStartIdx + 12));
|
||||
return NtpTimestamp::toDateTime(ntp);
|
||||
}
|
||||
|
||||
/** */
|
||||
size_t OscBundle::getNumEntries()
|
||||
{
|
||||
return mContentList.size();
|
||||
}
|
||||
|
||||
/** */
|
||||
OscBundle* OscBundle::getBundle(qint32 index)
|
||||
{
|
||||
if (dynamic_cast<OscBundle*>(mContentList[index]) != 0)
|
||||
return dynamic_cast<OscBundle*>(mContentList[index]);
|
||||
throw GetBundleException();
|
||||
}
|
||||
|
||||
/**
|
||||
* Conversion type for current OscContent object as an OscMessage
|
||||
* object.
|
||||
*
|
||||
* @return this as an OscMessage object. If this cannot be convert to an
|
||||
* OscMessage object, returns null.
|
||||
*/
|
||||
OscMessage* OscBundle::getMessage(qint32 index)
|
||||
{
|
||||
if (dynamic_cast<OscMessage*>(mContentList[index]) != 0)
|
||||
return dynamic_cast<OscMessage*>(mContentList[index]);
|
||||
throw GetMessageException();
|
||||
}
|
||||
84
CasterSoundboard/libs/osc/reader/OscBundle.h
Normal file
84
CasterSoundboard/libs/osc/reader/OscBundle.h
Normal file
@ -0,0 +1,84 @@
|
||||
/*
|
||||
* Copyright (c) 2014 MUGEN SAS
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef OSC_BUNDLE_H_
|
||||
#define OSC_BUNDLE_H_
|
||||
|
||||
#include <libs/osc/reader/OscContent.h>
|
||||
#include <QDateTime>
|
||||
|
||||
class OSC_API OscBundle : public OscContent {
|
||||
public:
|
||||
|
||||
/** TODO */
|
||||
size_t getNumEntries();
|
||||
|
||||
/**
|
||||
* Conversion type for current OscContent object as an OscBundle object.
|
||||
*
|
||||
* @return this as an OscBundle object. If this cannot be convert to an
|
||||
* OscBundle object, returns null.
|
||||
*/
|
||||
OscBundle* getBundle(qint32 index);
|
||||
|
||||
/**
|
||||
* Conversion type for current OscContent object as an OscMessage
|
||||
* object.
|
||||
*
|
||||
* @return this as an OscMessage object. If this cannot be convert to an
|
||||
* OscMessage object, returns null.
|
||||
*/
|
||||
OscMessage* getMessage(qint32 index);
|
||||
|
||||
/**
|
||||
* Returns the current bundle time tag as a 64-bit integer value
|
||||
*
|
||||
* @return the time tag as a long value.
|
||||
*/
|
||||
QDateTime getTimeTag();
|
||||
|
||||
private:
|
||||
/**
|
||||
* Build a new OscBundle object.
|
||||
*
|
||||
* @param bufferSize
|
||||
* The size of the buffer containing the bundle to load.
|
||||
* @throws OscMalformedBundleException
|
||||
* The bundle cannot be read properly.
|
||||
* @throws OscMalformedMessageException
|
||||
* A contained message cannot be read properly.
|
||||
*/
|
||||
OscBundle(ByteBuffer* packet, qint32 bufferSize);
|
||||
|
||||
/** Destructor */
|
||||
virtual ~OscBundle();
|
||||
|
||||
/**
|
||||
* List of all messages or bundles directly accessible from this bundle.
|
||||
*/
|
||||
QVector<OscContent*> mContentList;
|
||||
|
||||
/** Required for access to constructor. */
|
||||
friend class OscReader;
|
||||
};
|
||||
|
||||
#endif // OSC_BUNDLE_H_
|
||||
41
CasterSoundboard/libs/osc/reader/OscContent.cpp
Normal file
41
CasterSoundboard/libs/osc/reader/OscContent.cpp
Normal file
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright (c) 2014 MUGEN SAS
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <libs/osc/reader/OscContent.h>
|
||||
#include <libs/tools/ByteBuffer.h>
|
||||
|
||||
/** Build the current OscContent object. */
|
||||
OscContent::OscContent(ByteBuffer* packet)
|
||||
: mPacket(packet)
|
||||
{
|
||||
mStartIdx = mPacket->getPosition();
|
||||
mDataIdx = 0;
|
||||
}
|
||||
|
||||
OscContent::~OscContent() {
|
||||
}
|
||||
|
||||
ByteBuffer*
|
||||
OscContent::getPacket()
|
||||
{
|
||||
return mPacket;
|
||||
}
|
||||
54
CasterSoundboard/libs/osc/reader/OscContent.h
Normal file
54
CasterSoundboard/libs/osc/reader/OscContent.h
Normal file
@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright (c) 2014 MUGEN SAS
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef OSC_CONTENT_H_
|
||||
#define OSC_CONTENT_H_
|
||||
|
||||
#include <QtCore/QtGlobal>
|
||||
#include <QtCore/QVector>
|
||||
#include <libs/osc/OscAPI.h>
|
||||
|
||||
class OscBundle;
|
||||
class OscMessage;
|
||||
class ByteBuffer;
|
||||
|
||||
/**
|
||||
* Abstract class to manage packet embedded content as objects.
|
||||
*/
|
||||
class OSC_API OscContent
|
||||
{
|
||||
|
||||
public:
|
||||
virtual ~OscContent();
|
||||
|
||||
ByteBuffer* getPacket();
|
||||
|
||||
protected:
|
||||
qint32 mDataIdx;
|
||||
qint32 mStartIdx;
|
||||
ByteBuffer* mPacket;
|
||||
|
||||
/** Build the current OscContent object. */
|
||||
OscContent(ByteBuffer* packet);
|
||||
};
|
||||
|
||||
#endif // OSC_CONTENT_H_
|
||||
202
CasterSoundboard/libs/osc/reader/OscMessage.cpp
Normal file
202
CasterSoundboard/libs/osc/reader/OscMessage.cpp
Normal file
@ -0,0 +1,202 @@
|
||||
/*
|
||||
* Copyright (c) 2014 MUGEN SAS
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <libs/osc/reader/OscMessage.h>
|
||||
#include <libs/osc/reader/OscReader.h>
|
||||
#include <libs/tools/ByteBuffer.h>
|
||||
#include <libs/osc/exceptions/MalformedArrayException.h>
|
||||
#include <libs/osc/exceptions/OutOfBoundsReadException.h>
|
||||
#include <libs/osc/exceptions/UnknownTagException.h>
|
||||
|
||||
#include <libs/osc/reader/types/OscAddress.h>
|
||||
#include <libs/osc/reader/types/OscArrayBegin.h>
|
||||
#include <libs/osc/reader/types/OscArrayEnd.h>
|
||||
#include <libs/osc/reader/types/OscBlob.h>
|
||||
#include <libs/osc/reader/types/OscChar.h>
|
||||
#include <libs/osc/reader/types/OscDouble.h>
|
||||
#include <libs/osc/reader/types/OscFalse.h>
|
||||
#include <libs/osc/reader/types/OscFloat.h>
|
||||
#include <libs/osc/reader/types/OscInfinitum.h>
|
||||
#include <libs/osc/reader/types/OscInteger.h>
|
||||
#include <libs/osc/reader/types/OscLong.h>
|
||||
#include <libs/osc/reader/types/OscMidi.h>
|
||||
#include <libs/osc/reader/types/OscNil.h>
|
||||
#include <libs/osc/reader/types/OscRGBA.h>
|
||||
#include <libs/osc/reader/types/OscString.h>
|
||||
#include <libs/osc/reader/types/OscSymbol.h>
|
||||
#include <libs/osc/reader/types/OscTags.h>
|
||||
#include <libs/osc/reader/types/OscTimetag.h>
|
||||
#include <libs/osc/reader/types/OscTrue.h>
|
||||
|
||||
/** */
|
||||
size_t OscMessage::getNumValues() const
|
||||
{
|
||||
return mValues.size() - 2;
|
||||
}
|
||||
|
||||
/** */
|
||||
OscValue* OscMessage::getValue(size_t index) const
|
||||
{
|
||||
return mValues[index + 2];
|
||||
}
|
||||
|
||||
QString OscMessage::getAddress() const
|
||||
{
|
||||
return ((OscAddress*)getValue(-2))->toString();
|
||||
}
|
||||
|
||||
QString OscMessage::getTags() const
|
||||
{
|
||||
return ((OscTags*)getValue(-1))->toString();
|
||||
}
|
||||
|
||||
QDateTime OscMessage::getTimeTag() const
|
||||
{
|
||||
int pos = getTags().indexOf( 't' );
|
||||
if (pos != -1)
|
||||
{
|
||||
OscValue* value = getValue( pos - 1 );
|
||||
return value->toTimetag();
|
||||
}
|
||||
return NtpTimestamp::IMMEDIATE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build a new OscMessage object. While building the message structure,
|
||||
* the packet buffer is parsed, and new OscValue objects are created and
|
||||
* registered in a list, in order to be accessible later.
|
||||
*
|
||||
* @param messageSize
|
||||
* The size of the buffer containing the bundle to load.
|
||||
* @throws OscMalformedMessageException
|
||||
* A contained message cannot be read properly.
|
||||
*/
|
||||
OscMessage::OscMessage(ByteBuffer* packet, qint32 messageSize) :
|
||||
OscContent(packet)
|
||||
{
|
||||
qint32 arrayLevel = 0;
|
||||
try
|
||||
{
|
||||
mValues.push_back(new OscAddress(packet, mStartIdx));
|
||||
|
||||
// Current packet position is set to data section.
|
||||
qint32 dataIdx = mPacket->getPosition();
|
||||
qint32 tagsIdx = dataIdx;
|
||||
do
|
||||
{
|
||||
if (dataIdx > mStartIdx + messageSize)
|
||||
throw new BufferUnderflowException();
|
||||
|
||||
char tag = mPacket->get(tagsIdx);
|
||||
dataIdx = mPacket->getPosition();
|
||||
OscValue* newValue = 0;
|
||||
switch (tag)
|
||||
{
|
||||
case 0: // null tag... exit loop...
|
||||
break;
|
||||
case ',':
|
||||
newValue = new OscTags(packet, dataIdx);
|
||||
break;
|
||||
case 'T':
|
||||
newValue = new OscTrue(packet, dataIdx);
|
||||
break;
|
||||
case 'F':
|
||||
newValue = new OscFalse(packet, dataIdx);
|
||||
break;
|
||||
case 'N':
|
||||
newValue = new OscNil(packet, dataIdx);
|
||||
break;
|
||||
case 'I':
|
||||
newValue = new OscInfinitum(packet, dataIdx);
|
||||
break;
|
||||
case '[':
|
||||
newValue = new OscArrayBegin(packet, dataIdx);
|
||||
++arrayLevel;
|
||||
break;
|
||||
case ']':
|
||||
newValue = new OscArrayEnd(packet, dataIdx);
|
||||
--arrayLevel;
|
||||
break;
|
||||
case 'i':
|
||||
newValue = new OscInteger(packet, dataIdx);
|
||||
break;
|
||||
case 'f':
|
||||
newValue = new OscFloat(packet, dataIdx);
|
||||
break;
|
||||
case 'c':
|
||||
newValue = new OscChar(packet, dataIdx);
|
||||
break;
|
||||
case 'r':
|
||||
newValue = new OscRGBA(packet, dataIdx);
|
||||
break;
|
||||
case 'm':
|
||||
newValue = new OscMidi(packet, dataIdx);
|
||||
break;
|
||||
case 'h':
|
||||
newValue = new OscLong(packet, dataIdx);
|
||||
break;
|
||||
case 't':
|
||||
newValue = new OscTimetag(packet, dataIdx);
|
||||
break;
|
||||
case 'd':
|
||||
newValue = new OscDouble(packet, dataIdx);
|
||||
break;
|
||||
case 's':
|
||||
newValue = new OscString(packet, dataIdx);
|
||||
break;
|
||||
case 'S':
|
||||
newValue = new OscSymbol(packet, dataIdx);
|
||||
break;
|
||||
case 'b':
|
||||
newValue = new OscBlob(packet, dataIdx);
|
||||
break;
|
||||
default:
|
||||
throw UnknownTagException();
|
||||
}
|
||||
|
||||
if (newValue != 0)
|
||||
mValues.push_back(newValue); // push this Value to the Value list
|
||||
|
||||
} while (mPacket->get(tagsIdx++) != 0);
|
||||
}
|
||||
catch (BufferUnderflowException&)
|
||||
{
|
||||
throw OutOfBoundsReadException();
|
||||
}
|
||||
catch (IndexOutOfBoundsException&)
|
||||
{
|
||||
throw OutOfBoundsReadException();
|
||||
}
|
||||
if (arrayLevel != 0)
|
||||
throw MalformedArrayException();
|
||||
}
|
||||
|
||||
OscMessage::~OscMessage()
|
||||
{
|
||||
delete mPacket;
|
||||
|
||||
for (qint32 i = 0; i < mValues.size(); i++)
|
||||
{
|
||||
delete (mValues[i]);
|
||||
}
|
||||
mValues.clear();
|
||||
}
|
||||
87
CasterSoundboard/libs/osc/reader/OscMessage.h
Normal file
87
CasterSoundboard/libs/osc/reader/OscMessage.h
Normal file
@ -0,0 +1,87 @@
|
||||
/*
|
||||
* Copyright (c) 2014 MUGEN SAS
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef OSC_MESSAGE_H_
|
||||
#define OSC_MESSAGE_H_
|
||||
|
||||
#include <libs/osc/reader/OscContent.h>
|
||||
#include <QDateTime>
|
||||
|
||||
class ByteArray;
|
||||
class OscValue;
|
||||
|
||||
/**
|
||||
* Class managing packet data as an OSC message object.
|
||||
* <p>
|
||||
* An OSC message object is composed of:
|
||||
* <ul>
|
||||
* <li>An address pattern string (aka OscAddress)
|
||||
* <li>A type tags string (aka OscTags)
|
||||
* <li>A list of values (aka OscValue)
|
||||
* <li>...
|
||||
* </ul>
|
||||
* </p>
|
||||
*/
|
||||
class OSC_API OscMessage : public OscContent
|
||||
{
|
||||
public:
|
||||
|
||||
/** */
|
||||
size_t getNumValues() const;
|
||||
|
||||
/** */
|
||||
OscValue* getValue(size_t index) const;
|
||||
|
||||
/** */
|
||||
QString getAddress() const;
|
||||
|
||||
/** */
|
||||
QString getTags() const;
|
||||
|
||||
/** */
|
||||
virtual QDateTime getTimeTag() const;
|
||||
|
||||
/** Destructor */
|
||||
virtual ~OscMessage();
|
||||
|
||||
private:
|
||||
/**
|
||||
* Build a new OscMessage object. While building the message structure,
|
||||
* the packet buffer is parsed, and new OscValue objects are created and
|
||||
* registered in a list, in order to be accessible later.
|
||||
*
|
||||
* @param messageSize
|
||||
* The size of the buffer containing the bundle to load.
|
||||
* @throws OscMalformedMessageException
|
||||
* A contained message cannot be read properly.
|
||||
*/
|
||||
OscMessage(ByteBuffer* packet, qint32 messageSize);
|
||||
|
||||
/** List of values embedded in the current OscMessage. */
|
||||
QVector<OscValue*> mValues;
|
||||
|
||||
/** Required for access to constructor. */
|
||||
friend class OscBundle;
|
||||
friend class OscReader;
|
||||
};
|
||||
|
||||
#endif // OSC_MESSAGE_H_
|
||||
105
CasterSoundboard/libs/osc/reader/OscReader.cpp
Normal file
105
CasterSoundboard/libs/osc/reader/OscReader.cpp
Normal file
@ -0,0 +1,105 @@
|
||||
/*
|
||||
* Copyright (c) 2014 MUGEN SAS
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <libs/osc/reader/OscReader.h>
|
||||
#include <libs/osc/reader/OscBundle.h>
|
||||
#include <libs/osc/reader/OscMessage.h>
|
||||
#include <libs/osc/exceptions/MalformedBundleException.h>
|
||||
#include <libs/osc/exceptions/GetBundleException.h>
|
||||
#include <libs/osc/exceptions/GetMessageException.h>
|
||||
#include <libs/osc/exceptions/ReadMessageException.h>
|
||||
#include <libs/tools/ByteBuffer.h>
|
||||
|
||||
/** */
|
||||
OscBundle* OscReader::getBundle()
|
||||
{
|
||||
OscBundle* bundle = dynamic_cast<OscBundle*>(mContent);
|
||||
if (bundle)
|
||||
return bundle;
|
||||
return 0;//NULL
|
||||
}
|
||||
|
||||
/**
|
||||
* Conversion type for current OscContent object as an OscMessage
|
||||
* object.
|
||||
*
|
||||
* @return this as an OscMessage object. If this cannot be convert to an
|
||||
* OscMessage object, returns null.
|
||||
*/
|
||||
OscMessage* OscReader::getMessage()
|
||||
{
|
||||
OscMessage* message = dynamic_cast<OscMessage*>(mContent);
|
||||
if (message)
|
||||
return message;
|
||||
return 0;//NULL
|
||||
}
|
||||
|
||||
/**
|
||||
* Build a new OscContent object based on the passed byte buffer.
|
||||
*
|
||||
* @param src
|
||||
* the byte buffer to parse containing OSC messages
|
||||
* @param length
|
||||
* the length of the message buffer
|
||||
* @throws OscMalformedBundleException
|
||||
* The bundle cannot be read properly.
|
||||
* @throws OscMalformedMessageException
|
||||
* A contained message cannot be read properly.
|
||||
*/
|
||||
OscReader::OscReader(QByteArray* src)
|
||||
{
|
||||
init(src, 0, src->size());
|
||||
}
|
||||
|
||||
OscReader::OscReader(QByteArray* src, qint32 offset, qint32 size)
|
||||
{
|
||||
init(src, offset, size);
|
||||
}
|
||||
|
||||
OscReader::~OscReader()
|
||||
{
|
||||
// DO NOT DESTROY OSCMESSAGE OR OSCBUNDLE
|
||||
// delete mContent
|
||||
// delete mPacket;
|
||||
}
|
||||
|
||||
void
|
||||
OscReader::init(QByteArray* src, qint32 offset, qint32 size)
|
||||
{
|
||||
mContent = NULL;
|
||||
mPacketSize = size;
|
||||
mPacket = ByteBuffer::wrap(src);
|
||||
try
|
||||
{
|
||||
if (mPacket->get(mPacket->getPosition()) == '#')
|
||||
mContent = new OscBundle(mPacket, mPacketSize);
|
||||
else
|
||||
{
|
||||
mPacket->setPosition(offset);
|
||||
mContent = new OscMessage(mPacket, mPacketSize);
|
||||
}
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
throw ReadMessageException();
|
||||
}
|
||||
}
|
||||
94
CasterSoundboard/libs/osc/reader/OscReader.h
Normal file
94
CasterSoundboard/libs/osc/reader/OscReader.h
Normal file
@ -0,0 +1,94 @@
|
||||
/*
|
||||
* Copyright (c) 2014 MUGEN SAS
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef OSC_READER_H_
|
||||
#define OSC_READER_H_
|
||||
|
||||
#include <libs/osc/OscVersion.h>
|
||||
#include <QtCore/QByteArray>
|
||||
|
||||
class ByteBuffer;
|
||||
class OscBundle;
|
||||
class OscMessage;
|
||||
class OscContent;
|
||||
|
||||
class OSC_API OscReader
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* @brief Conversion type for current OscContent object as an OscBundle object.
|
||||
*
|
||||
* @return this as an OscBundle object. If this cannot be convert to an
|
||||
* OscBundle object, returns null.
|
||||
*/
|
||||
OscBundle* getBundle();
|
||||
|
||||
/**
|
||||
* @brief Conversion type for current OscContent object as an OscMessage
|
||||
* object.
|
||||
*
|
||||
* @return this as an OscMessage object. If this cannot be convert to an
|
||||
* OscMessage object, returns null.
|
||||
*/
|
||||
OscMessage* getMessage();
|
||||
|
||||
/**
|
||||
* @brief Build a new OscContent object based on the passed byte buffer.
|
||||
*
|
||||
* @param src
|
||||
* the byte buffer to parse containing OSC messages
|
||||
* @throws ReadMessageException
|
||||
* The contained message cannot be read properly.
|
||||
*/
|
||||
OscReader(QByteArray* src);
|
||||
|
||||
/**
|
||||
* @brief Build a new OscContent object based on the passed byte buffer.
|
||||
*
|
||||
* @param src
|
||||
* the byte buffer to parse containing OSC messages
|
||||
* @param offset
|
||||
* the position where to start reading the byte buffer
|
||||
* @param size
|
||||
* the size of the byte buffer
|
||||
* @throws ReadMessageException
|
||||
* The contained message cannot be read properly.
|
||||
*/
|
||||
OscReader(QByteArray* src, qint32 offset, qint32 size);
|
||||
|
||||
/**
|
||||
* @brief Destructor.
|
||||
*/
|
||||
~OscReader();
|
||||
|
||||
private:
|
||||
|
||||
OscContent* mContent;
|
||||
ByteBuffer* mPacket;
|
||||
qint32 mPacketSize;
|
||||
|
||||
void init(QByteArray* src, qint32 offset, qint32 size);
|
||||
|
||||
friend class OscMessage;
|
||||
};
|
||||
|
||||
#endif // OSC_READER_H_
|
||||
167
CasterSoundboard/libs/osc/reader/OscValue.cpp
Normal file
167
CasterSoundboard/libs/osc/reader/OscValue.cpp
Normal file
@ -0,0 +1,167 @@
|
||||
/*
|
||||
* Copyright (c) 2014 MUGEN SAS
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <libs/osc/reader/types/OscValue.h>
|
||||
#include <libs/tools/ByteBuffer.h>
|
||||
#include <libs/osc/exceptions/TimetagConversionException.h>
|
||||
#include <libs/osc/exceptions/MidiConversionException.h>
|
||||
#include <libs/osc/exceptions/RgbaConversionException.h>
|
||||
|
||||
OscValue::OscValue(char typeTag, ByteBuffer* packet, qint32 pos)
|
||||
: mPacket(packet)
|
||||
, mTag(typeTag)
|
||||
, mPos(pos)
|
||||
{
|
||||
}
|
||||
|
||||
char OscValue::getTag()
|
||||
{
|
||||
return mTag;
|
||||
}
|
||||
|
||||
/** */
|
||||
bool OscValue::isArrayBegin()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/** */
|
||||
bool OscValue::isArrayEnd()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/** */
|
||||
bool OscValue::isFalse()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/** */
|
||||
bool OscValue::isInfinitum()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/** */
|
||||
bool OscValue::isNil()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/** */
|
||||
bool OscValue::isTrue()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/** */
|
||||
bool OscValue::toBoolean()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/** */
|
||||
char OscValue::toChar()
|
||||
{
|
||||
return getTag();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the position of the next null character in the packet.
|
||||
*
|
||||
* @return the position.
|
||||
*/
|
||||
qint32 OscValue::getLastStringIdx(ByteBuffer* packet)
|
||||
{
|
||||
// only check string for last 4th byte
|
||||
qint32 pos = packet->getPosition();
|
||||
while (packet->get(pos) != 0)
|
||||
pos += 1;
|
||||
return pos;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the string located at the passed position in the packet buffer.
|
||||
*
|
||||
* @param pos The position were the string starts
|
||||
* @return The read string.
|
||||
*/
|
||||
QByteArray OscValue::getString(ByteBuffer* packet, qint32 pos)
|
||||
{
|
||||
try
|
||||
{
|
||||
packet->setPosition(pos);
|
||||
qint32 end = getLastStringIdx(packet);
|
||||
qint32 size = end - pos;
|
||||
QByteArray bytes(size, 0);
|
||||
packet->get(&bytes, 0, size);
|
||||
|
||||
qint32 rem = 4 - ((size+1) % 4);
|
||||
if (rem == 4)
|
||||
rem = 0;
|
||||
|
||||
packet->setPosition(pos + size + 1 + rem);
|
||||
|
||||
return bytes;
|
||||
}
|
||||
catch (const QException& e)
|
||||
{
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
QString OscValue::toString()
|
||||
{
|
||||
return QString(getTag());
|
||||
}
|
||||
|
||||
QString OscValue::toSymbol()
|
||||
{
|
||||
return QString(getTag());
|
||||
}
|
||||
|
||||
qint32 OscValue::toInteger()
|
||||
{
|
||||
return (qint32)toLong();
|
||||
}
|
||||
|
||||
float OscValue::toFloat()
|
||||
{
|
||||
return (float)toDouble();
|
||||
}
|
||||
|
||||
Midi OscValue::toMIDI()
|
||||
{
|
||||
throw MidiConversionException();
|
||||
}
|
||||
|
||||
RGBA OscValue::toRGBA()
|
||||
{
|
||||
throw RgbaConversionException();
|
||||
}
|
||||
|
||||
QDateTime OscValue::toTimetag()
|
||||
{
|
||||
throw TimetagConversionException();
|
||||
}
|
||||
|
||||
90
CasterSoundboard/libs/osc/reader/types/Midi.h
Normal file
90
CasterSoundboard/libs/osc/reader/types/Midi.h
Normal file
@ -0,0 +1,90 @@
|
||||
/*
|
||||
* Copyright (c) 2014 MUGEN SAS
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef MIDI_H_
|
||||
#define MIDI_H_
|
||||
|
||||
#include <libs/osc/OscAPI.h>
|
||||
|
||||
class OSC_API Midi
|
||||
{
|
||||
private:
|
||||
char mPort;
|
||||
char mStatus;
|
||||
char mData1;
|
||||
char mData2;
|
||||
public:
|
||||
Midi()
|
||||
{
|
||||
mPort = 'm';
|
||||
mStatus = 'i';
|
||||
mData1 = 'd';
|
||||
mData2 = 'i';
|
||||
}
|
||||
|
||||
Midi(const QByteArray& aByteArray)
|
||||
{
|
||||
mPort = aByteArray[0];
|
||||
mStatus = aByteArray[1];
|
||||
mData1 = aByteArray[2];
|
||||
mData2 = aByteArray[3];
|
||||
}
|
||||
|
||||
Midi(char aPort, char aStatus, char aData1, char aData2)
|
||||
{
|
||||
mPort = aPort;
|
||||
mStatus = aStatus;
|
||||
mData1 = aData1;
|
||||
mData2 = aData2;
|
||||
}
|
||||
|
||||
char getPort() const
|
||||
{
|
||||
return mPort;
|
||||
}
|
||||
|
||||
char getStatus() const
|
||||
{
|
||||
return mStatus;
|
||||
}
|
||||
|
||||
char getData1() const
|
||||
{
|
||||
return mData1;
|
||||
}
|
||||
|
||||
char getData2() const
|
||||
{
|
||||
return mData2;
|
||||
}
|
||||
|
||||
bool operator== (const Midi& m) const
|
||||
{
|
||||
return mData1 == m.mData1
|
||||
&& mData2 == m.mData2
|
||||
&& mPort == m.mPort
|
||||
&& mStatus == m.mStatus;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
#endif // MIDI_H_
|
||||
111
CasterSoundboard/libs/osc/reader/types/OscAddress.cpp
Normal file
111
CasterSoundboard/libs/osc/reader/types/OscAddress.cpp
Normal file
@ -0,0 +1,111 @@
|
||||
/*
|
||||
* Copyright (c) 2014 MUGEN SAS
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <libs/osc/reader/types/OscAddress.h>
|
||||
#include <libs/osc/exceptions/BooleanConversionException.h>
|
||||
#include <libs/osc/exceptions/BytesConversionException.h>
|
||||
#include <libs/osc/exceptions/CharConversionException.h>
|
||||
#include <libs/osc/exceptions/DoubleConversionException.h>
|
||||
#include <libs/osc/exceptions/FloatConversionException.h>
|
||||
#include <libs/osc/exceptions/IntegerConversionException.h>
|
||||
#include <libs/osc/exceptions/LongConversionException.h>
|
||||
#include <libs/osc/exceptions/MidiConversionException.h>
|
||||
#include <libs/osc/exceptions/RgbaConversionException.h>
|
||||
#include <libs/osc/exceptions/SymbolConversionException.h>
|
||||
#include <libs/osc/exceptions/TimetagConversionException.h>
|
||||
|
||||
/**
|
||||
* Build a new OscAddress from the given location in packet.
|
||||
*
|
||||
* @param pos
|
||||
* an address pattern string position.
|
||||
*/
|
||||
OscAddress::OscAddress(ByteBuffer* packet, qint32 pos)
|
||||
: OscValue('\0', packet, pos)
|
||||
{
|
||||
try
|
||||
{
|
||||
get();
|
||||
}
|
||||
catch (const QException& e)
|
||||
{
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the address pattern string.
|
||||
*
|
||||
* @return a string
|
||||
*/
|
||||
QString OscAddress::get()
|
||||
{
|
||||
try
|
||||
{
|
||||
return OscValue::getString(mPacket, mPos);
|
||||
}
|
||||
catch (const QException& e)
|
||||
{
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
bool OscAddress::toBoolean()
|
||||
{
|
||||
throw BooleanConversionException();
|
||||
}
|
||||
|
||||
QByteArray OscAddress::toBytes()
|
||||
{
|
||||
throw BytesConversionException();
|
||||
}
|
||||
|
||||
char OscAddress::toChar()
|
||||
{
|
||||
throw CharConversionException();
|
||||
}
|
||||
|
||||
double OscAddress::toDouble()
|
||||
{
|
||||
throw DoubleConversionException();
|
||||
}
|
||||
|
||||
float OscAddress::toFloat()
|
||||
{
|
||||
throw FloatConversionException();
|
||||
}
|
||||
|
||||
qint32 OscAddress::toInteger()
|
||||
{
|
||||
throw IntegerConversionException();
|
||||
}
|
||||
|
||||
qint64 OscAddress::toLong()
|
||||
{
|
||||
throw LongConversionException();
|
||||
}
|
||||
|
||||
|
||||
QString OscAddress::toString()
|
||||
{
|
||||
return get();
|
||||
}
|
||||
65
CasterSoundboard/libs/osc/reader/types/OscAddress.h
Normal file
65
CasterSoundboard/libs/osc/reader/types/OscAddress.h
Normal file
@ -0,0 +1,65 @@
|
||||
/*
|
||||
* Copyright (c) 2014 MUGEN SAS
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef OSC_ADDRESS_H_
|
||||
#define OSC_ADDRESS_H_
|
||||
|
||||
#include <libs/osc/reader/types/OscValue.h>
|
||||
|
||||
/** Class representing an OSC-Address-Pattern. */
|
||||
class OSC_API OscAddress : public OscValue
|
||||
{
|
||||
|
||||
public:
|
||||
virtual bool toBoolean();
|
||||
virtual QByteArray toBytes();
|
||||
virtual char toChar();
|
||||
virtual double toDouble();
|
||||
virtual float toFloat();
|
||||
virtual qint32 toInteger();
|
||||
virtual qint64 toLong();
|
||||
virtual QString toString();
|
||||
|
||||
virtual ~OscAddress() {};
|
||||
|
||||
#ifndef BUILD_UNITTESTS
|
||||
private:
|
||||
#endif
|
||||
/**
|
||||
* Build a new OscAddress from the given location in packet.
|
||||
*
|
||||
* @param pos
|
||||
* an address pattern string position.
|
||||
*/
|
||||
OscAddress(ByteBuffer* packet, qint32 pos);
|
||||
|
||||
/**
|
||||
* Returns the address pattern string.
|
||||
*
|
||||
* @return a string
|
||||
*/
|
||||
QString get();
|
||||
|
||||
friend class OscMessage;
|
||||
};
|
||||
|
||||
#endif // OSC_ADDRESS_H_
|
||||
59
CasterSoundboard/libs/osc/reader/types/OscArrayBegin.cpp
Normal file
59
CasterSoundboard/libs/osc/reader/types/OscArrayBegin.cpp
Normal file
@ -0,0 +1,59 @@
|
||||
/*
|
||||
* Copyright (c) 2014 MUGEN SAS
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <libs/osc/reader/types/OscArrayBegin.h>
|
||||
|
||||
/**
|
||||
* Build a new OscArrayBegin from the given location in packet.
|
||||
*
|
||||
* @param pos
|
||||
* an ArrayBegin tag position.
|
||||
*/
|
||||
OscArrayBegin::OscArrayBegin(ByteBuffer* packet, qint32 pos)
|
||||
: OscValue('[', packet, pos)
|
||||
{
|
||||
}
|
||||
|
||||
bool OscArrayBegin::isArrayBegin()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool OscArrayBegin::toBoolean()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
QByteArray OscArrayBegin::toBytes()
|
||||
{
|
||||
return QByteArray(1, 1);
|
||||
}
|
||||
|
||||
double OscArrayBegin::toDouble()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
qint64 OscArrayBegin::toLong()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
53
CasterSoundboard/libs/osc/reader/types/OscArrayBegin.h
Normal file
53
CasterSoundboard/libs/osc/reader/types/OscArrayBegin.h
Normal file
@ -0,0 +1,53 @@
|
||||
/*
|
||||
* Copyright (c) 2014 MUGEN SAS
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef OSC_ARRAY_BEGIN_H_
|
||||
#define OSC_ARRAY_BEGIN_H_
|
||||
|
||||
#include <libs/osc/reader/types/OscValue.h>
|
||||
|
||||
/** Class representing an OSC-Array-Begin. */
|
||||
class OSC_API OscArrayBegin : public OscValue
|
||||
{
|
||||
public:
|
||||
virtual bool isArrayBegin();
|
||||
virtual bool toBoolean();
|
||||
virtual QByteArray toBytes();
|
||||
virtual double toDouble();
|
||||
virtual qint64 toLong();
|
||||
|
||||
#ifndef BUILD_UNITTESTS
|
||||
private:
|
||||
#endif
|
||||
/**
|
||||
* Build a new OscArrayBegin from the given location in packet.
|
||||
*
|
||||
* @param pos
|
||||
* an ArrayBegin tag position.
|
||||
*/
|
||||
OscArrayBegin(ByteBuffer* packet, qint32 pos);
|
||||
|
||||
friend class OscMessage;
|
||||
|
||||
};
|
||||
|
||||
#endif // OSC_ARRAY_BEGIN_H_
|
||||
49
CasterSoundboard/libs/osc/reader/types/OscArrayEnd.cpp
Normal file
49
CasterSoundboard/libs/osc/reader/types/OscArrayEnd.cpp
Normal file
@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Copyright (c) 2014 MUGEN SAS
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <libs/osc/reader/types/OscArrayEnd.h>
|
||||
|
||||
OscArrayEnd::OscArrayEnd(ByteBuffer* packet, qint32 pos)
|
||||
: OscValue(']', packet, pos)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool OscArrayEnd::isArrayEnd()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
QByteArray OscArrayEnd::toBytes()
|
||||
{
|
||||
return QByteArray(1, 0);
|
||||
}
|
||||
|
||||
double OscArrayEnd::toDouble()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
qint64 OscArrayEnd::toLong()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
51
CasterSoundboard/libs/osc/reader/types/OscArrayEnd.h
Normal file
51
CasterSoundboard/libs/osc/reader/types/OscArrayEnd.h
Normal file
@ -0,0 +1,51 @@
|
||||
/*
|
||||
* Copyright (c) 2014 MUGEN SAS
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef OSC_ARRAY_END_H_
|
||||
#define OSC_ARRAY_END_H_
|
||||
|
||||
#include <libs/osc/reader/types/OscValue.h>
|
||||
|
||||
/** Class representing an OSC-Array-End. */
|
||||
class OSC_API OscArrayEnd : public OscValue
|
||||
{
|
||||
public:
|
||||
virtual bool isArrayEnd();
|
||||
virtual QByteArray toBytes();
|
||||
virtual double toDouble();
|
||||
virtual qint64 toLong();
|
||||
|
||||
#ifndef BUILD_UNITTESTS
|
||||
private:
|
||||
#endif
|
||||
/**
|
||||
* Build a new OscArrayEnd from the given location in packet.
|
||||
*
|
||||
* @param pos
|
||||
* an ArrayEnd tag position.
|
||||
*/
|
||||
OscArrayEnd(ByteBuffer* packet, qint32 pos);
|
||||
|
||||
friend class OscMessage;
|
||||
|
||||
};
|
||||
#endif // OSC_ARRAY_END_H_
|
||||
115
CasterSoundboard/libs/osc/reader/types/OscBlob.cpp
Normal file
115
CasterSoundboard/libs/osc/reader/types/OscBlob.cpp
Normal file
@ -0,0 +1,115 @@
|
||||
/*
|
||||
* Copyright (c) 2014 MUGEN SAS
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <libs/osc/reader/types/OscBlob.h>
|
||||
#include <libs/tools/ByteBuffer.h>
|
||||
#include <libs/osc/exceptions/CharConversionException.h>
|
||||
#include <libs/osc/exceptions/DoubleConversionException.h>
|
||||
#include <libs/osc/exceptions/IntegerConversionException.h>
|
||||
#include <libs/osc/exceptions/FloatConversionException.h>
|
||||
#include <libs/osc/exceptions/LongConversionException.h>
|
||||
#include <libs/osc/exceptions/StringConversionException.h>
|
||||
|
||||
OscBlob::OscBlob(ByteBuffer* packet, qint32 pos)
|
||||
: OscValue('b', packet, pos)
|
||||
{
|
||||
try
|
||||
{
|
||||
get();
|
||||
}
|
||||
catch (const QException& e)
|
||||
{
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the blob data.
|
||||
*
|
||||
* @return a blob data.
|
||||
*/
|
||||
QByteArray& OscBlob::get()
|
||||
{
|
||||
try
|
||||
{
|
||||
mBlobSize = mPacket->getInt(mPos);
|
||||
|
||||
if (mBlobSize != 0)
|
||||
{
|
||||
mData = QByteArray(mBlobSize, 0);
|
||||
mPacket->setPosition(mPos + 4);
|
||||
mPacket->get(&mData, 0, mBlobSize);
|
||||
|
||||
qint32 rem = 4 - (mBlobSize % 4);
|
||||
if (rem == 4)
|
||||
rem = 0;
|
||||
|
||||
mPacket->setPosition(mPos + 4 + mBlobSize + rem);
|
||||
}
|
||||
|
||||
return mData;
|
||||
}
|
||||
catch (const QException& e)
|
||||
{
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
bool OscBlob::toBoolean()
|
||||
{
|
||||
return (get().length() != 0);
|
||||
}
|
||||
|
||||
QByteArray OscBlob::toBytes()
|
||||
{
|
||||
return get();
|
||||
}
|
||||
|
||||
char OscBlob::toChar()
|
||||
{
|
||||
throw CharConversionException();
|
||||
}
|
||||
|
||||
double OscBlob::toDouble()
|
||||
{
|
||||
throw DoubleConversionException();
|
||||
}
|
||||
|
||||
float OscBlob::toFloat()
|
||||
{
|
||||
throw FloatConversionException();
|
||||
}
|
||||
|
||||
qint32 OscBlob::toInteger()
|
||||
{
|
||||
throw IntegerConversionException();
|
||||
}
|
||||
|
||||
qint64 OscBlob::toLong()
|
||||
{
|
||||
throw LongConversionException();
|
||||
}
|
||||
|
||||
QString OscBlob::toString()
|
||||
{
|
||||
throw StringConversionException();
|
||||
}
|
||||
66
CasterSoundboard/libs/osc/reader/types/OscBlob.h
Normal file
66
CasterSoundboard/libs/osc/reader/types/OscBlob.h
Normal file
@ -0,0 +1,66 @@
|
||||
/*
|
||||
* Copyright (c) 2014 MUGEN SAS
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef OSC_BLOB_H_
|
||||
#define OSC_BLOB_H_
|
||||
|
||||
#include <libs/osc/reader/types/OscValue.h>
|
||||
|
||||
/** Class representing an OSC-Blob. */
|
||||
class OSC_API OscBlob : public OscValue
|
||||
{
|
||||
public:
|
||||
virtual bool toBoolean();
|
||||
virtual QByteArray toBytes();
|
||||
virtual char toChar();
|
||||
virtual double toDouble();
|
||||
virtual float toFloat();
|
||||
virtual qint32 toInteger();
|
||||
virtual qint64 toLong();
|
||||
virtual QString toString();
|
||||
|
||||
#ifndef BUILD_UNITTESTS
|
||||
private:
|
||||
#endif
|
||||
/**
|
||||
* Build a new OscBlob from the given location in packet.
|
||||
*
|
||||
* @param pos
|
||||
* the Blob byte array position.
|
||||
*/
|
||||
OscBlob(ByteBuffer* packet, qint32 pos);
|
||||
|
||||
/**
|
||||
* Returns the blob data.
|
||||
*
|
||||
* @return a blob data.
|
||||
*/
|
||||
QByteArray& get();
|
||||
|
||||
QByteArray mData;
|
||||
qint32 mBlobSize;
|
||||
|
||||
friend class OscMessage;
|
||||
|
||||
};
|
||||
|
||||
#endif // OSC_BLOB_H_
|
||||
76
CasterSoundboard/libs/osc/reader/types/OscChar.cpp
Normal file
76
CasterSoundboard/libs/osc/reader/types/OscChar.cpp
Normal file
@ -0,0 +1,76 @@
|
||||
/*
|
||||
* Copyright (c) 2014 MUGEN SAS
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <libs/osc/reader/types/OscChar.h>
|
||||
#include <libs/tools/ByteBuffer.h>
|
||||
|
||||
/**
|
||||
* Build a new OscChar from the given location in packet.
|
||||
*
|
||||
* @param pos
|
||||
* the char value position.
|
||||
*/
|
||||
OscChar::OscChar(ByteBuffer* packet, qint32 pos)
|
||||
: OscValue('c', packet, pos)
|
||||
{
|
||||
mPacket->getInt();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the char value.
|
||||
*
|
||||
* @return a char value.
|
||||
*/
|
||||
qint32 OscChar::get()
|
||||
{
|
||||
return mPacket->getInt(mPos);
|
||||
}
|
||||
|
||||
bool OscChar::toBoolean()
|
||||
{
|
||||
return (get() != 0);
|
||||
}
|
||||
|
||||
QByteArray OscChar::toBytes()
|
||||
{
|
||||
return QByteArray(1, (char)get());
|
||||
}
|
||||
|
||||
char OscChar::toChar()
|
||||
{
|
||||
return get();
|
||||
}
|
||||
|
||||
double OscChar::toDouble()
|
||||
{
|
||||
return get();
|
||||
}
|
||||
|
||||
qint64 OscChar::toLong()
|
||||
{
|
||||
return get();
|
||||
}
|
||||
|
||||
QString OscChar::toString()
|
||||
{
|
||||
return QChar(get());
|
||||
}
|
||||
60
CasterSoundboard/libs/osc/reader/types/OscChar.h
Normal file
60
CasterSoundboard/libs/osc/reader/types/OscChar.h
Normal file
@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Copyright (c) 2014 MUGEN SAS
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef OSC_CHAR_H_
|
||||
#define OSC_CHAR_H_
|
||||
|
||||
#include <libs/osc/reader/types/OscValue.h>
|
||||
|
||||
/** Class representing an OSC-char. */
|
||||
class OSC_API OscChar : public OscValue
|
||||
{
|
||||
public:
|
||||
virtual bool toBoolean();
|
||||
virtual QByteArray toBytes();
|
||||
virtual char toChar();
|
||||
virtual double toDouble();
|
||||
virtual qint64 toLong();
|
||||
virtual QString toString();
|
||||
|
||||
#ifndef BUILD_UNITTESTS
|
||||
private:
|
||||
#endif
|
||||
/**
|
||||
* Returns the char value.
|
||||
*
|
||||
* @return a char value.
|
||||
*/
|
||||
qint32 get();
|
||||
|
||||
/**
|
||||
* Build a new OscChar from the given location in packet.
|
||||
*
|
||||
* @param pos
|
||||
* the char value position.
|
||||
*/
|
||||
OscChar(ByteBuffer* packet, qint32 pos);
|
||||
|
||||
friend class OscMessage;
|
||||
};
|
||||
|
||||
#endif // OSC_CHAR_H_
|
||||
96
CasterSoundboard/libs/osc/reader/types/OscDouble.cpp
Normal file
96
CasterSoundboard/libs/osc/reader/types/OscDouble.cpp
Normal file
@ -0,0 +1,96 @@
|
||||
/*
|
||||
* Copyright (c) 2014 MUGEN SAS
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <libs/osc/reader/types/OscDouble.h>
|
||||
#include <libs/tools/ByteBuffer.h>
|
||||
#include <libs/osc/exceptions/CharConversionException.h>
|
||||
#include <limits>
|
||||
#include <libs/tools/NtpTimestamp.h>
|
||||
|
||||
OscDouble::OscDouble(ByteBuffer* packet, qint32 pos)
|
||||
: OscValue('d', packet, pos)
|
||||
{
|
||||
mPacket->getDouble();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the double value.
|
||||
*
|
||||
* @return a double value.
|
||||
*/
|
||||
double OscDouble::get()
|
||||
{
|
||||
return mPacket->getDouble(mPos);
|
||||
}
|
||||
|
||||
bool OscDouble::toBoolean()
|
||||
{
|
||||
return (get() != 0);
|
||||
}
|
||||
|
||||
QByteArray OscDouble::toBytes()
|
||||
{
|
||||
double d = get();
|
||||
QByteArray bytes(8, 0);
|
||||
bytes.insert(0, (char*)&d, 8);
|
||||
return bytes;
|
||||
}
|
||||
|
||||
char OscDouble::toChar()
|
||||
{
|
||||
double d = get();
|
||||
if (d > std::numeric_limits<char>::min() && d < std::numeric_limits<char>::max())
|
||||
return (char)get();
|
||||
else
|
||||
throw CharConversionException();
|
||||
}
|
||||
|
||||
double OscDouble::toDouble()
|
||||
{
|
||||
return get();
|
||||
}
|
||||
|
||||
qint64 OscDouble::toLong()
|
||||
{
|
||||
return (qint64)get();
|
||||
}
|
||||
|
||||
Midi OscDouble::toMIDI()
|
||||
{
|
||||
return Midi(toBytes());
|
||||
}
|
||||
|
||||
RGBA OscDouble::toRGBA()
|
||||
{
|
||||
return RGBA(toBytes());
|
||||
}
|
||||
|
||||
QString OscDouble::toString()
|
||||
{
|
||||
return QString::number(get());
|
||||
}
|
||||
|
||||
QDateTime OscDouble::toTimetag()
|
||||
{
|
||||
NtpTimestamp ntp( *(qint32*)(toBytes().constData()), *(qint32*)(toBytes().constData() + 4));
|
||||
return NtpTimestamp::toDateTime(ntp);
|
||||
}
|
||||
63
CasterSoundboard/libs/osc/reader/types/OscDouble.h
Normal file
63
CasterSoundboard/libs/osc/reader/types/OscDouble.h
Normal file
@ -0,0 +1,63 @@
|
||||
/*
|
||||
* Copyright (c) 2014 MUGEN SAS
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef OSC_DOUBLE_H_
|
||||
#define OSC_DOUBLE_H_
|
||||
|
||||
#include <libs/osc/reader/types/OscValue.h>
|
||||
|
||||
/** Class representing an OSC-double. */
|
||||
class OSC_API OscDouble : public OscValue
|
||||
{
|
||||
public:
|
||||
virtual bool toBoolean();
|
||||
virtual QByteArray toBytes();
|
||||
virtual char toChar();
|
||||
virtual double toDouble();
|
||||
virtual qint64 toLong();
|
||||
virtual Midi toMIDI();
|
||||
virtual RGBA toRGBA();
|
||||
virtual QString toString();
|
||||
virtual QDateTime toTimetag();
|
||||
|
||||
#ifndef BUILD_UNITTESTS
|
||||
private:
|
||||
#endif
|
||||
/**
|
||||
* Build a new OscDouble from the given location in packet.
|
||||
*
|
||||
* @param pos
|
||||
* the double value position.
|
||||
*/
|
||||
OscDouble(ByteBuffer* packet, qint32 pos);
|
||||
|
||||
/**
|
||||
* Returns the double value.
|
||||
*
|
||||
* @return a double value.
|
||||
*/
|
||||
double get();
|
||||
|
||||
friend class OscMessage;
|
||||
};
|
||||
|
||||
#endif // OSC_DOUBLE_H_
|
||||
55
CasterSoundboard/libs/osc/reader/types/OscFalse.cpp
Normal file
55
CasterSoundboard/libs/osc/reader/types/OscFalse.cpp
Normal file
@ -0,0 +1,55 @@
|
||||
/*
|
||||
* Copyright (c) 2014 MUGEN SAS
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <libs/osc/reader/types/OscFalse.h>
|
||||
|
||||
OscFalse::OscFalse(ByteBuffer* packet, qint32 pos)
|
||||
: OscValue('F', packet, pos)
|
||||
{
|
||||
}
|
||||
|
||||
bool OscFalse::isFalse()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
QByteArray OscFalse::toBytes()
|
||||
{
|
||||
return QByteArray(1, 0);
|
||||
}
|
||||
|
||||
double OscFalse::toDouble()
|
||||
{
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
|
||||
qint64 OscFalse::toLong()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
QString OscFalse::toString()
|
||||
{
|
||||
return "FALSE";
|
||||
}
|
||||
46
CasterSoundboard/libs/osc/reader/types/OscFalse.h
Normal file
46
CasterSoundboard/libs/osc/reader/types/OscFalse.h
Normal file
@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Copyright (c) 2014 MUGEN SAS
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef OSC_FALSE_H_
|
||||
#define OSC_FALSE_H_
|
||||
|
||||
#include <libs/osc/reader/types/OscValue.h>
|
||||
|
||||
/** Class representing an OSC-FALSE tag. */
|
||||
class OSC_API OscFalse : public OscValue
|
||||
{
|
||||
public:
|
||||
virtual bool isFalse();
|
||||
virtual QByteArray toBytes();
|
||||
virtual double toDouble();
|
||||
virtual qint64 toLong();
|
||||
virtual QString toString();
|
||||
|
||||
#ifndef BUILD_UNITTESTS
|
||||
private:
|
||||
#endif
|
||||
OscFalse(ByteBuffer* packet, qint32 pos);
|
||||
|
||||
friend class OscMessage;
|
||||
};
|
||||
|
||||
#endif // OSC_FALSE_H_
|
||||
84
CasterSoundboard/libs/osc/reader/types/OscFloat.cpp
Normal file
84
CasterSoundboard/libs/osc/reader/types/OscFloat.cpp
Normal file
@ -0,0 +1,84 @@
|
||||
/*
|
||||
* Copyright (c) 2014 MUGEN SAS
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <libs/osc/reader/types/OscFloat.h>
|
||||
#include <libs/tools/ByteBuffer.h>
|
||||
#include <libs/osc/exceptions/CharConversionException.h>
|
||||
#include <limits>
|
||||
|
||||
OscFloat::OscFloat(ByteBuffer* packet, qint32 pos)
|
||||
: OscValue('f', packet, pos)
|
||||
{
|
||||
mPacket->getFloat();
|
||||
}
|
||||
|
||||
float OscFloat::get()
|
||||
{
|
||||
return mPacket->getFloat(mPos);
|
||||
}
|
||||
|
||||
bool OscFloat::toBoolean()
|
||||
{
|
||||
return (get() != 0);
|
||||
}
|
||||
|
||||
QByteArray OscFloat::toBytes()
|
||||
{
|
||||
float f = get();
|
||||
QByteArray bytes(4, 0);
|
||||
bytes.insert(0, (char*)&f, 4);
|
||||
return bytes;
|
||||
}
|
||||
|
||||
char OscFloat::toChar()
|
||||
{
|
||||
float f = get();
|
||||
if (f > std::numeric_limits<char>::min() && f < std::numeric_limits<char>::max())
|
||||
return (char)get();
|
||||
else
|
||||
throw CharConversionException();
|
||||
}
|
||||
|
||||
double OscFloat::toDouble()
|
||||
{
|
||||
return get();
|
||||
}
|
||||
|
||||
qint64 OscFloat::toLong()
|
||||
{
|
||||
return (qint64)get();
|
||||
}
|
||||
|
||||
Midi OscFloat::toMIDI()
|
||||
{
|
||||
return Midi(toBytes());
|
||||
}
|
||||
|
||||
RGBA OscFloat::toRGBA()
|
||||
{
|
||||
return RGBA(toBytes());
|
||||
}
|
||||
|
||||
QString OscFloat::toString()
|
||||
{
|
||||
return QString::number(get());
|
||||
}
|
||||
62
CasterSoundboard/libs/osc/reader/types/OscFloat.h
Normal file
62
CasterSoundboard/libs/osc/reader/types/OscFloat.h
Normal file
@ -0,0 +1,62 @@
|
||||
/*
|
||||
* Copyright (c) 2014 MUGEN SAS
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef OSC_FLOAT_H_
|
||||
#define OSC_FLOAT_H_
|
||||
|
||||
#include <libs/osc/reader/types/OscValue.h>
|
||||
|
||||
/** Class representing an OSC-Float value. */
|
||||
class OSC_API OscFloat : public OscValue
|
||||
{
|
||||
public:
|
||||
virtual bool toBoolean();
|
||||
virtual QByteArray toBytes();
|
||||
virtual char toChar();
|
||||
virtual double toDouble();
|
||||
virtual qint64 toLong();
|
||||
virtual Midi toMIDI();
|
||||
virtual RGBA toRGBA();
|
||||
virtual QString toString();
|
||||
|
||||
#ifndef BUILD_UNITTESTS
|
||||
private:
|
||||
#endif
|
||||
/**
|
||||
* Build a new OscFloat from the given location in packet.
|
||||
*
|
||||
* @param pos
|
||||
* the float value position.
|
||||
*/
|
||||
OscFloat(ByteBuffer* packet, qint32 pos);
|
||||
|
||||
/**
|
||||
* Returns the float value.
|
||||
*
|
||||
* @return a float value.
|
||||
*/
|
||||
float get();
|
||||
|
||||
friend class OscMessage;
|
||||
};
|
||||
|
||||
#endif // OSC_FLOAT_H_
|
||||
80
CasterSoundboard/libs/osc/reader/types/OscInfinitum.cpp
Normal file
80
CasterSoundboard/libs/osc/reader/types/OscInfinitum.cpp
Normal file
@ -0,0 +1,80 @@
|
||||
/*
|
||||
* Copyright (c) 2014 MUGEN SAS
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <libs/osc/reader/types/OscInfinitum.h>
|
||||
#include <limits>
|
||||
|
||||
/**
|
||||
* Build a new OscInfinitum from the given location in packet.
|
||||
*
|
||||
* @param pos
|
||||
* the Infinitum tag position.
|
||||
*/
|
||||
OscInfinitum::OscInfinitum(ByteBuffer* packet, qint32 pos)
|
||||
: OscValue('I', packet, pos)
|
||||
{
|
||||
}
|
||||
|
||||
bool OscInfinitum::isInfinitum()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool OscInfinitum::toBoolean()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
QByteArray OscInfinitum::toBytes()
|
||||
{
|
||||
return QByteArray(1, std::numeric_limits<unsigned char>::infinity());
|
||||
}
|
||||
|
||||
char OscInfinitum::toChar()
|
||||
{
|
||||
return std::numeric_limits<char>::infinity();
|
||||
}
|
||||
|
||||
double OscInfinitum::toDouble()
|
||||
{
|
||||
return std::numeric_limits<double>::infinity();
|
||||
}
|
||||
|
||||
float OscInfinitum::toFloat()
|
||||
{
|
||||
return std::numeric_limits<float>::infinity();
|
||||
}
|
||||
|
||||
qint32 OscInfinitum::toInteger()
|
||||
{
|
||||
return std::numeric_limits<qint32>::infinity();
|
||||
}
|
||||
|
||||
qint64 OscInfinitum::toLong()
|
||||
{
|
||||
return std::numeric_limits<qint64>::infinity();
|
||||
}
|
||||
|
||||
QString OscInfinitum::toString()
|
||||
{
|
||||
return "INF";
|
||||
}
|
||||
56
CasterSoundboard/libs/osc/reader/types/OscInfinitum.h
Normal file
56
CasterSoundboard/libs/osc/reader/types/OscInfinitum.h
Normal file
@ -0,0 +1,56 @@
|
||||
/*
|
||||
* Copyright (c) 2014 MUGEN SAS
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef OSC_INFINITUM_H_
|
||||
#define OSC_INFINITUM_H_
|
||||
|
||||
#include <libs/osc/reader/types/OscValue.h>
|
||||
|
||||
/** Class representing an OSC-Infinitum tag. */
|
||||
class OSC_API OscInfinitum : public OscValue
|
||||
{
|
||||
public:
|
||||
virtual bool isInfinitum();
|
||||
virtual bool toBoolean();
|
||||
virtual QByteArray toBytes();
|
||||
virtual char toChar();
|
||||
virtual double toDouble();
|
||||
virtual float toFloat();
|
||||
virtual qint32 toInteger();
|
||||
virtual qint64 toLong();
|
||||
virtual QString toString();
|
||||
|
||||
#ifndef BUILD_UNITTESTS
|
||||
private:
|
||||
#endif
|
||||
/**
|
||||
* Build a new OscInfinitum from the given location in packet.
|
||||
*
|
||||
* @param pos
|
||||
* the Infinitum tag position.
|
||||
*/
|
||||
OscInfinitum(ByteBuffer* packet, qint32 pos);
|
||||
|
||||
friend class OscMessage;
|
||||
};
|
||||
|
||||
#endif // OSC_INFINITUM_H_
|
||||
85
CasterSoundboard/libs/osc/reader/types/OscInteger.cpp
Normal file
85
CasterSoundboard/libs/osc/reader/types/OscInteger.cpp
Normal file
@ -0,0 +1,85 @@
|
||||
/*
|
||||
* Copyright (c) 2014 MUGEN SAS
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <libs/osc/reader/types/OscInteger.h>
|
||||
#include <libs/tools/ByteBuffer.h>
|
||||
#include <libs/osc/exceptions/CharConversionException.h>
|
||||
#include <limits>
|
||||
|
||||
OscInteger::OscInteger(ByteBuffer* packet, qint32 pos)
|
||||
: OscValue('i', packet, pos)
|
||||
{
|
||||
mPacket->getInt();
|
||||
}
|
||||
|
||||
qint32 OscInteger::get()
|
||||
{
|
||||
return mPacket->getInt(mPos);
|
||||
}
|
||||
|
||||
bool OscInteger::toBoolean()
|
||||
{
|
||||
return (get() != 0);
|
||||
}
|
||||
|
||||
QByteArray OscInteger::toBytes()
|
||||
{
|
||||
qint32 i = get();
|
||||
QByteArray bytes(4, 0);
|
||||
bytes.insert(0, (char*)&i, 4);
|
||||
return bytes;
|
||||
}
|
||||
|
||||
char OscInteger::toChar()
|
||||
{
|
||||
qint32 i = get();
|
||||
if (i > std::numeric_limits<char>::min() && i < std::numeric_limits<char>::max())
|
||||
return (char)get();
|
||||
else
|
||||
throw CharConversionException();
|
||||
}
|
||||
|
||||
double OscInteger::toDouble()
|
||||
{
|
||||
return get();
|
||||
}
|
||||
|
||||
qint64 OscInteger::toLong()
|
||||
{
|
||||
return get();
|
||||
}
|
||||
|
||||
Midi OscInteger::toMIDI()
|
||||
{
|
||||
return Midi(toBytes());
|
||||
}
|
||||
|
||||
RGBA OscInteger::toRGBA()
|
||||
{
|
||||
return RGBA(toBytes());
|
||||
}
|
||||
|
||||
QString OscInteger::toString()
|
||||
{
|
||||
return QString::number(get());
|
||||
}
|
||||
|
||||
64
CasterSoundboard/libs/osc/reader/types/OscInteger.h
Normal file
64
CasterSoundboard/libs/osc/reader/types/OscInteger.h
Normal file
@ -0,0 +1,64 @@
|
||||
/*
|
||||
* Copyright (c) 2014 MUGEN SAS
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef OSC_INTEGER_H_
|
||||
#define OSC_INTEGER_H_
|
||||
|
||||
#include <libs/osc/reader/types/OscValue.h>
|
||||
|
||||
/**
|
||||
* Class representing an OSC-int32.
|
||||
*/
|
||||
class OSC_API OscInteger : public OscValue
|
||||
{
|
||||
public:
|
||||
virtual bool toBoolean();
|
||||
virtual QByteArray toBytes();
|
||||
virtual char toChar();
|
||||
virtual double toDouble();
|
||||
virtual qint64 toLong();
|
||||
virtual Midi toMIDI();
|
||||
virtual RGBA toRGBA();
|
||||
virtual QString toString();
|
||||
|
||||
#ifndef BUILD_UNITTESTS
|
||||
private:
|
||||
#endif
|
||||
/**
|
||||
* Build a new OscInteger from the given location in packet.
|
||||
*
|
||||
* @param pos
|
||||
* the int32 value position.
|
||||
*/
|
||||
OscInteger(ByteBuffer* packet, qint32 pos);
|
||||
|
||||
/**
|
||||
* Returns the int32 value.
|
||||
*
|
||||
* @return an qint32 value.
|
||||
*/
|
||||
qint32 get();
|
||||
|
||||
friend class OscMessage;
|
||||
};
|
||||
|
||||
#endif // OSC_INTEGER_H_
|
||||
96
CasterSoundboard/libs/osc/reader/types/OscLong.cpp
Normal file
96
CasterSoundboard/libs/osc/reader/types/OscLong.cpp
Normal file
@ -0,0 +1,96 @@
|
||||
/*
|
||||
* Copyright (c) 2014 MUGEN SAS
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <libs/osc/reader/types/OscLong.h>
|
||||
#include <libs/tools/ByteBuffer.h>
|
||||
#include <libs/osc/exceptions/CharConversionException.h>
|
||||
#include <limits>
|
||||
#include <libs/tools/NtpTimestamp.h>
|
||||
|
||||
OscLong::OscLong(ByteBuffer* packet, qint32 pos)
|
||||
: OscValue('h', packet, pos)
|
||||
{
|
||||
mPacket->getLong();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the int64 value.
|
||||
*
|
||||
* @return a long value.
|
||||
*/
|
||||
qint64 OscLong::get()
|
||||
{
|
||||
return mPacket->getLong(mPos);
|
||||
}
|
||||
|
||||
bool OscLong::toBoolean()
|
||||
{
|
||||
return (get() != 0);
|
||||
}
|
||||
|
||||
QByteArray OscLong::toBytes()
|
||||
{
|
||||
qint64 l = get();
|
||||
QByteArray bytes(8, 0);
|
||||
bytes.insert(0, (char*)&l, 8);
|
||||
return bytes;
|
||||
}
|
||||
|
||||
char OscLong::toChar()
|
||||
{
|
||||
qint64 l = get();
|
||||
if (l > std::numeric_limits<char>::min() && l < std::numeric_limits<char>::max())
|
||||
return (char)get();
|
||||
else
|
||||
throw CharConversionException();
|
||||
}
|
||||
|
||||
double OscLong::toDouble()
|
||||
{
|
||||
return get();
|
||||
}
|
||||
|
||||
qint64 OscLong::toLong()
|
||||
{
|
||||
return get();
|
||||
}
|
||||
|
||||
Midi OscLong::toMIDI()
|
||||
{
|
||||
return Midi(toBytes());
|
||||
}
|
||||
|
||||
RGBA OscLong::toRGBA()
|
||||
{
|
||||
return RGBA(toBytes());
|
||||
}
|
||||
|
||||
QString OscLong::toString()
|
||||
{
|
||||
return QString::number(get());
|
||||
}
|
||||
|
||||
QDateTime OscLong::toTimetag()
|
||||
{
|
||||
NtpTimestamp ntp( *(qint32*)(toBytes().constData()), *(qint32*)(toBytes().constData() + 4));
|
||||
return NtpTimestamp::toDateTime(ntp);
|
||||
}
|
||||
63
CasterSoundboard/libs/osc/reader/types/OscLong.h
Normal file
63
CasterSoundboard/libs/osc/reader/types/OscLong.h
Normal file
@ -0,0 +1,63 @@
|
||||
/*
|
||||
* Copyright (c) 2014 MUGEN SAS
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef OSC_LONG_H_
|
||||
#define OSC_LONG_H_
|
||||
|
||||
#include <libs/osc/reader/types/OscValue.h>
|
||||
|
||||
/** Class representing an OSC-int64 value. */
|
||||
class OSC_API OscLong : public OscValue
|
||||
{
|
||||
public:
|
||||
virtual bool toBoolean();
|
||||
virtual QByteArray toBytes();
|
||||
virtual char toChar();
|
||||
virtual double toDouble();
|
||||
virtual qint64 toLong();
|
||||
virtual Midi toMIDI();
|
||||
virtual RGBA toRGBA();
|
||||
virtual QString toString();
|
||||
virtual QDateTime toTimetag();
|
||||
|
||||
#ifndef BUILD_UNITTESTS
|
||||
private:
|
||||
#endif
|
||||
/**
|
||||
* Build a new OscInt64 from the given location in packet.
|
||||
*
|
||||
* @param pos
|
||||
* the int64 value position.
|
||||
*/
|
||||
OscLong(ByteBuffer* packet, qint32 pos);
|
||||
|
||||
/**
|
||||
* Returns the long value.
|
||||
*
|
||||
* @return a long value.
|
||||
*/
|
||||
qint64 get();
|
||||
|
||||
friend class OscMessage;
|
||||
};
|
||||
|
||||
#endif // OSC_LONG_H_
|
||||
97
CasterSoundboard/libs/osc/reader/types/OscMidi.cpp
Normal file
97
CasterSoundboard/libs/osc/reader/types/OscMidi.cpp
Normal file
@ -0,0 +1,97 @@
|
||||
/*
|
||||
* Copyright (c) 2014 MUGEN SAS
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <libs/osc/reader/types/OscMidi.h>
|
||||
#include <libs/tools/ByteBuffer.h>
|
||||
#include <libs/osc/exceptions/CharConversionException.h>
|
||||
#include <libs/osc/exceptions/FloatConversionException.h>
|
||||
#include <libs/osc/exceptions/DoubleConversionException.h>
|
||||
|
||||
/**
|
||||
* Build a new OscMidi from the given location in packet.
|
||||
*
|
||||
* @param pos
|
||||
* the MIDI message position.
|
||||
*/
|
||||
OscMidi::OscMidi(ByteBuffer* packet, qint32 pos)
|
||||
: OscValue('m', packet, pos)
|
||||
{
|
||||
mPacket->getInt();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the MIDI message value.
|
||||
*
|
||||
* @return an qint32 value.
|
||||
*/
|
||||
QByteArray OscMidi::get()
|
||||
{
|
||||
QByteArray bytes(4, 0);
|
||||
mPacket->setPosition(mPos);
|
||||
mPacket->get(&bytes);
|
||||
return bytes;
|
||||
}
|
||||
|
||||
bool OscMidi::toBoolean()
|
||||
{
|
||||
return (mPacket->getInt(mPos) != 0);
|
||||
}
|
||||
|
||||
QByteArray OscMidi::toBytes()
|
||||
{
|
||||
return get();
|
||||
}
|
||||
|
||||
char OscMidi::toChar()
|
||||
{
|
||||
throw CharConversionException();
|
||||
}
|
||||
|
||||
float OscMidi::toFloat()
|
||||
{
|
||||
throw FloatConversionException();
|
||||
}
|
||||
|
||||
double OscMidi::toDouble()
|
||||
{
|
||||
throw DoubleConversionException();
|
||||
}
|
||||
|
||||
qint64 OscMidi::toLong()
|
||||
{
|
||||
return mPacket->getInt(mPos);
|
||||
}
|
||||
|
||||
Midi OscMidi::toMIDI()
|
||||
{
|
||||
return Midi(get());
|
||||
}
|
||||
|
||||
RGBA OscMidi::toRGBA()
|
||||
{
|
||||
return RGBA(get());
|
||||
}
|
||||
|
||||
QString OscMidi::toString()
|
||||
{
|
||||
return QString::number(mPacket->getInt(mPos),16);
|
||||
}
|
||||
64
CasterSoundboard/libs/osc/reader/types/OscMidi.h
Normal file
64
CasterSoundboard/libs/osc/reader/types/OscMidi.h
Normal file
@ -0,0 +1,64 @@
|
||||
/*
|
||||
* Copyright (c) 2014 MUGEN SAS
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef OSC_MIDI_H_
|
||||
#define OSC_MIDI_H_
|
||||
|
||||
#include <libs/osc/reader/types/OscValue.h>
|
||||
|
||||
/** Class representing an OSC-Midi message. */
|
||||
class OSC_API OscMidi : public OscValue
|
||||
{
|
||||
public:
|
||||
virtual bool toBoolean();
|
||||
virtual QByteArray toBytes();
|
||||
virtual char toChar();
|
||||
virtual float toFloat();
|
||||
virtual double toDouble();
|
||||
virtual qint64 toLong();
|
||||
virtual Midi toMIDI();
|
||||
virtual RGBA toRGBA();
|
||||
virtual QString toString();
|
||||
|
||||
#ifndef BUILD_UNITTESTS
|
||||
private:
|
||||
#endif
|
||||
/**
|
||||
* Build a new OscMidi from the given location in packet.
|
||||
*
|
||||
* @param pos
|
||||
* the MIDI message position.
|
||||
*/
|
||||
OscMidi(ByteBuffer* packet, qint32 pos);
|
||||
|
||||
/**
|
||||
* Returns the MIDI message value.
|
||||
*
|
||||
* @return an qint32 value.
|
||||
*/
|
||||
QByteArray get();
|
||||
|
||||
friend class OscMessage;
|
||||
|
||||
};
|
||||
|
||||
#endif // OSC_MIDI_H_
|
||||
64
CasterSoundboard/libs/osc/reader/types/OscNil.cpp
Normal file
64
CasterSoundboard/libs/osc/reader/types/OscNil.cpp
Normal file
@ -0,0 +1,64 @@
|
||||
/*
|
||||
* Copyright (c) 2014 MUGEN SAS
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <libs/osc/reader/types/OscNil.h>
|
||||
|
||||
/**
|
||||
* Build a new OscNil from the given location in packet.
|
||||
*
|
||||
* @param pos
|
||||
* the Nil tag position.
|
||||
*/
|
||||
OscNil::OscNil(ByteBuffer* packet, qint32 pos)
|
||||
: OscValue('N', packet, pos)
|
||||
{
|
||||
}
|
||||
|
||||
bool OscNil::isNil()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
char OscNil::toChar()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
QByteArray OscNil::toBytes()
|
||||
{
|
||||
return QByteArray(1, 0);
|
||||
}
|
||||
|
||||
double OscNil::toDouble()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
qint64 OscNil::toLong()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
QString OscNil::toString()
|
||||
{
|
||||
return "NIL";
|
||||
}
|
||||
54
CasterSoundboard/libs/osc/reader/types/OscNil.h
Normal file
54
CasterSoundboard/libs/osc/reader/types/OscNil.h
Normal file
@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright (c) 2014 MUGEN SAS
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef OSC_NIL_H_
|
||||
#define OSC_NIL_H_
|
||||
|
||||
#include <libs/osc/reader/types/OscValue.h>
|
||||
|
||||
/** Class representing an OSC-Nil tag. */
|
||||
class OSC_API OscNil : public OscValue
|
||||
{
|
||||
public:
|
||||
virtual bool isNil();
|
||||
virtual char toChar();
|
||||
virtual QByteArray toBytes();
|
||||
virtual double toDouble();
|
||||
virtual qint64 toLong();
|
||||
virtual QString toString();
|
||||
|
||||
#ifndef BUILD_UNITTESTS
|
||||
private:
|
||||
#endif
|
||||
/**
|
||||
* Build a new OscNil from the given location in packet.
|
||||
*
|
||||
* @param pos
|
||||
* the Nil tag position.
|
||||
*/
|
||||
OscNil(ByteBuffer* packet, qint32 pos);
|
||||
|
||||
friend class OscMessage;
|
||||
|
||||
};
|
||||
|
||||
#endif // OSC_NIL_H_
|
||||
97
CasterSoundboard/libs/osc/reader/types/OscRGBA.cpp
Normal file
97
CasterSoundboard/libs/osc/reader/types/OscRGBA.cpp
Normal file
@ -0,0 +1,97 @@
|
||||
/*
|
||||
* Copyright (c) 2014 MUGEN SAS
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <libs/osc/reader/types/OscRGBA.h>
|
||||
#include <libs/tools/ByteBuffer.h>
|
||||
#include <libs/osc/exceptions/CharConversionException.h>
|
||||
#include <libs/osc/exceptions/FloatConversionException.h>
|
||||
#include <libs/osc/exceptions/DoubleConversionException.h>
|
||||
|
||||
/**
|
||||
* Build a new OscRGBA from the given location in packet.
|
||||
*
|
||||
* @param pos
|
||||
* the RGBA color value position.
|
||||
*/
|
||||
OscRGBA::OscRGBA(ByteBuffer* packet, qint32 pos)
|
||||
: OscValue('r', packet, pos)
|
||||
{
|
||||
mPacket->getInt();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the RGBA color value.
|
||||
*
|
||||
* @return an qint32 value.
|
||||
*/
|
||||
QByteArray OscRGBA::get()
|
||||
{
|
||||
qint32 i = mPacket->getInt(mPos);
|
||||
QByteArray bytes(4, 0);
|
||||
bytes.insert(0, (char*)&i, 4);
|
||||
return bytes;
|
||||
}
|
||||
|
||||
bool OscRGBA::toBoolean()
|
||||
{
|
||||
return (mPacket->getInt(mPos) != 0);
|
||||
}
|
||||
|
||||
QByteArray OscRGBA::toBytes()
|
||||
{
|
||||
return get();
|
||||
}
|
||||
|
||||
char OscRGBA::toChar()
|
||||
{
|
||||
throw CharConversionException();
|
||||
}
|
||||
|
||||
float OscRGBA::toFloat()
|
||||
{
|
||||
throw FloatConversionException();
|
||||
}
|
||||
|
||||
double OscRGBA::toDouble()
|
||||
{
|
||||
throw DoubleConversionException();
|
||||
}
|
||||
|
||||
qint64 OscRGBA::toLong()
|
||||
{
|
||||
return mPacket->getInt(mPos);
|
||||
}
|
||||
|
||||
Midi OscRGBA::toMIDI()
|
||||
{
|
||||
return Midi(get());
|
||||
}
|
||||
|
||||
RGBA OscRGBA::toRGBA()
|
||||
{
|
||||
return RGBA(get());
|
||||
}
|
||||
|
||||
QString OscRGBA::toString()
|
||||
{
|
||||
return QString::number(mPacket->getInt(mPos),16);
|
||||
}
|
||||
65
CasterSoundboard/libs/osc/reader/types/OscRGBA.h
Normal file
65
CasterSoundboard/libs/osc/reader/types/OscRGBA.h
Normal file
@ -0,0 +1,65 @@
|
||||
/*
|
||||
* Copyright (c) 2014 MUGEN SAS
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef OSC_RGBA_H_
|
||||
#define OSC_RGBA_H_
|
||||
|
||||
#include <libs/osc/reader/types/OscValue.h>
|
||||
|
||||
/** Class representing an OSC-RGBA-color value. */
|
||||
class OSC_API OscRGBA : public OscValue
|
||||
{
|
||||
public:
|
||||
virtual bool toBoolean();
|
||||
virtual QByteArray toBytes();
|
||||
virtual char toChar();
|
||||
virtual float toFloat();
|
||||
virtual double toDouble();
|
||||
virtual qint64 toLong();
|
||||
virtual Midi toMIDI();
|
||||
virtual RGBA toRGBA();
|
||||
virtual QString toString();
|
||||
|
||||
#ifndef BUILD_UNITTESTS
|
||||
private:
|
||||
#endif
|
||||
/**
|
||||
* Build a new OscRGBA from the given location in packet.
|
||||
*
|
||||
* @param pos
|
||||
* the RGBA color value position.
|
||||
*/
|
||||
|
||||
OscRGBA(ByteBuffer* packet, qint32 pos);
|
||||
|
||||
/**
|
||||
* Returns the RGBA color value.
|
||||
*
|
||||
* @return an qint32 value.
|
||||
*/
|
||||
QByteArray get();
|
||||
|
||||
friend class OscMessage;
|
||||
|
||||
};
|
||||
|
||||
#endif // OSC_RGBA_H_
|
||||
134
CasterSoundboard/libs/osc/reader/types/OscString.cpp
Normal file
134
CasterSoundboard/libs/osc/reader/types/OscString.cpp
Normal file
@ -0,0 +1,134 @@
|
||||
/*
|
||||
* Copyright (c) 2014 MUGEN SAS
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <libs/osc/reader/types/OscString.h>
|
||||
#include <QtCore/QHash>
|
||||
#include <libs/osc/exceptions/CharConversionException.h>
|
||||
#include <libs/osc/exceptions/FloatConversionException.h>
|
||||
#include <libs/osc/exceptions/DoubleConversionException.h>
|
||||
#include <libs/osc/exceptions/LongConversionException.h>
|
||||
#include <libs/osc/exceptions/IntegerConversionException.h>
|
||||
|
||||
/**
|
||||
* Build a new OscString from the given location in packet.
|
||||
*
|
||||
* @param pos
|
||||
* the string position.
|
||||
*/
|
||||
OscString::OscString(ByteBuffer* packet, qint32 pos)
|
||||
: OscValue('s', packet, pos)
|
||||
{
|
||||
try
|
||||
{
|
||||
get();
|
||||
}
|
||||
catch (const QException& e)
|
||||
{
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the string value.
|
||||
*
|
||||
* @return a string value.
|
||||
*/
|
||||
QByteArray OscString::get()
|
||||
{
|
||||
try
|
||||
{
|
||||
return OscValue::getString(mPacket, mPos);
|
||||
}
|
||||
catch (const QException& e)
|
||||
{
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
bool OscString::toBoolean()
|
||||
{
|
||||
return (get().length() != 0);
|
||||
}
|
||||
|
||||
QByteArray OscString::toBytes()
|
||||
{
|
||||
return get();
|
||||
}
|
||||
|
||||
char OscString::toChar()
|
||||
{
|
||||
const QByteArray& value = get();
|
||||
if (value.length() > 1)
|
||||
throw CharConversionException();
|
||||
else
|
||||
return value.at(0);
|
||||
}
|
||||
|
||||
float OscString::toFloat()
|
||||
{
|
||||
bool ok;
|
||||
float f = get().toFloat(&ok);
|
||||
if (ok)
|
||||
return f;
|
||||
else
|
||||
throw FloatConversionException();
|
||||
}
|
||||
|
||||
double OscString::toDouble()
|
||||
{
|
||||
bool ok;
|
||||
double d = get().toDouble(&ok);
|
||||
if (ok)
|
||||
return d;
|
||||
else
|
||||
throw DoubleConversionException();
|
||||
}
|
||||
|
||||
qint32 OscString::toInteger()
|
||||
{
|
||||
bool ok;
|
||||
qint32 i = get().toInt(&ok);
|
||||
if (ok)
|
||||
return i;
|
||||
else
|
||||
throw IntegerConversionException();
|
||||
}
|
||||
|
||||
qint64 OscString::toLong()
|
||||
{
|
||||
bool ok;
|
||||
qint64 h = get().toLongLong(&ok);
|
||||
if (ok)
|
||||
return h;
|
||||
else
|
||||
throw LongConversionException();
|
||||
}
|
||||
|
||||
QString OscString::toString()
|
||||
{
|
||||
return get();
|
||||
}
|
||||
|
||||
QString OscString::toSymbol()
|
||||
{
|
||||
return toString();
|
||||
}
|
||||
64
CasterSoundboard/libs/osc/reader/types/OscString.h
Normal file
64
CasterSoundboard/libs/osc/reader/types/OscString.h
Normal file
@ -0,0 +1,64 @@
|
||||
/*
|
||||
* Copyright (c) 2014 MUGEN SAS
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef OSC_STRING_H_
|
||||
#define OSC_STRING_H_
|
||||
|
||||
#include <libs/osc/reader/types/OscValue.h>
|
||||
|
||||
/** Class representing an OSC-string value. */
|
||||
class OSC_API OscString : public OscValue
|
||||
{
|
||||
public:
|
||||
virtual bool toBoolean();
|
||||
virtual QByteArray toBytes();
|
||||
virtual char toChar();
|
||||
virtual float toFloat();
|
||||
virtual double toDouble();
|
||||
virtual qint32 toInteger();
|
||||
virtual qint64 toLong();
|
||||
virtual QString toString();
|
||||
virtual QString toSymbol();
|
||||
|
||||
#ifndef BUILD_UNITTESTS
|
||||
private:
|
||||
#endif
|
||||
/**
|
||||
* Build a new OscString from the given location in packet.
|
||||
*
|
||||
* @param pos
|
||||
* the string position.
|
||||
*/
|
||||
OscString(ByteBuffer* packet, qint32 pos);
|
||||
|
||||
/**
|
||||
* Returns the string value.
|
||||
*
|
||||
* @return a string value.
|
||||
*/
|
||||
QByteArray get();
|
||||
|
||||
friend class OscMessage;
|
||||
|
||||
};
|
||||
|
||||
#endif // OSC_STRING_H_
|
||||
134
CasterSoundboard/libs/osc/reader/types/OscSymbol.cpp
Normal file
134
CasterSoundboard/libs/osc/reader/types/OscSymbol.cpp
Normal file
@ -0,0 +1,134 @@
|
||||
/*
|
||||
* Copyright (c) 2014 MUGEN SAS
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <libs/osc/reader/types/OscSymbol.h>
|
||||
#include <QtCore/QHash>
|
||||
#include <libs/osc/exceptions/CharConversionException.h>
|
||||
#include <libs/osc/exceptions/IntegerConversionException.h>
|
||||
#include <libs/osc/exceptions/FloatConversionException.h>
|
||||
#include <libs/osc/exceptions/DoubleConversionException.h>
|
||||
#include <libs/osc/exceptions/LongConversionException.h>
|
||||
|
||||
/**
|
||||
* Build a new OscSymbol from the given location in packet.
|
||||
*
|
||||
* @param pos
|
||||
* the Symbol string value position.
|
||||
*/
|
||||
OscSymbol::OscSymbol(ByteBuffer* packet, qint32 pos)
|
||||
: OscValue('S', packet, pos)
|
||||
{
|
||||
try
|
||||
{
|
||||
get();
|
||||
}
|
||||
catch (const QException& e)
|
||||
{
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Symbol value.
|
||||
*
|
||||
* @return a string value.
|
||||
*/
|
||||
QByteArray OscSymbol::get()
|
||||
{
|
||||
try
|
||||
{
|
||||
return OscValue::getString(mPacket, mPos);
|
||||
}
|
||||
catch (const QException& e)
|
||||
{
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
bool OscSymbol::toBoolean()
|
||||
{
|
||||
return (get().length() != 0);
|
||||
}
|
||||
|
||||
QByteArray OscSymbol::toBytes()
|
||||
{
|
||||
return get();
|
||||
}
|
||||
|
||||
char OscSymbol::toChar()
|
||||
{
|
||||
const QByteArray& value = get();
|
||||
if (value.length() > 1)
|
||||
throw CharConversionException();
|
||||
else
|
||||
return value.at(0);
|
||||
}
|
||||
|
||||
float OscSymbol::toFloat()
|
||||
{
|
||||
bool ok;
|
||||
float f = get().toFloat(&ok);
|
||||
if (ok)
|
||||
return f;
|
||||
else
|
||||
throw FloatConversionException();
|
||||
}
|
||||
|
||||
double OscSymbol::toDouble()
|
||||
{
|
||||
bool ok;
|
||||
double d = get().toDouble(&ok);
|
||||
if (ok)
|
||||
return d;
|
||||
else
|
||||
throw DoubleConversionException();
|
||||
}
|
||||
|
||||
qint32 OscSymbol::toInteger()
|
||||
{
|
||||
bool ok;
|
||||
qint32 i = get().toInt(&ok);
|
||||
if (ok)
|
||||
return i;
|
||||
else
|
||||
throw IntegerConversionException();
|
||||
}
|
||||
|
||||
qint64 OscSymbol::toLong()
|
||||
{
|
||||
bool ok;
|
||||
qint64 h = get().toLongLong(&ok);
|
||||
if (ok)
|
||||
return h;
|
||||
else
|
||||
throw LongConversionException();
|
||||
}
|
||||
|
||||
QString OscSymbol::toString()
|
||||
{
|
||||
return toSymbol();
|
||||
}
|
||||
|
||||
QString OscSymbol::toSymbol()
|
||||
{
|
||||
return get();
|
||||
}
|
||||
64
CasterSoundboard/libs/osc/reader/types/OscSymbol.h
Normal file
64
CasterSoundboard/libs/osc/reader/types/OscSymbol.h
Normal file
@ -0,0 +1,64 @@
|
||||
/*
|
||||
* Copyright (c) 2014 MUGEN SAS
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef OSC_SYMBOL_H_
|
||||
#define OSC_SYMBOL_H_
|
||||
|
||||
#include <libs/osc/reader/types/OscValue.h>
|
||||
|
||||
/** Class representing an OSC-symbol value. */
|
||||
class OSC_API OscSymbol : public OscValue
|
||||
{
|
||||
public:
|
||||
virtual bool toBoolean();
|
||||
virtual QByteArray toBytes();
|
||||
virtual char toChar();
|
||||
virtual float toFloat();
|
||||
virtual double toDouble();
|
||||
virtual qint32 toInteger();
|
||||
virtual qint64 toLong();
|
||||
virtual QString toString();
|
||||
virtual QString toSymbol();
|
||||
|
||||
#ifndef BUILD_UNITTESTS
|
||||
private:
|
||||
#endif
|
||||
/**
|
||||
* Build a new OscSymbol from the given location in packet.
|
||||
*
|
||||
* @param pos
|
||||
* the Symbol string value position.
|
||||
*/
|
||||
OscSymbol(ByteBuffer* packet, qint32 pos);
|
||||
|
||||
/**
|
||||
* Returns the Symbol value.
|
||||
*
|
||||
* @return a string value.
|
||||
*/
|
||||
QByteArray get();
|
||||
|
||||
friend class OscMessage;
|
||||
|
||||
};
|
||||
|
||||
#endif // OSC_SYMBOL_H_
|
||||
130
CasterSoundboard/libs/osc/reader/types/OscTags.cpp
Normal file
130
CasterSoundboard/libs/osc/reader/types/OscTags.cpp
Normal file
@ -0,0 +1,130 @@
|
||||
/*
|
||||
* Copyright (c) 2014 MUGEN SAS
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <libs/osc/reader/types/OscTags.h>
|
||||
#include <libs/osc/exceptions/BooleanConversionException.h>
|
||||
#include <libs/osc/exceptions/BytesConversionException.h>
|
||||
#include <libs/osc/exceptions/CharConversionException.h>
|
||||
#include <libs/osc/exceptions/DoubleConversionException.h>
|
||||
#include <libs/osc/exceptions/FloatConversionException.h>
|
||||
#include <libs/osc/exceptions/IntegerConversionException.h>
|
||||
#include <libs/osc/exceptions/LongConversionException.h>
|
||||
#include <libs/osc/exceptions/MidiConversionException.h>
|
||||
#include <libs/osc/exceptions/RgbaConversionException.h>
|
||||
#include <libs/osc/exceptions/SymbolConversionException.h>
|
||||
#include <libs/osc/exceptions/TimetagConversionException.h>
|
||||
|
||||
/**
|
||||
* Build a new OscTags from the given location in packet.
|
||||
*
|
||||
* @param pos
|
||||
* the message type tags string position.
|
||||
*/
|
||||
OscTags::OscTags(ByteBuffer* packet, qint32 pos)
|
||||
: OscValue('\0', packet, pos)
|
||||
{
|
||||
try
|
||||
{
|
||||
get();
|
||||
}
|
||||
catch (const QException& e)
|
||||
{
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the OSC type tags associated to this message.
|
||||
*
|
||||
* @return a string value.
|
||||
*/
|
||||
QString OscTags::get()
|
||||
{
|
||||
try
|
||||
{
|
||||
return OscValue::getString(mPacket, mPos);
|
||||
}
|
||||
catch (const QException& e)
|
||||
{
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
bool OscTags::toBoolean()
|
||||
{
|
||||
throw BooleanConversionException();
|
||||
}
|
||||
|
||||
QByteArray OscTags::toBytes()
|
||||
{
|
||||
throw BytesConversionException();
|
||||
}
|
||||
|
||||
char OscTags::toChar()
|
||||
{
|
||||
throw CharConversionException();
|
||||
}
|
||||
|
||||
double OscTags::toDouble()
|
||||
{
|
||||
throw DoubleConversionException();
|
||||
}
|
||||
|
||||
float OscTags::toFloat()
|
||||
{
|
||||
throw FloatConversionException();
|
||||
}
|
||||
|
||||
qint32 OscTags::toInteger()
|
||||
{
|
||||
throw IntegerConversionException();
|
||||
}
|
||||
|
||||
qint64 OscTags::toLong()
|
||||
{
|
||||
throw LongConversionException();
|
||||
}
|
||||
|
||||
Midi OscTags::toMIDI()
|
||||
{
|
||||
throw MidiConversionException();
|
||||
}
|
||||
|
||||
RGBA OscTags::toRGBA()
|
||||
{
|
||||
throw RgbaConversionException();
|
||||
}
|
||||
|
||||
QString OscTags::toString()
|
||||
{
|
||||
return get();
|
||||
}
|
||||
|
||||
QString OscTags::toSymbol()
|
||||
{
|
||||
throw SymbolConversionException();
|
||||
}
|
||||
|
||||
QDateTime OscTags::toTimetag()
|
||||
{
|
||||
throw TimetagConversionException();
|
||||
}
|
||||
65
CasterSoundboard/libs/osc/reader/types/OscTags.h
Normal file
65
CasterSoundboard/libs/osc/reader/types/OscTags.h
Normal file
@ -0,0 +1,65 @@
|
||||
/*
|
||||
* Copyright (c) 2014 MUGEN SAS
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef OSC_TAGS_H_
|
||||
#define OSC_TAGS_H_
|
||||
|
||||
#include <libs/osc/reader/types/OscValue.h>
|
||||
|
||||
/** Class representing the type tags string of this message. */
|
||||
class OSC_API OscTags: public OscValue
|
||||
{
|
||||
public:
|
||||
virtual bool toBoolean();
|
||||
virtual QByteArray toBytes();
|
||||
virtual char toChar();
|
||||
virtual double toDouble();
|
||||
virtual float toFloat();
|
||||
virtual qint32 toInteger();
|
||||
virtual qint64 toLong();
|
||||
virtual Midi toMIDI();
|
||||
virtual RGBA toRGBA();
|
||||
virtual QString toString();
|
||||
virtual QString toSymbol();
|
||||
virtual QDateTime toTimetag();
|
||||
|
||||
private:
|
||||
/**
|
||||
* Build a new OscTags from the given location in packet.
|
||||
*
|
||||
* @param pos
|
||||
* the message type tags string position.
|
||||
*/
|
||||
OscTags(ByteBuffer* packet, qint32 pos);
|
||||
|
||||
/**
|
||||
* Returns the OSC type tags associated to this message.
|
||||
*
|
||||
* @return a string value.
|
||||
*/
|
||||
QString get();
|
||||
|
||||
friend class OscMessage;
|
||||
|
||||
};
|
||||
|
||||
#endif // OSC_TAGS_H_
|
||||
126
CasterSoundboard/libs/osc/reader/types/OscTimeTag.cpp
Normal file
126
CasterSoundboard/libs/osc/reader/types/OscTimeTag.cpp
Normal file
@ -0,0 +1,126 @@
|
||||
/*
|
||||
* Copyright (c) 2014 MUGEN SAS
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <libs/osc/reader/types/OscTimetag.h>
|
||||
#include <libs/tools/ByteBuffer.h>
|
||||
#include <libs/osc/exceptions/CharConversionException.h>
|
||||
#include <libs/osc/exceptions/FloatConversionException.h>
|
||||
#include <libs/osc/exceptions/DoubleConversionException.h>
|
||||
#include <libs/osc/exceptions/IntegerConversionException.h>
|
||||
#include <libs/osc/exceptions/LongConversionException.h>
|
||||
#include <libs/osc/exceptions/StringConversionException.h>
|
||||
#include <limits>
|
||||
#include <libs/tools/NtpTimestamp.h>
|
||||
#include <QtEndian>
|
||||
|
||||
/**
|
||||
* Build a new OscTimetag from the given location in packet.
|
||||
*
|
||||
* @param pos
|
||||
* the time tag value position.
|
||||
*/
|
||||
OscTimetag::OscTimetag(ByteBuffer* packet, qint32 pos)
|
||||
: OscValue('t', packet, pos)
|
||||
{
|
||||
mPacket->getLong();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the OSC Timetag value.
|
||||
*
|
||||
* @return a long value.
|
||||
*/
|
||||
NtpTimestamp OscTimetag::get()
|
||||
{
|
||||
NtpTimestamp ntp( mPacket->getInt(mPos), mPacket->getInt(mPos + 4) );
|
||||
return ntp;
|
||||
}
|
||||
|
||||
bool OscTimetag::toBoolean()
|
||||
{
|
||||
NtpTimestamp ntp( qToBigEndian(0), qToBigEndian(1) );
|
||||
return (get() != ntp);
|
||||
}
|
||||
|
||||
QByteArray OscTimetag::toBytes()
|
||||
{
|
||||
NtpTimestamp ntp = get();
|
||||
QByteArray bytes(8, 0);
|
||||
quint32 secs = ntp.rawSeconds();
|
||||
quint32 fracs = ntp.rawFraction();
|
||||
bytes.insert(0, (char*)&secs, 4);
|
||||
bytes.insert(4, (char*)&fracs, 4);
|
||||
return bytes;
|
||||
}
|
||||
|
||||
char OscTimetag::toChar()
|
||||
{
|
||||
throw CharConversionException();
|
||||
}
|
||||
|
||||
double OscTimetag::toDouble()
|
||||
{
|
||||
throw DoubleConversionException();
|
||||
}
|
||||
|
||||
float OscTimetag::toFloat()
|
||||
{
|
||||
throw FloatConversionException();
|
||||
}
|
||||
|
||||
qint32 OscTimetag::toInteger()
|
||||
{
|
||||
throw IntegerConversionException();
|
||||
}
|
||||
|
||||
qint64 OscTimetag::toLong()
|
||||
{
|
||||
throw LongConversionException();
|
||||
}
|
||||
|
||||
Midi OscTimetag::toMIDI()
|
||||
{
|
||||
NtpTimestamp ntp = get();
|
||||
QByteArray bytes(4, 0);
|
||||
quint32 secs = ntp.seconds();
|
||||
bytes.insert(0, (char*)&secs, 4);
|
||||
return Midi(bytes);
|
||||
}
|
||||
|
||||
RGBA OscTimetag::toRGBA()
|
||||
{
|
||||
NtpTimestamp ntp = get();
|
||||
QByteArray bytes(4, 0);
|
||||
quint32 secs = ntp.seconds();
|
||||
bytes.insert(0, (char*)&secs, 4);
|
||||
return RGBA(bytes);
|
||||
}
|
||||
|
||||
QString OscTimetag::toString()
|
||||
{
|
||||
throw StringConversionException();
|
||||
}
|
||||
|
||||
QDateTime OscTimetag::toTimetag()
|
||||
{
|
||||
return NtpTimestamp::toDateTime(get());
|
||||
}
|
||||
66
CasterSoundboard/libs/osc/reader/types/OscTimetag.h
Normal file
66
CasterSoundboard/libs/osc/reader/types/OscTimetag.h
Normal file
@ -0,0 +1,66 @@
|
||||
/*
|
||||
* Copyright (c) 2014 MUGEN SAS
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef OSC_Timetag_H_
|
||||
#define OSC_Timetag_H_
|
||||
|
||||
#include <libs/osc/reader/types/OscValue.h>
|
||||
#include <libs/tools/NtpTimestamp.h>
|
||||
|
||||
/** Class representing an OSC-Timetag value. */
|
||||
class OSC_API OscTimetag : public OscValue
|
||||
{
|
||||
public:
|
||||
virtual bool toBoolean();
|
||||
virtual QByteArray toBytes();
|
||||
virtual char toChar();
|
||||
virtual double toDouble();
|
||||
virtual float toFloat();
|
||||
virtual qint32 toInteger();
|
||||
virtual qint64 toLong();
|
||||
virtual Midi toMIDI();
|
||||
virtual RGBA toRGBA();
|
||||
virtual QString toString();
|
||||
virtual QDateTime toTimetag();
|
||||
|
||||
#ifndef BUILD_UNITTESTS
|
||||
private:
|
||||
#endif
|
||||
/**
|
||||
* Build a new OscTimetag from the given location in packet.
|
||||
*
|
||||
* @param pos
|
||||
* the time tag value position.
|
||||
*/
|
||||
OscTimetag(ByteBuffer* packet, qint32 pos);
|
||||
|
||||
/**
|
||||
* Returns the OSC Timetag value.
|
||||
*
|
||||
* @return a long value.
|
||||
*/
|
||||
NtpTimestamp get();
|
||||
|
||||
friend class OscMessage;
|
||||
};
|
||||
|
||||
#endif // OSC_Timetag_H_
|
||||
64
CasterSoundboard/libs/osc/reader/types/OscTrue.cpp
Normal file
64
CasterSoundboard/libs/osc/reader/types/OscTrue.cpp
Normal file
@ -0,0 +1,64 @@
|
||||
/*
|
||||
* Copyright (c) 2014 MUGEN SAS
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <libs/osc/reader/types/OscTrue.h>
|
||||
|
||||
/**
|
||||
* Build a new OscTrue from the given location in packet.
|
||||
*
|
||||
* @param pos
|
||||
* the TRUE tag position.
|
||||
*/
|
||||
OscTrue::OscTrue(ByteBuffer* packet, qint32 pos)
|
||||
: OscValue('T', packet, pos)
|
||||
{
|
||||
}
|
||||
|
||||
bool OscTrue::isTrue()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool OscTrue::toBoolean()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
QByteArray OscTrue::toBytes()
|
||||
{
|
||||
return QByteArray(1, 1);
|
||||
}
|
||||
|
||||
double OscTrue::toDouble()
|
||||
{
|
||||
return 1.0;
|
||||
}
|
||||
|
||||
qint64 OscTrue::toLong()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
QString OscTrue::toString()
|
||||
{
|
||||
return "TRUE";
|
||||
}
|
||||
57
CasterSoundboard/libs/osc/reader/types/OscTrue.h
Normal file
57
CasterSoundboard/libs/osc/reader/types/OscTrue.h
Normal file
@ -0,0 +1,57 @@
|
||||
/*
|
||||
* Copyright (c) 2014 MUGEN SAS
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef OSC_TRUE_H_
|
||||
#define OSC_TRUE_H_
|
||||
|
||||
#include <libs/osc/reader/types/OscValue.h>
|
||||
|
||||
/** Class representing an OSC-TRUE tag. */
|
||||
class OSC_API OscTrue : public OscValue
|
||||
{
|
||||
public:
|
||||
virtual bool isTrue();
|
||||
virtual bool toBoolean();
|
||||
virtual QByteArray toBytes();
|
||||
virtual double toDouble();
|
||||
virtual qint64 toLong();
|
||||
virtual QString toString();
|
||||
|
||||
#ifndef BUILD_UNITTESTS
|
||||
private:
|
||||
#endif
|
||||
/**
|
||||
* Build a new OscTrue from the given location in packet.
|
||||
*
|
||||
* @param pos
|
||||
* the TRUE tag position.
|
||||
*/
|
||||
OscTrue(ByteBuffer* packet, qint32 pos);
|
||||
|
||||
/** */
|
||||
|
||||
|
||||
friend class OscMessage;
|
||||
|
||||
};
|
||||
|
||||
#endif // OSC_TRUE_H_
|
||||
95
CasterSoundboard/libs/osc/reader/types/OscValue.h
Normal file
95
CasterSoundboard/libs/osc/reader/types/OscValue.h
Normal file
@ -0,0 +1,95 @@
|
||||
/*
|
||||
* Copyright (c) 2014 MUGEN SAS
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef OSC_VALUE_H_
|
||||
#define OSC_VALUE_H_
|
||||
|
||||
#include <libs/osc/OscAPI.h>
|
||||
#include <QtCore/QByteArray>
|
||||
#include <QtCore/QString>
|
||||
#include <libs/osc/reader/types/Midi.h>
|
||||
#include <libs/osc/reader/types/RGBA.h>
|
||||
#include <QDateTime>
|
||||
|
||||
class ByteBuffer;
|
||||
|
||||
/**
|
||||
* Abstract class representing an OSC value. This class is derivated to
|
||||
* manage all OSC common types.
|
||||
*/
|
||||
class OSC_API OscValue
|
||||
{
|
||||
public:
|
||||
|
||||
virtual char getTag();
|
||||
virtual bool isArrayBegin();
|
||||
virtual bool isArrayEnd();
|
||||
virtual bool isFalse();
|
||||
virtual bool isTrue();
|
||||
virtual bool isNil();
|
||||
virtual bool isInfinitum();
|
||||
virtual bool toBoolean();
|
||||
virtual QByteArray toBytes() = 0;
|
||||
virtual char toChar();
|
||||
virtual float toFloat();
|
||||
virtual double toDouble() = 0;
|
||||
virtual qint32 toInteger();
|
||||
virtual qint64 toLong() = 0;
|
||||
virtual QString toString();
|
||||
virtual QString toSymbol();
|
||||
virtual Midi toMIDI();
|
||||
virtual RGBA toRGBA();
|
||||
virtual QDateTime toTimetag();
|
||||
|
||||
virtual ~OscValue() {};
|
||||
|
||||
protected:
|
||||
|
||||
OscValue(char typeTag, ByteBuffer* packet, qint32 pos);
|
||||
|
||||
|
||||
/**
|
||||
* Returns the position of the next non-null character in the packet.
|
||||
*
|
||||
* @return the position.
|
||||
*/
|
||||
static qint32 getLastStringIdx(ByteBuffer* packet);
|
||||
|
||||
/**
|
||||
* Returns the string located at the passed position in the packet buffer.
|
||||
*
|
||||
* @param pos
|
||||
* The position were the string starts
|
||||
* @return The read string.
|
||||
*/
|
||||
static QByteArray getString(ByteBuffer* packet, qint32 pos);
|
||||
|
||||
/** The buffer to read to. */
|
||||
ByteBuffer* mPacket;
|
||||
|
||||
/** The Osc value type tag. */
|
||||
char mTag;
|
||||
|
||||
qint32 mPos;
|
||||
};
|
||||
|
||||
#endif // OSC_VALUE_H_
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user