예제 #1
0
//==============================================================================
void MidiSlider::setFunction(const String &_functionName, const int &_functionArg, const int &_midiChannel, const int &initialValue)
{
    functionName = _functionName;
    functionArg = _functionArg;
    midiChannel = _midiChannel;

    slider->snapsBackOnRelease = 0;
    if( functionName.containsWholeWord(T("CC")) ) {
        String labelStr(functionArg);
        sliderFunction->clear(true);
        for(int i=0; i<128; ++i) {
            sliderFunction->addItem(T("CC") + String(i) + T(": ") + String(MidiSliderCcNames[i]), i+1);
        }
        sliderFunction->setSelectedId(functionArg+1, true);
    } else if( functionName.containsWholeWord(T("PB")) ) {
        String labelStr(functionArg);
        slider->snapsBackOnRelease = 1;
        sliderFunction->clear();
    } else {
        sliderFunction->clear();
    }

    slider->setValue(initialValue, dontSendNotification); // don't send update message

    // store settings
    PropertiesFile *propertiesFile = MiosStudioProperties::getInstance()->getCommonSettings(true);
    if( propertiesFile ) {
        propertiesFile->setValue("slider" + String(sliderNum) + "FunctionName",_functionName);
        propertiesFile->setValue("slider" + String(sliderNum) + "FunctionArg", functionArg);
        propertiesFile->setValue("slider" + String(sliderNum) + "MidiChannel", midiChannel);
        propertiesFile->setValue("slider" + String(sliderNum) + "InitialValue", slider->getValue());
    }
}
예제 #2
0
//==============================================================================
MidiSlider::MidiSlider(MiosStudio *_miosStudio, int _num, String _functionName, int _functionArg, int _midiChannel, int initialValue, bool _vertical)
    : miosStudio(_miosStudio)
    , sliderNum(_num)
    , vertical(_vertical)
{
    addAndMakeVisible(slider = new MidiSliderComponent(T("Slider")));
    slider->setSliderStyle(vertical ? MidiSliderComponent::LinearVertical : MidiSliderComponent::LinearHorizontal);
    slider->addListener(this);

    // only used for horizontal sliders
    addAndMakeVisible(sliderFunction = new ComboBox(String::empty));
    sliderFunction->addListener(this);

    // restore settings
    PropertiesFile *propertiesFile = MiosStudioProperties::getInstance()->getCommonSettings(true);
    if( propertiesFile ) {
        _functionName = propertiesFile->getValue("slider" + String(sliderNum) + "FunctionName", _functionName);
        _functionArg = propertiesFile->getIntValue("slider" + String(sliderNum) + "FunctionArg", _functionArg);
        _midiChannel = propertiesFile->getIntValue("slider" + String(sliderNum) + "MidiChannel", _midiChannel);
        initialValue = propertiesFile->getIntValue("slider" + String(sliderNum) + "InitialValue", initialValue);
    }

    setFunction(_functionName, _functionArg, _midiChannel, initialValue);

    if( vertical )
        setSize(24, 18+80);
    else
        setSize(128, 24+18);
}
예제 #3
0
파일: GuiApp.cpp 프로젝트: bketech/element
    void
    GuiApp::run()
    {
        commander().registerAllCommandsForTarget (JUCEApplication::getInstance());
        commander().registerAllCommandsForTarget (this);

        globals().session().open();
        sessionDoc = new SessionDocument (globals().session());

        content = new ContentComponent (*this);
        content->setSize (800, 600);
        mainWindow = new MainWindow (*this);
        mainWindow->setContentNonOwned (content.get(), true);

        PropertiesFile* pf = globals().settings().getUserSettings();
        mainWindow->restoreWindowStateFromString (pf->getValue ("mainWindowState"));

       #if JUCE_IOS || JUCE_ANDROID
        Desktop& d = Desktop::getInstance();
        d.setKioskModeComponent (mainWindow);
       #endif

        mainWindow->addToDesktop();
        mainWindow->setVisible (true);
        dispatch->startTimer (250);

        openWindow (ELEMENT_PLUGIN_MANAGER);

        File sess (pf->getValue ("lastSession"));
        if (sess.existsAsFile()) {
            sessionDoc->loadFrom (sess, true);
            mainWindow->setName (sessionDoc->getDocumentTitle());
        }
    }
