Exemplo n.º 1
0
bool SmugMug::getImageUrls(SmugID id, ImageUrls& urls)
{
	StringPairArray params;
	params.set(("ImageID"), String(id.id));
	params.set(("ImageKey"), id.key);
	params.set(("Password"), "");
	XmlElement* n = smugMugRequest(("smugmug.images.getURLs"), params);

	if (n)
	{
		XmlElement* img = n->getChildByName(("Image"));

		if (img)
		{
			urls.originalURL = img->getStringAttribute(("OriginalURL"));
			urls.largeURL    = img->getStringAttribute(("LargeURL"));
			urls.mediumURL   = img->getStringAttribute(("MediumURL"));
			urls.smallURL    = img->getStringAttribute(("SmallURL"));
			urls.tinyURL     = img->getStringAttribute(("TinyURL"));
			urls.thumbURL    = img->getStringAttribute(("ThumbURL"));
			urls.albumURL    = img->getStringAttribute(("AlbumURL"));
		}
	
		delete n;
		return true;
	}
	return false;
}
Exemplo n.º 2
0
void SmugMug::login(const String& username, const String& password)
{
	sessionId = String::empty;

	StringPairArray params;
	params.set(("EmailAddress"), username);
	params.set(("Password"), password);

	XmlElement* n = smugMugRequest(("smugmug.login.withPassword"), params);
	
	if (n)
	{
		XmlElement* l = n->getChildByName(("Login"));
		if (l)
		{
			accountType = l->getStringAttribute(("AccountType"));
			XmlElement* s = l->getChildByName(("Session"));
			if (s)
			{
				sessionId = s->getStringAttribute(("id"));
				addLogEntry(("Info: logged in session: ") + sessionId);
			}
		}
		delete n;
	}
}
    static void findTempoEvents (MidiFile& midiFile, StringPairArray& midiMetadata)
    {
        MidiMessageSequence tempoEvents;
        midiFile.findAllTempoEvents (tempoEvents);

        const int numTempoEvents = tempoEvents.getNumEvents();
        MemoryOutputStream tempoSequence;

        for (int i = 0; i < numTempoEvents; ++i)
        {
            const double tempo = getTempoFromTempoMetaEvent (tempoEvents.getEventPointer (i));

            if (tempo > 0.0)
            {
                if (i == 0)
                    midiMetadata.set (CoreAudioFormat::tempo, String (tempo));

                if (numTempoEvents > 1)
                    tempoSequence << String (tempo) << ',' << tempoEvents.getEventTime (i) << ';';
            }
        }

        if (tempoSequence.getDataSize() > 0)
            midiMetadata.set ("tempo sequence", tempoSequence.toUTF8());
    }
    static void findKeySigEvents (MidiFile& midiFile, StringPairArray& midiMetadata)
    {
        MidiMessageSequence keySigEvents;
        midiFile.findAllKeySigEvents (keySigEvents);
        const int numKeySigEvents = keySigEvents.getNumEvents();

        MemoryOutputStream keySigSequence;

        for (int i = 0; i < numKeySigEvents; ++i)
        {
            const MidiMessage& message (keySigEvents.getEventPointer (i)->message);
            const int key = jlimit (0, 14, message.getKeySignatureNumberOfSharpsOrFlats() + 7);
            const bool isMajor = message.isKeySignatureMajorKey();

            static const char* majorKeys[] = { "Cb", "Gb", "Db", "Ab", "Eb", "Bb", "F", "C", "G", "D", "A", "E", "B", "F#", "C#" };
            static const char* minorKeys[] = { "Ab", "Eb", "Bb", "F", "C", "G", "D", "A", "E", "B", "F#", "C#", "G#", "D#", "A#" };

            String keySigString (isMajor ? majorKeys[key]
                                         : minorKeys[key]);

            if (! isMajor)
                keySigString << 'm';

            if (i == 0)
                midiMetadata.set (CoreAudioFormat::keySig, keySigString);

            if (numKeySigEvents > 1)
                keySigSequence << keySigString << ',' << keySigEvents.getEventTime (i) << ';';
        }

        if (keySigSequence.getDataSize() > 0)
            midiMetadata.set ("key signature sequence", keySigSequence.toUTF8());
    }
