Browse Source

Added cue point parsing to wav file format. Added SystemStats::getComputerName() method. More minor nullptr/noexcept tweaks.

tags/2021-05-28
Julian Storer 14 years ago
parent
commit
8519598c93
16 changed files with 367 additions and 135 deletions
  1. +3
    -3
      extras/Introjucer/Source/Project/jucer_Project.h
  2. +1
    -1
      extras/Introjucer/Source/Utility/jucer_MiscUtilities.h
  3. +1
    -0
      extras/JuceDemo/Source/ApplicationStartup.cpp
  4. +21
    -21
      extras/audio plugin host/Source/FilterGraph.cpp
  5. +9
    -9
      extras/audio plugin host/Source/FilterGraph.h
  6. +44
    -44
      extras/audio plugin host/Source/GraphEditorPanel.cpp
  7. +1
    -1
      extras/browser plugins/wrapper/juce_ActiveX_GlueCode.cpp
  8. +1
    -1
      extras/browser plugins/wrapper/juce_NPAPI_GlueCode.cpp
  9. +140
    -27
      juce_amalgamated.cpp
  10. +3
    -0
      juce_amalgamated.h
  11. +87
    -6
      src/audio/audio_file_formats/juce_WavAudioFormat.cpp
  12. +3
    -0
      src/core/juce_SystemStats.h
  13. +9
    -0
      src/native/android/juce_android_SystemStats.cpp
  14. +9
    -0
      src/native/linux/juce_linux_SystemStats.cpp
  15. +6
    -0
      src/native/mac/juce_mac_SystemStats.mm
  16. +29
    -22
      src/native/windows/juce_win32_SystemStats.cpp

+ 3
- 3
extras/Introjucer/Source/Project/jucer_Project.h View File

@@ -163,9 +163,9 @@ public:
//==============================================================================
bool isValid() const { return node.isValid(); }
const ValueTree& getNode() const throw() { return node; }
ValueTree& getNode() throw() { return node; }
Project& getProject() const throw() { return *project; }
const ValueTree& getNode() const noexcept { return node; }
ValueTree& getNode() noexcept { return node; }
Project& getProject() const noexcept { return *project; }
bool operator== (const Item& other) const { return node == other.node && project == other.project; }
bool operator!= (const Item& other) const { return ! operator== (other); }


+ 1
- 1
extras/Introjucer/Source/Utility/jucer_MiscUtilities.h View File

@@ -57,7 +57,7 @@ public:
PropertyPanelWithTooltips();
~PropertyPanelWithTooltips();
PropertyPanel& getPanel() throw() { return panel; }
PropertyPanel& getPanel() noexcept { return panel; }
void paint (Graphics& g);
void resized();


+ 1
- 0
extras/JuceDemo/Source/ApplicationStartup.cpp View File

@@ -111,6 +111,7 @@ private:
<< "Time and date: " << Time::getCurrentTime().toString (true, true)
<< "\nUser logon name: " << SystemStats::getLogonName()
<< "\nFull user name: " << SystemStats::getFullUserName()
<< "\nHost name: " << SystemStats::getComputerName()
<< "\nOperating system: " << SystemStats::getOperatingSystemName()
<< "\nCPU vendor: " << SystemStats::getCpuVendor()
<< "\nCPU speed: " << SystemStats::getCpuSpeedInMegaherz() << "MHz"


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

