Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Basic DMX over art-net added. #23

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
165 changes: 165 additions & 0 deletions assets/rb3.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
[General]
# The multiplier to apply to the speed of the note highway.
# 1.0 = 100%, 1.2 = 120%, 1.5 = 150%
TrackSpeedMultiplier = 1.0
# The multiplier to apply to the speed of the song audio.
# 1.0 = 100%, 1.2 = 120%, 1.5 = 150%
SongSpeedMultiplier = 1.0
# The name of the venue to force. (e.g. "none" for black background)
# To disable this and use default venue selection, set this to "false"
ForcedVenue = false
# Whether to enable game origin icons in the setlist menu.
# This requires the correct font files in the rawfiles directory.
GameOriginIcons = true
# Whether to unlock all clothing and other unlockables by default.
UnlockClothing = false
# The folder to check on the Hard Drive and USB drives for raw files.
# The default is "rb3", uncomment this line to change it
#RawfilesDir = rb3

[Events]
# Enables sending events (song start, etc) to a computer or other networked device.
EnableEvents = false
# The IP address to send these events to (set to 255.255.255.255 to broadcast to the entire local network.)
BroadcastTarget = 255.255.255.255
# Sends stage kit data over events. Default false to keep network chatter down.
SendStagekit = false

[GoCentral]
# Enables redirecting Rock Central servers to a custom server.
# This also re-enables Audition Mode if enabled.
# (This setting is ignored if using an Xbox 360 and connected to official services.)
EnableGoCentral = true
# The IP address of the GoCentral server.
#GoCentralAddress = 0.0.0.0

[Xbox360]
# Enables playing online multiplayer without the need for Xbox Live.
# (This setting is ignored if using an Xbox 360 and connected to official services.)
EnableLiveless = true
# The IP to direct connect to. If hosting a game, set this to "127.0.0.1"
DirectConnectIP = 127.0.0.1
# The STUN server to contact to request your public IP address, for liveless multiplayer. (TCP required.)
# Uncomment these lines to enable.
#STUNServer = stun.l.google.com
#STUNServerPort = 19302
# Your external IPv4 address, for liveless multiplayer. Overrode by STUN, if enabled.
ExternalIP = 0.0.0.0

[Art-Net]
# Art-Net protocol : https://art-net.org.uk/
# Enables sending of stage kit lights, strobe & fog as DMX over the Art-Net protocol.
ArtNetEnable = false
# The Art-Net UDP port. Protocol states this should be 6454, so only change if you have a custom receiver.
ArtNetPort = 6454
# The IP address to send art-net data to (set to 255.255.255.255 to broadcast to the entire local network.)
ArtNetTarget = 255.255.255.255
# The universe of this Art-Net.
ArtNetUniverse = 1
# Global brightness. Default is 12.5%, so adjust up as needed or override on a real dmx controller.
ArtNetGlobalBrightnessChannel = 1
ArtNetGlobalBrightnessValue = 32
# Set channel & value for each light.
# To disable an item, use channel=513 which won't be sent out.
ArtNetRed1Channel = 2
ArtNetRed1Value = 255
ArtNetRed2Channel = 3
ArtNetRed2Value = 255
ArtNetRed3Channel = 4
ArtNetRed3Value = 255
ArtNetRed4Channel = 5
ArtNetRed4Value = 255
ArtNetRed5Channel = 6
ArtNetRed5Value = 255
ArtNetRed6Channel = 7
ArtNetRed6Value = 255
ArtNetRed7Channel = 8
ArtNetRed7Value = 255
ArtNetRed8Channel = 9
ArtNetRed8Value = 255
ArtNetGreen1Channel = 10
ArtNetGreen1Value = 255
ArtNetGreen2Channel = 11
ArtNetGreen2Value = 255
ArtNetGreen3Channel = 12
ArtNetGreen3Value = 255
ArtNetGreen4Channel = 13
ArtNetGreen4Value = 255
ArtNetGreen5Channel = 14
ArtNetGreen5Value = 255
ArtNetGreen6Channel = 15
ArtNetGreen6Value = 255
ArtNetGreen7Channel = 16
ArtNetGreen7Value = 255
ArtNetGreen8Channel = 17
ArtNetGreen8Value = 255
ArtNetBlue1Channel = 18
ArtNetBlue1Value = 255
ArtNetBlue2Channel = 19
ArtNetBlue2Value = 255
ArtNetBlue3Channel = 20
ArtNetBlue3Value = 255
ArtNetBlue4Channel = 21
ArtNetBlue4Value = 255
ArtNetBlue5Channel = 22
ArtNetBlue5Value = 255
ArtNetBlue6Channel = 23
ArtNetBlue6Value = 255
ArtNetBlue7Channel = 24
ArtNetBlue7Value = 255
ArtNetBlue8Channel = 25
ArtNetBlue8Value = 255
ArtNetYellow1Channel = 26
ArtNetYellow1Value = 255
ArtNetYellow2Channel = 27
ArtNetYellow2Value = 255
ArtNetYellow3Channel = 28
ArtNetYellow3Value = 255
ArtNetYellow4Channel = 29
ArtNetYellow4Value = 255
ArtNetYellow5Channel = 30
ArtNetYellow5Value = 255
ArtNetYellow6Channel = 31
ArtNetYellow6Value = 255
ArtNetYellow7Channel = 32
ArtNetYellow7Value = 255
ArtNetYellow8Channel = 33
ArtNetYellow8Value = 255