Exemplo n.º 5
0
void ProjectExporter::addTargetSpecificPreprocessorDefs (StringPairArray& defs, const ProjectType::Target::Type targetType) const
{
    std::pair<String, ProjectType::Target::Type> targetFlags[] = {
        {"JucePlugin_Build_VST",        ProjectType::Target::VSTPlugIn},
        {"JucePlugin_Build_VST3",       ProjectType::Target::VST3PlugIn},
        {"JucePlugin_Build_AU",         ProjectType::Target::AudioUnitPlugIn},
        {"JucePlugin_Build_AUv3",       ProjectType::Target::AudioUnitv3PlugIn},
        {"JucePlugin_Build_RTAS",       ProjectType::Target::RTASPlugIn},
        {"JucePlugin_Build_AAX",        ProjectType::Target::AAXPlugIn},
        {"JucePlugin_Build_Standalone", ProjectType::Target::StandalonePlugIn}
    };

    if (targetType == ProjectType::Target::SharedCodeTarget)
    {
        for (auto& flag : targetFlags)
            defs.set (flag.first, (shouldBuildTargetType (flag.second) ? "1" : "0"));

        defs.set ("JUCE_SHARED_CODE", "1");
    }
    else if (targetType != ProjectType::Target::unspecified)
    {
        for (auto& flag : targetFlags)
            defs.set (flag.first, (targetType == flag.second ? "1" : "0"));
    }
}
    static void findTimeSigEvents (MidiFile& midiFile, StringPairArray& midiMetadata)
    {
        MidiMessageSequence timeSigEvents;
        midiFile.findAllTimeSigEvents (timeSigEvents);
        const int numTimeSigEvents = timeSigEvents.getNumEvents();

        MemoryOutputStream timeSigSequence;

        for (int i = 0; i < numTimeSigEvents; ++i)
        {
            int numerator, denominator;
            timeSigEvents.getEventPointer(i)->message.getTimeSignatureInfo (numerator, denominator);

            String timeSigString;
            timeSigString << numerator << '/' << denominator;

            if (i == 0)
                midiMetadata.set (CoreAudioFormat::timeSig, timeSigString);

            if (numTimeSigEvents > 1)
                timeSigSequence << timeSigString << ',' << timeSigEvents.getEventTime (i) << ';';
        }

        if (timeSigSequence.getDataSize() > 0)
            midiMetadata.set ("time signature sequence", timeSigSequence.toUTF8());
    }
Exemplo n.º 7
0
//==============================================================================
static void setData (const AnalyticsDestination::AnalyticsEvent& event, StringPairArray& data)
{
    data.set ("ea",  event.name);

    if (event.parameters.getAllKeys().contains ("label"))
        data.set ("el", event.parameters.getValue ("label", {}));

    data.addArray (event.userProperties);
}
Exemplo n.º 8
0
bool SmugMug::getImages(OwnedArray<ImageItem>& images, SmugID albumId)
{
	StringPairArray params;
	params.set(("AlbumID"), String(albumId.id));
	params.set(("AlbumKey"), albumId.key);
	params.set(("Heavy"), ("1"));
	XmlElement* n = smugMugRequest(("smugmug.images.get"), params);

	if (n)
	{
		XmlElement* a = n->getChildByName(("Album"));
		if (a)
		{
			XmlElement* i = a->getChildByName(("Images"));
			if (i)
			{
				XmlElement* img = i->getChildByName(("Image"));
				while (img)
				{
					ImageItem* itm = new ImageItem();

					itm->id.id			= img->getIntAttribute(("id"));
					itm->id.key			= img->getStringAttribute(("Key"));
					itm->filename		= img->getStringAttribute(("FileName"));
					itm->caption		= img->getStringAttribute((""));
					itm->keywords		= img->getStringAttribute((""));
					itm->position		= img->getIntAttribute(("Position"));
					itm->date			= img->getStringAttribute(("Date"));
					itm->format			= img->getStringAttribute(("Format"));
					itm->serial			= img->getIntAttribute(("Serial"));
					itm->watermark		= img->getBoolAttribute(("Watermark"));
					itm->size			= img->getIntAttribute(("Size"));
					itm->width			= img->getIntAttribute(("Width"));
					itm->height			= img->getIntAttribute(("Height"));
					itm->md5sum			= img->getStringAttribute(("MD5Sum"));
					itm->lastUpdated	= img->getStringAttribute(("LastUpdated"));
					itm->originalURL	= img->getStringAttribute(("OriginalURL"));
					itm->largeURL		= img->getStringAttribute(("LargeURL"));
					itm->mediumURL		= img->getStringAttribute(("MediumURL"));
					itm->smallURL		= img->getStringAttribute(("SmallURL"));
					itm->tinyURL		= img->getStringAttribute(("TinyURL"));
					itm->thumbURL		= img->getStringAttribute(("ThumbURL"));
					itm->albumURL		= img->getStringAttribute(("AlbumURL"));

					images.add(itm);

					img = img->getNextElementWithTagName(("Image"));
				}
			}
		}
		delete n;
		return images.size() > 0;
	}
	return false;
}
Exemplo n.º 9
0
    void testBackend (String type, int64 const seedValue, int numObjectsToTest = 2000)
    {
        DummyScheduler scheduler;

        beginTestCase (String ("Backend type=") + type);

        StringPairArray params;
        File const path (File::createTempFile ("node_db"));
        params.set ("type", type);
        params.set ("path", path.getFullPathName ());

        // Create a batch
        Batch batch;
        createPredictableBatch (batch, 0, numObjectsToTest, seedValue);

        {
            // Open the backend
            ScopedPointer <Backend> backend (DatabaseImp::createBackend (params, scheduler));

            // Write the batch
            storeBatch (*backend, batch);

            {
                // Read it back in
                Batch copy;
                fetchCopyOfBatch (*backend, &copy, batch);
                expect (areBatchesEqual (batch, copy), "Should be equal");
            }

            {
                // Reorder and read the copy again
                Batch copy;
                UnitTestUtilities::repeatableShuffle (batch.size (), batch, seedValue);
                fetchCopyOfBatch (*backend, &copy, batch);
                expect (areBatchesEqual (batch, copy), "Should be equal");
            }
        }

        {
            // Re-open the backend
            ScopedPointer <Backend> backend (DatabaseImp::createBackend (params, scheduler));

            // Read it back in
            Batch copy;
            fetchCopyOfBatch (*backend, &copy, batch);
            // Canonicalize the source and destination batches
            std::sort (batch.begin (), batch.end (), NodeObject::LessThan ());
            std::sort (copy.begin (), copy.end (), NodeObject::LessThan ());
            expect (areBatchesEqual (batch, copy), "Should be equal");
        }
    }
