Add toggle for syhpon/spout

pre-release-3
James H Ball 2024-12-23 19:37:12 +00:00
rodzic 961c6ada19
commit 9cd2c5b4d3
6 zmienionych plików z 50 dodań i 17 usunięć

Wyświetl plik

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19,14.5C19,14.5 21,16.67 21,18A2,2 0 0,1 19,20A2,2 0 0,1 17,18C17,16.67 19,14.5 19,14.5M5,18V9A2,2 0 0,1 3,7A2,2 0 0,1 5,5V4A2,2 0 0,1 7,2H9A2,2 0 0,1 11,4V5H19A2,2 0 0,1 21,7V9L21,11A1,1 0 0,1 22,12A1,1 0 0,1 21,13H17A1,1 0 0,1 16,12A1,1 0 0,1 17,11V9H11V18H12A2,2 0 0,1 14,20V22H2V20A2,2 0 0,1 4,18H5Z" /></svg>

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 383 B

Wyświetl plik

@ -2,9 +2,10 @@
#include "../SosciPluginEditor.h"
#include "../SosciPluginProcessor.h"
SosciMainMenuBarModel::SosciMainMenuBarModel(SosciPluginEditor& editor, SosciAudioProcessor& processor) : editor(editor), processor(processor) {
SosciMainMenuBarModel::SosciMainMenuBarModel(SosciPluginEditor& e, SosciAudioProcessor& processor) : editor(e), processor(processor) {
addTopLevelMenu("File");
addTopLevelMenu("About");
addTopLevelMenu("Recording");
addTopLevelMenu("Audio");
addMenuItem(0, "Open", [&]() { editor.openProject(); });
@ -32,13 +33,17 @@ SosciMainMenuBarModel::SosciMainMenuBarModel(SosciPluginEditor& editor, SosciAud
juce::DialogWindow* dw = options.launchAsync();
});
addMenuItem(2, "Settings...", [this] {
editor.openRecordingSettings();
});
addMenuItem(2, "Force Disable Brightness Input", [&]() {
addMenuItem(3, "Force Disable Brightness Input", [&]() {
processor.forceDisableBrightnessInput = !processor.forceDisableBrightnessInput;
menuItemsChanged();
});
if (editor.processor.wrapperType == juce::AudioProcessor::WrapperType::wrapperType_Standalone) {
addMenuItem(2, "Settings...", [&]() { editor.openAudioSettings(); });
addMenuItem(3, "Settings...", [&]() { editor.openAudioSettings(); });
}
}

Wyświetl plik

@ -27,6 +27,7 @@ VisualiserComponent::VisualiserComponent(juce::File& lastOpenedDirectory, juce::
};
addAndMakeVisible(record);
record.setTooltip("Toggles recording of the oscilloscope's visuals and audio.");
record.setPulseAnimation(true);
record.onClick = [this] {
setRecording(record.getToggleState());
@ -39,11 +40,29 @@ VisualiserComponent::VisualiserComponent(juce::File& lastOpenedDirectory, juce::
if (parent == nullptr && !visualiserOnly) {
addAndMakeVisible(fullScreenButton);
fullScreenButton.setTooltip("Toggles fullscreen mode.");
}
if (child == nullptr && parent == nullptr && !visualiserOnly) {
addAndMakeVisible(popOutButton);
popOutButton.setTooltip("Opens the oscilloscope in a new window.");
}
addAndMakeVisible(settingsButton);
settingsButton.setTooltip("Opens the visualiser settings window.");
//if (visualiserOnly) {
addAndMakeVisible(sharedTextureButton);
sharedTextureButton.setTooltip("Toggles sending the oscilloscope's visuals to a Syphon/Spout receiver.");
sharedTextureButton.onClick = [this] {
if (sharedTextureSender != nullptr) {
openGLContext.executeOnGLThread([this](juce::OpenGLContext& context) {
closeSharedTexture();
}, false);
} else {
openGLContext.executeOnGLThread([this](juce::OpenGLContext& context) {
initialiseSharedTexture();
}, false);
}
};
//}
fullScreenButton.onClick = [this]() {
enableFullScreen();
@ -277,6 +296,9 @@ void VisualiserComponent::resized() {
popOutButton.setBounds(buttonRow.removeFromRight(30));
}
settingsButton.setBounds(buttonRow.removeFromRight(30));
//if (visualiserOnly) {
sharedTextureButton.setBounds(buttonRow.removeFromRight(30));
//}
record.setBounds(buttonRow.removeFromRight(25));
if (record.getToggleState()) {
stopwatch.setVisible(true);
@ -293,6 +315,9 @@ void VisualiserComponent::resized() {
}
void VisualiserComponent::popoutWindow() {
if (sharedTextureButton.getToggleState()) {
sharedTextureButton.triggerClick();
}
setRecording(false);
auto visualiser = new VisualiserComponent(lastOpenedDirectory, ffmpegFile, haltRecording, threadManager, settings, recordingParameters, this);
visualiser->settings.setLookAndFeel(&getLookAndFeel());
@ -338,10 +363,12 @@ void VisualiserComponent::initialiseSharedTexture() {
}
void VisualiserComponent::closeSharedTexture() {
if (SharedTextureManager::getInstanceWithoutCreating() != nullptr) {
SharedTextureManager::getInstance()->removeSender(sharedTextureSender);
if (sharedTextureSender != nullptr) {
if (SharedTextureManager::getInstanceWithoutCreating() != nullptr) {
SharedTextureManager::getInstance()->removeSender(sharedTextureSender);
}
sharedTextureSender = nullptr;
}
sharedTextureSender = nullptr;
}
@ -394,18 +421,12 @@ void VisualiserComponent::newOpenGLContextCreated() {
glGenBuffers(1, &vertexIndexBuffer);
setupTextures();
if (parent == nullptr) {
initialiseSharedTexture();
}
}
void VisualiserComponent::openGLContextClosing() {
using namespace juce::gl;
if (parent == nullptr) {
closeSharedTexture();
}
closeSharedTexture();
glDeleteBuffers(1, &quadIndexBuffer);
glDeleteBuffers(1, &vertexIndexBuffer);
@ -447,11 +468,11 @@ void VisualiserComponent::renderOpenGL() {
renderScope(xSamples, ySamples, zSamples);
}
if (parent == nullptr) {
//if (parent == nullptr) {
if (sharedTextureSender != nullptr) {
sharedTextureSender->renderGL();
}
}
//}
if (record.getToggleState()) {
if (recordingVideo) {

Wyświetl plik

@ -75,6 +75,7 @@ private:
SvgButton fullScreenButton{ "fullScreen", BinaryData::fullscreen_svg, juce::Colours::white, juce::Colours::white };
SvgButton popOutButton{ "popOut", BinaryData::open_in_new_svg, juce::Colours::white, juce::Colours::white };
SvgButton settingsButton{ "settings", BinaryData::cog_svg, juce::Colours::white, juce::Colours::white };
SvgButton sharedTextureButton{ "sharedTexture", BinaryData::spout_svg, juce::Colours::white, juce::Colours::red };
std::function<void(FullScreenMode)> fullScreenCallback;

Wyświetl plik

@ -52,6 +52,8 @@
<FILE id="CE6di2" name="range.svg" compile="0" resource="1" file="Resources/svg/range.svg"/>
<FILE id="n79IAy" name="record.svg" compile="0" resource="1" file="Resources/svg/record.svg"/>
<FILE id="OaqZb1" name="right_arrow.svg" compile="0" resource="1" file="Resources/svg/right_arrow.svg"/>
<FILE id="yiDo4s" name="spout.svg" compile="0" resource="1" file="Resources/svg/spout.svg"/>
<FILE id="I34qEM" name="spout_off.svg" compile="0" resource="1" file="Resources/svg/spout_off.svg"/>
<FILE id="rXjNlx" name="threshold.svg" compile="0" resource="1" file="Resources/svg/threshold.svg"/>
<FILE id="rFYmV8" name="timer.svg" compile="0" resource="1" file="Resources/svg/timer.svg"/>
<FILE id="qC6QiP" name="volume.svg" compile="0" resource="1" file="Resources/svg/volume.svg"/>

Wyświetl plik

@ -41,6 +41,7 @@
<FILE id="CE6di2" name="range.svg" compile="0" resource="1" file="Resources/svg/range.svg"/>
<FILE id="n79IAy" name="record.svg" compile="0" resource="1" file="Resources/svg/record.svg"/>
<FILE id="OaqZb1" name="right_arrow.svg" compile="0" resource="1" file="Resources/svg/right_arrow.svg"/>
<FILE id="z3A7FT" name="spout.svg" compile="0" resource="1" file="Resources/svg/spout.svg"/>
<FILE id="rXjNlx" name="threshold.svg" compile="0" resource="1" file="Resources/svg/threshold.svg"/>
<FILE id="rFYmV8" name="timer.svg" compile="0" resource="1" file="Resources/svg/timer.svg"/>
<FILE id="qC6QiP" name="volume.svg" compile="0" resource="1" file="Resources/svg/volume.svg"/>
@ -242,7 +243,9 @@
<XCODE_MAC targetFolder="Builds/sosci/MacOSX" extraLinkerFlags="-Wl,-weak_reference_mismatches,weak"
extraDefs="JUCE_SILENCE_XCODE_15_LINKER_WARNING=1" smallIcon="pSc1mq"
bigIcon="pSc1mq" applicationCategory="public.app-category.music"
microphonePermissionNeeded="1">
microphonePermissionNeeded="1" frameworkSearchPaths="../../../External/syphon"
extraCustomFrameworks="../../../External/syphon/Syphon.framework"
embeddedFrameworks="../../../External/syphon/Syphon.framework">
<CONFIGURATIONS>
<CONFIGURATION isDebug="1" name="Debug" targetName="sosci"/>
<CONFIGURATION name="Release" targetName="sosci"/>