# Additive values.
# If multiple values on the same channel for the same colour, then the highest colour numbers value will be used.
# Example, Red1Channel = 2 Red1Value = 10 Red1Channel = 2 Red2Value = 20, then if Red1 & Red2 are 'on' the Red2 value of 20 is used.
# Now if ArtNetAdditiveRed = true, then with the above example the channel value will be 10+20=30
ArtNetAdditiveRed = false
ArtNetAdditiveGreen = false
ArtNetAdditiveBlue = false
ArtNetAdditiveYellow = false

# Fog unit value. This may be different depending on the type of fogger unit you have.
ArtNetFogChannel = 34
ArtNetFogValue = 255

# Strobe values - Set these to your strobe unit.
# WARNING: Check with your own hardware before you break it!
# 3 channels are available since some strobes can use Rate, Intensity & Duration.
# 1 = slowest
# 4 = fastest
ArtNetStrobeRateChannel = 35
ArtNetStrobeIntensityChannel = 36
ArtNetStrobeDurationChannel = 37

# RB has 4 rates. 1 = Slowest & 4 = Fastest
ArtNetStrobeRate1 = 237
ArtNetStrobeRate2 = 245
ArtNetStrobeRate3 = 247
ArtNetStrobeRate4 = 250
ArtNetStrobeIntensity1 = 126
ArtNetStrobeIntensity2 = 126
ArtNetStrobeIntensity3 = 126
ArtNetStrobeIntensity4 = 126
ArtNetStrobeDuration1 = 1
ArtNetStrobeDuration2 = 1
ArtNetStrobeDuration3 = 1
ArtNetStrobeDuration4 = 1

# End of rb3.ini
19 changes: 19 additions & 0 deletions include/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,25 @@ typedef struct _RB3E_Config
char ExternalIP[RB3E_MAX_IP_LEN];
char STUNServer[RB3E_MAX_DOMAIN];
int STUNServerPort;
// [Art-Net]
char ArtNetEnable;
int ArtNetPort;
char ArtNetDisableSendingStageKitEvents;
char ArtNetTarget[RB3E_MAX_DOMAIN];
unsigned char ArtNetUniverse;
unsigned short ArtNetGlobalBrightnessChannel;
unsigned char ArtNetGlobalBrightnessValue;
unsigned short ArtNetColourTranslationChannel[4][8]; // Colour (BGYR) | LED number | Channel
unsigned char ArtNetColourTranslationValue[4][8]; // Colour (BGYR) | LED number | Value
unsigned char ArtNetColourAdditive[4];
unsigned short ArtNetFogChannel;
unsigned char ArtNetFogValue;
unsigned short ArtNetStrobeRateChannel;
unsigned short ArtNetStrobeIntensityChannel;
unsigned short ArtNetStrobeDurationChannel;
unsigned char ArtNetStrobeRate[4];
unsigned char ArtNetStrobeIntensity[4];
unsigned char ArtNetStrobeDuration[4];
#elif RB3E_WII
// [Wii]
char NASServer[RB3E_MAX_DOMAIN];
Expand Down
59 changes: 59 additions & 0 deletions include/net_art-net.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/*
RB3Enhanced - net_art-net.h
Art-Net protocol : https://art-net.org.uk/

Art-Net™ is a trademark of Artistic Licence Engineering Ltd.
*/


