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

Stop putting the session info (all channels of all participants) into… #39

Open
wants to merge 31 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
52125a3
Stop putting the session info (all channels of all participants) into…
christofmuc Oct 18, 2024
455379e
Fix? CMake including the generated header files the correct way
christofmuc Oct 19, 2024
a13d789
A little lint
christofmuc Oct 19, 2024
e0c2062
Prepare for a generic control message that will be used to send param…
christofmuc Oct 19, 2024
dc0ae8f
A bit more lint
christofmuc Oct 19, 2024
a38e4d1
Lot's of Lint, and get the Server compile on MacOS without warnings.
christofmuc Oct 19, 2024
526da4b
Now get the Common package MacOS warning free
christofmuc Oct 19, 2024
e02d5c7
Warnings as errors for Mac, get the Mac build warning free
christofmuc Oct 19, 2024
8577677
Get pedantic in Common
christofmuc Oct 19, 2024
5e373a8
Pedantic for the server
christofmuc Oct 19, 2024
cb211c9
And pedantic for the Client. That did not make a difference for clang.
christofmuc Oct 19, 2024
001d44c
Shield clang pragmas from the other compilers
christofmuc Oct 19, 2024
fce0391
One more ignore for the Github Mac build machine
christofmuc Oct 19, 2024
41b4404
Fix
christofmuc Oct 19, 2024
450d8a8
Allow remote control of Server settings from client. First item is th…
christofmuc Oct 19, 2024
65ae094
One more suppression for the gitlab Mac build
christofmuc Oct 19, 2024
75651e1
Fix Windows build
christofmuc Oct 20, 2024
01e6e25
One more for Mac
christofmuc Oct 20, 2024
7dfbe00
Seems we switch to GNUC pragmas so Linux works and clang keeps working?
christofmuc Oct 20, 2024
d447a5e
Switch over all pragmas to GNUC instead of clang. Linux should build …
christofmuc Oct 20, 2024
d1874e2
One more for Linux
christofmuc Oct 20, 2024
20b9088
Test gcc warning
christofmuc Oct 20, 2024
a5c24ab
And more GCC fixes...
christofmuc Oct 20, 2024
666e383
And another GCC find
christofmuc Oct 21, 2024
a56164a
More GNUC supressions
christofmuc Oct 21, 2024
3792254
Ok ok, just suppress it for the whole file.
christofmuc Oct 21, 2024
8671549
Crazy to split out the pragmas per compiler here
christofmuc Oct 21, 2024
35886ef
Fix a real init error in the recording info class
christofmuc Oct 21, 2024
dc6e955
Fix CMakeLists
christofmuc Oct 22, 2024
971a5ec
More Linux suppressions
christofmuc Oct 22, 2024
a1306dd
Added a switch -DBUILD_JAMMERNETZ_CLIENT=OFF to reduce the number of …
christofmuc Oct 28, 2024
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,5 @@ venv/
.vs/
builds2024/
.conan_venv/
builds24/
buildServer/
41 changes: 31 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ set(CMAKE_OSX_DEPLOYMENT_TARGET "10.11" CACHE STRING "Minimum OS X version to ta

project(JammerNetz)

OPTION(BUILD_JAMMERNETZ_CLIENT "Option to turn off the client build" ON)

# Since we also build MacOS, we need C++ 17. Which is not a bad thing.
# JUCE 8 seems to force us to C++ 20 now!
set(CMAKE_CXX_STANDARD 20)
Expand Down Expand Up @@ -75,9 +77,11 @@ elseif(UNIX)
find_package(OpenGL)

# These calls create special `PkgConfig::<MODULE>` variables
pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0)
pkg_check_modules(GLEW REQUIRED IMPORTED_TARGET glew)
pkg_check_modules(WEBKIT REQUIRED IMPORTED_TARGET webkit2gtk-4.1)
if(BUILD_JAMMERNETZ_CLIENT)
pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0)
pkg_check_modules(GLEW REQUIRED IMPORTED_TARGET glew)
pkg_check_modules(WEBKIT REQUIRED IMPORTED_TARGET webkit2gtk-4.1)
endif()
endif()