Exemplo n.º 10
0
    void testImport (String destBackendType, String srcBackendType, int64 seedValue)
    {
        DummyScheduler scheduler;

        File const node_db (File::createTempFile ("node_db"));
        StringPairArray srcParams;
        srcParams.set ("type", srcBackendType);
        srcParams.set ("path", node_db.getFullPathName ());

        // Create a batch
        Batch batch;
        createPredictableBatch (batch, 0, numObjectsToTest, seedValue);

        // Write to source db
        {
            ScopedPointer <Database> src (Database::New ("test", scheduler, srcParams));
            storeBatch (*src, batch);
        }

        Batch copy;

        {
            // Re-open the db
            ScopedPointer <Database> src (Database::New ("test", scheduler, srcParams));

            // Set up the destination database
            File const dest_db (File::createTempFile ("dest_db"));
            StringPairArray destParams;
            destParams.set ("type", destBackendType);
            destParams.set ("path", dest_db.getFullPathName ());

            ScopedPointer <Database> dest (Database::New ("test", scheduler, destParams));

            beginTestCase (String ("import into '") + destBackendType + "' from '" + srcBackendType + "'");

            // Do the import
            dest->import (*src);

            // Get the results of the import
            fetchCopyOfBatch (*dest, &copy, batch);
        }

        // Canonicalize the source and destination batches
        std::sort (batch.begin (), batch.end (), NodeObject::LessThan ());
        std::sort (copy.begin (), copy.end (), NodeObject::LessThan ());
        expect (areBatchesEqual (batch, copy), "Should be equal");

    }
Exemplo n.º 11
0
StringPairArray ProjectExporter::getAllPreprocessorDefs (const ProjectExporter::BuildConfiguration& config) const
{
    StringPairArray defs (mergePreprocessorDefs (config.getAllPreprocessorDefs(),
                                                 parsePreprocessorDefs (getExporterPreprocessorDefsString())));
    defs.set (getExporterIdentifierMacro(), "1");
    return defs;
}
Exemplo n.º 12
0
StringPairArray ProjectExporter::getAllPreprocessorDefs() const
{
    StringPairArray defs (mergePreprocessorDefs (project.getPreprocessorDefs(),
                                                 parsePreprocessorDefs (getExporterPreprocessorDefsString())));
    defs.set (getExporterIdentifierMacro(), "1");
    return defs;
}
Exemplo n.º 13
0
StringPairArray mergePreprocessorDefs (StringPairArray inheritedDefs, const StringPairArray& overridingDefs)
{
    for (int i = 0; i < overridingDefs.size(); ++i)
        inheritedDefs.set (overridingDefs.getAllKeys()[i], overridingDefs.getAllValues()[i]);

    return inheritedDefs;
}
Exemplo n.º 14
0
//======================================================================
static void sendProjectButtonAnalyticsEvent (StringRef label)
{
    StringPairArray data;
    data.set ("label", label);

    Analytics::getInstance()->logEvent ("Project Button",  data, ProjucerAnalyticsEvent::projectEvent);
}
Exemplo n.º 15
0
int SmugMug::createSubCategory(const int categoryId, const String& title)
{	
	int subCatId = -1;

	StringPairArray params;
	params.set(("CategoryID"), String(categoryId));
	params.set(("Name"), title);
	XmlElement* n = smugMugRequest(("smugmug.subcategories.create"), params);

	if (n)
	{
		XmlElement* a = n->getChildByName(("SubCategory"));
		if (a) 
			subCatId = a->getIntAttribute(("id"), -1);

		delete n;
	}
	return subCatId;
}
    //==============================================================================
    static StringPairArray parseInformationChunk (InputStream& input)
    {
        StringPairArray infoStrings;
        const uint32 numEntries = (uint32) input.readIntBigEndian();

        for (uint32 i = 0; i < numEntries; ++i)
            infoStrings.set (input.readString(), input.readString());

        return infoStrings;
    }