#ifndef PACKSTART
#ifdef RB3E_XBOX
// MSVC notation
#define PACKSTART __pragma(pack(push, 1))
#define PACKEND __pragma(pack(pop))
#define PACKED
#else
// GCC notation
#define PACKSTART
#define PACKEND
#define PACKED __attribute__((packed))
#endif
#endif

PACKSTART
// art-net packet structure for DMX512
typedef struct _RB3E_ArtNetPacket
{
char ID[8]; // "Art-Net"
char OpCode[2]; // 0x5000 : This is an ArtDmx data packet. It contains DMX512 information for a single Universe.
char ProtocolHi; // 0
char ProtocolLo; // 14 (Version 2)
unsigned char Sequence; // monotonic counter
char Physical; // 0x00
char UniverseLo; // low universe
char UniverseHi; // high universe
short Length; // data length (Must be even number for channel,data pairs)
unsigned char Data[513]; // DMX512 data
} RB3E_ArtNetPacket;

// Consumers of ArtPoll shall accept as valid a packet of length 14 bytes or larger (Page 17)
typedef struct _RB3E_ArtNetPollPacket
{
char ID[8]; // "Art-Net"
char OpCode[2]; // 0x2000 This is an ArtPoll packet, no other data is contained in this UDP packet.
char ProtocolHi; // 0
char ProtocolLo; // 14 (Version 2)
char Flags; // 0x00 - Disable receiving diagnostics, etc & only send ArtPollReply in response to an ArtPoll.
char DiagPriority; // 0x10 Low priority message.
} RB3E_ArtNetPollPacket;

PACKEND

// Start up the socket & build default packet
void RB3E_InitArtNet();

// Decode weight data to art-net & broadcast
void RB3E_ArtNetSend(int state1, int state2);