예제 #4
0
StoredSettings::~StoredSettings()
{
	propertiesFile = nullptr;
	for (int i = propertyFiles.size(); --i >= 0;)
    {
        PropertiesFile* props = propertyFiles.getUnchecked(i);
        if (props != nullptr)
			props->save();
    }
}
예제 #5
0
void ApplicationSettingsComponent::saveSettingsToFile(){
  PropertiesFile* properties = ApplicationConfiguration::getApplicationProperties();
  properties->setValue("serialport", serialPortComboBox->getText());
  properties->setValue("serialspeed", serialSpeedComboBox->getText());
  properties->setValue("presetdirectory", presetDirectoryEditor->getText());
  properties->setValue("midiinput", midiInputComboBox->getText());
  properties->setValue("midioutput", midiOutputComboBox->getText());
  properties->setValue("oschost", oscHostEditor->getText());
  properties->setValue("oscport", oscPortEditor->getText());
  properties->saveIfNeeded();
  std::cout << "saved settings to file " << properties->getFile().getFullPathName() << std::endl;
}
예제 #6
0
 void changeListenerCallback(void *something){
   printf("Some audio change thing.\n");
   if(audioDeviceManager.getCurrentAudioDevice()!=NULL){
     samplerate=audioDeviceManager.getCurrentAudioDevice()->getCurrentSampleRate();
     propertiesfile->setValue("audiodevicemanager",audioDeviceManager.createStateXml());
   }else{
     fprintf(stderr,"Gakkegakke\n");
   }
 }
예제 #7
0
파일: GuiApp.cpp 프로젝트: bketech/element
    GuiApp::~GuiApp()
    {       
        PropertiesFile* pf = globals().settings().getUserSettings();
        pf->setValue ("mainWindowState", mainWindow->getWindowStateAsString());

        File f (sessionDoc->getFile());
        if (f.existsAsFile()) {
            pf->setValue ("lastSession", f.getFullPathName());
        }

        render.detach();

        mainWindow->setVisible (false);
        mainWindow->removeFromDesktop();

        mainWindow = nullptr;
        windowManager = nullptr;
        LookAndFeel::setDefaultLookAndFeel (nullptr);
    }
예제 #8
0
PropertiesFile& StoredSettings::getProjectProperties (const String& projectUID)
{
    const String filename ("Introjucer_Project_" + projectUID);

    for (int i = propertyFiles.size(); --i >= 0;)
    {
        PropertiesFile* const props = propertyFiles.getUnchecked(i);
        if (props->getFile().getFileNameWithoutExtension() == filename)
            return *props;
    }

    PropertiesFile* p = createPropsFile (filename);
	if (!p->getFile().existsAsFile())
	{
		p->getFile().create();
	}
	DBG("PROPERTIES FILE FOR PROJECT: " + p->getFile().getFullPathName());
    propertyFiles.add (p);
    return *p;
}
예제 #9
0
void ApplicationSettingsComponent::loadSettingsFromFile(){
  PropertiesFile* properties = ApplicationConfiguration::getApplicationProperties();
#if JUCE_MAC || JUCE_IOS
  DirectoryIterator it(File("/dev"), false, "tty.usbserial-*");
#elif JUCE_WINDOWS
  DirectoryIterator it(File("\\\\.\\"), false, "COM*");
#elif JUCE_LINUX
  DirectoryIterator it(File("/dev"), false, "ttyUSB*");
#endif
  int index = 1;
  serialPortComboBox->addItem("none", index);
  while(it.next())
    serialPortComboBox->addItem(it.getFile().getFullPathName(), ++index);
  serialPortComboBox->setText(properties->getValue("serialport"));
  serialSpeedComboBox->setText(properties->getValue("serialspeed"));
  presetDirectoryEditor->setText(properties->getValue("presetdirectory"));

  const StringArray& inputs = MidiInput::getDevices();
  midiInputComboBox->addItem("none", ++index);
  for(int i=0; i<inputs.size(); ++i)
    midiInputComboBox->addItem(inputs[i], ++index);
#if ! JUCE_WINDOWS
  midiInputComboBox->addItem("BlipZones", ++index);
#endif
  midiInputComboBox->setText(properties->getValue("midiinput"));

  const StringArray& outputs = MidiOutput::getDevices();
  midiOutputComboBox->addItem("none", ++index);
  for(int i=0; i<outputs.size(); ++i)
    midiOutputComboBox->addItem(outputs[i], ++index);
#if ! JUCE_WINDOWS
  midiOutputComboBox->addItem("BlipZones", ++index);
#endif
  midiOutputComboBox->setText(properties->getValue("midioutput"));

  oscHostEditor->setText(properties->getValue("oschost"));
  oscPortEditor->setText(properties->getValue("oscport"));

  std::cout << "loaded settings from file " << properties->getFile().getFullPathName() << std::endl;
}
예제 #10
0
  void initJuceAudio(void){
    XmlElement *settings=propertiesfile->getXmlValue("audiodevicemanager");
    const String error (audioDeviceManager.initialise (0, /* number of input channels */
						       8, /* number of output channels */
						       settings,
						       true  /* select default device on failure */));
    
    if (audioDeviceManager.getCurrentAudioDevice()==NULL || error.isNotEmpty())
      {
	AlertWindow::showMessageBox (AlertWindow::WarningIcon,
				     T("Mammut"),
				     T("Couldn't open an output device!\n\n") + error);
      }
    else
      {
	isinitialized=true;
	
	// start the IO device pulling its data from our callback..
	audioDeviceManager.setAudioCallback (this);
	
      }
  }
