Move volume component to a nicer position and get spout input working

visualiser-refactor
James H Ball 2025-04-27 18:36:44 +01:00
rodzic 14b00e0354
commit 769492c22c
4 zmienionych plików z 30 dodań i 17 usunięć

Wyświetl plik

@ -6,6 +6,8 @@
MainComponent::MainComponent(OscirenderAudioProcessor& p, OscirenderAudioProcessorEditor& editor) : audioProcessor(p), pluginEditor(editor) {
setText("Main Settings");
addAndMakeVisible(editor.volume);
addAndMakeVisible(fileButton);
fileButton.setButtonText("Choose File(s)");
@ -233,7 +235,11 @@ void MainComponent::resized() {
createFile.setBounds(row.removeFromLeft(buttonWidth));
bounds.removeFromTop(padding);
bounds.expand(10, 0);
bounds.expand(15, 0);
auto volumeArea = bounds.removeFromLeft(30);
pluginEditor.volume.setBounds(volumeArea.withSizeKeepingCentre(volumeArea.getWidth(), juce::jmin(volumeArea.getHeight(), 300)));
if (!audioProcessor.visualiserParameters.visualiserFullScreen->getBoolValue()) {
auto minDim = juce::jmin(bounds.getWidth(), bounds.getHeight());
juce::Point<int> localTopLeft = {bounds.getX(), bounds.getY()};
@ -241,9 +247,6 @@ void MainComponent::resized() {
auto shiftedBounds = bounds;
shiftedBounds.setX(topLeft.getX());
shiftedBounds.setY(topLeft.getY());
//if (minDim < 35) {
// minDim = 35;
//}
pluginEditor.visualiser.setBounds(shiftedBounds.withSizeKeepingCentre(minDim - 25, minDim));
pluginEditor.visualiser.setBounds(shiftedBounds.withSizeKeepingCentre(minDim, minDim + 25).reduced(10));
}
}

Wyświetl plik

@ -27,8 +27,6 @@ OscirenderAudioProcessorEditor::OscirenderAudioProcessorEditor(OscirenderAudioPr
upgradeButton.setColour(juce::TextButton::buttonColourId, Colours::accentColor);
upgradeButton.setColour(juce::TextButton::textColourOffId, Colours::veryDark);
#endif
addAndMakeVisible(volume);
addAndMakeVisible(console);
console.setConsoleOpen(false);
@ -200,11 +198,6 @@ void OscirenderAudioProcessorEditor::resized() {
#endif
}
area.removeFromTop(2);
area.removeFromLeft(3);
auto volumeArea = area.removeFromLeft(30);
volume.setBounds(volumeArea.withSizeKeepingCentre(volumeArea.getWidth(), juce::jmin(volumeArea.getHeight(), 300)));
area.removeFromLeft(3);
bool editorVisible = false;
{

Wyświetl plik

@ -9,10 +9,23 @@ public:
: juce::Thread("SyphonFrameGrabber"), pollIntervalMs(pollMs), manager(manager), parser(parser) {
// Create the invisible OpenGL context component
glContextComponent = std::make_unique<InvisibleOpenGLContextComponent>();
// Make sure the context is properly initialized before creating the receiver
glContextComponent->getContext().makeActive();
// Create the receiver after the context is active
receiver = manager.addReceiver(server, app);
if (receiver) {
receiver->setUseCPUImage(true); // for pixel access
// Initialize the receiver with the active GL context
receiver->initGL();
}
// Release the context
glContextComponent->getContext().deactivateCurrentContext();
// Start the thread after everything is set up
startThread();
}
@ -28,12 +41,15 @@ public:
void run() override {
while (!threadShouldExit()) {
{
bool activated = false;
if (glContextComponent) {
glContextComponent->getContext().makeActive();
activated = glContextComponent->getContext().makeActive();
}
receiver->renderGL();
if (glContextComponent) {
glContextComponent->getContext().deactivateCurrentContext();
if (juce::OpenGLContext::getCurrentContext() != nullptr) {
receiver->renderGL();
}
if (activated && glContextComponent) {
juce::OpenGLContext::deactivateCurrentContext();
}
if (isActive() && receiver->isConnected) {
juce::Image image = receiver->getImage();
@ -61,6 +77,7 @@ private:
SharedTextureReceiver* receiver = nullptr;
ImageParser& parser;
std::unique_ptr<InvisibleOpenGLContextComponent> glContextComponent;
juce::CriticalSection openGLLock; // To protect OpenGL context operations
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(SyphonFrameGrabber)
};

@ -1 +1 @@
Subproject commit 8c77ff43e2d22ae927bfb3a268d0724e4174b53f
Subproject commit aeabce4a83b16c7277ba0d4ff0c8160726c82f8d