@@ -78,42 +78,42 @@ FilterGraph::~FilterGraph()
graph.clear();
}
uint32 FilterGraph::getNextUID() throw()
uint32 FilterGraph::getNextUID() noexcept
{
return ++lastUID;
}
//==============================================================================
int FilterGraph::getNumFilters() const throw()
int FilterGraph::getNumFilters() const noexcept
{
return graph.getNumNodes();
}
const AudioProcessorGraph::Node::Ptr FilterGraph::getNode (const int index) const throw()
const AudioProcessorGraph::Node::Ptr FilterGraph::getNode (const int index) const noexcept
{
return graph.getNode (index);
}
const AudioProcessorGraph::Node::Ptr FilterGraph::getNodeForId (const uint32 uid) const throw()
const AudioProcessorGraph::Node::Ptr FilterGraph::getNodeForId (const uint32 uid) const noexcept
{
return graph.getNodeForId (uid);
}
void FilterGraph::addFilter (const PluginDescription* desc, double x, double y)
{
if (desc != 0)
if (desc != nullptr)
{
String errorMessage;
AudioPluginInstance* instance
= AudioPluginFormatManager::getInstance()->createPluginInstance (*desc, errorMessage);
AudioProcessorGraph::Node* node = 0;
AudioProcessorGraph::Node* node = nullptr;
if (instance != 0)
if (instance != nullptr)
node = graph.addNode (instance);
if (node != 0)
if (node != nullptr)
{
node->properties.set ("x", x);
node->properties.set ("y", y);
@@ -152,7 +152,7 @@ void FilterGraph::setNodePosition (const int nodeId, double x, double y)
{
const AudioProcessorGraph::Node::Ptr n (graph.getNodeForId (nodeId));
if (n != 0)
if (n != nullptr)
{
n->properties.set ("x", jlimit (0.0, 1.0, x));
n->properties.set ("y", jlimit (0.0, 1.0, y));
@@ -165,7 +165,7 @@ void FilterGraph::getNodePosition (const int nodeId, double& x, double& y) const
const AudioProcessorGraph::Node::Ptr n (graph.getNodeForId (nodeId));
if (n != 0)
if (n != nullptr)
{
x = (double) n->properties ["x"];
y = (double) n->properties ["y"];
@@ -173,25 +173,25 @@ void FilterGraph::getNodePosition (const int nodeId, double& x, double& y) const
}
//==============================================================================
int FilterGraph::getNumConnections() const throw()
int FilterGraph::getNumConnections() const noexcept
{
return graph.getNumConnections();
}
const AudioProcessorGraph::Connection* FilterGraph::getConnection (const int index) const throw()
const AudioProcessorGraph::Connection* FilterGraph::getConnection (const int index) const noexcept
{
return graph.getConnection (index);
}
const AudioProcessorGraph::Connection* FilterGraph::getConnectionBetween (uint32 sourceFilterUID, int sourceFilterChannel,
uint32 destFilterUID, int destFilterChannel) const throw()
uint32 destFilterUID, int destFilterChannel) const noexcept
{
return graph.getConnectionBetween (sourceFilterUID, sourceFilterChannel,
destFilterUID, destFilterChannel);
}
bool FilterGraph::canConnect (uint32 sourceFilterUID, int sourceFilterChannel,
uint32 destFilterUID, int destFilterChannel) const throw()
uint32 destFilterUID, int destFilterChannel) const noexcept
{
return graph.canConnect (sourceFilterUID, sourceFilterChannel,
destFilterUID, destFilterChannel);
@@ -245,7 +245,7 @@ const String FilterGraph::loadDocument (const File& file)
XmlDocument doc (file);
XmlElement* xml = doc.getDocumentElement();
if (xml == 0 || ! xml->hasTagName (T("FILTERGRAPH")))
if (xml == nullptr || ! xml->hasTagName (T("FILTERGRAPH")))
{
delete xml;
return "Not a valid filter graph file";
@@ -292,14 +292,14 @@ void FilterGraph::setLastDocumentOpened (const File& file)
}
//==============================================================================
static XmlElement* createNodeXml (AudioProcessorGraph::Node* const node) throw()
static XmlElement* createNodeXml (AudioProcessorGraph::Node* const node) noexcept
{
AudioPluginInstance* plugin = dynamic_cast <AudioPluginInstance*> (node->getProcessor());
if (plugin == 0)
if (plugin == nullptr)
{
jassertfalse
return 0;
return nullptr;
}
XmlElement* e = new XmlElement ("FILTER");
@@ -340,19 +340,19 @@ void FilterGraph::createNodeFromXml (const XmlElement& xml)
AudioPluginInstance* instance
= AudioPluginFormatManager::getInstance()->createPluginInstance (pd, errorMessage);
if (instance == 0)
if (instance == nullptr)
{
// xxx handle ins + outs
}
if (instance == 0)
if (instance == nullptr)
return;
AudioProcessorGraph::Node::Ptr node (graph.addNode (instance, xml.getIntAttribute (T("uid"))));
const XmlElement* const state = xml.getChildByName (T("STATE"));
if (state != 0)
if (state != nullptr)
{
MemoryBlock m;
m.fromBase64Encoding (state->getAllSubText());


+ 9
- 9
extras/audio plugin host/Source/FilterGraph.h View File

@@ -71,11 +71,11 @@ public:
~FilterGraph();
//==============================================================================
AudioProcessorGraph& getGraph() throw() { return graph; }
AudioProcessorGraph& getGraph() noexcept { return graph; }
int getNumFilters() const throw();
const AudioProcessorGraph::Node::Ptr getNode (const int index) const throw();
const AudioProcessorGraph::Node::Ptr getNodeForId (const uint32 uid) const throw();
int getNumFilters() const noexcept;
const AudioProcessorGraph::Node::Ptr getNode (const int index) const noexcept;
const AudioProcessorGraph::Node::Ptr getNodeForId (const uint32 uid) const noexcept;
void addFilter (const PluginDescription* desc, double x, double y);
@@ -88,14 +88,14 @@ public:
void getNodePosition (const int nodeId, double& x, double& y) const;
//==============================================================================
int getNumConnections() const throw();
const AudioProcessorGraph::Connection* getConnection (const int index) const throw();
int getNumConnections() const noexcept;
const AudioProcessorGraph::Connection* getConnection (const int index) const noexcept;
const AudioProcessorGraph::Connection* getConnectionBetween (uint32 sourceFilterUID, int sourceFilterChannel,
uint32 destFilterUID, int destFilterChannel) const throw();
uint32 destFilterUID, int destFilterChannel) const noexcept;
bool canConnect (uint32 sourceFilterUID, int sourceFilterChannel,
uint32 destFilterUID, int destFilterChannel) const throw();
uint32 destFilterUID, int destFilterChannel) const noexcept;
bool addConnection (uint32 sourceFilterUID, int sourceFilterChannel,
uint32 destFilterUID, int destFilterChannel);
@@ -130,7 +130,7 @@ private:
AudioProcessorPlayer player;
uint32 lastUID;
uint32 getNextUID() throw();
uint32 getNextUID() noexcept;
void createNodeFromXml (const XmlElement& xml);


+ 44
- 44
extras/audio plugin host/Source/GraphEditorPanel.cpp View File

@@ -73,13 +73,13 @@ PluginWindow* PluginWindow::getWindowFor (AudioProcessorGraph::Node* node,
&& activePluginWindows.getUnchecked(i)->isGeneric == useGenericView)
return activePluginWindows.getUnchecked(i);
AudioProcessorEditor* ui = 0;
AudioProcessorEditor* ui = nullptr;
if (! useGenericView)
{
ui = node->getProcessor()->createEditorIfNeeded();
if (ui == 0)
if (ui == nullptr)
useGenericView = true;
}
@@ -88,17 +88,17 @@ PluginWindow* PluginWindow::getWindowFor (AudioProcessorGraph::Node* node,
ui = new GenericAudioProcessorEditor (node->getProcessor());
}
if (ui != 0)
if (ui != nullptr)
{
AudioPluginInstance* const plugin = dynamic_cast <AudioPluginInstance*> (node->getProcessor());
if (plugin != 0)
if (plugin != nullptr)
ui->setName (plugin->getName());
return new PluginWindow (ui, node, useGenericView);
}
return 0;
return nullptr;
}
PluginWindow::~PluginWindow()
@@ -132,7 +132,7 @@ public:
{
const AudioProcessorGraph::Node::Ptr node (graph.getNodeForId (filterID_));
if (node != 0)
if (node != nullptr)
{
String tip;
@@ -195,9 +195,9 @@ public:
private:
FilterGraph& graph;
GraphEditorPanel* getGraphPanel() const throw()
GraphEditorPanel* getGraphPanel() const noexcept
{
return findParentComponentOfClass ((GraphEditorPanel*) 0);
return findParentComponentOfClass ((GraphEditorPanel*) nullptr);
}
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (PinComponent);
@@ -259,11 +259,11 @@ public:
{
AudioProcessorGraph::Node::Ptr f (graph.getNodeForId (filterID));
if (f != 0)
if (f != nullptr)
{
PluginWindow* const w = PluginWindow::getWindowFor (f, r == 4);
if (w != 0)
if (w != nullptr)
w->toFront (true);
}
}
@@ -276,8 +276,8 @@ public:
{
Point<int> pos (originalPos + Point<int> (e.getDistanceFromDragStartX(), e.getDistanceFromDragStartY()));
if (getParentComponent() != 0)
pos = getParentComponent()->getLocalPoint (0, pos);
if (getParentComponent() != nullptr)
pos = getParentComponent()->getLocalPoint (nullptr, pos);
graph.setNodePosition (filterID,
(pos.getX() + getWidth() / 2) / (double) getParentWidth(),
@@ -293,11 +293,11 @@ public:
{
const AudioProcessorGraph::Node::Ptr f (graph.getNodeForId (filterID));
if (f != 0)
if (f != nullptr)
{
PluginWindow* const w = PluginWindow::getWindowFor (f, false);
if (w != 0)
if (w != nullptr)
w->toFront (true);
}
}
@@ -343,7 +343,7 @@ public:
{
PinComponent* const pc = dynamic_cast <PinComponent*> (getChildComponent(i));
if (pc != 0)
if (pc != nullptr)
{
const int total = pc->isInput ? numIns : numOuts;
const int index = pc->index == FilterGraph::midiChannelNumber ? (total - 1) : pc->index;
@@ -361,7 +361,7 @@ public:
{
PinComponent* const pc = dynamic_cast <PinComponent*> (getChildComponent(i));
if (pc != 0 && pc->index == index && isInput == pc->isInput)
if (pc != nullptr && pc->index == index && isInput == pc->isInput)
{
x = getX() + pc->getX() + pc->getWidth() * 0.5f;
y = getY() + pc->getY() + pc->getHeight() * 0.5f;
@@ -374,7 +374,7 @@ public:
{
const AudioProcessorGraph::Node::Ptr f (graph.getNodeForId (filterID));
if (f == 0)
if (f == nullptr)
{
delete this;
return;
@@ -443,9 +443,9 @@ private:
int numIns, numOuts;
DropShadowEffect shadow;
GraphEditorPanel* getGraphPanel() const throw()
GraphEditorPanel* getGraphPanel() const noexcept
{
return findParentComponentOfClass ((GraphEditorPanel*) 0);
return findParentComponentOfClass ((GraphEditorPanel*) nullptr);
}
FilterComponent (const FilterComponent&);
@@ -550,16 +550,16 @@ public:
GraphEditorPanel* const hostPanel = getGraphPanel();
if (hostPanel != 0)
if (hostPanel != nullptr)
{
FilterComponent* srcFilterComp = hostPanel->getComponentForFilter (sourceFilterID);
if (srcFilterComp != 0)
if (srcFilterComp != nullptr)
srcFilterComp->getPinPos (sourceFilterChannel, false, x1, y1);
FilterComponent* dstFilterComp = hostPanel->getComponentForFilter (destFilterID);
if (dstFilterComp != 0)
if (dstFilterComp != nullptr)
dstFilterComp->getPinPos (destFilterChannel, true, x2, y2);
}
}
@@ -681,9 +681,9 @@ private:
Path linePath, hitPath;
bool dragging;
GraphEditorPanel* getGraphPanel() const throw()
GraphEditorPanel* getGraphPanel() const noexcept
{
return findParentComponentOfClass ((GraphEditorPanel*) 0);
return findParentComponentOfClass ((GraphEditorPanel*) nullptr);
}
void getDistancesFromEnds (int x, int y, double& distanceFromStart, double& distanceFromEnd) const
@@ -702,7 +702,7 @@ private:
//==============================================================================
GraphEditorPanel::GraphEditorPanel (FilterGraph& graph_)
: graph (graph_),
draggingConnector (0)
draggingConnector (nullptr)
{
graph.addChangeListener (this);
setOpaque (true);
@@ -726,9 +726,9 @@ void GraphEditorPanel::mouseDown (const MouseEvent& e)
{
PopupMenu m;
MainHostWindow* const mainWindow = findParentComponentOfClass ((MainHostWindow*) 0);
MainHostWindow* const mainWindow = findParentComponentOfClass ((MainHostWindow*) nullptr);
if (mainWindow != 0)
if (mainWindow != nullptr)
{
mainWindow->addPluginsToMenu (m);
@@ -750,11 +750,11 @@ FilterComponent* GraphEditorPanel::getComponentForFilter (const uint32 filterID)
{
FilterComponent* const fc = dynamic_cast <FilterComponent*> (getChildComponent (i));
if (fc != 0 && fc->filterID == filterID)
if (fc != nullptr && fc->filterID == filterID)
return fc;
}
return 0;
return nullptr;
}
ConnectorComponent* GraphEditorPanel::getComponentForConnection (const AudioProcessorGraph::Connection& conn) const
@@ -763,7 +763,7 @@ ConnectorComponent* GraphEditorPanel::getComponentForConnection (const AudioProc
{
ConnectorComponent* const c = dynamic_cast <ConnectorComponent*> (getChildComponent (i));
if (c != 0
if (c != nullptr
&& c->sourceFilterID == conn.sourceNodeId
&& c->destFilterID == conn.destNodeId
&& c->sourceFilterChannel == conn.sourceChannelIndex
@@ -773,7 +773,7 @@ ConnectorComponent* GraphEditorPanel::getComponentForConnection (const AudioProc
}
}
return 0;
return nullptr;
}
PinComponent* GraphEditorPanel::findPinAt (const int x, const int y) const
@@ -782,18 +782,18 @@ PinComponent* GraphEditorPanel::findPinAt (const int x, const int y) const
{
FilterComponent* const fc = dynamic_cast <FilterComponent*> (getChildComponent (i));
if (fc != 0)
if (fc != nullptr)
{
PinComponent* const pin
= dynamic_cast <PinComponent*> (fc->getComponentAt (x - fc->getX(),
y - fc->getY()));
if (pin != 0)
if (pin != nullptr)
return pin;
}
}
return 0;
return nullptr;
}
void GraphEditorPanel::resized()
@@ -813,7 +813,7 @@ void GraphEditorPanel::updateComponents()
{
FilterComponent* const fc = dynamic_cast <FilterComponent*> (getChildComponent (i));
if (fc != 0)
if (fc != nullptr)
fc->update();
}
@@ -821,10 +821,10 @@ void GraphEditorPanel::updateComponents()
{
ConnectorComponent* const cc = dynamic_cast <ConnectorComponent*> (getChildComponent (i));
if (cc != 0 && cc != draggingConnector)
if (cc != nullptr && cc != draggingConnector)
{
if (graph.getConnectionBetween (cc->sourceFilterID, cc->sourceFilterChannel,
cc->destFilterID, cc->destFilterChannel) == 0)
cc->destFilterID, cc->destFilterChannel) == nullptr)
{
delete cc;
}
@@ -869,7 +869,7 @@ void GraphEditorPanel::beginConnectorDrag (const uint32 sourceFilterID, const in
delete draggingConnector;
draggingConnector = dynamic_cast <ConnectorComponent*> (e.originalComponent);
if (draggingConnector == 0)
if (draggingConnector == nullptr)
draggingConnector = new ConnectorComponent (graph);
draggingConnector->setInput (sourceFilterID, sourceFilterChannel);
@@ -885,7 +885,7 @@ void GraphEditorPanel::dragConnector (const MouseEvent& e)
{
const MouseEvent e2 (e.getEventRelativeTo (this));
if (draggingConnector != 0)
if (draggingConnector != nullptr)
{
draggingConnector->setTooltip (String::empty);
@@ -894,7 +894,7 @@ void GraphEditorPanel::dragConnector (const MouseEvent& e)
PinComponent* const pin = findPinAt (x, y);
if (pin != 0)
if (pin != nullptr)
{
uint32 srcFilter = draggingConnector->sourceFilterID;
int srcChannel = draggingConnector->sourceFilterChannel;
@@ -930,7 +930,7 @@ void GraphEditorPanel::dragConnector (const MouseEvent& e)
void GraphEditorPanel::endDraggingConnector (const MouseEvent& e)
{
if (draggingConnector == 0)
if (draggingConnector == nullptr)
return;
draggingConnector->setTooltip (String::empty);
@@ -946,7 +946,7 @@ void GraphEditorPanel::endDraggingConnector (const MouseEvent& e)
PinComponent* const pin = findPinAt (e2.x, e2.y);
if (pin != 0)
if (pin != nullptr)
{
if (srcFilter == 0)
{
@@ -994,7 +994,7 @@ public:
String newTip;
if (ttc != 0 && ! (underMouse->isMouseButtonDown() || underMouse->isCurrentlyBlockedByAnotherModalComponent()))
if (ttc != nullptr && ! (underMouse->isMouseButtonDown() || underMouse->isCurrentlyBlockedByAnotherModalComponent()))
newTip = ttc->getTooltip();
if (newTip != tip)
@@ -1038,7 +1038,7 @@ GraphDocumentComponent::~GraphDocumentComponent()
deleteAllChildren();
graphPlayer.setProcessor (0);
graphPlayer.setProcessor (nullptr);
keyState.removeListener (&graphPlayer.getMidiMessageCollector());
graph.clear();


+ 1
- 1
extras/browser plugins/wrapper/juce_ActiveX_GlueCode.cpp View File

@@ -148,7 +148,7 @@ public:
private:
StringPool identifierPool;
static DISPID getHashFromString (const String::CharPointerType& s) throw()
static DISPID getHashFromString (const String::CharPointerType& s) noexcept
{
return (DISPID) (pointer_sized_int) s.getAddress();
}


+ 1
- 1
extras/browser plugins/wrapper/juce_NPAPI_GlueCode.cpp View File

@@ -539,7 +539,7 @@ public:
};
//==============================================================================
static NPIdentifier getIdentifierFromString (const var::identifier& s) throw()
static NPIdentifier getIdentifierFromString (const var::identifier& s) noexcept
{
return browser.getstringidentifier (s.toString().toUTF8());
}


+ 140
- 27
juce_amalgamated.cpp View File

@@ -22716,6 +22716,7 @@ const StringPairArray WavAudioFormat::createBWAVMetadata (const String& descript

namespace WavFileHelpers
{
inline int chunkName (const char* const name) noexcept { return (int) ByteOrder::littleEndianInt (name); }

#if JUCE_MSVC
#pragma pack (push, 1)
@@ -22854,7 +22855,7 @@ struct SMPLChunk
MemoryBlock data ((sizeNeeded + 3) & ~3);
data.fillWith (0);

SMPLChunk* s = (SMPLChunk*) data.getData();
SMPLChunk* const s = static_cast <SMPLChunk*> (data.getData());

// Allow these calls to overwrite an extra byte at the end, which is fine as long
// as they get called in the right order..
@@ -22883,6 +22884,73 @@ struct SMPLChunk
}
} PACKED;

struct CueChunk
{
struct Cue
{
uint32 identifier;
uint32 order;
uint32 chunkID;
uint32 chunkStart;
uint32 blockStart;
uint32 offset;
} PACKED;

uint32 numCues;
Cue cues[1];

void copyTo (StringPairArray& values, const int totalSize) const
{
values.set ("NumCuePoints", String (ByteOrder::swapIfBigEndian (numCues)));

for (uint32 i = 0; i < numCues; ++i)
{
if ((uint8*) (cues + (i + 1)) > ((uint8*) this) + totalSize)
break;

const String prefix ("Cue" + String(i));
values.set (prefix + "Identifier", String (ByteOrder::swapIfBigEndian (cues[i].identifier)));
values.set (prefix + "Order", String (ByteOrder::swapIfBigEndian (cues[i].order)));
values.set (prefix + "ChunkID", String (ByteOrder::swapIfBigEndian (cues[i].chunkID)));
values.set (prefix + "ChunkStart", String (ByteOrder::swapIfBigEndian (cues[i].chunkStart)));
values.set (prefix + "BlockStart", String (ByteOrder::swapIfBigEndian (cues[i].blockStart)));
values.set (prefix + "Offset", String (ByteOrder::swapIfBigEndian (cues[i].offset)));
}
}

static MemoryBlock createFrom (const StringPairArray& values)
{
const int numCues = values.getValue ("NumCuePoints", "0").getIntValue();

if (numCues <= 0)
return MemoryBlock();

const size_t sizeNeeded = sizeof (CueChunk) + (numCues - 1) * sizeof (Cue);
MemoryBlock data ((sizeNeeded + 3) & ~3);
data.fillWith (0);

CueChunk* const c = static_cast <CueChunk*> (data.getData());

c->numCues = ByteOrder::swapIfBigEndian ((uint32) numCues);

const String dataChunkID (chunkName ("data"));

for (int i = 0; i < numCues; ++i)
{
const String prefix ("Cue" + String(i));
c->cues[i].identifier = ByteOrder::swapIfBigEndian ((uint32) values.getValue (prefix + "Identifier", "0").getIntValue());
c->cues[i].order = ByteOrder::swapIfBigEndian ((uint32) values.getValue (prefix + "Order", "0").getIntValue());
c->cues[i].chunkID = ByteOrder::swapIfBigEndian ((uint32) values.getValue (prefix + "ChunkID", dataChunkID).getIntValue());
c->cues[i].chunkStart = ByteOrder::swapIfBigEndian ((uint32) values.getValue (prefix + "ChunkStart", "0").getIntValue());
c->cues[i].blockStart = ByteOrder::swapIfBigEndian ((uint32) values.getValue (prefix + "BlockStart", "0").getIntValue());
c->cues[i].offset = ByteOrder::swapIfBigEndian ((uint32) values.getValue (prefix + "Offset", "0").getIntValue());
}

return data;
}

} PACKED;

struct ExtensibleWavSubFormat
{
uint32 data1;
@@ -22907,8 +22975,6 @@ struct DataSize64Chunk // chunk ID = 'ds64' if data size > 0xffffffff, 'JUNK'
#endif

#undef PACKED

inline int chunkName (const char* const name) { return (int) ByteOrder::littleEndianInt (name); }
}

class WavAudioFormatReader : public AudioFormatReader
@@ -23026,7 +23092,6 @@ public:
}
else if (chunkType == chunkName ("data"))
{
// get the data chunk's position
if (! isRF64) // data size is expected to be -1, actual data size is in ds64 chunk
dataLength = length;

@@ -23040,7 +23105,6 @@ public:
bwavChunkStart = input->getPosition();
bwavSize = length;

// Broadcast-wav extension chunk..
HeapBlock <BWAVChunk> bwav;
bwav.calloc (jmax ((size_t) length + 1, sizeof (BWAVChunk)), 1);
input->read (bwav, length);
@@ -23053,6 +23117,13 @@ public:
input->read (smpl, length);
smpl->copyTo (metadataValues, length);
}
else if (chunkType == chunkName ("cue "))
{
HeapBlock <CueChunk> cue;
cue.calloc (jmax ((size_t) length + 1, sizeof (CueChunk)), 1);
input->read (cue, length);
cue->copyTo (metadataValues, length);
}
else if (chunkEnd <= input->getPosition())
{
break;
@@ -23143,6 +23214,7 @@ public:
{
bwavChunk = BWAVChunk::createFrom (metadataValues);
smplChunk = SMPLChunk::createFrom (metadataValues);
cueChunk = CueChunk ::createFrom (metadataValues);
}

headerPosition = out->getPosition();
@@ -23199,7 +23271,7 @@ public:

private:
ScopedPointer<AudioData::Converter> converter;
MemoryBlock tempBlock, bwavChunk, smplChunk;
MemoryBlock tempBlock, bwavChunk, smplChunk, cueChunk;
uint64 lengthInSamples, bytesWritten;
int64 headerPosition;
bool writeFailed;
@@ -23238,6 +23310,7 @@ private:
+ 8 + audioDataSize + (audioDataSize & 1)
+ (bwavChunk.getSize() > 0 ? (8 + bwavChunk.getSize()) : 0)
+ (smplChunk.getSize() > 0 ? (8 + smplChunk.getSize()) : 0)
+ (cueChunk .getSize() > 0 ? (8 + cueChunk .getSize()) : 0)
+ (8 + 28); // (ds64 chunk)

riffChunkSize += (riffChunkSize & 0x1);
@@ -23316,6 +23389,13 @@ private:
output->write (smplChunk.getData(), (int) smplChunk.getSize());
}

if (cueChunk.getSize() > 0)
{
output->writeInt (chunkName ("cue "));
output->writeInt ((int) cueChunk.getSize());
output->write (cueChunk.getData(), (int) cueChunk.getSize());
}

output->writeInt (chunkName ("data"));
output->writeInt (isRF64 ? -1 : (int) (lengthInSamples * bytesPerFrame));

@@ -242212,16 +242292,17 @@ static void juce_getCpuVendor (char* const v)
{
int vendor[4] = { 0 };

#ifdef JUCE_64BIT
#else
#if JUCE_64BIT
/// xxx todo
#else
#ifndef __MINGW32__
__try
#endif
{
#if JUCE_GCC
#if JUCE_GCC
unsigned int dummy = 0;
__asm__ ("cpuid" : "=a" (dummy), "=b" (vendor[0]), "=c" (vendor[2]),"=d" (vendor[1]) : "a" (0));
#else
#else
__asm
{
mov eax, 0
@@ -242230,15 +242311,15 @@ static void juce_getCpuVendor (char* const v)
mov [vendor + 4], edx
mov [vendor + 8], ecx
}
#endif
#endif
}
#ifndef __MINGW32__
#ifndef __MINGW32__
__except (EXCEPTION_EXECUTE_HANDLER)
{
*v = 0;
}
#endif
#endif
#endif
#endif

memcpy (v, vendor, 16);
}
@@ -242256,11 +242337,11 @@ void SystemStats::initialiseStats()
cpuFlags.hasMMX = IsProcessorFeaturePresent (PF_MMX_INSTRUCTIONS_AVAILABLE) != 0;
cpuFlags.hasSSE = IsProcessorFeaturePresent (PF_XMMI_INSTRUCTIONS_AVAILABLE) != 0;
cpuFlags.hasSSE2 = IsProcessorFeaturePresent (PF_XMMI64_INSTRUCTIONS_AVAILABLE) != 0;
#ifdef PF_AMD3D_INSTRUCTIONS_AVAILABLE
#ifdef PF_AMD3D_INSTRUCTIONS_AVAILABLE
cpuFlags.has3DNow = IsProcessorFeaturePresent (PF_AMD3D_INSTRUCTIONS_AVAILABLE) != 0;
#else
#else
cpuFlags.has3DNow = IsProcessorFeaturePresent (PF_3DNOW_INSTRUCTIONS_AVAILABLE) != 0;
#endif
#endif

{
SYSTEM_INFO systemInfo;
@@ -242279,9 +242360,9 @@ void SystemStats::initialiseStats()
(void) res;
jassert (res == TIMERR_NOERROR);

#if JUCE_MSVC && JUCE_CHECK_MEMORY_LEAKS
#if JUCE_MSVC && JUCE_CHECK_MEMORY_LEAKS
_CrtSetDbgFlag (_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
#endif
#endif
}

SystemStats::OperatingSystemType SystemStats::getOperatingSystemType()
@@ -242327,9 +242408,9 @@ const String SystemStats::getOperatingSystemName()

bool SystemStats::isOperatingSystem64Bit()
{
#ifdef _WIN64
#ifdef _WIN64
return true;
#else
#else
typedef BOOL (WINAPI* LPFN_ISWOW64PROCESS) (HANDLE, PBOOL);

LPFN_ISWOW64PROCESS fnIsWow64Process = (LPFN_ISWOW64PROCESS) GetProcAddress (GetModuleHandle (L"kernel32"), "IsWow64Process");
@@ -242339,7 +242420,7 @@ bool SystemStats::isOperatingSystem64Bit()
return (fnIsWow64Process != 0)
&& fnIsWow64Process (GetCurrentProcess(), &isWow64)
&& (isWow64 != FALSE);
#endif
#endif
}

int SystemStats::getMemorySizeInMegabytes()
@@ -242386,11 +242467,11 @@ int64 Time::getHighResolutionTicksPerSecond() noexcept

static int64 juce_getClockCycleCounter() noexcept
{
#if JUCE_USE_INTRINSICS
#if JUCE_USE_INTRINSICS
// MS intrinsics version...
return __rdtsc();

#elif JUCE_GCC
#elif JUCE_GCC
// GNU inline asm version...
unsigned int hi = 0, lo = 0;

@@ -242406,7 +242487,7 @@ static int64 juce_getClockCycleCounter() noexcept
: "cc", "eax", "ebx", "ecx", "edx", "memory");

return (int64) ((((uint64) hi) << 32) | lo);
#else
#else
// MSVC inline asm version...
unsigned int hi = 0, lo = 0;

@@ -242420,7 +242501,7 @@ static int64 juce_getClockCycleCounter() noexcept
}

return (int64) ((((uint64) hi) << 32) | lo);
#endif
#endif
}

int SystemStats::getCpuSpeedInMegaherz()
@@ -242479,7 +242560,7 @@ int SystemStats::getPageSize()
const String SystemStats::getLogonName()
{
TCHAR text [256] = { 0 };
DWORD len = numElementsInArray (text) - 2;
DWORD len = numElementsInArray (text) - 1;
GetUserName (text, &len);
return String (text, len);
}
@@ -242489,6 +242570,14 @@ const String SystemStats::getFullUserName()
return getLogonName();
}

const String SystemStats::getComputerName()
{
TCHAR text [MAX_COMPUTERNAME_LENGTH + 1] = { 0 };
DWORD len = numElementsInArray (text) - 1;
GetComputerName (text, &len);
return String (text, len);
}

#endif
/*** End of inlined file: juce_win32_SystemStats.cpp ***/

@@ -260274,6 +260363,15 @@ const String SystemStats::getFullUserName()
return getLogonName();
}

const String SystemStats::getComputerName()
{
char name [256] = { 0 };
if (gethostname (name, sizeof (name) - 1) == 0)
return name;

return String::empty;
}

void SystemStats::initialiseStats()
{
const String flags (LinuxStatsHelpers::getCpuInfo ("flags"));
@@ -267642,6 +267740,12 @@ const String SystemStats::getFullUserName()
return nsStringToJuce (NSFullUserName());
}

const String SystemStats::getComputerName()
{
return nsStringToJuce ([[NSProcessInfo processInfo] hostName])
.upToLastOccurrenceOf (".local", false, true);
}

uint32 juce_millisecondsSinceStartup() noexcept
{
return (uint32) (mach_absolute_time() * SystemStatsHelpers::highResTimerToMillisecRatio);
@@ -284701,6 +284805,15 @@ const String SystemStats::getFullUserName()
return getLogonName();
}

const String SystemStats::getComputerName()
{
char name [256] = { 0 };
if (gethostname (name, sizeof (name) - 1) == 0)
return name;

return String::empty;
}

void SystemStats::initialiseStats()
{
// TODO


+ 3
- 0
juce_amalgamated.h View File

@@ -18160,6 +18160,9 @@ public:
*/
static const String getFullUserName();

/** Returns the host-name of the computer. */
static const String getComputerName();

// CPU and memory information..

/** Returns the approximate CPU speed.


+ 87
- 6
src/audio/audio_file_formats/juce_WavAudioFormat.cpp View File

@@ -71,6 +71,7 @@ const StringPairArray WavAudioFormat::createBWAVMetadata (const String& descript
//==============================================================================
namespace WavFileHelpers
{
inline int chunkName (const char* const name) noexcept { return (int) ByteOrder::littleEndianInt (name); }
#if JUCE_MSVC
#pragma pack (push, 1)
@@ -211,7 +212,7 @@ struct SMPLChunk
MemoryBlock data ((sizeNeeded + 3) & ~3);
data.fillWith (0);
SMPLChunk* s = (SMPLChunk*) data.getData();
SMPLChunk* const s = static_cast <SMPLChunk*> (data.getData());
// Allow these calls to overwrite an extra byte at the end, which is fine as long
// as they get called in the right order..
@@ -240,7 +241,75 @@ struct SMPLChunk
}
} PACKED;
//==============================================================================
struct CueChunk
{
struct Cue
{
uint32 identifier;
uint32 order;
uint32 chunkID;
uint32 chunkStart;
uint32 blockStart;
uint32 offset;
} PACKED;
uint32 numCues;
Cue cues[1];
void copyTo (StringPairArray& values, const int totalSize) const
{
values.set ("NumCuePoints", String (ByteOrder::swapIfBigEndian (numCues)));
for (uint32 i = 0; i < numCues; ++i)
{
if ((uint8*) (cues + (i + 1)) > ((uint8*) this) + totalSize)
break;
const String prefix ("Cue" + String(i));
values.set (prefix + "Identifier", String (ByteOrder::swapIfBigEndian (cues[i].identifier)));
values.set (prefix + "Order", String (ByteOrder::swapIfBigEndian (cues[i].order)));
values.set (prefix + "ChunkID", String (ByteOrder::swapIfBigEndian (cues[i].chunkID)));
values.set (prefix + "ChunkStart", String (ByteOrder::swapIfBigEndian (cues[i].chunkStart)));
values.set (prefix + "BlockStart", String (ByteOrder::swapIfBigEndian (cues[i].blockStart)));
values.set (prefix + "Offset", String (ByteOrder::swapIfBigEndian (cues[i].offset)));
}
}
static MemoryBlock createFrom (const StringPairArray& values)
{
const int numCues = values.getValue ("NumCuePoints", "0").getIntValue();
if (numCues <= 0)
return MemoryBlock();
const size_t sizeNeeded = sizeof (CueChunk) + (numCues - 1) * sizeof (Cue);
MemoryBlock data ((sizeNeeded + 3) & ~3);
data.fillWith (0);
CueChunk* const c = static_cast <CueChunk*> (data.getData());
c->numCues = ByteOrder::swapIfBigEndian ((uint32) numCues);
const String dataChunkID (chunkName ("data"));
for (int i = 0; i < numCues; ++i)
{
const String prefix ("Cue" + String(i));
c->cues[i].identifier = ByteOrder::swapIfBigEndian ((uint32) values.getValue (prefix + "Identifier", "0").getIntValue());
c->cues[i].order = ByteOrder::swapIfBigEndian ((uint32) values.getValue (prefix + "Order", "0").getIntValue());
c->cues[i].chunkID = ByteOrder::swapIfBigEndian ((uint32) values.getValue (prefix + "ChunkID", dataChunkID).getIntValue());
c->cues[i].chunkStart = ByteOrder::swapIfBigEndian ((uint32) values.getValue (prefix + "ChunkStart", "0").getIntValue());
c->cues[i].blockStart = ByteOrder::swapIfBigEndian ((uint32) values.getValue (prefix + "BlockStart", "0").getIntValue());
c->cues[i].offset = ByteOrder::swapIfBigEndian ((uint32) values.getValue (prefix + "Offset", "0").getIntValue());
}
return data;
}
} PACKED;
//==============================================================================
struct ExtensibleWavSubFormat
{
uint32 data1;
@@ -266,8 +335,6 @@ struct DataSize64Chunk // chunk ID = 'ds64' if data size > 0xffffffff, 'JUNK'
#endif
#undef PACKED
inline int chunkName (const char* const name) { return (int) ByteOrder::littleEndianInt (name); }
}
@@ -387,7 +454,6 @@ public:
}
else if (chunkType == chunkName ("data"))
{
// get the data chunk's position
if (! isRF64) // data size is expected to be -1, actual data size is in ds64 chunk
dataLength = length;
@@ -401,7 +467,6 @@ public:
bwavChunkStart = input->getPosition();
bwavSize = length;
// Broadcast-wav extension chunk..
HeapBlock <BWAVChunk> bwav;
bwav.calloc (jmax ((size_t) length + 1, sizeof (BWAVChunk)), 1);
input->read (bwav, length);
@@ -414,6 +479,13 @@ public:
input->read (smpl, length);
smpl->copyTo (metadataValues, length);
}
else if (chunkType == chunkName ("cue "))
{
HeapBlock <CueChunk> cue;
cue.calloc (jmax ((size_t) length + 1, sizeof (CueChunk)), 1);
input->read (cue, length);
cue->copyTo (metadataValues, length);
}
else if (chunkEnd <= input->getPosition())
{
break;
@@ -506,6 +578,7 @@ public:
{
bwavChunk = BWAVChunk::createFrom (metadataValues);
smplChunk = SMPLChunk::createFrom (metadataValues);
cueChunk = CueChunk ::createFrom (metadataValues);
}
headerPosition = out->getPosition();
@@ -563,7 +636,7 @@ public:
private:
ScopedPointer<AudioData::Converter> converter;
MemoryBlock tempBlock, bwavChunk, smplChunk;
MemoryBlock tempBlock, bwavChunk, smplChunk, cueChunk;
uint64 lengthInSamples, bytesWritten;
int64 headerPosition;
bool writeFailed;
@@ -602,6 +675,7 @@ private:
+ 8 + audioDataSize + (audioDataSize & 1)
+ (bwavChunk.getSize() > 0 ? (8 + bwavChunk.getSize()) : 0)
+ (smplChunk.getSize() > 0 ? (8 + smplChunk.getSize()) : 0)
+ (cueChunk .getSize() > 0 ? (8 + cueChunk .getSize()) : 0)
+ (8 + 28); // (ds64 chunk)
riffChunkSize += (riffChunkSize & 0x1);
@@ -680,6 +754,13 @@ private:
output->write (smplChunk.getData(), (int) smplChunk.getSize());
}
if (cueChunk.getSize() > 0)
{
output->writeInt (chunkName ("cue "));
output->writeInt ((int) cueChunk.getSize());
output->write (cueChunk.getData(), (int) cueChunk.getSize());
}
output->writeInt (chunkName ("data"));
output->writeInt (isRF64 ? -1 : (int) (lengthInSamples * bytesPerFrame));


+ 3
- 0
src/core/juce_SystemStats.h View File

@@ -99,6 +99,9 @@ public:
*/
static const String getFullUserName();
/** Returns the host-name of the computer. */
static const String getComputerName();
//==============================================================================
// CPU and memory information..


+ 9
- 0
src/native/android/juce_android_SystemStats.cpp View File

@@ -105,6 +105,15 @@ const String SystemStats::getFullUserName()
return getLogonName();
}
const String SystemStats::getComputerName()
{
char name [256] = { 0 };
if (gethostname (name, sizeof (name) - 1) == 0)
return name;
return String::empty;
}
//==============================================================================
void SystemStats::initialiseStats()
{


+ 9
- 0
src/native/linux/juce_linux_SystemStats.cpp View File

@@ -116,6 +116,15 @@ const String SystemStats::getFullUserName()
return getLogonName();
}
const String SystemStats::getComputerName()
{
char name [256] = { 0 };
if (gethostname (name, sizeof (name) - 1) == 0)
return name;
return String::empty;
}
//==============================================================================
void SystemStats::initialiseStats()
{


+ 6
- 0
src/native/mac/juce_mac_SystemStats.mm View File

@@ -182,6 +182,12 @@ const String SystemStats::getFullUserName()
return nsStringToJuce (NSFullUserName());
}
const String SystemStats::getComputerName()
{
return nsStringToJuce ([[NSProcessInfo processInfo] hostName])
.upToLastOccurrenceOf (".local", false, true);
}
//==============================================================================
uint32 juce_millisecondsSinceStartup() noexcept
{


+ 29
- 22
src/native/windows/juce_win32_SystemStats.cpp View File

@@ -69,16 +69,17 @@ static void juce_getCpuVendor (char* const v)
{
int vendor[4] = { 0 };
#ifdef JUCE_64BIT
#else
#if JUCE_64BIT
/// xxx todo
#else
#ifndef __MINGW32__
__try
#endif
{
#if JUCE_GCC
#if JUCE_GCC
unsigned int dummy = 0;
__asm__ ("cpuid" : "=a" (dummy), "=b" (vendor[0]), "=c" (vendor[2]),"=d" (vendor[1]) : "a" (0));
#else
#else
__asm
{
mov eax, 0
@@ -87,15 +88,15 @@ static void juce_getCpuVendor (char* const v)
mov [vendor + 4], edx
mov [vendor + 8], ecx
}
#endif
#endif
}
#ifndef __MINGW32__
#ifndef __MINGW32__
__except (EXCEPTION_EXECUTE_HANDLER)
{
*v = 0;
}
#endif
#endif
#endif
#endif
memcpy (v, vendor, 16);
}
@@ -115,11 +116,11 @@ void SystemStats::initialiseStats()
cpuFlags.hasMMX = IsProcessorFeaturePresent (PF_MMX_INSTRUCTIONS_AVAILABLE) != 0;
cpuFlags.hasSSE = IsProcessorFeaturePresent (PF_XMMI_INSTRUCTIONS_AVAILABLE) != 0;
cpuFlags.hasSSE2 = IsProcessorFeaturePresent (PF_XMMI64_INSTRUCTIONS_AVAILABLE) != 0;
#ifdef PF_AMD3D_INSTRUCTIONS_AVAILABLE
#ifdef PF_AMD3D_INSTRUCTIONS_AVAILABLE
cpuFlags.has3DNow = IsProcessorFeaturePresent (PF_AMD3D_INSTRUCTIONS_AVAILABLE) != 0;
#else
#else
cpuFlags.has3DNow = IsProcessorFeaturePresent (PF_3DNOW_INSTRUCTIONS_AVAILABLE) != 0;
#endif
#endif
{
SYSTEM_INFO systemInfo;
@@ -138,9 +139,9 @@ void SystemStats::initialiseStats()
(void) res;
jassert (res == TIMERR_NOERROR);
#if JUCE_MSVC && JUCE_CHECK_MEMORY_LEAKS
#if JUCE_MSVC && JUCE_CHECK_MEMORY_LEAKS
_CrtSetDbgFlag (_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
#endif
#endif
}
//==============================================================================
@@ -187,9 +188,9 @@ const String SystemStats::getOperatingSystemName()
bool SystemStats::isOperatingSystem64Bit()
{
#ifdef _WIN64
#ifdef _WIN64
return true;
#else
#else
typedef BOOL (WINAPI* LPFN_ISWOW64PROCESS) (HANDLE, PBOOL);
LPFN_ISWOW64PROCESS fnIsWow64Process = (LPFN_ISWOW64PROCESS) GetProcAddress (GetModuleHandle (L"kernel32"), "IsWow64Process");
@@ -199,10 +200,9 @@ bool SystemStats::isOperatingSystem64Bit()
return (fnIsWow64Process != 0)
&& fnIsWow64Process (GetCurrentProcess(), &isWow64)
&& (isWow64 != FALSE);
#endif
#endif
}
//==============================================================================
int SystemStats::getMemorySizeInMegabytes()
{
@@ -249,11 +249,11 @@ int64 Time::getHighResolutionTicksPerSecond() noexcept
static int64 juce_getClockCycleCounter() noexcept
{
#if JUCE_USE_INTRINSICS
#if JUCE_USE_INTRINSICS
// MS intrinsics version...
return __rdtsc();
#elif JUCE_GCC
#elif JUCE_GCC
// GNU inline asm version...
unsigned int hi = 0, lo = 0;
@@ -269,7 +269,7 @@ static int64 juce_getClockCycleCounter() noexcept
: "cc", "eax", "ebx", "ecx", "edx", "memory");
return (int64) ((((uint64) hi) << 32) | lo);
#else
#else
// MSVC inline asm version...
unsigned int hi = 0, lo = 0;
@@ -283,7 +283,7 @@ static int64 juce_getClockCycleCounter() noexcept
}
return (int64) ((((uint64) hi) << 32) | lo);
#endif
#endif
}
int SystemStats::getCpuSpeedInMegaherz()
@@ -345,7 +345,7 @@ int SystemStats::getPageSize()
const String SystemStats::getLogonName()
{
TCHAR text [256] = { 0 };
DWORD len = numElementsInArray (text) - 2;
DWORD len = numElementsInArray (text) - 1;
GetUserName (text, &len);
return String (text, len);
}
@@ -355,5 +355,12 @@ const String SystemStats::getFullUserName()
return getLogonName();
}
const String SystemStats::getComputerName()
{
TCHAR text [MAX_COMPUTERNAME_LENGTH + 1] = { 0 };
DWORD len = numElementsInArray (text) - 1;
GetComputerName (text, &len);
return String (text, len);
}
#endif

Loading…
Cancel
Save