void Pfm2AudioProcessor::setStateInformation (const void* data, int sizeInBytes) { // You should use this method to restore your parameters from this memory block, // whose contents will have been created by the getStateInformation() call. // This getXmlFromBinary() helper function retrieves our XML from the binary blob.. ScopedPointer<XmlElement> xmlState (getXmlFromBinary (data, sizeInBytes)); if (xmlState != nullptr) { String name = xmlState->getStringAttribute("presetName"); for (int k=0; k<13; k++) { presetName[k] = 0; } for (int k=0; k<13 && name.toRawUTF8()[k] != 0; k++) { presetName[k] = name.toRawUTF8()[k]; } if (pfm2Editor) { pfm2Editor->setPresetName(presetName); } printf(">>> PresetName : %s\n", presetName); // make sure that it's actually our type of XML object.. if (xmlState->hasTagName ("PreenFM2AppStatus")) { for (int k=0; k<NUMBER_OF_PROGRAM; k++) { if (xmlState->getStringAttribute("Preset" + String(k)) != String::empty){ programName[k] = xmlState->getStringAttribute("Preset" + String(k)); } } double value; for (int p=0; p< parameterSet.size(); p++) { if (p == nrpmIndex[2047]) continue; if (xmlState->getStringAttribute(teragon::Parameter::makeSafeName(parameterSet[p]->getName()).c_str()) != String::empty) { value = (float) xmlState->getDoubleAttribute (teragon::Parameter::makeSafeName(parameterSet[p]->getName()).c_str(), value); parameterSet.setScaled(p, value, this); } else { printf("Cannot set %d : %s\n", p, parameterSet[p]->getName().c_str()); } } parameterSet.processRealtimeEvents(); // If no UI we must set current currentMidiChannel = parameterSet[nrpmIndex[2045]]->getValue(); // REDRAW UI for (int p=0; p< parameterSet.size(); p++) { const MidifiedFloatParameter* midifiedFP = dynamic_cast<const MidifiedFloatParameter*>(parameterSet[p]); if (midifiedFP != nullptr) { parametersToUpdateMutex.lock(); parametersToUpdate.insert(midifiedFP->getName().c_str()); parametersToUpdateMutex.unlock(); } } // Flush NRPN flushAllParametrsToNrpn(); } } }
FatalError::FatalError (char const* message, char const* fileName, int lineNumber) { typedef CriticalSection LockType; static LockType s_mutex; std::lock_guard <LockType> lock (s_mutex); String const backtraceString = SystemStats::getStackBacktrace (); char const* const szStackBacktrace = backtraceString.toRawUTF8 (); String const fileNameString = fileName; char const* const szFileName = fileNameString.toRawUTF8 (); Reporter* const reporter (s_reporter); if (reporter != nullptr) { reporter->onFatalError (message, szStackBacktrace, szFileName, lineNumber); } Process::terminate (); }
bool SysexComm::setInput(String target) { if ( input != NULL ) { input->stop(); delete input; input = NULL; } if ( listener == NULL ) return true; StringArray devices = MidiInput::getDevices(); int idx = devices.indexOf(target); if ( idx == -1 ) { TRACE("device %s not found", target.toRawUTF8()); inputName = ""; if ( target == "None" || target == "" ) return true; return false; } input = MidiInput::openDevice(idx, listener); if ( input == NULL ) { TRACE("unable to open %s", target.toRawUTF8()); return false; } inputName = target; TRACE("sysex %s opened", target.toRawUTF8()); input->start(); return true; }
bool SysexComm::setOutput(String target) { if ( output != NULL ) { delete output; output = NULL; } StringArray devices = MidiOutput::getDevices(); int idx = devices.indexOf(target); if ( idx == -1 ) { TRACE("device %s not found", target.toRawUTF8()); outputName = ""; if ( target == "None" || target == "" ) return true; return false; } output = MidiOutput::openDevice(idx); if ( output == NULL ) { TRACE("unable to open %s", target.toRawUTF8()); return false; } outputName = target; TRACE("sysex %s opened", target.toRawUTF8()); return true; }
bool Database::executeQuery (var& results, const String& sql, const QueryArgs& args) { if (nullptr == db) return false; char* err = nullptr; int res = SQLITE_ERROR; if (! sql.containsChar ('?')) { res = sqlite3_exec (db, sql.toRawUTF8(), ksp1_query_var, &results, &err); } else { String query; int start = 0; int end = 0; for (const var& val : args) { end = sql.indexOf (start, "?"); query << sql.substring (start, end); if (val.isString()) query << "'" << val.toString() << "'"; else query << val.toString(); start = end + 1; } query << sql.substring (start); res = sqlite3_exec (db, query.toRawUTF8(), ksp1_query_var, &results, &err); } const bool result = (res == SQLITE_OK); if (res == SQLITE_OK) { } else { } if (err) { DBG ("SQL Error: " << err); sqlite3_free (err); err = nullptr; } return result; }
void AppsPageComponent::focusApp(AppIconButton* appButton, const String& windowId) { DBG("AppsPageComponent::focusApp - " << appButton->shell); String focusShell = "echo 'focus_client_by_window_id("+windowId+")' | awesome-client"; StringArray focusCmd{"sh", "-c", focusShell.toRawUTF8()}; ChildProcess focusWindow; focusWindow.start(focusCmd); };
bool OpenGLShaderProgram::addShader (const String& code, GLenum type) { GLuint shaderID = context.extensions.glCreateShader (type); const GLchar* c = code.toRawUTF8(); context.extensions.glShaderSource (shaderID, 1, &c, nullptr); context.extensions.glCompileShader (shaderID); GLint status = GL_FALSE; context.extensions.glGetShaderiv (shaderID, GL_COMPILE_STATUS, &status); if (status == GL_FALSE) { GLchar infoLog [16384]; GLsizei infoLogLength = 0; context.extensions.glGetShaderInfoLog (shaderID, sizeof (infoLog), &infoLogLength, infoLog); errorLog = String (infoLog, (size_t) infoLogLength); #if JUCE_DEBUG && ! JUCE_DONT_ASSERT_ON_GLSL_COMPILE_ERROR // Your GLSL code contained compile errors! // Hopefully this compile log should help to explain what went wrong. DBG (errorLog); jassertfalse; #endif return false; } context.extensions.glAttachShader (getProgramID(), shaderID); context.extensions.glDeleteShader (shaderID); JUCE_CHECK_OPENGL_ERROR return true; }
void heartbeat() { if (mNeedToEnd) { Time now = Time::getCurrentTime(); RelativeTime dt = (now - mLastXYTime); if (dt.inMilliseconds() > 200) { mEditor->getMover()->end(kOsc); mNeedToEnd = false; } } if (!mAddress) return; int src = mEditor->getOscLeapSource(); if (src != mSource) { String s = "Source "; s << (src+1); lo_send(mAddress, kSelectSourcePath, "s", s.toRawUTF8()); mSource = src; } FPoint p = mFilter->getSourceXY01(src); if (mSourceXY != p) { //fprintf(stderr, "sent new pos to %s\n", kSourceXYPath); lo_send(mAddress, kSourceXYPath, "ff", p.y, p.x); mSourceXY = p; } }
void DiauproPluginAudioProcessor::handleAsyncUpdate () { if (editor != nullptr && editorReady) { vcoRtTime = diauproVCOProcessor.getRoundTripTime(); vcoProcessTime = diauproVCOProcessor.getProcessTime() ; vcoRtMaxTime = jmax(vcoRtMaxTime, vcoRtTime); if (vcoRtTime > 0.0) vcoRtMinTime = jmin(vcoRtMinTime, vcoRtTime); vcoNetStatus = diauproVCOProcessor.hasActiveNetworkConnection(); vcaRtTime = diauproVCAProcessor.getRoundTripTime(); vcaProcessTime = diauproVCAProcessor.getProcessTime() ; vcaRtMaxTime = jmax(vcaRtMaxTime, vcaRtTime); if (vcaRtTime > 0.0) vcaRtMinTime = jmin(vcaRtMinTime, vcaRtTime); vcaNetStatus = diauproVCAProcessor.hasActiveNetworkConnection(); nullRtTime = diauproNullProcessor.getRoundTripTime(); nullProcessTime = diauproNullProcessor.getProcessTime() ; nullRtMaxTime = jmax(nullRtMaxTime, nullRtTime); if (nullRtTime > 0.0) nullRtMinTime = jmin(nullRtMinTime, nullRtTime); nullNetStatus = diauproNullProcessor.hasActiveNetworkConnection(); if(((DiauproPluginAudioProcessorEditor *)editor)->isReady()) editor->repaint (); //nullNetStatus, nullAsync, nullRtTime, nullProcessTime String log = String::formatted("%d,%d,%f,%f\n", nullNetStatus, nullAsync, nullRtTime, nullProcessTime ); logfile->write(log.toRawUTF8(), log.length() ); } }
ID3DBlob* D3D11Context::compileShaderFromBinaryData (const char* id, const char* entry, const char* target) { String fileId = String (id).replaceCharacter ('.', '_'); int dataSize; const char* data = BinaryData::getNamedResource (fileId.toRawUTF8(), dataSize); if (nullptr == data) return nullptr; ShaderCompileDesc desc; desc.name = id; desc.entry = entry; desc.target = target; desc.source = data; desc.sourceSize = (size_t)dataSize; ShaderCompileResult ret = compileShader (desc); if (ret.errorMessage) { const char* str = (const char*)ret.errorMessage->GetBufferPointer(); errLog (str); ret.errorMessage->Release(); } return ret.byteCode; }
static void writeManifestFile(PluginListManager& plm) { String text; // ------------------------------------------------------------------- // Header text += "@prefix lv2: <" LV2_CORE_PREFIX "> .\n"; text += "@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .\n"; text += "@prefix ui: <" LV2_UI_PREFIX "> .\n"; text += "\n"; // ------------------------------------------------------------------- // Plugins for (LinkedList<const NativePluginDescriptor*>::Itenerator it = plm.descs.begin2(); it.valid(); it.next()) { const NativePluginDescriptor* const& pluginDesc(it.getValue(nullptr)); CARLA_SAFE_ASSERT_CONTINUE(pluginDesc != nullptr); const String label(pluginDesc->label); text += "<http://kxstudio.sf.net/carla/plugins/" + label + ">\n"; text += " a lv2:Plugin ;\n"; text += " lv2:binary <carla" PLUGIN_EXT "> ;\n"; text += " rdfs:seeAlso <" + label + ".ttl> .\n"; text += "\n"; } // ------------------------------------------------------------------- // UI #ifdef CARLA_OS_LINUX text += "<http://kxstudio.sf.net/carla/ui-embed>\n"; text += " a <" LV2_UI__X11UI "> ;\n"; text += " ui:binary <carla" PLUGIN_EXT "> ;\n"; text += " lv2:extensionData <" LV2_PROGRAMS__UIInterface "> ;\n"; text += " lv2:optionalFeature <" LV2_UI__fixedSize "> ,\n"; text += " <" LV2_UI__noUserResize "> ;\n"; text += " lv2:requiredFeature <" LV2_INSTANCE_ACCESS_URI "> ,\n"; text += " <" LV2_UI__resize "> .\n"; text += "\n"; #endif text += "<http://kxstudio.sf.net/carla/ui-ext>\n"; text += " a <" LV2_EXTERNAL_UI__Widget "> ;\n"; text += " ui:binary <carla" PLUGIN_EXT "> ;\n"; text += " lv2:extensionData <" LV2_UI__idleInterface "> ,\n"; text += " <" LV2_UI__showInterface "> ,\n"; text += " <" LV2_PROGRAMS__UIInterface "> ;\n"; text += " lv2:requiredFeature <" LV2_INSTANCE_ACCESS_URI "> .\n"; // ------------------------------------------------------------------- // Write file now std::fstream manifest("carla.lv2/manifest.ttl", std::ios::out); manifest << text.toRawUTF8(); manifest.close(); }
static bool multicast (int handle, const String& multicastIPAddress, const String& interfaceIPAddress, bool join) noexcept { struct ip_mreq mreq; zerostruct (mreq); mreq.imr_multiaddr.s_addr = inet_addr (multicastIPAddress.toRawUTF8()); mreq.imr_interface.s_addr = INADDR_ANY; if (interfaceIPAddress.isNotEmpty()) mreq.imr_interface.s_addr = inet_addr (interfaceIPAddress.toRawUTF8()); return setsockopt (handle, IPPROTO_IP, join ? IP_ADD_MEMBERSHIP : IP_DROP_MEMBERSHIP, (const char*) &mreq, sizeof (mreq)) == 0; }
StringTS::StringTS(String S, int64 ts_software) { str = new uint8[S.length()]; memcpy(str, S.toRawUTF8(), S.length()); timestamp = ts_software; len = S.length(); }
StringTS::StringTS(String S) { Time t; str = new uint8[S.length()]; memcpy(str, S.toRawUTF8(), S.length()); timestamp = t.getHighResolutionTicks(); len = S.length(); }
void Database::executeUpdate (const String& sql, const QueryArgs& args) { if (nullptr == db) return; char* err = nullptr; int res = SQLITE_ERROR; if (! sql.containsChar ('?')) { res = sqlite3_exec (db, sql.toRawUTF8(), ksp1_query_var, this, &err); } else { String query; int start = 0; int end = 0; for (const var& val : args) { const bool isString = val.isString(); end = sql.indexOf (start, "?"); query << sql.substring (start, end); if (isString) query << "'"; query << val.toString(); if (isString) query << "'"; start = end + 1; } query << sql.substring (start); res = sqlite3_exec (db, query.toRawUTF8(), ksp1_query_var, this, &err); } if (err) { DBG ("SQL Error: " << err); sqlite3_free (err); err = nullptr; } }
int HDF5FileBase::createGroupIfDoesNotExist(String path) { if (!opened) return -1; try { file->childObjType(path.toRawUTF8()); } catch (FileIException) { return createGroup(path); } return 0; }
const char* carla_get_supported_file_extensions() { carla_debug("carla_get_supported_file_extensions()"); static CarlaString retText; if (retText.isEmpty()) { retText = // Base types "*.carxp;*.carxs" // MIDI files ";*.mid;*.midi" #ifdef HAVE_FLUIDSYNTH // fluidsynth (sf2) ";*.sf2" #endif #ifdef HAVE_LINUXSAMPLER // linuxsampler (gig and sfz) ";*.gig;*.sfz" #endif #ifdef WANT_ZYNADDSUBFX // zynaddsubfx presets ";*.xmz;*.xiz" #endif ; #ifndef BUILD_BRIDGE // Audio files { using namespace juce; AudioFormatManager afm; afm.registerBasicFormats(); String juceFormats; for (AudioFormat **it=afm.begin(), **end=afm.end(); it != end; ++it) { const StringArray& exts((*it)->getFileExtensions()); for (String *eit=exts.begin(), *eend=exts.end(); eit != eend; ++eit) juceFormats += String(";*" + (*eit)).toRawUTF8(); } retText += juceFormats.toRawUTF8(); } #endif } return retText; }
void PanelEngine::updateUIEnveloppe(const char* paramName) { const char** pointName = enveloppe[0]->getPointSuffix(); for (int k=0; k<NUMBER_OF_OPERATORS; k++) { const char* pString = enveloppe[k]->getName().toRawUTF8(); for (int p=2; p < enveloppe[k]->getNumberOfPoints() * 2; p++) { String name = String(pString) + String(pointName[p - 2]); if (paramName != nullptr && name != String(paramName)) { continue; } teragon::Parameter* paramToMap = parameterSet->get(name.toRawUTF8()); // Will remove that later but dont' BUG for the moment if that doesn't fit if (paramToMap == nullptr) { printf("Enveloppe point %s does not exist...\r\n", name.toRawUTF8()); return; } if (panelParameterMap[name] == nullptr) { panelParameterMap.set(name ,paramToMap); } // And let's update the value and update the UI Without sending modification !!! // No modification : we dont want sliderValueChanged to be called in the different panels if ((p & 0x1) == 0) { if (paramToMap->getValue() != enveloppe[k]->getX(p / 2)) { enveloppe[k]->setX(p / 2, paramToMap->getValue()); enveloppe[k]->repaint(); } } else { if (paramToMap->getValue() != enveloppe[k]->getY(p / 2)) { enveloppe[k]->setY(p / 2, paramToMap->getValue()); enveloppe[k]->repaint(); } } } } }
bool OutputStream::writeString (const String& text) { #if (JUCE_STRING_UTF_TYPE == 8) return write (text.toRawUTF8(), text.getNumBytesAsUTF8() + 1); #else // (This avoids using toUTF8() to prevent the memory bloat that it would leave behind // if lots of large, persistent strings were to be written to streams). const size_t numBytes = text.getNumBytesAsUTF8() + 1; HeapBlock<char> temp (numBytes); text.copyToUTF8 (temp, numBytes); return write (temp, numBytes); #endif }
void jojo_bang (t_jojo *x) { const ScopedLock myLock (x->lock_); post ("Public / %s", x->public_.toString().toRawUTF8()); post ("Private / %s", x->private_.toString().toRawUTF8()); String myText (CharPointer_UTF8 ("P\xc3\xa9p\xc3\xa9 p\xc3\xa8te en ao\xc3\xbbt!")); post ("%s", myText.toRawUTF8()); const juce::MemoryBlock blockBegin (myText.toRawUTF8(), myText.getNumBytesAsUTF8() + 1); BigInteger bitArray; bitArray.loadFromMemoryBlock (blockBegin); x->public_.applyToValue (bitArray); /* Encrypt with the public key. */ post ("%s", bitArray.toString (16).toRawUTF8()); x->private_.applyToValue (bitArray); /* Then decrypt with the private key. */ const juce::MemoryBlock blockEnd (bitArray.toMemoryBlock()); post ("%s", blockEnd.toString().toRawUTF8()); }
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); }
static bool bindSocket (SocketHandle handle, int port, const String& address) noexcept { if (handle <= 0 || ! isValidPortNumber (port)) return false; struct sockaddr_in addr; zerostruct (addr); // (can't use "= { 0 }" on this object because it's typedef'ed as a C struct) addr.sin_family = PF_INET; addr.sin_port = htons ((uint16) port); addr.sin_addr.s_addr = address.isNotEmpty() ? ::inet_addr (address.toRawUTF8()) : htonl (INADDR_ANY); return ::bind (handle, (struct sockaddr*) &addr, sizeof (addr)) >= 0; }
static void writeManifestFile(PluginListManager& plm) { String text; // ------------------------------------------------------------------- // Header text += "@prefix lv2: <" LV2_CORE_PREFIX "> .\n"; text += "@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .\n"; text += "@prefix ui: <" LV2_UI_PREFIX "> .\n"; text += "\n"; // ------------------------------------------------------------------- // Plugins for (LinkedList<const NativePluginDescriptor*>::Itenerator it = plm.descs.begin(); it.valid(); it.next()) { const NativePluginDescriptor* const& pluginDesc(it.getValue()); const String label(pluginDesc->label); text += "<http://kxstudio.sf.net/carla/plugins/" + label + ">\n"; text += " a lv2:Plugin ;\n"; text += " lv2:binary <carla-native" PLUGIN_EXT "> ;\n"; text += " rdfs:seeAlso <" + label + ".ttl> .\n"; text += "\n"; } // ------------------------------------------------------------------- // UI text += "<http://kxstudio.sf.net/carla/ui>\n"; text += " a <" LV2_EXTERNAL_UI__Widget "> ;\n"; text += " ui:binary <carla-native" PLUGIN_EXT "> ;\n"; text += " lv2:extensionData ui:idleInterface ,\n"; text += " ui:showInterface ,\n"; text += " <" LV2_PROGRAMS__UIInterface "> ;\n"; text += " lv2:requiredFeature <" LV2_INSTANCE_ACCESS_URI "> .\n"; // ------------------------------------------------------------------- // Write file now std::fstream manifest("carla-native.lv2/manifest.ttl", std::ios::out); manifest << text.toRawUTF8(); manifest.close(); }
bool Tunefish4AudioProcessor::loadProgram(eU32 index) { String path = pluginLocation + File::separatorString + String("tf4programs") + File::separatorString + String("program") + String(index) + String(".txt"); File file(path); FileInputStream *stream = file.createInputStream(); if (!stream) return false; String name = stream->readNextLine(); programs[index].setName(name.toRawUTF8()); while(true) { String line = stream->readNextLine(); if (line.length() == 0) { eDelete(stream); return true; } StringArray parts; parts.addTokens(line, ";", String::empty); if (parts.size() == 2) { String key = parts[0]; eF32 value = parts[1].getFloatValue(); for(eU32 i=0;i<TF_PARAM_COUNT;i++) { if (key == TF_NAMES[i]) { programs[index].setParam(i, value); break; } } } } return true; }
void Config::setRpcIpAndOptionalPort (std::string const& newAddress) { String const s (newAddress.c_str ()); int const colonPosition = s.lastIndexOfChar (':'); if (colonPosition != -1) { String const ipPart = s.substring (0, colonPosition); String const portPart = s.substring (colonPosition + 1, s.length ()); setRpcIP (ipPart.toRawUTF8 ()); setRpcPort (portPart.getIntValue ()); } else { setRpcIP (newAddress); } }
Image JUCE_API getIconFromApplication (const String& applicationPath, const int size) { Image hostIcon; if (CFStringRef pathCFString = CFStringCreateWithCString (kCFAllocatorDefault, applicationPath.toRawUTF8(), kCFStringEncodingUTF8)) { if (CFURLRef url = CFURLCreateWithFileSystemPath (kCFAllocatorDefault, pathCFString, kCFURLPOSIXPathStyle, 1)) { if (CFBundleRef appBundle = CFBundleCreate (kCFAllocatorDefault, url)) { if (CFTypeRef infoValue = CFBundleGetValueForInfoDictionaryKey (appBundle, CFSTR("CFBundleIconFile"))) { if (CFGetTypeID (infoValue) == CFStringGetTypeID()) { CFStringRef iconFilename = reinterpret_cast<CFStringRef> (infoValue); CFStringRef resourceURLSuffix = CFStringHasSuffix (iconFilename, CFSTR(".icns")) ? nullptr : CFSTR("icns"); if (CFURLRef iconURL = CFBundleCopyResourceURL (appBundle, iconFilename, resourceURLSuffix, nullptr)) { if (CFStringRef iconPath = CFURLCopyFileSystemPath (iconURL, kCFURLPOSIXPathStyle)) { File icnsFile (CFStringGetCStringPtr (iconPath, CFStringGetSystemEncoding())); hostIcon = getIconFromIcnsFile (icnsFile, size); CFRelease (iconPath); } CFRelease (iconURL); } } } CFRelease (appBundle); } CFRelease (url); } CFRelease (pathCFString); } return hostIcon; }
void DexedAudioProcessorEditor::saveCart() { File startFileName = processor->activeFileCartridge.exists() ? processor->activeFileCartridge : processor->dexedCartDir; FileChooser fc ("Export DX sysex...", processor->dexedCartDir, "*.syx", 1); if ( fc.browseForFileToSave(true) ) { String f = fc.getResults().getReference(0).getFullPathName(); char syx_data[4104]; exportSysexCart((char *) syx_data, (char *) &processor->sysex, 0); ofstream fp_out(f.toRawUTF8(), ios::binary); fp_out.write((char *)syx_data, 4104); fp_out.close(); if (fp_out.fail()) { AlertWindow::showMessageBoxAsync (AlertWindow::WarningIcon, "Error", "Unable to write: " + f); } } }
int LAudioAppComponent::setAudioChannels(lua_State *L) { if(audioOpen) { lua_pushnil(L); lua_pushliteral(L, "audio channels already set."); return 2; } int numInputChannels = LUA::checkAndGetNumber<int>(2, 0); int numOutputChannels = LUA::checkAndGetNumber<int>(2, 2); String audioError = deviceManager.initialise (numInputChannels, numOutputChannels, nullptr, true); jassert (audioError.isEmpty()); if(audioError.isEmpty()) { deviceManager.addAudioCallback (&audioSourcePlayer); audioOpen = true; lua_pushboolean(L, true); return 1; }else{ lua_pushnil(L); lua_pushstring(L, audioError.toRawUTF8()); return 2; } }
void DexedAudioProcessorEditor::loadCart(File file) { String f = file.getFullPathName(); uint8_t syx_data[4104]; ifstream fp_in(f.toRawUTF8(), ios::binary); if (fp_in.fail()) { AlertWindow::showMessageBoxAsync (AlertWindow::WarningIcon, "Error", "Unable to open: " + f); return; } fp_in.read((char *)syx_data, 4104); fp_in.close(); if ( processor->importSysex((char *) &syx_data) ) { global.setSystemMessage(String("Unkown sysex format !?")); } processor->setCurrentProgram(0); rebuildProgramCombobox(); global.programs->setSelectedId(processor->getCurrentProgram()+1, dontSendNotification); processor->updateHostDisplay(); processor->activeFileCartridge = file; }
static String getLinkedFile (const String& file) { HeapBlock<char> buffer (8194); const int numBytes = (int) readlink (file.toRawUTF8(), buffer, 8192); return String::fromUTF8 (buffer, jmax (0, numBytes)); };