本文整理汇总了C++中MemoryBlock::toBase64Encoding方法的典型用法代码示例。如果您正苦于以下问题:C++ MemoryBlock::toBase64Encoding方法的具体用法?C++ MemoryBlock::toBase64Encoding怎么用?C++ MemoryBlock::toBase64Encoding使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MemoryBlock
的用法示例。
在下文中一共展示了MemoryBlock::toBase64Encoding方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: crashHandler
static void crashHandler()
{
if (JUCEApplication::isStandaloneApp())
{
MemoryBlock mb (SystemStats::getStackBacktrace().toUTF8(), SystemStats::getStackBacktrace().length());
File::getSpecialLocation(File::currentApplicationFile)
.startAsProcess("--crashReport=\""
+File::getSpecialLocation(File::currentApplicationFile).getFullPathName()
+"\" --stackTrace=\""+mb.toBase64Encoding()
+"\"");
}
else
{
const String stackTrace = SystemStats::getStackBacktrace();
File crashFile (File::getSpecialLocation(File::currentApplicationFile).getFileExtension()+".crash");
AlertWindow::showMessageBox (AlertWindow::WarningIcon,
"Ctrlr has crashed",
"Looks like Ctrlr has crashed, since this is not a standalone instance, we won't do anything.\
A crash log will be written to "+crashFile.getFullPathName()
+"\n\n"+stackTrace);
crashFile.replaceWithText ("Ctrlr crash at: "+Time::getCurrentTime().toString(true, true, true, true) + "\nStack trace:\n"+stackTrace);
}
}
示例2: getGlobalSettings
StandaloneFilterWindow::~StandaloneFilterWindow()
{
PropertySet* const globalSettings = getGlobalSettings();
globalSettings->setValue (T("windowX"), getX());
globalSettings->setValue (T("windowY"), getY());
deleteAndZero (optionsButton);
if (globalSettings != 0 && deviceManager != 0)
{
XmlElement* const xml = deviceManager->createStateXml();
globalSettings->setValue (T("audioSetup"), xml);
delete xml;
}
if (globalSettings != 0 && filter != 0)
{
MemoryBlock data;
filter->getStateInformation (data);
globalSettings->setValue (T("filterState"), data.toBase64Encoding());
}
deleteAndZero (deviceManager);
deleteFilter();
}
示例3: memoryStream
const String imageToBase64 (const Image &image)
{
MemoryBlock memoryBlock;
MemoryOutputStream memoryStream(memoryBlock,true);
PNGImageFormat png;
png.writeImageToStream (image, memoryStream);
return (memoryBlock.toBase64Encoding());
}
示例4: savePresetToXml
//==============================================================================
void WrappedJucePlugin::savePresetToXml(XmlElement* element)
{
if (instance)
{
MemoryBlock pluginState;
instance->getStateInformation(pluginState);
XmlElement* chunk = new XmlElement (T("juceVSTPluginData"));
chunk->addTextElement (pluginState.toBase64Encoding ());
element->addChildElement (chunk);
}
}
示例5: create_state
static void create_state(struct SoundPlugin *plugin, hash_t *state){
#if JUCE_LINUX
const MessageManagerLock mmLock;
#endif
Data *data = (Data*)plugin->data;
AudioPluginInstance *audio_instance = data->audio_instance;
// save state
{
MemoryBlock destData;
audio_instance->getStateInformation(destData);
if (destData.getSize() > 0){
String stateAsString = destData.toBase64Encoding();
HASH_put_chars(state, "audio_instance_state", stateAsString.toRawUTF8());
}
}
// save program state
{
MemoryBlock destData;
audio_instance->getCurrentProgramStateInformation(destData);
if (destData.getSize() > 0){
String stateAsString = destData.toBase64Encoding();
HASH_put_chars(state, "audio_instance_program_state", stateAsString.toRawUTF8());
}
}
HASH_put_int(state, "audio_instance_current_program", audio_instance->getCurrentProgram());
HASH_put_int(state, "x_pos", data->x);
HASH_put_int(state, "y_pos", data->y);
}
示例6: parseMidiChunk
//==============================================================================
static StringPairArray parseMidiChunk (InputStream& input, int64 size)
{
const int64 originalPosition = input.getPosition();
MemoryBlock midiBlock;
input.readIntoMemoryBlock (midiBlock, (ssize_t) size);
MemoryInputStream midiInputStream (midiBlock, false);
StringPairArray midiMetadata;
MidiFile midiFile;
if (midiFile.readFrom (midiInputStream))
{
midiMetadata.set (CoreAudioFormat::midiDataBase64, midiBlock.toBase64Encoding());
findTempoEvents (midiFile, midiMetadata);
findTimeSigEvents (midiFile, midiMetadata);
}
input.setPosition (originalPosition + size);
return midiMetadata;
}
示例7: createNodeFromXml
e->setAttribute ("uid", (int) node->nodeId);
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());
XmlElement* state = new XmlElement ("STATE");
MemoryBlock m;
node->getProcessor()->getStateInformation (m);
state->addTextElement (m.toBase64Encoding());
e->addChildElement (state);
return e;
}
void FilterGraph::createNodeFromXml (const XmlElement& xml)
{
PluginDescription pd;
forEachXmlChildElement (xml, e)
{
if (pd.loadFromXml (*e))
break;
}
示例8: createNodeXml
XmlElement* PMixDocument::createNodeXml (AudioProcessorGraph::Node* const node) noexcept
{
AudioPluginInstance* plugin = dynamic_cast <AudioPluginInstance*> (node->getProcessor());
if (plugin == nullptr)
{
jassertfalse;
return nullptr;
}
XmlElement* e = new XmlElement ("NODE");
e->setAttribute ("uid", (int) node->nodeID);
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());
e->setAttribute ("uiStatus", node->properties ["uiStatus"].toString());
PluginDescription pd;
plugin->fillInPluginDescription (pd);
if(!InternalPluginFormat::isInternalFormat(pd.name))
{
e->setAttribute("colour", node->properties ["colour"].toString());
e->setAttribute ("iposx", node->properties ["iposx"].toString());
e->setAttribute ("iposy", node->properties ["iposy"].toString());
}
e->addChildElement (pd.createXml());
XmlElement* state = new XmlElement ("STATE");
MemoryBlock m;
node->getProcessor()->getStateInformation (m);
state->addTextElement (m.toBase64Encoding());
e->addChildElement (state);
if(!InternalPluginFormat::isInternalFormat(pd.name))
{
XmlElement* params = new XmlElement ("PARAMS");
Array<var>* paramsArray = node->properties.getVarPointer("params")->getArray();
params->addTextElement("[");
for(int i=0;i<paramsArray->size();i++)
{
var parameterIdx = paramsArray->getReference(i);
params->addTextElement(parameterIdx.toString());
if(i != paramsArray->size()-1)
params->addTextElement(", ");
}
params->addTextElement("]");
e->addChildElement(params);
Array<var>* presetsArr = node->properties.getVarPointer("presets")->getArray();
for(int i=0;i<presetsArr->size();i++)
{
XmlElement* presetXML = new XmlElement ("PRESET");
DynamicObject* thePreset = presetsArr->getReference(i).getDynamicObject();
presetXML->setAttribute("name", thePreset->getProperty("name").toString());
presetXML->setAttribute("x", thePreset->getProperty("x").toString());
presetXML->setAttribute("y", thePreset->getProperty("y").toString());
presetXML->setAttribute("radius", thePreset->getProperty("radius").toString());
presetXML->setAttribute("hidden", thePreset->getProperty("hidden").toString());
//presetXML->setAttribute("distance", thePreset->getProperty("distance").toString());
presetXML->setAttribute("coeff", thePreset->getProperty("coeff").toString());
presetXML->setAttribute("uid", thePreset->getProperty("uid").toString());
Array<var>* paramsArray = thePreset->getProperty("state").getArray();
presetXML->addTextElement("[");
for(int i=0;i<paramsArray->size();i++)
{
var parameterIdx = paramsArray->getReference(i);
presetXML->addTextElement(parameterIdx.toString());
if(i != paramsArray->size()-1)
presetXML->addTextElement(", ");
}
presetXML->addTextElement("]");
e->addChildElement(presetXML);
}
}
return e;
}
示例9:
const String fileToBase64 (const File &file)
{
MemoryBlock memoryBlock;
file.loadFileAsData (memoryBlock);
return (memoryBlock.toBase64Encoding());
}