// Send keep alive
void RB3E_ArtNetPoll();
1 change: 1 addition & 0 deletions include/rb3e_include.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "MiloSceneHooks.h"
#include "MusicLibrary.h"
#include "net_events.h"
#include "net_art-net.h"
#include "net_natpmp.h"
#include "net_liveless_online.h"
#include "net.h"
Expand Down
120 changes: 120 additions & 0 deletions source/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ static int INIHandler(void *user, const char *section, const char *name, const c
config.EnableEvents = RB3E_CONFIG_BOOL(value);
if (strcmp(name, "BroadcastTarget") == 0)
strncpy(config.BroadcastTarget, value, RB3E_MAX_DOMAIN);
if (strcmp(name, "SendStagekit") == 0)
config.SendStagekit = RB3E_CONFIG_BOOL(value);
}
if (strcmp(section, "GoCentral") == 0)
{
Expand All @@ -96,6 +98,124 @@ static int INIHandler(void *user, const char *section, const char *name, const c
if (strcmp(name, "EnableUPnP") == 0)
config.EnableUPnP = RB3E_CONFIG_BOOL(value);
}
#ifdef RB3E_XBOX
if (strcmp(section, "Art-Net") == 0)
{
char tokenbuffer[25];
int loopi = 1;
if (strcmp(name, "ArtNetEnable") == 0)
config.ArtNetEnable = RB3E_CONFIG_BOOL(value);
if (strcmp(name, "ArtNetPort") == 0)
config.ArtNetPort = atoi(value);
if (strcmp(name, "ArtNetTarget") == 0)
strncpy(config.ArtNetTarget, value, RB3E_MAX_DOMAIN);
if (strcmp(name, "ArtNetUniverse") == 0)
config.ArtNetUniverse = (char)atoi(value);
if (strcmp(name, "ArtNetGlobalBrightnessChannel") == 0)
config.ArtNetGlobalBrightnessChannel = (unsigned short) (atoi(value) - 1);
if (strcmp(name, "ArtNetGlobalBrightnessValue") == 0)
config.ArtNetGlobalBrightnessValue = (char)atoi(value);

// LED translation data
for (; loopi <=8; loopi++)
{
sprintf(tokenbuffer, "ArtNetBlue%dChannel", loopi);
if (strcmp(name, tokenbuffer) == 0)
{
config.ArtNetColourTranslationChannel[0][loopi-1] = (unsigned short) (atoi(value) - 1);
break;
}
sprintf(tokenbuffer, "ArtNetBlue%dValue", loopi);
if (strcmp(name, tokenbuffer) == 0)
{
config.ArtNetColourTranslationValue[0][loopi-1] = (unsigned char)atoi(value);
break;
}
sprintf(tokenbuffer, "ArtNetGreen%dChannel", loopi);
if (strcmp(name, tokenbuffer) == 0)
{
config.ArtNetColourTranslationChannel[1][loopi-1] = (unsigned short) (atoi(value) - 1);
break;
}
sprintf(tokenbuffer, "ArtNetGreen%dValue", loopi);
if (strcmp(name, tokenbuffer) == 0)
{
config.ArtNetColourTranslationValue[1][loopi-1] = (unsigned char)atoi(value);
break;
}
sprintf(tokenbuffer, "ArtNetYellow%dChannel", loopi);
if (strcmp(name, tokenbuffer) == 0)
{
config.ArtNetColourTranslationChannel[2][loopi-1] = (unsigned short) (atoi(value) - 1);
break;
}
sprintf(tokenbuffer, "ArtNetYellow%dValue", loopi);
if (strcmp(name, tokenbuffer) == 0)
{
config.ArtNetColourTranslationValue[2][loopi-1] = (unsigned char)atoi(value);
break;
}
sprintf(tokenbuffer, "ArtNetRed%dChannel", loopi);
if (strcmp(name, tokenbuffer) == 0)
{
config.ArtNetColourTranslationChannel[3][loopi-1] = (unsigned short) (atoi(value) - 1);
break;
}
sprintf(tokenbuffer, "ArtNetRed%dValue", loopi);
if (strcmp(name, tokenbuffer) == 0)
{
config.ArtNetColourTranslationValue[3][loopi-1] = (unsigned char)atoi(value);
break;
}
}

// Additive Colour (BGYR)
if (strcmp(name, "ArtNetAdditiveBlue") == 0)
config.ArtNetColourAdditive[0] = RB3E_CONFIG_BOOL(value);
if (strcmp(name, "ArtNetAdditiveGreen") == 0)
config.ArtNetColourAdditive[1] = RB3E_CONFIG_BOOL(value);
if (strcmp(name, "ArtNetAdditiveYellow") == 0)
config.ArtNetColourAdditive[2] = RB3E_CONFIG_BOOL(value);
if (strcmp(name, "ArtNetAdditiveRed") == 0)
config.ArtNetColourAdditive[3] = RB3E_CONFIG_BOOL(value);

// Fog
if (strcmp(name, "ArtNetFogChannel") == 0)
config.ArtNetFogChannel = (unsigned short) (atoi(value) - 1);
if (strcmp(name, "ArtNetFogValue") == 0)
config.ArtNetFogValue = (char)atoi(value);

// Strobe
if (strcmp(name, "ArtNetStrobeRateChannel") == 0)
config.ArtNetStrobeRateChannel = (unsigned short) (atoi(value) - 1);
if (strcmp(name, "ArtNetStrobeIntensityChannel") == 0)
config.ArtNetStrobeIntensityChannel = (unsigned short) (atoi(value) - 1);
if (strcmp(name, "ArtNetStrobeDurationChannel") == 0)
config.ArtNetStrobeDurationChannel = (unsigned short) (atoi(value) - 1);

for (loopi = 1; loopi <=4; loopi++)
{
sprintf(tokenbuffer, "ArtNetStrobeRate%d", loopi);
if (strcmp(name, tokenbuffer) == 0)
{
config.ArtNetStrobeRate[loopi-1] = (unsigned char)atoi(value);
break;
}
sprintf(tokenbuffer, "ArtNetStrobeIntensity%d", loopi);
if (strcmp(name, tokenbuffer) == 0)
{
config.ArtNetStrobeIntensity[loopi-1] = (unsigned char)atoi(value);
break;
}
sprintf(tokenbuffer, "ArtNetStrobeDuration%d", loopi);
if (strcmp(name, tokenbuffer) == 0)
{
config.ArtNetStrobeDuration[loopi-1] = (unsigned char)atoi(value);
break;
}
}
}
#endif
#ifdef RB3E_WII
if (strcmp(section, "Wii") == 0)
{
Expand Down
Loading