Browse Source

Mac hostname fix. Minor clean-ups.

tags/2021-05-28
Julian Storer 14 years ago
parent
commit
4f4eff1cc0
6 changed files with 45 additions and 47 deletions
  1. +26
    -35
      extras/audio plugin host/Source/FilterGraph.cpp
  2. +3
    -3
      extras/audio plugin host/Source/MainHostWindow.cpp
  3. +6
    -6
      extras/binarybuilder/Source/Main.cpp
  4. +4
    -0
      src/core/juce_PlatformDefs.h
  5. +1
    -1
      src/memory/juce_WeakReference.h
  6. +5
    -2
      src/native/mac/juce_mac_SystemStats.mm

+ 26
- 35
extras/audio plugin host/Source/FilterGraph.cpp View File

@@ -243,31 +243,23 @@ const String FilterGraph::getDocumentTitle()
const String FilterGraph::loadDocument (const File& file)
{
XmlDocument doc (file);
XmlElement* xml = doc.getDocumentElement();
ScopedPointer<XmlElement> xml (doc.getDocumentElement());
if (xml == nullptr || ! xml->hasTagName (T("FILTERGRAPH")))
{
delete xml;
if (xml == nullptr || ! xml->hasTagName ("FILTERGRAPH"))
return "Not a valid filter graph file";
}
restoreFromXml (*xml);
delete xml;
return String::empty;
}
const String FilterGraph::saveDocument (const File& file)
{
XmlElement* xml = createXml();
String error;
ScopedPointer<XmlElement> xml (createXml());
if (! xml->writeToFile (file, String::empty))
error = "Couldn't write to the file";
return "Couldn't write to the file";
delete xml;
return error;
return String::empty;
}
const File FilterGraph::getLastDocumentOpened()
@@ -303,14 +295,13 @@ static XmlElement* createNodeXml (AudioProcessorGraph::Node* const node) noexcep
}
XmlElement* e = new XmlElement ("FILTER");
e->setAttribute (T("uid"), (int) node->id);
e->setAttribute (T("x"), node->properties ["x"].toString());
e->setAttribute (T("y"), node->properties ["y"].toString());
e->setAttribute (T("uiLastX"), node->properties ["uiLastX"].toString());
e->setAttribute (T("uiLastY"), node->properties ["uiLastY"].toString());
e->setAttribute ("uid", (int) node->id);
e->setAttribute ("x", node->properties ["x"].toString());
e->setAttribute ("y", node->properties ["y"].toString());
e->setAttribute ("uiLastX", node->properties ["uiLastX"].toString());
e->setAttribute ("uiLastY", node->properties ["uiLastY"].toString());
PluginDescription pd;
plugin->fillInPluginDescription (pd);
e->addChildElement (pd.createXml());
@@ -348,9 +339,9 @@ void FilterGraph::createNodeFromXml (const XmlElement& xml)
if (instance == nullptr)
return;
AudioProcessorGraph::Node::Ptr node (graph.addNode (instance, xml.getIntAttribute (T("uid"))));
AudioProcessorGraph::Node::Ptr node (graph.addNode (instance, xml.getIntAttribute ("uid")));
const XmlElement* const state = xml.getChildByName (T("STATE"));
const XmlElement* const state = xml.getChildByName ("STATE");
if (state != nullptr)
{
@@ -360,10 +351,10 @@ void FilterGraph::createNodeFromXml (const XmlElement& xml)
node->getProcessor()->setStateInformation (m.getData(), (int) m.getSize());
}
node->properties.set ("x", xml.getDoubleAttribute (T("x")));
node->properties.set ("y", xml.getDoubleAttribute (T("y")));
node->properties.set ("uiLastX", xml.getIntAttribute (T("uiLastX")));
node->properties.set ("uiLastY", xml.getIntAttribute (T("uiLastY")));
node->properties.set ("x", xml.getDoubleAttribute ("x"));
node->properties.set ("y", xml.getDoubleAttribute ("y"));
node->properties.set ("uiLastX", xml.getIntAttribute ("uiLastX"));
node->properties.set ("uiLastY", xml.getIntAttribute ("uiLastY"));
}
XmlElement* FilterGraph::createXml() const
@@ -382,10 +373,10 @@ XmlElement* FilterGraph::createXml() const
XmlElement* e = new XmlElement ("CONNECTION");
e->setAttribute (T("srcFilter"), (int) fc->sourceNodeId);
e->setAttribute (T("srcChannel"), fc->sourceChannelIndex);
e->setAttribute (T("dstFilter"), (int) fc->destNodeId);
e->setAttribute (T("dstChannel"), fc->destChannelIndex);
e->setAttribute ("srcFilter", (int) fc->sourceNodeId);
e->setAttribute ("srcChannel", fc->sourceChannelIndex);
e->setAttribute ("dstFilter", (int) fc->destNodeId);
e->setAttribute ("dstChannel", fc->destChannelIndex);
xml->addChildElement (e);
}
@@ -397,18 +388,18 @@ void FilterGraph::restoreFromXml (const XmlElement& xml)
{
clear();
forEachXmlChildElementWithTagName (xml, e, T("FILTER"))
forEachXmlChildElementWithTagName (xml, e, "FILTER")
{
createNodeFromXml (*e);
changed();
}
forEachXmlChildElementWithTagName (xml, e, T("CONNECTION"))
forEachXmlChildElementWithTagName (xml, e, "CONNECTION")
{
addConnection ((uint32) e->getIntAttribute (T("srcFilter")),
e->getIntAttribute (T("srcChannel")),
(uint32) e->getIntAttribute (T("dstFilter")),
e->getIntAttribute (T("dstChannel")));
addConnection ((uint32) e->getIntAttribute ("srcFilter"),
e->getIntAttribute ("srcChannel"),
(uint32) e->getIntAttribute ("dstFilter"),
e->getIntAttribute ("dstChannel"));
}
graph.removeIllegalConnections();


+ 3
- 3
extras/audio plugin host/Source/MainHostWindow.cpp View File

@@ -415,7 +415,7 @@ bool MainHostWindow::perform (const InvocationInfo& info)
{
/* AboutBoxComponent aboutComp;
DialogWindow::showModalDialog (T("About"),
DialogWindow::showModalDialog ("About",
&aboutComp,
this, Colours::white,
true, false, false);
@@ -439,7 +439,7 @@ void MainHostWindow::showAudioSettings()
audioSettingsComp.setSize (500, 450);
DialogWindow::showModalDialog (T("Audio Settings"),
DialogWindow::showModalDialog ("Audio Settings",
&audioSettingsComp,
this,
Colours::azure,
@@ -448,7 +448,7 @@ void MainHostWindow::showAudioSettings()
XmlElement* const audioState = deviceManager.createStateXml();
ApplicationProperties::getInstance()->getUserSettings()
->setValue (T("audioDeviceState"), audioState);
->setValue ("audioDeviceState", audioState);
delete audioState;


+ 6
- 6
extras/binarybuilder/Source/Main.cpp View File

@@ -24,7 +24,7 @@ static int addFile (const File& file,
const String name (file.getFileName().toLowerCase()
.replaceCharacter (' ', '_')
.replaceCharacter ('.', '_')
.retainCharacters (T("abcdefghijklmnopqrstuvwxyz_0123456789")));
.retainCharacters ("abcdefghijklmnopqrstuvwxyz_0123456789"));
std::cout << "Adding " << name << ": "
<< (int) mb.getSize() << " bytes" << std::endl;
@@ -60,9 +60,9 @@ static int addFile (const File& file,
static bool isHiddenFile (const File& f, const File& root)
{
return f.getFileName().endsWithIgnoreCase (T(".scc"))
|| f.getFileName() == T(".svn")
|| f.getFileName().startsWithChar (T('.'))
return f.getFileName().endsWithIgnoreCase (".scc")
|| f.getFileName() == ".svn"
|| f.getFileName().startsWithChar ('.')
|| (f.getSize() == 0 && ! f.isDirectory())
|| (f.getParentDirectory() != root && isHiddenFile (f.getParentDirectory(), root));
}
@@ -117,8 +117,8 @@ int main (int argc, char* argv[])
String className (argv[3]);
className = className.trim();
const File headerFile (destDirectory.getChildFile (className).withFileExtension (T(".h")));
const File cppFile (destDirectory.getChildFile (className).withFileExtension (T(".cpp")));
const File headerFile (destDirectory.getChildFile (className).withFileExtension (".h"));
const File cppFile (destDirectory.getChildFile (className).withFileExtension (".cpp"));
std::cout << "Creating " << headerFile.getFullPathName()
<< " and " << cppFile.getFullPathName()


+ 4
- 0
src/core/juce_PlatformDefs.h View File

@@ -273,6 +273,10 @@
#endif
#endif
#if defined (_MSC_VER) && _MSC_VER >= 1600
//#define JUCE_COMPILER_SUPPORTS_CXX2011 1
#endif
#if ! (DOXYGEN || JUCE_COMPILER_SUPPORTS_CXX2011)
#define noexcept throw() // for c++98 compilers, we can fake these newer language features.
#define nullptr (0)


+ 1
- 1
src/memory/juce_WeakReference.h View File

@@ -98,7 +98,7 @@ public:
WeakReference& operator= (const WeakReference& other) { holder = other.holder; return *this; }
/** Copies another pointer to this one. */
WeakReference& operator= (ObjectType* const newObject) { holder = newObject != nullptr ? newObject->getWeakReference() : nullptr; return *this; }
WeakReference& operator= (ObjectType* const newObject) { holder = (newObject != nullptr) ? newObject->getWeakReference() : nullptr; return *this; }
/** Returns the object that this pointer refers to, or null if the object no longer exists. */
ObjectType* get() const noexcept { return holder != nullptr ? holder->get() : nullptr; }


+ 5
- 2
src/native/mac/juce_mac_SystemStats.mm View File

@@ -184,8 +184,11 @@ const String SystemStats::getFullUserName()
const String SystemStats::getComputerName()
{
return nsStringToJuce ([[NSProcessInfo processInfo] hostName])
.upToLastOccurrenceOf (".local", false, true);
char name [256] = { 0 };
if (gethostname (name, sizeof (name) - 1) == 0)
return String (name).upToLastOccurrenceOf (".local", false, true);
return String::empty;
}
//==============================================================================


Loading…
Cancel
Save