Browse Source

Updated blendish, bridge protocol

tags/v0.6.0
Andrew Belt 7 years ago
parent
commit
1c53d7b35f
7 changed files with 70 additions and 27 deletions
  1. +1
    -1
      dep/oui-blendish
  2. +1
    -3
      include/bridge.hpp
  3. +62
    -0
      include/bridgeprotocol.hpp
  4. +1
    -1
      src/audio.cpp
  5. +1
    -18
      src/bridge.cpp
  6. +1
    -1
      src/plugin.cpp
  7. +3
    -3
      src/window.cpp

+ 1
- 1
dep/oui-blendish

@@ -1 +1 @@
Subproject commit b7066201022a757cbcbd986d8c91d565e4daef90
Subproject commit 383f24f6ed41facf25eda0d32b0f6bc9aee96e53

+ 1
- 3
include/bridge.hpp View File

@@ -1,13 +1,11 @@
#pragma once
#include "bridgeprotocol.hpp"
#include "audio.hpp"


namespace rack {


static const int BRIDGE_NUM_PORTS = 16;


void bridgeInit();
void bridgeDestroy();
void bridgeAudioSubscribe(int channel, AudioIO *audio);


+ 62
- 0
include/bridgeprotocol.hpp View File

@@ -0,0 +1,62 @@
#pragma once


namespace rack {


static const int BRIDGE_NUM_PORTS = 16;
// A random number which prevents connection from other protocols and old Bridge versions
const int BRIDGE_HELLO = 0xff00fefd;


/** All commands are called from the client and served by the server
send
- uint8_t cmd
*/
enum BridgeCommand {
NO_COMMAND = 0,
/** Initial state of the state machine. The client should not send the command number itself, just its arguments.
send
- uint32_t hello
*/
START_COMMAND,
/** Requests the server to shut down the client */
QUIT_COMMAND,
/** Sets the port
send
- uint8_t port
*/
PORT_SET_COMMAND,
/** Sends a 3-byte MIDI command
send
- uint8_t msg[3]
*/
MIDI_MESSAGE_SEND_COMMAND,
/** Sets the audio sample rate
send
- uint32_t sampleRate
*/
AUDIO_SAMPLE_RATE_SET_COMMAND,
/** Sets the number of audio channels
Currently not supported, hard-coded at 2.
send
- uint8_t channels
*/
AUDIO_CHANNELS_SET_COMMAND,
/** Sends and receives an audio buffer
send
- uint32_t length
- float input[n]
recv
- float output[n]
*/
AUDIO_PROCESS_COMMAND,
/** Resumes the audio buffer, forcing Rack to wait on an audio buffer */
AUDIO_ACTIVATE,
/** Pauses the audio buffer, allowing Rack to not wait on an audio buffer */
AUDIO_DEACTIVATE,
NUM_COMMANDS
};


} // namespace rack

+ 1
- 1
src/audio.cpp View File

@@ -206,7 +206,7 @@ void AudioIO::openStream() {
setChannels(clamp((int) deviceInfo.outputChannels - offset, 0, maxChannels), clamp((int) deviceInfo.inputChannels - offset, 0, maxChannels));

if (numOutputs == 0 && numInputs == 0) {
warn("RtAudio device %d has 0 inputs and 0 outputs");
warn("RtAudio device %d has 0 inputs and 0 outputs", device);
return;
}



+ 1
- 18
src/bridge.cpp View File

@@ -21,21 +21,6 @@
namespace rack {


enum BridgeCommand {
NO_COMMAND = 0,
START_COMMAND,
QUIT_COMMAND,
PORT_SET_COMMAND,
MIDI_MESSAGE_SEND_COMMAND,
AUDIO_SAMPLE_RATE_SET_COMMAND,
AUDIO_CHANNELS_SET_COMMAND,
AUDIO_BUFFER_SEND_COMMAND,
AUDIO_ACTIVATE,
AUDIO_DEACTIVATE,
NUM_COMMANDS
};


static const int RECV_BUFFER_SIZE = (1<<13);
static const int RECV_QUEUE_SIZE = (1<<17);

@@ -192,7 +177,7 @@ struct BridgeClientConnection {
}
} break;

case AUDIO_BUFFER_SEND_COMMAND: {
case AUDIO_PROCESS_COMMAND: {
if (audioBufferLength < 0) {
// Get audio buffer size
if (recvQueue.size() >= 4) {
@@ -216,8 +201,6 @@ struct BridgeClientConnection {
float output[audioBufferLength];
processStream(input, output, frames);
// Send output buffer
send<uint8_t>(AUDIO_BUFFER_SEND_COMMAND);
send<uint32_t>(audioBufferLength);
send((uint8_t*) output, audioBufferLength * sizeof(float));

audioBufferLength = -1;


+ 1
- 1
src/plugin.cpp View File

@@ -268,7 +268,7 @@ static bool syncPlugin(json_t *pluginJ, bool dryRun) {
std::string zipPath = pluginPath + ".zip";
bool success = requestDownload(download, zipPath, &downloadProgress);
if (!success) {
warn("Plugin %s download was unsuccessful");
warn("Plugin %s download was unsuccessful", slug.c_str());
return false;
}



+ 3
- 3
src/window.cpp View File

@@ -547,9 +547,9 @@ void windowSetTheme(NVGcolor bg, NVGcolor fg) {
// Assume dark background and light foreground

BNDwidgetTheme w;
w.outlineColor = bg;
w.outlineColor = colorMinus(bg, nvgRGB(0x10, 0x10, 0x10));
w.itemColor = fg;
w.innerColor = bg;
w.innerColor = colorMinus(bg, nvgRGB(0x10, 0x10, 0x10));
w.innerSelectedColor = colorPlus(bg, nvgRGB(0x30, 0x30, 0x30));
w.textColor = fg;
w.textSelectedColor = fg;
@@ -571,7 +571,7 @@ void windowSetTheme(NVGcolor bg, NVGcolor fg) {
t.menuTheme = w;
t.menuItemTheme = w;

t.sliderTheme.itemColor = bg;
t.sliderTheme.itemColor = colorMinus(bg, nvgRGB(0x10, 0x10, 0x10));
t.sliderTheme.innerColor = colorPlus(bg, nvgRGB(0x50, 0x50, 0x50));
t.sliderTheme.innerSelectedColor = colorPlus(bg, nvgRGB(0x60, 0x60, 0x60));



Loading…
Cancel
Save