kopia lustrzana https://github.com/jameshball/osci-render
Use audio processor properties instead of manually loading and saving
rodzic
f0c185e538
commit
0eb21a0a70
|
@ -184,11 +184,6 @@ OscirenderAudioProcessor::OscirenderAudioProcessor() : CommonAudioProcessor(Buse
|
|||
synth.addSound(defaultSound);
|
||||
|
||||
addAllParameters();
|
||||
|
||||
if (objectServerPort == 0) {
|
||||
objectServerPort = 51677;
|
||||
objectServer.reload();
|
||||
}
|
||||
}
|
||||
|
||||
OscirenderAudioProcessor::~OscirenderAudioProcessor() {
|
||||
|
@ -412,7 +407,7 @@ void OscirenderAudioProcessor::setObjectServerRendering(bool enabled) {
|
|||
}
|
||||
|
||||
void OscirenderAudioProcessor::setObjectServerPort(int port) {
|
||||
objectServerPort = port;
|
||||
setProperty("objectServerPort", port);
|
||||
objectServer.reload();
|
||||
}
|
||||
|
||||
|
@ -674,8 +669,6 @@ void OscirenderAudioProcessor::getStateInformation(juce::MemoryBlock& destData)
|
|||
}
|
||||
xml->setAttribute("currentFile", currentFile);
|
||||
|
||||
xml->setAttribute("objectServerPort", objectServerPort);
|
||||
|
||||
recordingParameters.save(xml.get());
|
||||
|
||||
saveProperties(*xml);
|
||||
|
@ -793,12 +786,10 @@ void OscirenderAudioProcessor::setStateInformation(const void* data, int sizeInB
|
|||
}
|
||||
changeCurrentFile(xml->getIntAttribute("currentFile", -1));
|
||||
|
||||
objectServerPort = xml->getIntAttribute("objectServerPort", juce::Random::getSystemRandom().nextInt(juce::Range<int>(51600, 51700)));
|
||||
objectServer.reload();
|
||||
|
||||
recordingParameters.load(xml.get());
|
||||
|
||||
loadProperties(*xml);
|
||||
objectServer.reload();
|
||||
|
||||
broadcaster.sendChangeMessage();
|
||||
prevMidiEnabled = !midiEnabled->getBoolValue();
|
||||
|
|
|
@ -184,8 +184,6 @@ public:
|
|||
|
||||
std::function<void()> haltRecording;
|
||||
|
||||
int objectServerPort = 0;
|
||||
|
||||
void addLuaSlider();
|
||||
void updateEffectPrecedence();
|
||||
void updateFileBlock(int index, std::shared_ptr<juce::MemoryBlock> block);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include "AboutComponent.h"
|
||||
|
||||
AboutComponent::AboutComponent(const void *image, size_t imageSize, juce::String sectionText, int* port) {
|
||||
AboutComponent::AboutComponent(const void *image, size_t imageSize, juce::String sectionText, int port) {
|
||||
addAndMakeVisible(logoComponent);
|
||||
addAndMakeVisible(text);
|
||||
addAndMakeVisible(portText);
|
||||
|
@ -26,11 +26,7 @@ AboutComponent::AboutComponent(const void *image, size_t imageSize, juce::String
|
|||
portText.setColour(juce::TextEditor::backgroundColourId, juce::Colours::transparentBlack);
|
||||
portText.setColour(juce::TextEditor::outlineColourId, juce::Colours::transparentBlack);
|
||||
portText.setJustification(juce::Justification(juce::Justification::centred));
|
||||
portText.setText(juce::String("Blender Port: ") + ((port != nullptr) ? juce::String(*port) : juce::String("<error>")));
|
||||
}
|
||||
|
||||
void AboutComponent::updatePortText(int* port) {
|
||||
portText.setText(juce::String("Blender Port: ") + ((port != nullptr) ? juce::String(*port) : juce::String("<error>")));
|
||||
portText.setText(juce::String("Blender Port: ") + juce::String(port));
|
||||
}
|
||||
|
||||
void AboutComponent::resized() {
|
||||
|
|
|
@ -4,10 +4,9 @@
|
|||
|
||||
class AboutComponent : public juce::Component {
|
||||
public:
|
||||
AboutComponent(const void *image, size_t imageSize, juce::String sectionText, int* port);
|
||||
AboutComponent(const void *image, size_t imageSize, juce::String sectionText, int port);
|
||||
|
||||
void resized() override;
|
||||
void updatePortText(int* port);
|
||||
|
||||
private:
|
||||
juce::Image logo;
|
||||
|
|
|
@ -32,7 +32,7 @@ OsciMainMenuBarModel::OsciMainMenuBarModel(OscirenderAudioProcessor& p, Oscirend
|
|||
"BUS ERROR Collective, for providing the source code for the Hilligoss encoder\n"
|
||||
"Jean Perbet (@jeanprbt) for the osci-render macOS icon\n"
|
||||
"All the community, for suggesting features and reporting issues!",
|
||||
&audioProcessor.objectServerPort);
|
||||
std::any_cast<int>(audioProcessor.getProperty("objectServerPort")));
|
||||
options.content.setOwned(about);
|
||||
options.content->setSize(500, 270);
|
||||
options.dialogTitle = "About";
|
||||
|
@ -48,9 +48,9 @@ OsciMainMenuBarModel::OsciMainMenuBarModel(OscirenderAudioProcessor& p, Oscirend
|
|||
|
||||
juce::DialogWindow* dw = options.launchAsync();
|
||||
});
|
||||
addMenuItem(1, "Randomize Port", [this] {
|
||||
addMenuItem(1, "Randomize Blender Port", [this] {
|
||||
audioProcessor.setObjectServerPort(juce::Random::getSystemRandom().nextInt(juce::Range<int>(51600, 51700)));
|
||||
});
|
||||
});
|
||||
|
||||
#if !SOSCI_FEATURES
|
||||
addMenuItem(1, "Purchase osci-render premium!", [this] {
|
||||
|
|
|
@ -16,7 +16,7 @@ void ObjectServer::reload() {
|
|||
}
|
||||
|
||||
void ObjectServer::run() {
|
||||
port = audioProcessor.objectServerPort;
|
||||
port = std::any_cast<int>(audioProcessor.getProperty("objectServerPort", 51677));
|
||||
if (socket.createListener(port, "127.0.0.1")) {
|
||||
// preallocating a large buffer to avoid allocations in the loop
|
||||
std::unique_ptr<char[]> message{ new char[10 * 1024 * 1024] };
|
||||
|
|
Ładowanie…
Reference in New Issue