void PluginListComponent::setLastSearchPath (PropertiesFile& properties, AudioPluginFormat& format,
                                             const FileSearchPath& newPath)
{
    properties.setValue ("lastPluginScanPath_" + format.getName(), newPath.toString());
}
FileSearchPath PluginListComponent::getLastSearchPath (PropertiesFile& properties, AudioPluginFormat& format)
{
    return FileSearchPath (properties.getValue ("lastPluginScanPath_" + format.getName(),
                                                format.getDefaultLocationsToSearch().toString()));
}
예제 #13
0
void StoredSettings::flush()
{
    if (props != nullptr)
    {
        props->setValue ("recentFiles", recentFiles.toString());

        props->removeValue ("keyMappings");

        if (commandManager != nullptr)
        {
            ScopedPointer <XmlElement> keys (commandManager->getKeyMappings()->createXml (true));

            if (keys != nullptr)
                props->setValue ("keyMappings", (XmlElement*) keys);
        }
    }

    props = nullptr;

    {
        // These settings are used in defining the properties file's location.
        PropertiesFile::Options options;
        options.applicationName     = "Introjucer";
        options.folderName          = "Introjucer";
        options.filenameSuffix      = "settings";
        options.osxLibrarySubFolder = "Application Support";

        props = new PropertiesFile (options);

        // Because older versions of the introjucer saved their settings under a different
        // name, this code is an example of how to migrate your old settings files...
        if (! props->getFile().exists())
        {
            PropertiesFile::Options oldOptions;
            oldOptions.applicationName      = "Jucer2";
            oldOptions.filenameSuffix       = "settings";
            oldOptions.osxLibrarySubFolder  = "Preferences";

            PropertiesFile oldProps (oldOptions);

            if (oldProps.getFile().exists())
                props->addAllPropertiesFrom (oldProps);
        }
    }

    // recent files...
    recentFiles.restoreFromString (props->getValue ("recentFiles"));
    recentFiles.removeNonExistentFiles();

    // swatch colours...
    swatchColours.clear();

    #define COL(col)  Colours::col,

    const Colour colours[] =
    {
        #include "jucer_Colours.h"
        Colours::transparentBlack
    };

    #undef COL

    const int numSwatchColours = 24;

    for (int i = 0; i < numSwatchColours; ++i)
        swatchColours.add (Colour::fromString (props->getValue ("swatchColour" + String (i),
                                                                colours [2 + i].toString())));
}