Skip to content

Commit

Permalink
merge rocket and version 1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
helgrima committed Dec 12, 2018
2 parents cbb8584 + 25dc67c commit 68e301f
Show file tree
Hide file tree
Showing 16 changed files with 1,226 additions and 42 deletions.
7 changes: 7 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,14 @@
"type": "shell",
"command": "g++.exe",
"args": [
"libs/device.c",
"libs/track.c",
"libs/jsoncpp.cpp",
"src/Cosmonaut.cpp",
"src/Configuration.cpp",
"src/Music.cpp",
"main.cpp",
"-D_WIN32_WINNT=0x501", //For getting rocket socket communication work on windows
"-w",
"-g",
"-ggdb",
Expand All @@ -59,13 +63,16 @@
"-lfreeglut",
"-lopengl32",
"-lbass",
"-lws2_32",
"-ID:\\development\\glew-2.1.0\\include",
"-ID:\\development\\freeglut\\include",
"-I${workspaceFolder}\\libs",
"-I${workspaceFolder}\\libs\\json",
"-I${workspaceFolder}\\include",
"-ID:\\development\\bass24\\c",
"-static-libgcc",
"-static-libstdc++",
"-fpermissive",
"-o",
"bin\\debug\\shader-system.exe"
],
Expand Down
18 changes: 16 additions & 2 deletions configuration.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,25 @@
},
"music": {
"file": "assets\\music\\demo-release.mp3",
"BPM": 120,
"BPM": 120.0,
"frequency": 44000
},
"sync": {
"RPB": 8,
"file": "assets\\music\\demo-release.rocket",
"host": "localhost"
},
"shaders": {
"vertex": "shaders\\vertex.glsl",
"fragment": "shaders\\fragment.glsl"
}
},
"tracks": [
{
"type": "float3",
"name": {
"track": "scene1.color",
"variable": "baseColor"
}
}
]
}
25 changes: 24 additions & 1 deletion include/Configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
#include <string>
#include <json.h>
#include <fstream>
#include <list>
#include "sync.h"

namespace DemoSystem {
struct Demo {
Expand All @@ -18,15 +20,34 @@ namespace DemoSystem {

struct Tune {
std::string file;
int BPM;
double BPM;
int RPB;
int frequency;
};

struct Sync {
std::string file;
int RPB;
std::string host;
};

struct Shaders {
std::string vertex;
std::string fragment;
};

struct Track {
enum TrackType {
FLOAT1,
FLOAT2,
FLOAT3
};

TrackType type;
std::string trackName;
std::string variableName;
};

class Configuration {
public:
Configuration();
Expand All @@ -35,7 +56,9 @@ namespace DemoSystem {
Demo demo;
Screen screen;
Tune tune;
Sync sync;
Shaders shaders;
std::list<DemoSystem::Track> tracks;
};

}
Expand Down
61 changes: 61 additions & 0 deletions include/Cosmonaut.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#ifndef COSMONAUT_H
#define COSMONAUT_H
#include <sync.h>
#include <string>
#include <math.h>
#include <list>
#include <GL/gl.h>
#include "Configuration.h"
#define SYNC_PLAYER

namespace DemoSystem {
class Cosmonaut {
public:
Cosmonaut();
~Cosmonaut();
void initialize(double bpm, int rpb);
bool connectPlayer(std::string host);
void setFunctions(sync_cb* functions);
void update(double row);
void setTracks(std::list<DemoSystem::Track> tracks);

double getRowRate();
void cleanUp();

struct SyncTrack {
const sync_track* x;
const sync_track* y;
const sync_track* z;
};

struct Vector3 {
double x;
double y;
double z;
};

struct Gateway {
SyncTrack syncTrack;
Vector3 value;
DemoSystem::Track::TrackType type;
std::string name;
GLint uniform;
};

std::list<Gateway> gateways;
private:
bool player;
std::string host;
double BPM;
int RPB;
double rowRate;

sync_device* device;
sync_cb* functions;


};
}


#endif
4 changes: 3 additions & 1 deletion include/Music.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <string>
#include <fstream>
#include <bass.h>
#include "Cosmonaut.h"

namespace DemoSystem {
class Music {
Expand All @@ -14,7 +15,8 @@ namespace DemoSystem {
void pause();
bool isPlaying();
double position();
void seek(double position);
void seek(double row);
void cleanUp();

private:
HSTREAM stream;
Expand Down
35 changes: 35 additions & 0 deletions libs/base.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#ifndef SYNC_BASE_H
#define SYNC_BASE_H

#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS 1
#define _CRT_NONSTDC_NO_DEPRECATE 1
#endif

#include <stddef.h>

/* configure inline keyword */
#if (!defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L)) && !defined(__cplusplus)
#if defined(_MSC_VER) || defined(__GNUC__) || defined(__SASC)
#define inline __inline
#else
/* compiler does not support inline */
#define inline
#endif
#endif

/* configure lacking CRT features */
#ifdef _MSC_VER
#if _MSC_VER < 1900
#define snprintf _snprintf
#endif
/* int is 32-bit for both x86 and x64 */
typedef unsigned int uint32_t;
#define UINT32_MAX UINT_MAX
#elif defined(__GNUC__)
#include <stdint.h>
#elif defined(M68000)
typedef unsigned int uint32_t;
#endif

#endif /* SYNC_BASE_H */
Loading

0 comments on commit 68e301f

Please sign in to comment.