Exemplo n.º 17
0
void ProjucerAnalyticsDestination::restoreUnloggedEvents (std::deque<AnalyticsEvent>& restoredEventQueue)
{
    XmlDocument savedEvents (savedEventsFile);
    std::unique_ptr<XmlElement> xml (savedEvents.getDocumentElement());

    if (xml.get() == nullptr || xml->getTagName() != "events")
        return;

    auto numEvents = xml->getNumChildElements();

    for (int iEvent = 0; iEvent < numEvents; ++iEvent)
    {
        auto* xmlEvent = xml->getChildElement (iEvent);

        StringPairArray parameters;
        auto* xmlParameters = xmlEvent->getChildByName ("parameters");
        auto numParameters = xmlParameters->getNumAttributes();

        for (int iParam = 0; iParam < numParameters; ++iParam)
            parameters.set (xmlParameters->getAttributeName (iParam),
                            xmlParameters->getAttributeValue (iParam));

        StringPairArray userProperties;
        auto* xmlUserProperties = xmlEvent->getChildByName ("user_properties");
        auto numUserProperties = xmlUserProperties->getNumAttributes();

        for (int iProp = 0; iProp < numUserProperties; ++iProp)
            userProperties.set (xmlUserProperties->getAttributeName (iProp),
                                xmlUserProperties->getAttributeValue (iProp));

        restoredEventQueue.push_back ({
            xmlEvent->getStringAttribute ("name"),
            xmlEvent->getIntAttribute ("type"),
            static_cast<uint32> (xmlEvent->getIntAttribute ("timestamp")),
            parameters,
            xmlEvent->getStringAttribute ("user_id"),
            userProperties
        });
    }

    savedEventsFile.deleteFile();
}
Exemplo n.º 18
0
bool SmugMug::getNumberOfViews(int month, int year, OwnedArray<Views>& albums, OwnedArray<Views>& images)
{
	StringPairArray params;
	params.set(("Month"), String(month));
	params.set(("Year"), String(year));
	XmlElement* n = smugMugRequest(("smugmug.users.getTransferStats"), params);

	if (n)
	{
		XmlElement* albs = n->getChildByName(("Albums"));
		if (albs)
		{
			XmlElement* alb = albs->getChildByName(("Album"));
			while (alb)
			{
				Views* v = new Views();
				v->id    = alb->getIntAttribute(("id"));
				v->views = alb->getIntAttribute(("Tiny")) + alb->getIntAttribute(("Small")) + alb->getIntAttribute(("Medium")) + alb->getIntAttribute(("Large")) + roundDoubleToInt(alb->getDoubleAttribute(("Original")));

				albums.add(v);

				XmlElement* img = n->getChildByName(("Image"));
				while (img)
				{
					Views* v = new Views();
					v->id    = img->getIntAttribute(("id"));
					v->views = img->getIntAttribute(("Tiny")) + img->getIntAttribute(("Small")) + img->getIntAttribute(("Medium")) + img->getIntAttribute(("Large")) + roundDoubleToInt(img->getDoubleAttribute(("Original")));

					img = img->getNextElementWithTagName(("Image"));
				}

				alb = alb->getNextElementWithTagName(("Album"));
			}
		}
		delete n;
		return true;
	}
	return false;
}
Exemplo n.º 19
0
    StringPairArray getResponseHeaders() const
    {
        StringPairArray responseHeaders;
        if (! isError())
        {
            for (int i = 0; i < headerLines.size(); ++i)
            {
                const String& headersEntry = headerLines[i];
                const String key (headersEntry.upToFirstOccurrenceOf (": ", false, false));
                const String value (headersEntry.fromFirstOccurrenceOf (": ", false, false));
                const String previousValue (responseHeaders [key]);
                responseHeaders.set (key, previousValue.isEmpty() ? value : (previousValue + "," + value));
            }
        }

        return responseHeaders;
    }
