@@ -62,9 +62,6 @@ public: | |||
if (getInternetNeeded().toString().isEmpty()) | |||
getInternetNeeded() = true; | |||
androidDynamicLibs.add ("GLESv1_CM"); | |||
androidDynamicLibs.add ("GLESv2"); | |||
} | |||
//============================================================================== | |||
@@ -149,6 +146,8 @@ protected: | |||
AndroidBuildConfiguration (Project& project, const ValueTree& settings) | |||
: BuildConfiguration (project, settings) | |||
{ | |||
androidDynamicLibs.add ("GLESv1_CM"); | |||
androidDynamicLibs.add ("GLESv2"); | |||
} | |||
void createPropertyEditors (PropertyListBuilder& props) | |||
@@ -156,6 +155,8 @@ protected: | |||
createBasicPropertyEditors (props); | |||
} | |||
StringArray androidDynamicLibs; | |||
}; | |||
BuildConfiguration::Ptr createBuildConfig (const ValueTree& settings) const | |||
@@ -259,26 +260,40 @@ private: | |||
for (int i = 0; i < files.size(); ++i) | |||
out << " ../" << escapeSpaces (files.getReference(i).toUnixStyle()) << "\\" << newLine; | |||
String debugSettings, releaseSettings; | |||
out << newLine | |||
<< "ifeq ($(CONFIG),Debug)" << newLine | |||
<< " LOCAL_CPPFLAGS += " << createCPPFlags (true) << newLine | |||
<< "else" << newLine | |||
<< " LOCAL_CPPFLAGS += " << createCPPFlags (false) << newLine | |||
<< "endif" << newLine | |||
<< newLine | |||
<< getDynamicLibs() | |||
<< "ifeq ($(CONFIG),Debug)" << newLine; | |||
writeConfigSettings (out, true); | |||
out << "else" << newLine; | |||
writeConfigSettings (out, false); | |||
out << "endif" << newLine | |||
<< newLine | |||
<< "include $(BUILD_SHARED_LIBRARY)" << newLine; | |||
} | |||
String getDynamicLibs() | |||
void writeConfigSettings (OutputStream& out, bool forDebug) | |||
{ | |||
if (androidDynamicLibs.size() == 0) | |||
for (ConfigIterator config (*this); config.next();) | |||
{ | |||
if (config->isDebug() == forDebug) | |||
{ | |||
out << " LOCAL_CPPFLAGS += " << createCPPFlags (*config) << newLine | |||
<< getDynamicLibs (dynamic_cast <const AndroidBuildConfiguration&> (*config)); | |||
break; | |||
} | |||
} | |||
} | |||
String getDynamicLibs (const AndroidBuildConfiguration& config) | |||
{ | |||
if (config.androidDynamicLibs.size() == 0) | |||
return String::empty; | |||
String flags ("LOCAL_LDLIBS :="); | |||
for (int i = 0; i < androidDynamicLibs.size(); ++i) | |||
flags << " -l" << androidDynamicLibs[i]; | |||
String flags (" LOCAL_LDLIBS :="); | |||
for (int i = 0; i < config.androidDynamicLibs.size(); ++i) | |||
flags << " -l" << config.androidDynamicLibs[i]; | |||
return flags + newLine; | |||
} | |||
@@ -296,27 +311,16 @@ private: | |||
return flags; | |||
} | |||
String createCPPFlags (bool forDebug) | |||
String createCPPFlags (const BuildConfiguration& config) | |||
{ | |||
String flags ("-fsigned-char -fexceptions -frtti"); | |||
if (forDebug) | |||
flags << " -g"; | |||
for (ConfigIterator config (*this); config.next();) | |||
{ | |||
if (config->isDebug() == forDebug) | |||
{ | |||
flags << createIncludePathFlags (*config); | |||
break; | |||
} | |||
} | |||
StringPairArray defines; | |||
defines.set ("JUCE_ANDROID", "1"); | |||
if (forDebug) | |||
String flags ("-fsigned-char -fexceptions -frtti"); | |||
if (config.isDebug().getValue()) | |||
{ | |||
flags << " -g"; | |||
defines.set ("DEBUG", "1"); | |||
defines.set ("_DEBUG", "1"); | |||
} | |||
@@ -325,17 +329,10 @@ private: | |||
defines.set ("NDEBUG", "1"); | |||
} | |||
for (ConfigIterator config (*this); config.next();) | |||
{ | |||
if (config->isDebug() == forDebug) | |||
{ | |||
flags << " -O" << config->getGCCOptimisationFlag(); | |||
defines = mergePreprocessorDefs (defines, getAllPreprocessorDefs (*config)); | |||
break; | |||
} | |||
} | |||
flags << createIncludePathFlags (config) | |||
<< " -O" << config.getGCCOptimisationFlag(); | |||
defines = mergePreprocessorDefs (defines, getAllPreprocessorDefs (config)); | |||
return flags + createGCCPreprocessorFlags (defines); | |||
} | |||
@@ -44,7 +44,15 @@ public: | |||
getLibraryType() = 1; | |||
projectGUID = createGUID (project.getProjectUID()); | |||
msvcPreBuildCommand = getPrebuildCommand().toString(); | |||
const String oldStylePrebuildCommand (getSetting (Ids::prebuildCommand).toString()); | |||
if (oldStylePrebuildCommand.isNotEmpty()) // update an old project format.. | |||
{ | |||
for (ConfigIterator config (*this); config.next();) | |||
dynamic_cast <MSVCBuildConfiguration&> (*config).getPrebuildCommand() = oldStylePrebuildCommand; | |||
settings.removeProperty (Ids::prebuildCommand, nullptr); | |||
} | |||
} | |||
//============================================================================== | |||
@@ -61,16 +69,17 @@ public: | |||
{ | |||
const char* const libTypes[] = { "Static Library (.lib)", "Dynamic Library (.dll)", 0 }; | |||
const int libTypeValues[] = { 1, 2, 0 }; | |||
props.add (new ChoicePropertyComponent (getLibraryType(), "Library Type", StringArray (libTypes), Array<var> (libTypeValues))); | |||
props.add (new ChoicePropertyComponent (getLibraryType(), "Library Type", | |||
StringArray (libTypes), Array<var> (libTypeValues))); | |||
props.add (new TextPropertyComponent (getSetting (Ids::libraryName_Debug), "Library Name (Debug)", 128, false), | |||
"If set, this name will override the binary name specified in the configuration settings, for a debug build. You must include the .lib or .dll suffix on this filename."); | |||
"If set, this name will override the binary name specified in the configuration settings, for a debug build. " | |||
"You must include the .lib or .dll suffix on this filename."); | |||
props.add (new TextPropertyComponent (getSetting (Ids::libraryName_Release), "Library Name (Release)", 128, false), | |||
"If set, this name will override the binary name specified in the configuration settings, for a release build. You must include the .lib or .dll suffix on this filename."); | |||
"If set, this name will override the binary name specified in the configuration settings, for a release build. " | |||
"You must include the .lib or .dll suffix on this filename."); | |||
} | |||
props.add (new TextPropertyComponent (getPrebuildCommand(), "Pre-build Command", 2048, false)); | |||
} | |||
protected: | |||
@@ -81,7 +90,6 @@ protected: | |||
File getProjectFile (const String& extension) const { return getTargetFolder().getChildFile (project.getProjectFilenameRoot()).withFileExtension (extension); } | |||
Value getLibraryType() const { return getSetting (Ids::libraryType); } | |||
Value getPrebuildCommand() const { return getSetting (Ids::prebuildCommand); } | |||
bool isLibraryDLL() const { return msvcIsDLL || (projectType.isLibrary() && getLibraryType() == 2); } | |||
//============================================================================== | |||
@@ -93,11 +101,15 @@ protected: | |||
{ | |||
if (getWarningLevel() == 0) | |||
getWarningLevelValue() = 4; | |||
msvcPreBuildCommand = getPrebuildCommand().toString(); | |||
} | |||
Value getWarningLevelValue() const { return getValue (Ids::winWarningLevel); } | |||
int getWarningLevel() const { return getWarningLevelValue().getValue(); } | |||
Value getPrebuildCommand() const { return getValue (Ids::prebuildCommand); } | |||
void createPropertyEditors (PropertyListBuilder& props) | |||
{ | |||
createBasicPropertyEditors (props); | |||
@@ -107,6 +119,8 @@ protected: | |||
props.add (new ChoicePropertyComponent (getWarningLevelValue(), "Warning Level", | |||
StringArray (warningLevelNames), Array<var> (warningLevels))); | |||
props.add (new TextPropertyComponent (getPrebuildCommand(), "Pre-build Command", 2048, false)); | |||
} | |||
}; | |||
@@ -549,7 +563,7 @@ protected: | |||
return e; | |||
} | |||
void createConfig (XmlElement& xml, const BuildConfiguration& config) const | |||
void createConfig (XmlElement& xml, const MSVCBuildConfiguration& config) const | |||
{ | |||
String binariesPath (getConfigTargetPath (config)); | |||
String intermediatesPath (getIntermediatesPath (config)); | |||
@@ -569,19 +583,19 @@ protected: | |||
XmlElement* preBuildEvent = createToolElement (xml, "VCPreBuildEventTool"); | |||
if (msvcPreBuildCommand.isNotEmpty()) | |||
if (config.msvcPreBuildCommand.isNotEmpty()) | |||
{ | |||
preBuildEvent->setAttribute ("Description", "Pre-build"); | |||
preBuildEvent->setAttribute ("CommandLine", msvcPreBuildCommand); | |||
preBuildEvent->setAttribute ("CommandLine", config.msvcPreBuildCommand); | |||
} | |||
XmlElement* customBuild = createToolElement (xml, "VCCustomBuildTool"); | |||
if (msvcPostBuildCommand.isNotEmpty()) | |||
customBuild->setAttribute ("CommandLine", msvcPostBuildCommand); | |||
if (config.msvcPostBuildCommand.isNotEmpty()) | |||
customBuild->setAttribute ("CommandLine", config.msvcPostBuildCommand); | |||
if (msvcPostBuildOutputs.isNotEmpty()) | |||
customBuild->setAttribute ("Outputs", msvcPostBuildOutputs); | |||
if (config.msvcPostBuildOutputs.isNotEmpty()) | |||
customBuild->setAttribute ("Outputs", config.msvcPostBuildOutputs); | |||
createToolElement (xml, "VCXMLDataGeneratorTool"); | |||
createToolElement (xml, "VCWebServiceProxyGeneratorTool"); | |||
@@ -667,13 +681,13 @@ protected: | |||
if (msvcDelayLoadedDLLs.isNotEmpty()) | |||
linker->setAttribute ("DelayLoadDLLs", msvcDelayLoadedDLLs); | |||
if (msvcModuleDefinitionFile.isNotEmpty()) | |||
linker->setAttribute ("ModuleDefinitionFile", msvcModuleDefinitionFile); | |||
if (config.msvcModuleDefinitionFile.isNotEmpty()) | |||
linker->setAttribute ("ModuleDefinitionFile", config.msvcModuleDefinitionFile); | |||
String extraLinkerOptions (getExtraLinkerFlags().toString()); | |||
if (msvcExtraLinkerOptions.isNotEmpty()) | |||
extraLinkerOptions << ' ' << msvcExtraLinkerOptions; | |||
if (config.msvcExtraLinkerOptions.isNotEmpty()) | |||
extraLinkerOptions << ' ' << config.msvcExtraLinkerOptions; | |||
if (extraLinkerOptions.isNotEmpty()) | |||
linker->setAttribute ("AdditionalOptions", replacePreprocessorTokens (config, extraLinkerOptions).trim()); | |||
@@ -720,8 +734,9 @@ protected: | |||
void createConfigs (XmlElement& xml) | |||
{ | |||
for (ConfigIterator i (*this); i.next();) | |||
createConfig (*xml.createNewChildElement ("Configuration"), *i); | |||
for (ConfigIterator config (*this); config.next();) | |||
createConfig (*xml.createNewChildElement ("Configuration"), | |||
dynamic_cast <const MSVCBuildConfiguration&> (*config)); | |||
} | |||
//============================================================================== | |||
@@ -1218,16 +1233,18 @@ protected: | |||
} | |||
} | |||
for (ConfigIterator config (*this); config.next();) | |||
for (ConfigIterator i (*this); i.next();) | |||
{ | |||
String binariesPath (getConfigTargetPath (*config)); | |||
String intermediatesPath (getIntermediatesPath (*config)); | |||
const bool isDebug = (bool) config->isDebug().getValue(); | |||
const String binaryName (File::createLegalFileName (config->getTargetBinaryName().toString())); | |||
const String outputFileName (getBinaryFileForConfig (*config)); | |||
const MSVCBuildConfiguration& config = dynamic_cast <const MSVCBuildConfiguration&> (*i); | |||
String binariesPath (getConfigTargetPath (config)); | |||
String intermediatesPath (getIntermediatesPath (config)); | |||
const bool isDebug = (bool) config.isDebug().getValue(); | |||
const String binaryName (File::createLegalFileName (config.getTargetBinaryName().toString())); | |||
const String outputFileName (getBinaryFileForConfig (config)); | |||
XmlElement* group = projectXml.createNewChildElement ("ItemDefinitionGroup"); | |||
setConditionAttribute (*group, *config); | |||
setConditionAttribute (*group, config); | |||
{ | |||
XmlElement* midl = group->createNewChildElement ("Midl"); | |||
@@ -1244,13 +1261,13 @@ protected: | |||
cl->createNewChildElement ("Optimization")->addTextElement (isDebug ? "Disabled" : "MaxSpeed"); | |||
if (isDebug) | |||
cl->createNewChildElement ("DebugInformationFormat")->addTextElement (is64Bit (*config) ? "ProgramDatabase" | |||
: "EditAndContinue"); | |||
cl->createNewChildElement ("DebugInformationFormat")->addTextElement (is64Bit (config) ? "ProgramDatabase" | |||
: "EditAndContinue"); | |||
StringArray includePaths (getHeaderSearchPaths (*config)); | |||
StringArray includePaths (getHeaderSearchPaths (config)); | |||
includePaths.add ("%(AdditionalIncludeDirectories)"); | |||
cl->createNewChildElement ("AdditionalIncludeDirectories")->addTextElement (includePaths.joinIntoString (";")); | |||
cl->createNewChildElement ("PreprocessorDefinitions")->addTextElement (getPreprocessorDefs (*config, ";") + ";%(PreprocessorDefinitions)"); | |||
cl->createNewChildElement ("PreprocessorDefinitions")->addTextElement (getPreprocessorDefs (config, ";") + ";%(PreprocessorDefinitions)"); | |||
cl->createNewChildElement ("RuntimeLibrary")->addTextElement (msvcNeedsDLLRuntimeLib ? (isDebug ? "MultiThreadedDLLDebug" : "MultiThreadedDLL") | |||
: (isDebug ? "MultiThreadedDebug" : "MultiThreaded")); | |||
cl->createNewChildElement ("RuntimeTypeInfo")->addTextElement ("true"); | |||
@@ -1258,11 +1275,11 @@ protected: | |||
cl->createNewChildElement ("AssemblerListingLocation")->addTextElement (FileHelpers::windowsStylePath (intermediatesPath + "/")); | |||
cl->createNewChildElement ("ObjectFileName")->addTextElement (FileHelpers::windowsStylePath (intermediatesPath + "/")); | |||
cl->createNewChildElement ("ProgramDataBaseFileName")->addTextElement (FileHelpers::windowsStylePath (intermediatesPath + "/")); | |||
cl->createNewChildElement ("WarningLevel")->addTextElement ("Level" + String (getWarningLevel (*config))); | |||
cl->createNewChildElement ("WarningLevel")->addTextElement ("Level" + String (getWarningLevel (config))); | |||
cl->createNewChildElement ("SuppressStartupBanner")->addTextElement ("true"); | |||
cl->createNewChildElement ("MultiProcessorCompilation")->addTextElement ("true"); | |||
const String extraFlags (replacePreprocessorTokens (*config, getExtraCompilerFlags().toString()).trim()); | |||
const String extraFlags (replacePreprocessorTokens (config, getExtraCompilerFlags().toString()).trim()); | |||
if (extraFlags.isNotEmpty()) | |||
cl->createNewChildElement ("AdditionalOptions")->addTextElement (extraFlags + " %(AdditionalOptions)"); | |||
} | |||
@@ -1283,7 +1300,7 @@ protected: | |||
link->createNewChildElement ("ProgramDatabaseFile")->addTextElement (FileHelpers::windowsStylePath (intermediatesPath + "/" + binaryName + ".pdb")); | |||
link->createNewChildElement ("SubSystem")->addTextElement (msvcIsWindowsSubsystem ? "Windows" : "Console"); | |||
if (! is64Bit (*config)) | |||
if (! is64Bit (config)) | |||
link->createNewChildElement ("TargetMachine")->addTextElement ("MachineX86"); | |||
if (! isDebug) | |||
@@ -1294,7 +1311,7 @@ protected: | |||
String extraLinkerOptions (getExtraLinkerFlags().toString()); | |||
if (extraLinkerOptions.isNotEmpty()) | |||
link->createNewChildElement ("AdditionalOptions")->addTextElement (replacePreprocessorTokens (*config, extraLinkerOptions).trim() | |||
link->createNewChildElement ("AdditionalOptions")->addTextElement (replacePreprocessorTokens (config, extraLinkerOptions).trim() | |||
+ " %(AdditionalOptions)"); | |||
} | |||
@@ -1304,10 +1321,10 @@ protected: | |||
bsc->createNewChildElement ("OutputFile")->addTextElement (FileHelpers::windowsStylePath (intermediatesPath + "/" + binaryName + ".bsc")); | |||
} | |||
if (msvcPostBuildCommand.isNotEmpty()) | |||
if (config.msvcPostBuildCommand.isNotEmpty()) | |||
{ | |||
XmlElement* bsc = group->createNewChildElement ("PostBuildEvent"); | |||
bsc->createNewChildElement ("Command")->addTextElement (msvcPostBuildCommand); | |||
bsc->createNewChildElement ("Command")->addTextElement (config.msvcPostBuildCommand); | |||
} | |||
//xxx | |||
@@ -389,6 +389,21 @@ void ProjectExporter::createDefaultConfigs() | |||
} | |||
} | |||
//============================================================================== | |||
ProjectExporter::ConfigIterator::ConfigIterator (ProjectExporter& exporter_) | |||
: index (-1), exporter (exporter_) | |||
{ | |||
} | |||
bool ProjectExporter::ConfigIterator::next() | |||
{ | |||
if (++index >= exporter.getNumConfigurations()) | |||
return false; | |||
config = exporter.getConfiguration (index); | |||
return true; | |||
} | |||
//============================================================================== | |||
ProjectExporter::BuildConfiguration::BuildConfiguration (Project& project_, const ValueTree& configNode) | |||
: config (configNode), project (project_) | |||
@@ -130,12 +130,7 @@ public: | |||
String msvcTargetSuffix; | |||
StringPairArray msvcExtraPreprocessorDefs; | |||
bool msvcIsDLL, msvcIsWindowsSubsystem, msvcNeedsDLLRuntimeLib; | |||
String msvcExtraLinkerOptions, msvcDelayLoadedDLLs, msvcModuleDefinitionFile; | |||
String msvcPostBuildCommand, msvcPostBuildOutputs; | |||
String msvcPreBuildCommand; | |||
//============================================================================== | |||
StringArray androidDynamicLibs; | |||
String msvcDelayLoadedDLLs; | |||
//============================================================================== | |||
StringArray extraSearchPaths; | |||
@@ -168,6 +163,11 @@ public: | |||
//============================================================================== | |||
ValueTree config; | |||
//============================================================================== | |||
String msvcExtraLinkerOptions, msvcModuleDefinitionFile; | |||
String msvcPostBuildCommand, msvcPostBuildOutputs; | |||
String msvcPreBuildCommand; | |||
protected: | |||
Project& project; | |||
@@ -188,16 +188,9 @@ public: | |||
//============================================================================== | |||
struct ConfigIterator | |||
{ | |||
ConfigIterator (ProjectExporter& exporter_) : index (-1), exporter (exporter_) {} | |||
ConfigIterator (ProjectExporter& exporter); | |||
bool next() | |||
{ | |||
if (++index >= exporter.getNumConfigurations()) | |||
return false; | |||
config = exporter.getConfiguration (index); | |||
return true; | |||
} | |||
bool next(); | |||
BuildConfiguration& operator*() const { return *config; } | |||
BuildConfiguration* operator->() const { return config; } | |||
@@ -309,13 +309,16 @@ namespace RTASHelpers | |||
.getChildFile ("modules/juce_audio_plugin_client/RTAS") | |||
.toWindowsStyle() + "\\"); | |||
exporter.msvcExtraLinkerOptions = "/FORCE:multiple"; | |||
exporter.msvcDelayLoadedDLLs = "DAE.dll; DigiExt.dll; DSI.dll; PluginLib.dll; DSPManager.dll"; | |||
exporter.msvcModuleDefinitionFile = msvcPathToRTASFolder + "juce_RTAS_WinExports.def"; | |||
exporter.msvcPostBuildOutputs = "\"$(TargetPath)\".rsr"; | |||
exporter.msvcPostBuildCommand = "copy /Y \"" + msvcPathToRTASFolder + "juce_RTAS_WinResources.rsr" | |||
+ "\" \"$(TargetPath)\".rsr"; | |||
for (ProjectExporter::ConfigIterator config (exporter); config.next();) | |||
{ | |||
config->msvcExtraLinkerOptions = "/FORCE:multiple"; | |||
config->msvcModuleDefinitionFile = msvcPathToRTASFolder + "juce_RTAS_WinExports.def"; | |||
config->msvcPostBuildOutputs = "\"$(TargetPath)\".rsr"; | |||
config->msvcPostBuildCommand = "copy /Y \"" + msvcPathToRTASFolder + "juce_RTAS_WinResources.rsr" | |||
+ "\" \"$(TargetPath)\".rsr"; | |||
} | |||
exporter.xcodeExtraLibrariesDebug.add (rtasFolder.getChildFile ("MacBag/Libs/Debug/libPluginLibrary.a")); | |||
exporter.xcodeExtraLibrariesRelease.add (rtasFolder.getChildFile ("MacBag/Libs/Release/libPluginLibrary.a")); | |||
@@ -47,10 +47,10 @@ LOCAL_SRC_FILES := \ | |||
ifeq ($(CONFIG),Debug) | |||
LOCAL_CPPFLAGS += -fsigned-char -fexceptions -frtti -g -I "../../JuceLibraryCode" -O0 -D "JUCE_ANDROID=1" -D "DEBUG=1" -D "_DEBUG=1" -D "JUCE_UNIT_TESTS=1" -D "JUCER_ANDROID_7F0E4A25=1" | |||
LOCAL_LDLIBS := -lGLESv1_CM -lGLESv2 | |||
else | |||
LOCAL_CPPFLAGS += -fsigned-char -fexceptions -frtti -I "../../JuceLibraryCode" -Os -D "JUCE_ANDROID=1" -D "NDEBUG=1" -D "JUCE_UNIT_TESTS=1" -D "JUCER_ANDROID_7F0E4A25=1" | |||
LOCAL_LDLIBS := -lGLESv1_CM -lGLESv2 | |||
endif | |||
LOCAL_LDLIBS := -lGLESv1_CM -lGLESv2 | |||
include $(BUILD_SHARED_LIBRARY) |
@@ -40,6 +40,35 @@ namespace MidiBufferHelpers | |||
{ | |||
return getEventDataSize (d) + sizeof (int) + sizeof (uint16); | |||
} | |||
int findActualEventLength (const uint8* const data, const int maxBytes) noexcept | |||
{ | |||
unsigned int byte = (unsigned int) *data; | |||
int size = 0; | |||
if (byte == 0xf0 || byte == 0xf7) | |||
{ | |||
const uint8* d = data + 1; | |||
while (d < data + maxBytes) | |||
if (*d++ == 0xf7) | |||
break; | |||
size = (int) (d - data); | |||
} | |||
else if (byte == 0xff) | |||
{ | |||
int n; | |||
const int bytesLeft = MidiMessage::readVariableLengthVal (data + 1, n); | |||
size = jmin (maxBytes, n + 2 + bytesLeft); | |||
} | |||
else if (byte >= 0x80) | |||
{ | |||
size = jmin (maxBytes, MidiMessage::getMessageLengthFromFirstByte ((uint8) byte)); | |||
} | |||
return size; | |||
} | |||
} | |||
//============================================================================== | |||
@@ -109,38 +138,6 @@ void MidiBuffer::addEvent (const MidiMessage& m, const int sampleNumber) | |||
addEvent (m.getRawData(), m.getRawDataSize(), sampleNumber); | |||
} | |||
namespace MidiBufferHelpers | |||
{ | |||
int findActualEventLength (const uint8* const data, const int maxBytes) noexcept | |||
{ | |||
unsigned int byte = (unsigned int) *data; | |||
int size = 0; | |||
if (byte == 0xf0 || byte == 0xf7) | |||
{ | |||
const uint8* d = data + 1; | |||
while (d < data + maxBytes) | |||
if (*d++ == 0xf7) | |||
break; | |||
size = (int) (d - data); | |||
} | |||
else if (byte == 0xff) | |||
{ | |||
int n; | |||
const int bytesLeft = MidiMessage::readVariableLengthVal (data + 1, n); | |||
size = jmin (maxBytes, n + 2 + bytesLeft); | |||
} | |||
else if (byte >= 0x80) | |||
{ | |||
size = jmin (maxBytes, MidiMessage::getMessageLengthFromFirstByte ((uint8) byte)); | |||
} | |||
return size; | |||
} | |||
} | |||
void MidiBuffer::addEvent (const void* const newData, const int maxBytes, const int sampleNumber) | |||
{ | |||
const int numBytes = MidiBufferHelpers::findActualEventLength (static_cast <const uint8*> (newData), maxBytes); | |||
@@ -327,23 +327,22 @@ MidiMessage::MidiMessage (MidiMessage&& other) noexcept | |||
MidiMessage& MidiMessage::operator= (MidiMessage&& other) noexcept | |||
{ | |||
if (this != &other) | |||
{ | |||
timeStamp = other.timeStamp; | |||
size = other.size; | |||
jassert (this != &other); // shouldn't be possible | |||
freeData(); | |||
timeStamp = other.timeStamp; | |||
size = other.size; | |||
if (other.usesAllocatedData()) | |||
{ | |||
data = other.data; | |||
other.setToUseInternalData(); | |||
} | |||
else | |||
{ | |||
setToUseInternalData(); | |||
preallocatedData.asInt32 = other.preallocatedData.asInt32; | |||
} | |||
freeData(); | |||
if (other.usesAllocatedData()) | |||
{ | |||
data = other.data; | |||
other.setToUseInternalData(); | |||
} | |||
else | |||
{ | |||
setToUseInternalData(); | |||
preallocatedData.asInt32 = other.preallocatedData.asInt32; | |||
} | |||
return *this; | |||
@@ -188,10 +188,8 @@ private: | |||
//============================================================================== | |||
class Component::ComponentHelpers | |||
struct Component::ComponentHelpers | |||
{ | |||
public: | |||
//============================================================================== | |||
#if JUCE_MODAL_LOOPS_PERMITTED | |||
static void* runModalLoopCallback (void* userData) | |||
{ | |||
@@ -2349,8 +2349,8 @@ private: | |||
void sendEnablementChangeMessage(); | |||
void sendVisibilityChangeMessage(); | |||
class ComponentHelpers; | |||
friend class ComponentHelpers; | |||
struct ComponentHelpers; | |||
friend struct ComponentHelpers; | |||
/* Components aren't allowed to have copy constructors, as this would mess up parent hierarchies. | |||
You might need to give your subclasses a private dummy constructor to avoid compiler warnings. | |||