Skip to content

Commit

Permalink
eve osc ok 20241003
Browse files Browse the repository at this point in the history
  • Loading branch information
evelynnev committed Oct 3, 2024
1 parent 87a9397 commit 605b32b
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 77 deletions.
8 changes: 8 additions & 0 deletions src/engine/enginebuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -615,6 +615,14 @@ void EngineBuffer::slotTrackLoaded(TrackPointer pTrack,
0,
0,
(float)pTrack->getDuration());
OscFunctionsSendPtrType(m_pConfig,
getGroup(),
"playposition",
FLOATBODY,
"",
0,
0,
0);
}
// EveOSC end

Expand Down
8 changes: 0 additions & 8 deletions src/mixer/basetrackplayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -952,14 +952,6 @@ void BaseTrackPlayerImpl::slotPlayToggled(double value) {
0,
0,
(float)value);
// OscFunctionsSendPtrType(m_pConfig,
// getGroup(),
// "play",
// DOUBLEBODY,
// "",
// 0,
// value,
// 0);
}
// EveOSC end
}
Expand Down
37 changes: 31 additions & 6 deletions src/osc/ip/IpEndpointName.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,17 @@ unsigned long IpEndpointName::GetHostByName(const char* s) {

void IpEndpointName::AddressAsString(char* s) const {
if (address == ANY_ADDRESS) {
std::sprintf(s, "<any>");
// std::sprintf(s, "<any>");
std::snprintf(s, 16, "<any>");
} else {
std::sprintf(s,
// std::sprintf(s,
// "%d.%d.%d.%d",
// (int)((address >> 24) & 0xFF),
// (int)((address >> 16) & 0xFF),
// (int)((address >> 8) & 0xFF),
// (int)(address & 0xFF));
std::snprintf(s,
16,
"%d.%d.%d.%d",
(int)((address >> 24) & 0xFF),
(int)((address >> 16) & 0xFF),
Expand All @@ -60,9 +68,17 @@ void IpEndpointName::AddressAsString(char* s) const {
void IpEndpointName::AddressAndPortAsString(char* s) const {
if (port == ANY_PORT) {
if (address == ANY_ADDRESS) {
std::sprintf(s, "<any>:<any>");
// std::sprintf(s, "<any>:<any>");
std::snprintf(s, 16, "<any>:<any>");
} else {
std::sprintf(s,
// std::sprintf(s,
// "%d.%d.%d.%d:<any>",
// (int)((address >> 24) & 0xFF),
// (int)((address >> 16) & 0xFF),
// (int)((address >> 8) & 0xFF),
// (int)(address & 0xFF));
std::snprintf(s,
16,
"%d.%d.%d.%d:<any>",

Check warning on line 82 in src/osc/ip/IpEndpointName.cpp

View workflow job for this annotation

GitHub Actions / Ubuntu 22.04

‘:<any>’ directive output may be truncated writing 6 bytes into a region of size between 1 and 9 [-Wformat-truncation=]
(int)((address >> 24) & 0xFF),
(int)((address >> 16) & 0xFF),
Expand All @@ -71,9 +87,18 @@ void IpEndpointName::AddressAndPortAsString(char* s) const {
}
} else {
if (address == ANY_ADDRESS) {
std::sprintf(s, "<any>:%d", port);
// std::sprintf(s, "<any>:%d", port);
std::snprintf(s, 16, "<any>:%d", port);
} else {
std::sprintf(s,
// std::sprintf(s,
// "%d.%d.%d.%d:%d",
// (int)((address >> 24) & 0xFF),
// (int)((address >> 16) & 0xFF),
// (int)((address >> 8) & 0xFF),
// (int)(address & 0xFF),
// (int)port);
std::snprintf(s,
16,
"%d.%d.%d.%d:%d",

Check warning on line 102 in src/osc/ip/IpEndpointName.cpp

View workflow job for this annotation

GitHub Actions / Ubuntu 22.04

‘%d’ directive output may be truncated writing between 1 and 11 bytes into a region of size between 0 and 8 [-Wformat-truncation=]
(int)((address >> 24) & 0xFF),
(int)((address >> 16) & 0xFF),
Expand Down
3 changes: 1 addition & 2 deletions src/osc/ip/win32/NetworkingUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@
// #include "ip/NetworkingUtils.h"
#include "../NetworkingUtils.h"

#include <winsock2.h> // this must come first to prevent errors with MSVC7
// #include <windows.h>
#include <winsock2.h>

#include <cstring>

Expand Down
1 change: 0 additions & 1 deletion src/osc/ip/win32/UdpSocket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
#include <algorithm>
#include <cassert>
#include <cstring> // for memset
// #include <QTime>
#include <stdexcept>
#include <vector>

Expand Down
45 changes: 10 additions & 35 deletions src/osc/oscfunctions.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ void OscFunctionsSendPtrType(UserSettingsPointer m_pConfig,
if (m_pConfig->getValue<bool>(ConfigKey("[OSC]", "OscEnabled"))) {
char buffer[IP_MTU_SIZE];
osc::OutboundPacketStream p(buffer, IP_MTU_SIZE);
QString MixxxOSCStatusTxtBody;
QString OscStatusTxtBody;
switch (OscBodyType) {
case 1: // QSTRINGBODY = 1
OscMessageBodyBa = OscMessageBodyQString.toLocal8Bit();
Expand All @@ -51,37 +51,34 @@ void OscFunctionsSendPtrType(UserSettingsPointer m_pConfig,
p << osc::BeginBundle();
p << osc::BeginMessage(OscMessageHeaderChar) << OscMessageBodyChar << osc::EndMessage;
p << osc::EndBundle;
MixxxOSCStatusTxtBody = OscMessageBodyChar;
OscStatusTxtBody = OscMessageBodyChar;
break;
case 2: // INTBODY = 2
p.Clear();
p << osc::BeginBundle();
p << osc::BeginMessage(OscMessageHeaderChar) << OscMessageBodyInt << osc::EndMessage;
p << osc::EndBundle;
MixxxOSCStatusTxtBody = QString::number(OscMessageBodyInt);
OscStatusTxtBody = QString::number(OscMessageBodyInt);
break;
case 3: // DOUBLEBODY = 3
p.Clear();
p << osc::BeginBundle();
p << osc::BeginMessage(OscMessageHeaderChar) << OscMessageBodyDouble << osc::EndMessage;
p << osc::EndBundle;
MixxxOSCStatusTxtBody = QString::number(OscMessageBodyDouble);
OscStatusTxtBody = QString::number(OscMessageBodyDouble);
break;
case 4: // FLOATBODY = 4
p.Clear();
p << osc::BeginBundle();
p << osc::BeginMessage(OscMessageHeaderChar) << OscMessageBodyFloat << osc::EndMessage;
p << osc::EndBundle;
MixxxOSCStatusTxtBody = QString::number(OscMessageBodyFloat);
OscStatusTxtBody = QString::number(OscMessageBodyFloat);
break;
}

QString CKOscPortOut = m_pConfig->getValue(ConfigKey("[OSC]", "OscPortOut"));
int CKOscPortOutInt = CKOscPortOut.toInt();
if (m_pConfig->getValue<bool>(ConfigKey("[OSC]", "OscReceiver1Active"))) {
// QString CKOscRec1Active =
// m_pConfig->getValue(ConfigKey("[OSC]",
// "OscReceiver1Active"));
const QString& CKOscRec1Ip = m_pConfig->getValue(ConfigKey("[OSC]", "OscReceiver1Ip"));
QByteArray CKOscRec1Ipba = CKOscRec1Ip.toLocal8Bit();
const char* CKOscRec1IpChar = CKOscRec1Ipba.data();
Expand All @@ -90,14 +87,9 @@ void OscFunctionsSendPtrType(UserSettingsPointer m_pConfig,
transmitSocket.Send(p.Data(), p.Size());
qDebug() << "OSC Msg Send to Receiver 1 ("
<< CKOscRec1IpChar << ":" << CKOscPortOutInt
<< QString(") : <%1 : %2")
.arg(OscMessageHeader)
.arg(MixxxOSCStatusTxtBody);
<< QString(") : <%1 : %2").arg(OscMessageHeader, OscStatusTxtBody);
}
if (m_pConfig->getValue<bool>(ConfigKey("[OSC]", "OscReceiver2Active"))) {
// QString CKOscRec2Active =
// m_pConfig->getValue(ConfigKey("[OSC]",
// "OscReceiver2Active"));
const QString& CKOscRec2Ip = m_pConfig->getValue(ConfigKey("[OSC]", "OscReceiver2Ip"));
QByteArray CKOscRec2Ipba = CKOscRec2Ip.toLocal8Bit();
const char* CKOscRec2IpChar = CKOscRec2Ipba.data();
Expand All @@ -106,14 +98,9 @@ void OscFunctionsSendPtrType(UserSettingsPointer m_pConfig,
transmitSocket.Send(p.Data(), p.Size());
qDebug() << "OSC Msg Send to Receiver 2 ("
<< CKOscRec2IpChar << ":" << CKOscPortOutInt
<< QString(") : <%1 : %2")
.arg(OscMessageHeader)
.arg(MixxxOSCStatusTxtBody);
<< QString(") : <%1 : %2").arg(OscMessageHeader, OscStatusTxtBody);
}
if (m_pConfig->getValue<bool>(ConfigKey("[OSC]", "OscReceiver3Active"))) {
// QString CKOscRec3Active =
// m_pConfig->getValue(ConfigKey("[OSC]",
// "OscReceiver3Active"));
const QString& CKOscRec3Ip = m_pConfig->getValue(ConfigKey("[OSC]", "OscReceiver3Ip"));
QByteArray CKOscRec3Ipba = CKOscRec3Ip.toLocal8Bit();
const char* CKOscRec3IpChar = CKOscRec3Ipba.data();
Expand All @@ -122,29 +109,19 @@ void OscFunctionsSendPtrType(UserSettingsPointer m_pConfig,
transmitSocket.Send(p.Data(), p.Size());
qDebug() << "OSC Msg Send to Receiver 3 ("
<< CKOscRec3IpChar << ":" << CKOscPortOutInt
<< QString(") : <%1 : %2")
.arg(OscMessageHeader)
.arg(MixxxOSCStatusTxtBody);
<< QString(") : <%1 : %2").arg(OscMessageHeader, OscStatusTxtBody);
}
if (m_pConfig->getValue<bool>(ConfigKey("[OSC]", "OscReceiver4Active"))) {
// QString CKOscRec4Active =
// m_pConfig->getValue(ConfigKey("[OSC]",
// "OscReceiver4Active"));
const QString& CKOscRec4Ip = m_pConfig->getValue(ConfigKey("[OSC]", "OscReceiver4Ip"));
QByteArray CKOscRec4Ipba = CKOscRec4Ip.toLocal8Bit();
const char* CKOscRec4IpChar = CKOscRec4Ipba.data();

UdpTransmitSocket transmitSocket(IpEndpointName(CKOscRec4IpChar, CKOscPortOutInt));
qDebug() << "OSC Msg Send to Receiver 4 ("
<< CKOscRec4IpChar << ":" << CKOscPortOutInt
<< QString(") : <%1 : %2")
.arg(OscMessageHeader)
.arg(MixxxOSCStatusTxtBody);
<< QString(") : <%1 : %2").arg(OscMessageHeader, OscStatusTxtBody);
}
if (m_pConfig->getValue<bool>(ConfigKey("[OSC]", "OscReceiver5Active"))) {
// QString CKOscRec5Active =
// m_pConfig->getValue(ConfigKey("[OSC]",
// "OscReceiver5Active"));
const QString& CKOscRec5Ip = m_pConfig->getValue(ConfigKey("[OSC]", "OscReceiver5Ip"));
QByteArray CKOscRec5Ipba = CKOscRec5Ip.toLocal8Bit();
const char* CKOscRec5IpChar = CKOscRec5Ipba.data();
Expand All @@ -153,9 +130,7 @@ void OscFunctionsSendPtrType(UserSettingsPointer m_pConfig,
transmitSocket.Send(p.Data(), p.Size());
qDebug() << "OSC Msg Send to Receiver 5 ("
<< CKOscRec5IpChar << ":" << CKOscPortOutInt
<< QString(") : <%1 : %2")
.arg(OscMessageHeader)
.arg(MixxxOSCStatusTxtBody);
<< QString(") : <%1 : %2").arg(OscMessageHeader, OscStatusTxtBody);
}
} else {
qDebug() << "OSC NOT Enabled";
Expand Down
25 changes: 0 additions & 25 deletions src/osc/oscreceiver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
#include <cstring>
#include <iostream>

// #pragma comment(lib, "winmm.lib")

#include "control/controlobject.h"
#include "control/controlproxy.h"
#include "control/pollingcontrolproxy.h"
Expand Down Expand Up @@ -60,7 +58,6 @@ class OscReceivePacketListener : public osc::OscPacketListener {
}

osc::ReceivedMessageArgumentStream args = m.ArgumentStream();
// osc::ReceivedMessage::const_iterator arg = m.ArgumentsBegin();

float oscInVal;
args >> oscInVal >> osc::EndMessage;
Expand Down Expand Up @@ -104,8 +101,6 @@ class OscReceivePacketListener : public osc::OscPacketListener {
std::unique_ptr<PollingControlProxy> m_poscPCP;
m_poscPCP = std::make_unique<PollingControlProxy>(
oscIn.oscGroup, oscIn.oscKey);
// float m_posPCPValue = m_poscPCP->get();
// double m_posPCPValue = m_poscPCP->get();
OscFunctionsSendPtrType(m_pConfig,
oscIn.oscGroup,
oscIn.oscKey,
Expand All @@ -116,7 +111,6 @@ class OscReceivePacketListener : public osc::OscPacketListener {
(float)m_poscPCP->get());
qDebug() << "OSC Msg Snd: Group, Key: Value: "
<< oscIn.oscGroup << "," << oscIn.oscKey << ":"
// << m_posPCPValue;
<< m_poscPCP->get();
}
}
Expand Down Expand Up @@ -157,7 +151,6 @@ class OscReceivePacketListener : public osc::OscPacketListener {
m_poscPCP = std::make_unique<PollingControlProxy>(
oscIn.oscGroup, oscIn.oscKey);
m_poscPCP->set(oscIn.oscValue);
// float m_posPCPValue = m_poscPCP->get();
OscFunctionsSendPtrType(m_pConfig,
oscIn.oscGroup,
oscIn.oscKey,
Expand Down Expand Up @@ -195,16 +188,11 @@ void RunOscReceiver(int OscPortIn, UserSettingsPointer m_pConfig) {

void OscReceiverMain(UserSettingsPointer m_pConfig) {
if (m_pConfig->getValue<bool>(ConfigKey("[OSC]", "OscEnabled"))) {
// QString CKOscPortOut = m_pConfig->getValue(ConfigKey("[OSC]", "OscPortOut"));
QString CKOscPortIn = m_pConfig->getValue(ConfigKey("[OSC]", "OscPortIn"));
// int CKOscPortOutInt = CKOscPortOut.toInt();
int CKOscPortInInt = CKOscPortIn.toInt();
qDebug() << "OSC Enabled -> Started";

if (m_pConfig->getValue<bool>(ConfigKey("[OSC]", "OscReceiver1Active"))) {
// QString CKOscRec1Active =
// m_pConfig->getValue(ConfigKey("[OSC]",
// "OscReceiver1Active"));
const QString& CKOscRec1Ip = m_pConfig->getValue(ConfigKey("[OSC]", "OscReceiver1Ip"));
QByteArray CKOscRec1Ipba = CKOscRec1Ip.toLocal8Bit();
const char* CKOscRec1IpChar = CKOscRec1Ipba.data();
Expand All @@ -214,9 +202,6 @@ void OscReceiverMain(UserSettingsPointer m_pConfig) {
qDebug() << "Mixxx OSC Receiver 1 Not Activated";
}
if (m_pConfig->getValue<bool>(ConfigKey("[OSC]", "OscReceiver2Active"))) {
// QString CKOscRec2Active =
// m_pConfig->getValue(ConfigKey("[OSC]",
// "OscReceiver2Active"));
const QString& CKOscRec2Ip = m_pConfig->getValue(ConfigKey("[OSC]", "OscReceiver2Ip"));
QByteArray CKOscRec2Ipba = CKOscRec2Ip.toLocal8Bit();
const char* CKOscRec2IpChar = CKOscRec2Ipba.data();
Expand All @@ -226,9 +211,6 @@ void OscReceiverMain(UserSettingsPointer m_pConfig) {
qDebug() << "Mixxx OSC Receiver 2 Not Activated";
}
if (m_pConfig->getValue<bool>(ConfigKey("[OSC]", "OscReceiver3Active"))) {
// QString CKOscRec3Active =
// m_pConfig->getValue(ConfigKey("[OSC]",
// "OscReceiver3Active"));
const QString& CKOscRec3Ip = m_pConfig->getValue(ConfigKey("[OSC]", "OscReceiver3Ip"));
QByteArray CKOscRec3Ipba = CKOscRec3Ip.toLocal8Bit();
const char* CKOscRec3IpChar = CKOscRec3Ipba.data();
Expand All @@ -238,9 +220,6 @@ void OscReceiverMain(UserSettingsPointer m_pConfig) {
qDebug() << "Mixxx OSC Receiver 3 Not Activated";
}
if (m_pConfig->getValue<bool>(ConfigKey("[OSC]", "OscReceiver4Active"))) {
// QString CKOscRec4Active =
// m_pConfig->getValue(ConfigKey("[OSC]",
// "OscReceiver4Active"));
const QString& CKOscRec4Ip = m_pConfig->getValue(ConfigKey("[OSC]", "OscReceiver4Ip"));
QByteArray CKOscRec4Ipba = CKOscRec4Ip.toLocal8Bit();
const char* CKOscRec4IpChar = CKOscRec4Ipba.data();
Expand All @@ -250,9 +229,6 @@ void OscReceiverMain(UserSettingsPointer m_pConfig) {
qDebug() << "Mixxx OSC Receiver 4 Not Activated";
}
if (m_pConfig->getValue<bool>(ConfigKey("[OSC]", "OscReceiver5Active"))) {
// QString CKOscRec5Active =
// m_pConfig->getValue(ConfigKey("[OSC]",
// "OscReceiver5Active"));
const QString& CKOscRec5Ip = m_pConfig->getValue(ConfigKey("[OSC]", "OscReceiver5Ip"));
QByteArray CKOscRec5Ipba = CKOscRec5Ip.toLocal8Bit();
const char* CKOscRec5IpChar = CKOscRec5Ipba.data();
Expand All @@ -262,7 +238,6 @@ void OscReceiverMain(UserSettingsPointer m_pConfig) {
qDebug() << "Mixxx OSC Receiver 5 Not Activated";
}

// QString OscTrackGroup;
for (int i = 1; i < 5; i++) {
const QString& OscTrackGroup = QString("[Channel%1]").arg(i);
OscFunctionsSendPtrType(m_pConfig,
Expand Down

0 comments on commit 605b32b

Please sign in to comment.