Exemplo n.º 20
0
bool SmugMug::deleteAlbum(SmugID album)
{
	StringPairArray params;
	params.set(("AlbumID"), String(album.id));
	XmlElement* n = smugMugRequest(("smugmug.albums.delete"), params);

	if (n)
	{	
		if (n->getTagName() == ("rsp") && n->getStringAttribute(("stat")) == ("ok"))
		{
			delete n;
			return true;
		}
		delete n;
	}
	return false;
}
Exemplo n.º 21
0
bool SmugMug::deleteSubCategory(int subCategory)
{
	StringPairArray params;
	params.set(("SubCategoryID"), String(subCategory));
	XmlElement* n = smugMugRequest(("smugmug.subcategories.delete"), params);

	if (n)
	{	
		if (n->getTagName() == ("rsp") && n->getStringAttribute(("stat")) == ("ok"))
		{
			delete n;
			return true;
		}
		delete n;
	}
	return false;
}
Exemplo n.º 22
0
bool SmugMug::deleteImage(SmugID image)
{
	StringPairArray params;
	params.set(("ImageID"), String(image.id));
	XmlElement* n = smugMugRequest(("smugmug.images.delete"), params);

	if (n)
	{	
		if (n->getTagName() == ("rsp") && n->getStringAttribute(("stat")) == ("ok"))
		{
			delete n;
			return true;
		}
		delete n;
	}
	return false;
}
Exemplo n.º 23
0
void ProjectExporter::addTargetSpecificPreprocessorDefs (StringPairArray& defs, const ProjectType::Target::Type targetType) const
{
    if (targetType == ProjectType::Target::SharedCodeTarget)
    {
        defs.set ("JucePlugin_Build_VST",        (shouldBuildTargetType (ProjectType::Target::VSTPlugIn)         ? "1" : "0"));
        defs.set ("JucePlugin_Build_VST3",       (shouldBuildTargetType (ProjectType::Target::VST3PlugIn)        ? "1" : "0"));
        defs.set ("JucePlugin_Build_AU",         (shouldBuildTargetType (ProjectType::Target::AudioUnitPlugIn)   ? "1" : "0"));
        defs.set ("JucePlugin_Build_AUv3",       (shouldBuildTargetType (ProjectType::Target::AudioUnitv3PlugIn) ? "1" : "0"));
        defs.set ("JucePlugin_Build_RTAS",       (shouldBuildTargetType (ProjectType::Target::RTASPlugIn)        ? "1" : "0"));
        defs.set ("JucePlugin_Build_AAX",        (shouldBuildTargetType (ProjectType::Target::AAXPlugIn)         ? "1" : "0"));
        defs.set ("JucePlugin_Build_Standalone", (shouldBuildTargetType (ProjectType::Target::StandalonePlugIn)  ? "1" : "0"));
        defs.set ("JUCE_SHARED_CODE", "1");
    }
    else if (targetType != ProjectType::Target::unspecified)
    {
        defs.set ("JucePlugin_Build_VST",        (targetType == ProjectType::Target::VSTPlugIn         ? "1" : "0"));
        defs.set ("JucePlugin_Build_VST3",       (targetType == ProjectType::Target::VST3PlugIn        ? "1" : "0"));
        defs.set ("JucePlugin_Build_AU",         (targetType == ProjectType::Target::AudioUnitPlugIn   ? "1" : "0"));
        defs.set ("JucePlugin_Build_AUv3",       (targetType == ProjectType::Target::AudioUnitv3PlugIn ? "1" : "0"));
        defs.set ("JucePlugin_Build_RTAS",       (targetType == ProjectType::Target::RTASPlugIn        ? "1" : "0"));
        defs.set ("JucePlugin_Build_AAX",        (targetType == ProjectType::Target::AAXPlugIn         ? "1" : "0"));
        defs.set ("JucePlugin_Build_Standalone", (targetType == ProjectType::Target::StandalonePlugIn  ? "1" : "0"));
    }
}
Exemplo n.º 24
0
//==============================================================================
StringPairArray parsePreprocessorDefs (const String& text)
{
    StringPairArray result;
    String::CharPointerType s (text.getCharPointer());

    while (! s.isEmpty())
    {
        String token, value;
        s = s.findEndOfWhitespace();

        while ((! s.isEmpty()) && *s != '=' && ! s.isWhitespace())
            token << s.getAndAdvance();

        s = s.findEndOfWhitespace();

        if (*s == '=')
        {
            ++s;

            while ((! s.isEmpty()) && *s == ' ')
                ++s;

            while ((! s.isEmpty()) && ! s.isWhitespace())
            {
                if (*s == ',')
                {
                    ++s;
                    break;
                }

                if (*s == '\\' && (s[1] == ' ' || s[1] == ','))
                    ++s;

                value << s.getAndAdvance();
            }
        }

        if (token.isNotEmpty())
            result.set (token, value);
    }

    return result;
}
Exemplo n.º 25
0
StringPairArray WebInputStream::parseHttpHeaders (const String& headerData)
{
    StringPairArray headerPairs;
    StringArray headerLines = StringArray::fromLines (headerData);

    // ignore the first line as this is the status line
    for (int i = 1; i < headerLines.size(); ++i)
    {
        const String& headersEntry = headerLines[i];

        if (headersEntry.isNotEmpty())
        {
            const String key (headersEntry.upToFirstOccurrenceOf (": ", false, false));
            const String value (headersEntry.fromFirstOccurrenceOf (": ", false, false));
            const String previousValue (headerPairs [key]);
            headerPairs.set (key, previousValue.isEmpty() ? value : (previousValue + "," + value));
        }
    }

    return headerPairs;
}
Exemplo n.º 26
0
    //==============================================================================
    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;
    }