Expand Down Expand Up @@ -111,12 +115,17 @@ mark_as_advanced(

# Define the list of link libraries required on Linux linking with JUCE, this must be used by any executable / module to run standalone
if(UNIX AND NOT APPLE)
set(LINUX_JUCE_LINK_LIBRARIES
if(BUILD_JAMMERNETZ_CLIENT)
set(LINUX_UI_LIBRARIES
PkgConfig::WEBKIT
PkgConfig::GTK
PkgConfig::GLEW
)
endif()
set(LINUX_JUCE_LINK_LIBRARIES
Xext
X11
${LINUX_UI_LIBRARIES}
pthread
${CMAKE_DL_LIBS}
freetype
Expand All @@ -133,13 +142,22 @@ add_subdirectory("third_party/JUCE" EXCLUDE_FROM_ALL)

# Build a static library from juce
add_library(juce-static STATIC)
if(BUILD_JAMMERNETZ_CLIENT)
set(ADDITIONAL_JUCE_MODULES
juce::juce_graphics
juce::juce_gui_basics
juce::juce_gui_extra
juce::juce_opengl
juce::juce_video
)
endif()
target_link_libraries(juce-static
PRIVATE
juce::juce_audio_basics juce::juce_audio_devices juce::juce_audio_formats
juce::juce_audio_processors juce::juce_audio_utils juce::juce_core
juce::juce_cryptography juce::juce_data_structures juce::juce_dsp
juce::juce_events juce::juce_graphics juce::juce_gui_basics
juce::juce_gui_extra juce::juce_opengl juce::juce_video
juce::juce_events
${ADDITIONAL_JUCE_MODULES}
${LINUX_JUCE_LINK_LIBRARIES}
PUBLIC
juce::juce_recommended_config_flags
Expand Down Expand Up @@ -170,10 +188,8 @@ target_compile_definitions(juce-static
target_include_directories(juce-static
INTERFACE
$<TARGET_PROPERTY:juce-static,INCLUDE_DIRECTORIES>
if (WIN32)
PRIVATE
"${ASIO_SDK_DIRECTORY}"
endif()
)

set_target_properties(juce-static PROPERTIES
Expand All @@ -194,21 +210,26 @@ if(WIN32)
endif()

# Add subdirectories
add_subdirectory("third_party/JUCE-user-modules")
add_subdirectory("third_party/json")
add_subdirectory("third_party/fmt")
add_subdirectory("third_party/spdlog")
add_subdirectory("modules/juce-utils")
add_subdirectory("modules/juce-widgets")
if(BUILD_JAMMERNETZ_CLIENT)
add_subdirectory("third_party/JUCE-user-modules")
add_subdirectory("modules/juce-widgets")
endif()
add_subdirectory("modules/MidiKraft")
message(${CMAKE_MODULE_PATH})
add_subdirectory("third_party/oneTBB" EXCLUDE_FROM_ALL)
add_subdirectory("common")
add_subdirectory("Server")

if(BUILD_JAMMERNETZ_CLIENT)
add_subdirectory("Client")

# The client installer now contains the server as well for local testing - make sure to always build the server
add_dependencies(JammerNetzClient JammerNetzServer)
endif()

# For Windows, we additionally build a little test program to check if ASIO initialization works.
if(WIN32)
Expand Down
3 changes: 2 additions & 1 deletion Client/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ set(UICOMPONENT_FILES
Source/ClientConfig.h
Source/DeviceSelector.cpp
Source/DeviceSelector.h
Source/IncludeFFMeters.h
Source/MidiDeviceSelector.cpp
Source/MidiDeviceSelector.h
Source/RecordingInfo.cpp
Expand Down Expand Up @@ -158,7 +159,7 @@ if (MSVC)
target_compile_options(JammerNetzClient PRIVATE /W4 /WX)
else()
# lots of warnings and all warnings as errors
#target_compile_options(JammerNetzClient PRIVATE -Wall -Wextra -pedantic -Werror)
target_compile_options(JammerNetzClient PRIVATE -Wall -Wextra -Werror -Wno-unknown-pragmas)
endif()

IF(WIN32)
Expand Down
47 changes: 27 additions & 20 deletions Client/Source/AudioCallback.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,15 @@

#include "Logger.h"

AudioCallback::AudioCallback() : jammerService_([this](std::shared_ptr < JammerNetzAudioData> buffer) { playBuffer_.push(buffer); }), playBuffer_("server"), masterVolume_(1.0), monitorBalance_(0.0),
channelSetup_(false), clientBpm_(0.0f), midiSignalToGenerate_(MidiSignal_None), midiSignalToSend_(MidiSignal_None)
AudioCallback::AudioCallback() :
jammerService_([this](std::shared_ptr < JammerNetzAudioData> buffer) { playBuffer_.push(buffer); })
, playBuffer_("server")
, masterVolume_(1.0)
, monitorBalance_(0.0)
, clientBpm_(0.0f)
, channelSetup_(false)
, midiSignalToSend_(MidiSignal_None)
, midiSignalToGenerate_(MidiSignal_None)
{
isPlaying_ = false;
minPlayoutBufferLength_ = CLIENT_PLAYOUT_JITTER_BUFFER;
Expand All @@ -26,7 +33,7 @@ AudioCallback::AudioCallback() : jammerService_([this](std::shared_ptr < JammerN
// Where to record to?
uploadRecorder_ = std::make_shared<Recorder>(Settings::instance().getSessionStorageDir(), "LocalRecording", RecordingType::WAV);
masterRecorder_ = std::make_shared<Recorder>(Settings::instance().getSessionStorageDir(), "MasterRecording", RecordingType::FLAC);
masterRecorder_->setChannelInfo(SAMPLE_RATE, JammerNetzChannelSetup(false, { JammerNetzChannelTarget::Left, JammerNetzChannelTarget::Right }));
masterRecorder_->setChannelInfo(SAMPLE_RATE, JammerNetzChannelSetup(false, { JammerNetzSingleChannelSetup(JammerNetzChannelTarget::Left), JammerNetzSingleChannelSetup(JammerNetzChannelTarget::Right) }));
//midiRecorder_ = std::make_unique<MidiRecorder>(deviceManager);

// We might want to share a score sheet or similar
Expand All @@ -37,10 +44,10 @@ AudioCallback::AudioCallback() : jammerService_([this](std::shared_ptr < JammerN

// Setup listeners
listeners_.push_back(std::make_unique<ValueListener>(Data::instance().get().getPropertyAsValue(VALUE_MIN_PLAYOUT_BUFFER, nullptr), [this](Value& newValue) {
minPlayoutBufferLength_ = (int) newValue.getValue();
minPlayoutBufferLength_ = (uint64) newValue.getValue().operator long long();
}));
listeners_.push_back(std::make_unique<ValueListener>(Data::instance().get().getPropertyAsValue(VALUE_MAX_PLAYOUT_BUFFER, nullptr), [this](Value& newValue) {
maxPlayoutBufferLength_ = (int)newValue.getValue();
maxPlayoutBufferLength_ = (uint64)newValue.getValue().operator long long();
}));
auto mixer = Data::instance().get().getOrCreateChildWithName(VALUE_MIXER, nullptr);
auto outputController = mixer.getOrCreateChildWithName(VALUE_MASTER_OUTPUT, nullptr);
Expand Down Expand Up @@ -123,7 +130,7 @@ void AudioCallback::measureSamplesPerTime(PlayoutQualityInfo &qualityInfo, int n
}

// https://dsp.stackexchange.com/questions/14754/equal-power-crossfade
std::pair<double, double> calcMonitorGain() {
static std::pair<double, double> calcMonitorGain() {
auto mixer = Data::instance().get().getChildWithName(VALUE_MIXER);
double t = mixer.getProperty(VALUE_MONITOR_BALANCE);

Expand All @@ -140,7 +147,7 @@ void AudioCallback::calcLocalMonitoring(std::shared_ptr<AudioBuffer<float>> inpu
auto [monitorVolume, _] = calcMonitorGain();
// Apply gain to our channels and do a stereo mixdown
jassert(inputBuffer->getNumSamples() == outputBuffer.getNumSamples());
for (int channel = 0; channel < inputBuffer->getNumChannels(); channel++) {
for (size_t channel = 0; channel < (size_t) inputBuffer->getNumChannels(); channel++) {
const JammerNetzSingleChannelSetup& setup = channelSetup_.channels[channel];
float input_volume = (float) (setup.volume * monitorVolume * masterVolume_);
switch (setup.target) {
Expand All @@ -150,13 +157,13 @@ void AudioCallback::calcLocalMonitoring(std::shared_ptr<AudioBuffer<float>> inpu
case Left:
// This is a left channel, going into the left.
if (outputBuffer.getNumChannels() > 0) {
outputBuffer.addFrom(0, 0, *inputBuffer, channel, 0, inputBuffer->getNumSamples(), input_volume);
outputBuffer.addFrom(0, 0, *inputBuffer, (int) channel, 0, inputBuffer->getNumSamples(), input_volume);
}
break;
case Right:
// And the same for the right channel
if (outputBuffer.getNumChannels() > 1) {
outputBuffer.addFrom(1, 0, *inputBuffer, channel, 0, inputBuffer->getNumSamples(), input_volume);
outputBuffer.addFrom(1, 0, *inputBuffer, (int) channel, 0, inputBuffer->getNumSamples(), input_volume);
}
break;
case SendLeft:
Expand All @@ -166,28 +173,28 @@ void AudioCallback::calcLocalMonitoring(std::shared_ptr<AudioBuffer<float>> inpu
break;
case Mono:
if (outputBuffer.getNumChannels() > 0) {
outputBuffer.addFrom(0, 0, *inputBuffer, channel, 0, inputBuffer->getNumSamples(), input_volume);
outputBuffer.addFrom(0, 0, *inputBuffer, (int) channel, 0, inputBuffer->getNumSamples(), input_volume);
}
if (outputBuffer.getNumChannels() > 1) {
outputBuffer.addFrom(1, 0, *inputBuffer, channel, 0, inputBuffer->getNumSamples(), input_volume);
outputBuffer.addFrom(1, 0, *inputBuffer, (int) channel, 0, inputBuffer->getNumSamples(), input_volume);
}
break;
}
}
}
}

uint8 sysexMsb(uint16 in)
static uint8 sysexMsb(uint16 in)
{
return (uint8)(in >> 7);
}

uint8 sysexLsb(uint16 in)
static uint8 sysexLsb(uint16 in)
{
return (uint8)(in & 0x7f);
}

MidiMessage createBossRC300ClockMessage(double bpm, MidiSignal additionalSignal)
static MidiMessage createBossRC300ClockMessage(double bpm, MidiSignal additionalSignal)
{
// Boss RC-300 loop pedal is infamous for not being able to slave to MIDI clock. Let's try with tailored sysex messages then
// See https://www.vguitarforums.com/smf/index.php?topic=7678.50 "RC300- Here's how to slave the RC-300's Tempo to (some) external sources"
Expand Down Expand Up @@ -225,7 +232,7 @@ MidiMessage createBossRC300ClockMessage(double bpm, MidiSignal additionalSignal)
return MidiMessage::createSysExMessage(rc300.data(), (int) rc300.size());
}

std::vector<MidiMessage> createMidiBeatMessage(double bpm, std::optional<MidiSignal> additionalSignal, bool includeBossRC300)
static std::vector<MidiMessage> createMidiBeatMessage(double bpm, std::optional<MidiSignal> additionalSignal, bool includeBossRC300)
{
// For every Midi "Beat" we create a clock message (0xf8)
std::vector<MidiMessage> result;
Expand Down Expand Up @@ -292,10 +299,10 @@ void AudioCallback::audioDeviceIOCallbackWithContext(const float* const* inputCh
meterSource_.measureBlock(*audioBuffer);

// Send the MAG, RMS values and the pitch to the server, which will forward it to the other clients so they can show my levels even if they have only the mixed audio
for (int c = 0; c < numInputChannels; c++) {
for (size_t c = 0; c < (size_t) numInputChannels; c++) {
if (c < channelSetup_.channels.size()) {
channelSetup_.channels[c].mag = meterSource_.getMaxLevel(c);
channelSetup_.channels[c].rms = meterSource_.getRMSLevel(c);
channelSetup_.channels[c].mag = meterSource_.getMaxLevel((int) c);
channelSetup_.channels[c].rms = meterSource_.getRMSLevel((int) c);
channelSetup_.channels[c].pitch = tuner_->getPitch(c);
}
else {
Expand Down Expand Up @@ -535,12 +542,12 @@ double AudioCallback::currentRTT()
return jammerService_.receiver()->currentRTT();
}

float AudioCallback::channelPitch(int channel) const
float AudioCallback::channelPitch(size_t channel) const
{
return tuner_->getPitch(channel);
}

float AudioCallback::sessionPitch(int channel) {
float AudioCallback::sessionPitch(size_t channel) {
auto setup = getSessionSetup();
if (channel < setup.channels.size())
return setup.channels[channel].pitch;
Expand Down
8 changes: 4 additions & 4 deletions Client/Source/AudioCallback.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,15 @@ class ReadOnceLatch
class AudioCallback : public AudioIODeviceCallback {
public:
AudioCallback();
virtual ~AudioCallback();
virtual ~AudioCallback() override;

void shutdown();

void restartClock(std::vector<MidiDeviceInfo> outputs);
void setMidiSignalToSend(MidiSignal signal);

virtual void audioDeviceIOCallbackWithContext(const float* const* inputChannelData, int numInputChannels, float* const* outputChannelData, int numOutputChannels,
int numSamples, const AudioIODeviceCallbackContext& context);
int numSamples, const AudioIODeviceCallbackContext& context) override;
virtual void audioDeviceAboutToStart(AudioIODevice* device) override;
virtual void audioDeviceStopped() override;

Expand All @@ -109,8 +109,8 @@ class AudioCallback : public AudioIODeviceCallback {
std::string currentReceptionQuality() const;
bool isReceivingData();
double currentRTT();
float channelPitch(int channel) const;
float sessionPitch(int channel);
float channelPitch(size_t channel) const;
float sessionPitch(size_t channel);

std::shared_ptr<Recorder> getMasterRecorder() const;
std::shared_ptr<Recorder> getLocalRecorder() const;
Expand Down
8 changes: 4 additions & 4 deletions Client/Source/AudioService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ void AudioService::refreshChannelSetup(std::shared_ptr<ChannelSetup> setup)
JammerNetzChannelSetup channelSetup(isLocalMonitoring);

if (setup) {
for (int i = 0; i < setup->activeChannelIndices.size(); i++) {
for (size_t i = 0; i < setup->activeChannelIndices.size(); i++) {
String inputController = "Input" + String(i);
auto controllerData = mixer.getChildWithName(inputController);
jassert(controllerData.isValid());
Expand Down Expand Up @@ -146,12 +146,12 @@ int AudioService::currentPacketSize()
return callback_.currentPacketSize();
}

float AudioService::channelPitch(int channel) const
float AudioService::channelPitch(size_t channel) const
{
return callback_.channelPitch(channel);
}

float AudioService::sessionPitch(int channel)
float AudioService::sessionPitch(size_t channel)
{
return callback_.sessionPitch(channel);
}
Expand Down Expand Up @@ -225,7 +225,7 @@ std::shared_ptr<ChannelSetup> AudioService::getSetup(ValueTree data) const
return channelSetup;
}

BigInteger makeChannelMask(std::vector<int> const& indices) {
static BigInteger makeChannelMask(std::vector<int> const& indices) {
BigInteger inputChannelMask;
for (int activeChannelIndex : indices) {
inputChannelMask.setBit(activeChannelIndex);
Expand Down
6 changes: 3 additions & 3 deletions Client/Source/AudioService.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ struct ChannelSetup {
class AudioService : private ValueTree::Listener {
public:
AudioService();
~AudioService();
virtual ~AudioService() override;

void shutdown(); // Controlled stop

Expand All @@ -48,8 +48,8 @@ class AudioService : private ValueTree::Listener {
std::string currentReceptionQuality() const;
int currentPacketSize();

float channelPitch(int channel) const;
float sessionPitch(int channel);
float channelPitch(size_t channel) const;
float sessionPitch(size_t channel);

FFAU::LevelMeterSource* getInputMeterSource();
FFAU::LevelMeterSource* getOutputMeterSource();
Expand Down
2 changes: 1 addition & 1 deletion Client/Source/BPMDisplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

class BPMTimer : public Timer {
public:
BPMTimer(Label &label, std::weak_ptr<MidiClocker> clocker) : label_(label), clocker_(clocker) {};
BPMTimer(Label &label, std::weak_ptr<MidiClocker> clocker) : label_(label), clocker_(clocker) {}

virtual void timerCallback() override
{
Expand Down
9 changes: 7 additions & 2 deletions Client/Source/ChannelController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,13 @@

ChannelController::ChannelController(String const &name, String const &id,
bool hasVolume /*= true*/, bool hasTarget /*= true*/, bool hasPitch /* = false */) :
id_(id), levelMeter_(name == "Master" ? FFAU::LevelMeter::Default : FFAU::LevelMeter::SingleChannel),
hasVolume_(hasVolume), hasTarget_(hasTarget), hasPitch_(hasPitch), meterSource_(nullptr), channelNo_(0)
id_(id)
, hasVolume_(hasVolume)
, hasTarget_(hasTarget)
, hasPitch_(hasPitch)
, levelMeter_(name == "Master" ? FFAU::LevelMeter::Default : FFAU::LevelMeter::SingleChannel)
, meterSource_(nullptr)
, channelNo_(0)
{
channelName_.setText(name, dontSendNotification);
if (hasVolume) {
Expand Down
Loading
Loading