Browse Source

Fixed a spelling mistake and in the VST hosting code. Fixed a mistake in the design of the StandaloneFilterwindow class.

tags/2021-05-28
Julian Storer 14 years ago
parent
commit
5b92d8cc8f
5 changed files with 49 additions and 44 deletions
  1. +1
    -1
      extras/Introjucer/Source/Project/jucer_ProjectInformationComponent.cpp
  2. +32
    -32
      modules/juce_audio_plugin_client/Standalone/juce_StandaloneFilterWindow.cpp
  3. +8
    -9
      modules/juce_audio_plugin_client/Standalone/juce_StandaloneFilterWindow.h
  4. +2
    -2
      modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp
  5. +6
    -0
      modules/juce_gui_basics/windows/juce_ResizableWindow.cpp

+ 1
- 1
extras/Introjucer/Source/Project/jucer_ProjectInformationComponent.cpp View File

@@ -227,7 +227,7 @@ private:
//==============================================================================
class MissingDependenciesComponent : public PropertyComponent,
public Button::Listener
public ButtonListener
{
public:
MissingDependenciesComponent (Project& project_, ModuleList& moduleList_, const String& moduleID_)


+ 32
- 32
modules/juce_audio_plugin_client/Standalone/juce_StandaloneFilterWindow.cpp View File

@@ -35,10 +35,12 @@ extern AudioProcessor* JUCE_CALLTYPE createPluginFilter();
//==============================================================================
StandaloneFilterWindow::StandaloneFilterWindow (const String& title,
const Colour& backgroundColour)
const Colour& backgroundColour,
PropertySet* settingsToUse)
: DocumentWindow (title, backgroundColour,
DocumentWindow::minimiseButton
| DocumentWindow::closeButton),
settings (settingsToUse),
optionsButton ("options")
{
setTitleBarButtonsRequired (DocumentWindow::minimiseButton | DocumentWindow::closeButton, false);
@@ -63,8 +65,6 @@ StandaloneFilterWindow::StandaloneFilterWindow (const String& title,
JucePlugin_MaxNumOutputChannels,
44100, 512);
PropertySet* const globalSettings = getGlobalSettings();
deviceManager = new AudioDeviceManager();
deviceManager->addAudioCallback (&player);
deviceManager->addMidiInputCallback (String::empty, &player);
@@ -73,19 +73,19 @@ StandaloneFilterWindow::StandaloneFilterWindow (const String& title,
ScopedPointer<XmlElement> savedState;
if (globalSettings != nullptr)
savedState = globalSettings->getXmlValue ("audioSetup");
if (settings != nullptr)
savedState = settings->getXmlValue ("audioSetup");
deviceManager->initialise (filter->getNumInputChannels(),
filter->getNumOutputChannels(),
savedState,
true);
if (globalSettings != nullptr)
if (settings != nullptr)
{
MemoryBlock data;
if (data.fromBase64Encoding (globalSettings->getValue ("filterState"))
if (data.fromBase64Encoding (settings->getValue ("filterState"))
&& data.getSize() > 0)
{
filter->setStateInformation (data.getData(), data.getSize());
@@ -94,28 +94,33 @@ StandaloneFilterWindow::StandaloneFilterWindow (const String& title,
setContentOwned (filter->createEditorIfNeeded(), true);
const int x = globalSettings->getIntValue ("windowX", -100);
const int y = globalSettings->getIntValue ("windowY", -100);
if (settings != nullptr)
{
const int x = settings->getIntValue ("windowX", -100);
const int y = settings->getIntValue ("windowY", -100);
if (x != -100 && y != -100)
setBoundsConstrained (Rectangle<int> (x, y, getWidth(), getHeight()));
if (x != -100 && y != -100)
setBoundsConstrained (Rectangle<int> (x, y, getWidth(), getHeight()));
else
centreWithSize (getWidth(), getHeight());
}
else
{
centreWithSize (getWidth(), getHeight());
}
}
StandaloneFilterWindow::~StandaloneFilterWindow()
{
PropertySet* const globalSettings = getGlobalSettings();
if (globalSettings != nullptr)
if (settings != nullptr)
{
globalSettings->setValue ("windowX", getX());
globalSettings->setValue ("windowY", getY());
settings->setValue ("windowX", getX());
settings->setValue ("windowY", getY());
if (deviceManager != nullptr)
{
ScopedPointer<XmlElement> xml (deviceManager->createStateXml());
globalSettings->setValue ("audioSetup", xml);
settings->setValue ("audioSetup", xml);
}
}
@@ -123,12 +128,12 @@ StandaloneFilterWindow::~StandaloneFilterWindow()
deviceManager->removeAudioCallback (&player);
deviceManager = nullptr;
if (globalSettings != nullptr && filter != nullptr)
if (settings != nullptr && filter != nullptr)
{
MemoryBlock data;
filter->getStateInformation (data);
globalSettings->setValue ("filterState", data.toBase64Encoding());
settings->setValue ("filterState", data.toBase64Encoding());
}
deleteFilter();
@@ -162,20 +167,16 @@ void StandaloneFilterWindow::resetFilter()
setContentOwned (filter->createEditorIfNeeded(), true);
}
PropertySet* const globalSettings = getGlobalSettings();
if (globalSettings != nullptr)
globalSettings->removeValue ("filterState");
if (settings != nullptr)
settings->removeValue ("filterState");
}
//==============================================================================
void StandaloneFilterWindow::saveState()
{
PropertySet* const globalSettings = getGlobalSettings();
FileChooser fc (TRANS("Save current state"),
globalSettings != nullptr ? File (globalSettings->getValue ("lastStateFile"))
: File::nonexistent);
settings != nullptr ? File (settings->getValue ("lastStateFile"))
: File::nonexistent);
if (fc.browseForFileToSave (true))
{
@@ -193,11 +194,9 @@ void StandaloneFilterWindow::saveState()
void StandaloneFilterWindow::loadState()
{
PropertySet* const globalSettings = getGlobalSettings();
FileChooser fc (TRANS("Load a saved state"),
globalSettings != nullptr ? File (globalSettings->getValue ("lastStateFile"))
: File::nonexistent);
settings != nullptr ? File (settings->getValue ("lastStateFile"))
: File::nonexistent);
if (fc.browseForFileToOpen())
{
@@ -228,7 +227,8 @@ void StandaloneFilterWindow::showAudioSettingsDialog()
selectorComp.setSize (500, 450);
DialogWindow::showModalDialog (TRANS("Audio Settings"), &selectorComp, this, Colours::lightgrey, true, false, false);
DialogWindow::showModalDialog (TRANS("Audio Settings"), &selectorComp, this,
Colours::lightgrey, true, false, false);
}
//==============================================================================


+ 8
- 9
modules/juce_audio_plugin_client/Standalone/juce_StandaloneFilterWindow.h View File

@@ -42,8 +42,14 @@ class StandaloneFilterWindow : public DocumentWindow,
{
public:
//==============================================================================
/** Creates a window with a given title and colour.
The settings object can be a PropertySet that the class should use to
store its settings - the object that is passed-in will be owned by this
class and deleted automatically when no longer needed. (It can also be null)
*/
StandaloneFilterWindow (const String& title,
const Colour& backgroundColour);
const Colour& backgroundColour,
PropertySet* settingsToUse);
~StandaloneFilterWindow();
@@ -60,14 +66,6 @@ public:
/** Shows the audio properties dialog box modally. */
virtual void showAudioSettingsDialog();
/** Implement this method to return the property set that should be used for storing
the plugin's state.
This will be used to store the audio set-up and the filter's last state. You may want
to return an ApplicationProperties object.
*/
virtual PropertySet* getGlobalSettings() = 0;
//==============================================================================
/** @internal */
void closeButtonPressed();
@@ -77,6 +75,7 @@ public:
void resized();
private:
ScopedPointer<PropertySet> settings;
ScopedPointer<AudioProcessor> filter;
ScopedPointer<AudioDeviceManager> deviceManager;
AudioProcessorPlayer player;


+ 2
- 2
modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp View File

@@ -2147,7 +2147,7 @@ int VSTPluginInstance::dispatch (const int opcode, const int index, const int va
//==============================================================================
namespace
{
static const int defaultVSTSampleRateValue = 16384;
static const int defaultVSTSampleRateValue = 44100;
static const int defaultVSTBlockSizeValue = 512;
// handles non plugin-specific callbacks..
@@ -2409,7 +2409,7 @@ const String VSTPluginInstance::getCategory() const
{
case kPlugCategEffect: result = "Effect"; break;
case kPlugCategSynth: result = "Synth"; break;
case kPlugCategAnalysis: result = "Anaylsis"; break;
case kPlugCategAnalysis: result = "Analysis"; break;
case kPlugCategMastering: result = "Mastering"; break;
case kPlugCategSpacializer: result = "Spacial"; break;
case kPlugCategRoomFx: result = "Reverb"; break;


+ 6
- 0
modules/juce_gui_basics/windows/juce_ResizableWindow.cpp View File

@@ -229,7 +229,13 @@ void ResizableWindow::resized()
}
if (contentComponent != nullptr)
{
// The window expects to be able to be able to manage the size and position
// of its content component, so you can't arbitrarily add a transform to it!
jassert (! contentComponent->isTransformed());
contentComponent->setBoundsInset (getContentComponentBorder());
}
updateLastPos();


Loading…
Cancel
Save