Exemplo n.º 27
0
END_TEST

BEGIN_TEST(SystemNet_WebRequest_CanPostAsync)
{
	try
	{
		bytesReceived = 0;
		WebRequest request("http://www.google.com");
		DataReceivedDelegate callback = std::bind(downloadAsync, _1);
		StringPairArray params;
		params.set("q", "test");
		request.postAsync(params, callback);
		WIN_ASSERT_TRUE( request.isStarted() );
		WIN_ASSERT_TRUE( request.wait(5000) );
		WIN_ASSERT_TRUE( request.getResponseCode() == 405 );	// Post not allowed to Google
		WIN_ASSERT_TRUE( request.isCompleted() );
	}
	catch(Exception & ex)
	{
		String msg = ex.getFullMessage();
		WIN_ASSERT_FAIL(msg.toUTF16());
	}
}
Exemplo n.º 28
0
void SqueezerAudioProcessorEditor::buttonClicked(
    Button *Button)
{
    if (Button == &ButtonBypass_)
    {
        PluginProcessor_->changeParameter(SqueezerPluginParameters::selBypass,
                                          !Button->getToggleState());
    }
    else if (Button == &ButtonDetectorRms_)
    {
        PluginProcessor_->changeParameter(
            SqueezerPluginParameters::selDetectorRmsFilter,
            !Button->getToggleState());
    }
    else if (Button == &ButtonDesignFeedback_)
    {
        PluginProcessor_->changeParameter(
            SqueezerPluginParameters::selDesign,
            !Button->getToggleState());
    }
    else if (Button == &ButtonGainStageOptical_)
    {
        PluginProcessor_->changeParameter(
            SqueezerPluginParameters::selGainStage,
            !Button->getToggleState());
    }
    else if (Button == &ButtonDetectorLinear_)
    {
        PluginProcessor_->changeParameter(
            SqueezerPluginParameters::selDetector,
            SideChain::DetectorLinear /
            float(SideChain::NumberOfDetectors - 1));
    }
    else if (Button == &ButtonDetectorSmoothDecoupled_)
    {
        PluginProcessor_->changeParameter(
            SqueezerPluginParameters::selDetector,
            SideChain::DetectorSmoothDecoupled /
            float(SideChain::NumberOfDetectors - 1));
    }
    else if (Button == &ButtonDetectorSmoothBranching_)
    {
        PluginProcessor_->changeParameter(
            SqueezerPluginParameters::selDetector,
            SideChain::DetectorSmoothBranching /
            float(SideChain::NumberOfDetectors - 1));
    }
    else if (Button == &ButtonKneeHard_)
    {
        PluginProcessor_->changeParameter(
            SqueezerPluginParameters::selKneeWidth,
            Compressor::KneeHard /
            float(Compressor::NumberOfKneeSettings - 1));
    }
    else if (Button == &ButtonKneeMedium_)
    {
        PluginProcessor_->changeParameter(
            SqueezerPluginParameters::selKneeWidth,
            Compressor::KneeMedium /
            float(Compressor::NumberOfKneeSettings - 1));
    }
    else if (Button == &ButtonKneeSoft_)
    {
        PluginProcessor_->changeParameter(
            SqueezerPluginParameters::selKneeWidth,
            Compressor::KneeSoft /
            float(Compressor::NumberOfKneeSettings - 1));
    }
    else if (Button == &ButtonAutoMakeupGain_)
    {
        PluginProcessor_->changeParameter(
            SqueezerPluginParameters::selAutoMakeupGain,
            !Button->getToggleState());
    }
    else if (Button == &ButtonSidechainInput_)
    {
        PluginProcessor_->changeParameter(
            SqueezerPluginParameters::selSidechainInput,
            !Button->getToggleState());
    }
    else if (Button == &ButtonSidechainListen_)
    {
        PluginProcessor_->changeParameter(
            SqueezerPluginParameters::selSidechainListen,
            !Button->getToggleState());
    }
    else if (Button == &ButtonReset_)
    {
        PluginProcessor_->resetMeters();

        // apply skin to plug-in editor
        loadSkin_();
    }
    else if (Button == &ButtonSettings_)
    {
        // manually activate button
        Button->setToggleState(true,
                               dontSendNotification);

        int Width = 440;
        int Height = 155;
        String PluginSettings = PluginProcessor_->getParameters().trim();

        // prepare and launch dialog window
        DialogWindow *windowSettings =
            frut::widgets::WindowSettingsContent::createDialogWindow(
                this, Width, Height, PluginSettings);

        // attach callback to dialog window
        ModalComponentManager::getInstance()->attachCallback(
            windowSettings, ModalCallbackFunction::forComponent(
                window_settings_callback, this));

        // manually deactivate button
        Button->setToggleState(false, dontSendNotification);
    }
    else if (Button == &ButtonSkin_)
    {
        // manually activate button (will be deactivated in dialog
        // window callback)
        Button->setToggleState(true, dontSendNotification);

        // prepare and launch dialog window
        DialogWindow *WindowSkin =
            frut::widgets::WindowSkinContent::createDialogWindow(
                this, &CurrentSkinName_, SkinDirectory_);

        // attach callback to dialog window
        ModalComponentManager::getInstance()->attachCallback(
            WindowSkin, ModalCallbackFunction::forComponent(
                window_skin_callback, this));
    }
    else if (Button == &ButtonAbout_)
    {
        // manually activate button (will be deactivated in dialog
        // window callback)
        Button->setToggleState(true,
                               dontSendNotification);

        StringPairArray Chapters;

        String pluginNameAndVersion = String(ProjectInfo::projectName);
        pluginNameAndVersion += " v";
        pluginNameAndVersion += JucePlugin_VersionString;

#if JucePlugin_Build_AU
        pluginNameAndVersion += " (Audio Unit)";
#endif

#if JucePlugin_Build_LV2
        pluginNameAndVersion += " (LV2)";
#endif

#if JucePlugin_Build_VST
        pluginNameAndVersion += " (VST)";
#endif

#if JucePlugin_Build_VST3
        pluginNameAndVersion += " (VST3)";
#endif

        Chapters.set(
            pluginNameAndVersion,
            String(JucePlugin_Desc) + ".\n");

        Chapters.set(
            "Copyright",
            "(c) 2013-2019 Martin Zuther\n");

        Chapters.set(
            "Contributors",
            L"Dimitrios Giannoulis et al.\n"
            L"Filipe Coelho\n"
            L"Paul Kellet\n"
            L"Bram de Jong\n");

        Chapters.set(
            "Thanks",
            L"I want to thank all contributors and beta testers "
            L"and the open source community at large!\n\n"
            L"Thank you for using free software!\n");

        Chapters.set(
            "Libraries",
#ifdef LINUX
            L"ALSA\n"
#endif
#ifdef LINUX
            L"FreeType\n"
            L"JACK\n"
#endif
            L"JUCE\n"
#if JucePlugin_Build_LV2
            L"LV2\n"
#endif
#ifdef LINUX
            L"POSIX Threads\n"
#endif
#if JucePlugin_Build_VST || JucePlugin_Build_VST3
            L"VST\n"
#endif
#ifdef LINUX
            L"Xlib\n"
            L"Xext\n"
#endif
        );

#if JucePlugin_Build_VST || JucePlugin_Build_VST3
        // display trademarks (but only when necessary)
        Chapters.set(
            "Trademarks",
            L"VST is a trademark of Steinberg Media Technologies GmbH, "
            L"registered in Europe and other countries.\n");
#endif

        Chapters.set(
            "License",
            L"This program is free software: you can redistribute it "
            L"and/or modify it under the terms of the GNU General "
            L"Public License as published by the Free Software "
            L"Foundation, either version 3 of the License, or (at "
            L"your option) any later version.\n\n"

            L"This program is distributed in the hope that it will "
            L"be useful, but WITHOUT ANY WARRANTY; without even "
            L"the implied warranty of MERCHANTABILITY or FITNESS "
            L"FOR A PARTICULAR PURPOSE.  See the GNU General Public "
            L"License for more details.\n\n"

            L"You should have received a copy of the GNU General "
            L"Public License along with this program.  If not, "
            L"see <http://www.gnu.org/licenses/>.\n\n"

            L"Thank you for using free software!");

        // prepare and launch dialog window
        int Width = 270;
        int Height = 540;

        DialogWindow *windowAbout =
            frut::widgets::WindowAboutContent::createDialogWindow(
                this, Width, Height, Chapters);

        // attach callback to dialog window
        ModalComponentManager::getInstance()->attachCallback(
            windowAbout, ModalCallbackFunction::forComponent(
                window_about_callback, this));
    }
    else
    {
        float FloatValue = Button->getToggleState() ? 1.0f : 0.0f;
        frut::widgets::SliderCombined *Slider =
            dynamic_cast<frut::widgets::SliderCombined *>(
                Button->getParentComponent());

        if (Slider == SliderThreshold_)
        {
            PluginProcessor_->changeParameter(
                SqueezerPluginParameters::selThresholdSwitch,
                FloatValue);
        }
        else if (Slider == SliderRatio_)
        {
            PluginProcessor_->changeParameter(
                SqueezerPluginParameters::selRatioSwitch,
                FloatValue);
        }
        else if (Slider == SliderAttackRate_)
        {
            PluginProcessor_->changeParameter(
                SqueezerPluginParameters::selAttackRateSwitch,
                FloatValue);
        }
        else if (Slider == SliderReleaseRate_)
        {
            PluginProcessor_->changeParameter(
                SqueezerPluginParameters::selReleaseRateSwitch,
                FloatValue);
        }
        else if (Slider == SliderMakeupGain_)
        {
            PluginProcessor_->changeParameter(
                SqueezerPluginParameters::selMakeupGainSwitch,
                FloatValue);
        }
        else if (Slider == SliderWetMix_)
        {
            PluginProcessor_->changeParameter(
                SqueezerPluginParameters::selWetMixSwitch,
                FloatValue);
        }
        else if (Slider == SliderSidechainHPFCutoff_)
        {
            PluginProcessor_->changeParameter(
                SqueezerPluginParameters::selSidechainHPFCutoffSwitch,
                FloatValue);
        }
        else if (Slider == SliderSidechainLPFCutoff_)
        {
            PluginProcessor_->changeParameter(
                SqueezerPluginParameters::selSidechainLPFCutoffSwitch,
                FloatValue);
        }
        else
        {
            DBG("[Squeezer] editor::buttonClicked ==> invalid button");
        }
    }
}
Exemplo n.º 29
0
void ProjectExporter::addDefaultPreprocessorDefs (StringPairArray& defs) const
{
    defs.set (getExporterIdentifierMacro(), "1");
    defs.set ("JUCE_APP_VERSION", project.getVersionString());
    defs.set ("JUCE_APP_VERSION_HEX", project.getVersionAsHex());
}
Exemplo n.º 30
0
//==============================================================================
JUCESplashScreen::JUCESplashScreen (Component& parent)
{
    ignoreUnused (hasStartedFading);
    ignoreUnused (parent);

   #if JUCE_REPORT_APP_USAGE
    if (! appUsageReported)
    {
        const ScopedTryLock appUsageReportingLock (appUsageReporting);

        if (appUsageReportingLock.isLocked() && ! appUsageReported)
        {
            const auto deviceDescription = SystemStats::getDeviceDescription();
            const auto deviceString = SystemStats::getDeviceIdentifiers().joinIntoString (":");
            const auto deviceIdentifier = String::toHexString (deviceString.hashCode64());
            const auto osName = SystemStats::getOperatingSystemName();

            StringPairArray data;

            data.set ("v",   "1");
            data.set ("tid", "UA-19759318-3");
            data.set ("cid", deviceIdentifier);
            data.set ("t",   "event");
            data.set ("ec",  "info");
            data.set ("ea",  "appStarted");

            data.set ("cd1", SystemStats::getJUCEVersion());
            data.set ("cd2", osName);
            data.set ("cd3", deviceDescription);
            data.set ("cd4", deviceIdentifier);

            String appType, appName, appVersion, appManufacturer;

           #if defined(JucePlugin_Name)
            appType         = "Plugin";
            appName         = JucePlugin_Name;
            appVersion      = JucePlugin_VersionString;
            appManufacturer = JucePlugin_Manufacturer;
           #else
            if (JUCEApplicationBase::isStandaloneApp())
            {
                appType = "Application";

                if (auto* app = JUCEApplicationBase::getInstance())
                {
                    appName    = app->getApplicationName();
                    appVersion = app->getApplicationVersion();
                }
            }
            else
            {
                appType = "Library";
            }
           #endif

            data.set ("cd5", appType);
            data.set ("cd6", appName);
            data.set ("cd7", appVersion);
            data.set ("cd8", appManufacturer);

            data.set ("an", appName);
            data.set ("av", appVersion);

            auto agentCPUVendor = SystemStats::getCpuVendor();

            if (agentCPUVendor.isEmpty())
                agentCPUVendor = "CPU";

            auto agentOSName = osName.replaceCharacter ('.', '_')
                                     .replace ("iOS", "iPhone OS");
           #if JUCE_IOS
            agentOSName << " like Mac OS X";
           #endif

            String userAgent;
            userAgent << "Mozilla/5.0 ("
                      << deviceDescription << ";"
                      << agentCPUVendor << " " << agentOSName << ";"
                      << SystemStats::getDisplayLanguage() << ")";

            ReportingThreadContainer::getInstance()->sendReport ("https://www.google-analytics.com/collect", userAgent, data);

            appUsageReported = true;
        }
    }
   #else
    ignoreUnused (appUsageReported);
   #endif

   #if JUCE_DISPLAY_SPLASH_SCREEN
    if (splashDisplayTime == 0
         || Time::getMillisecondCounter() < splashDisplayTime + (uint32) millisecondsToDisplaySplash)
    {
        content = getSplashScreenLogo();

        setAlwaysOnTop (true);
        parent.addAndMakeVisible (this);
    }
    else
   #endif
    {
        startTimer (1);
    }
}