AudioProcessor::AudioProcessor()
    : wrapperType (wrapperTypeBeingCreated.get()),
      playHead (nullptr),
      currentSampleRate (0),
      blockSize (0),
      latencySamples (0),
     #if JUCE_DEBUG
      textRecursionCheck (false),
     #endif
      suspended (false),
      nonRealtime (false),
      processingPrecision (singlePrecision)
{
   #ifdef JucePlugin_PreferredChannelConfigurations
    const short channelConfigs[][2] = { JucePlugin_PreferredChannelConfigurations };
   #else
    const short channelConfigs[][2] = { {2, 2} };
   #endif

   #ifdef JucePlugin_MaxNumInputChannels
    const int maxInChannels = JucePlugin_MaxNumInputChannels;
   #else
    const int maxInChannels = std::numeric_limits<int>::max();
   #endif
    ignoreUnused (maxInChannels);

   #ifdef JucePlugin_MaxNumOutputChannels
    const int maxOutChannels = JucePlugin_MaxNumOutputChannels;
   #else
    const int maxOutChannels = std::numeric_limits<int>::max();
   #endif
    ignoreUnused (maxOutChannels);

 #if ! JucePlugin_IsMidiEffect
//   #if ! JucePlugin_IsSynth
    const int numInChannels = jmin (maxInChannels, (int) channelConfigs[0][0]);

    if (numInChannels > 0)
        busArrangement.inputBuses.add  (AudioProcessorBus ("Input",  AudioChannelSet::canonicalChannelSet (numInChannels)));
//   #endif

    const int numOutChannels = jmin (maxOutChannels, (int) channelConfigs[0][1]);
    if (numOutChannels > 0)
        busArrangement.outputBuses.add (AudioProcessorBus ("Output", AudioChannelSet::canonicalChannelSet (numOutChannels)));

  #ifdef JucePlugin_PreferredChannelConfigurations
//   #if ! JucePlugin_IsSynth
    AudioProcessor::setPreferredBusArrangement (true,  0, AudioChannelSet::stereo());
//   #endif
    AudioProcessor::setPreferredBusArrangement (false, 0, AudioChannelSet::stereo());
  #endif
 #endif
    updateSpeakerFormatStrings();
}
Example #2
0
void JUCE_CALLTYPE Thread::setCurrentThreadName (const String& name)
{
   #if JUCE_DEBUG && JUCE_MSVC
    struct
    {
        DWORD dwType;
        LPCSTR szName;
        DWORD dwThreadID;
        DWORD dwFlags;
    } info;

    info.dwType = 0x1000;
    info.szName = name.toUTF8();
    info.dwThreadID = GetCurrentThreadId();
    info.dwFlags = 0;

    __try
    {
        RaiseException (0x406d1388 /*MS_VC_EXCEPTION*/, 0, sizeof (info) / sizeof (ULONG_PTR), (ULONG_PTR*) &info);
    }
    __except (EXCEPTION_CONTINUE_EXECUTION)
    {}
   #else
    ignoreUnused (name);
   #endif
}
Example #3
0
String ModulatorSamplerSoundPool::getTextForPoolTable(int columnId, int indexInPool)
{
#if USE_BACKEND

	if (indexInPool < pool.size())
	{
		switch (columnId)
		{
		case SamplePoolTable::FileName:	return pool[indexInPool]->getFileName();
		case SamplePoolTable::Memory:	return String((int)(pool[indexInPool]->getActualPreloadSize() / 1024)) + " kB";
		case SamplePoolTable::State:	return String(pool[indexInPool]->getSampleStateAsString());
		case SamplePoolTable::References:	return String(pool[indexInPool]->getReferenceCount() - 2);
		default:						jassertfalse; return "";
		}
	}
	else
	{
		jassertfalse;

		return "Invalid Index";

	}
#else
	ignoreUnused(columnId, indexInPool);
	return "";

#endif
}
Example #4
0
    //==============================================================================
    void initialise (const String& commandLine) override
    {
        ignoreUnused (commandLine);
        // This method is where you should put your application's initialisation code..

        mainWindow = new MainWindow (getApplicationName());
    }
Example #5
0
 void anotherInstanceStarted (const String& commandLine) override
 {
     ignoreUnused (commandLine);
     // When another instance of the app is launched while this one is running,
     // this method is invoked, and the commandLine parameter tells you what
     // the other instance's command-line arguments were.
 }
//==============================================================================
MultiChoicePropertyComponent::MultiChoicePropertyComponent (const String& propertyName,
                                                            const StringArray& choices,
                                                            const Array<var>& correspondingValues)
    : PropertyComponent (propertyName, 70)
{
    // The array of corresponding values must contain one value for each of the items in
    // the choices array!
    jassert (choices.size() == correspondingValues.size());

    ignoreUnused (correspondingValues);

    for (auto choice : choices)
        addAndMakeVisible (choiceButtons.add (new ToggleButton (choice)));

    maxHeight = (choiceButtons.size() * 25) + 20;

    {
        Path expandShape;
        expandShape.addTriangle ({ 0, 0 }, { 5, 10 }, { 10, 0});
        expandButton.setShape (expandShape, true, true, false);
    }

    expandButton.onClick = [this] { setExpanded (! expanded); };
    addAndMakeVisible (expandButton);

    lookAndFeelChanged();
}
Example #7
0
    //==============================================================================
    void prepareToPlay (double newSampleRate, int samplesPerBlock) override
    {
        ignoreUnused (samplesPerBlock);

        for (int midiChannel = 0; midiChannel < maxMidiChannel; ++midiChannel)
            synth[midiChannel]->setCurrentPlaybackSampleRate (newSampleRate);
    }
Example #8
0
    //==============================================================================
    OpenSLAudioIODevice (const String& deviceName)
        : AudioIODevice (deviceName, openSLTypeName),
          audioProcessingEnabled (true),
          callback (nullptr)
    {
        // OpenSL has piss-poor support for determining latency, so the only way I can find to
        // get a number for this is by asking the AudioTrack/AudioRecord classes..
        AndroidAudioIODevice javaDevice (deviceName);

        // this is a total guess about how to calculate the latency, but seems to vaguely agree
        // with the devices I've tested.. YMMV
        inputLatency  = (javaDevice.minBufferSizeIn  * 2) / 3;
        outputLatency = (javaDevice.minBufferSizeOut * 2) / 3;

        const int64 longestLatency = jmax (inputLatency, outputLatency);
        const int64 totalLatency = inputLatency + outputLatency;
        inputLatency  = (int) ((longestLatency * inputLatency)  / totalLatency) & ~15;
        outputLatency = (int) ((longestLatency * outputLatency) / totalLatency) & ~15;

        supportsFloatingPoint = getSupportsFloatingPoint();

        bool success = slLibrary.open ("libOpenSLES.so");

        // You can only create this class if you are sure that your hardware supports OpenSL
        jassert (success);
        ignoreUnused (success);
    }
Example #9
0
/// Set **real** parameter value from float.  **This function must not
/// be used!**
///
/// @param newRealValue do not use
///
void ParString::setRealFloat(float newRealValue)
{
    ignoreUnused(newRealValue);

    // do nothing till you hear from me ...
    jassert(false);
}
Example #10
0
/// Set **real** default value from float.  **This function must not
/// be used!**
///
/// @param newRealValue do not use
///
/// @param updateParameter do not use
///
void ParString::setDefaultRealFloat(float newRealValue, bool updateParameter)
{
    ignoreUnused(newRealValue, updateParameter);

    // do nothing till you hear from me ...
    jassert(false);
}
Example #11
0
void JuceDemoPluginAudioProcessor::applyGain (AudioBuffer<FloatType>& buffer, AudioBuffer<FloatType>& delayBuffer)
{
	ignoreUnused (delayBuffer);
    const float gainLevel = *gainParam;

    for (int channel = 0; channel < getNumInputChannels(); ++channel)
        buffer.applyGain (channel, 0, buffer.getNumSamples(), gainLevel);
}
Example #12
0
void GainExample::prepareToPlay(double sampleRate, int blockSize)
{
    ignoreUnused(sampleRate, blockSize);

	// Resizes the internal buffer. This method will be preceded by a call to getConstantValue(), if any constant points to this data.
	internalStorage.allocate(blockSize, true);
	internalStorageSize = blockSize;
}
Example #13
0
void SqueezerAudioProcessorEditor::windowSettingsCallback(
    int ModalResult)
{
    ignoreUnused(ModalResult);

    // manually deactivate about button
    ButtonSettings_.setToggleState(false, dontSendNotification);
}
Example #14
0
/// Transform **internal** value to string.  **This function must not
/// be used!**
///
/// @param newValue **internal** value
///
/// @return formatted string
///
const String ParString::getTextFromFloat(float newValue)
{
    ignoreUnused(newValue);

    // do nothing till you hear from me ...
    jassert(false);

    return String();
}
Example #15
0
/// Transform string to **internal** parameter value.  **This function
/// must not be used!**
///
/// @param newValue correctly formatted string
///
/// @return **internal** value
///
float ParString::getFloatFromText(const String &newValue)
{
    ignoreUnused(newValue);

    // do nothing till you hear from me ...
    jassert(false);

    return 0.0f;
}
Example #16
0
void JucerTreeViewBase::paintItem (Graphics& g, int width, int height)
{
    ignoreUnused (width, height);

    auto bounds = g.getClipBounds().withY (0).withHeight (height).toFloat();

    g.setColour (getOwnerView()->findColour (treeIconColourId).withMultipliedAlpha (0.4f));
    g.fillRect (bounds.removeFromBottom (0.5f).reduced (5, 0));
}
void AudioProcessor::processBlock (AudioBuffer<double>& buffer, MidiBuffer& midiMessages)
{
    ignoreUnused (buffer, midiMessages);

    // If you hit this assertion then either the caller called the double
    // precision version of processBlock on a processor which does not support it
    // (i.e. supportsDoublePrecisionProcessing() returns false), or the implementation
    // of the AudioProcessor forgot to override the double precision version of this method
    jassertfalse;
}
Example #18
0
bool FileChooser::showDialog (const int flags, FilePreviewComponent* const previewComp)
{
    FocusRestorer focusRestorer;

    results.clear();

    // the preview component needs to be the right size before you pass it in here..
    jassert (previewComp == nullptr || (previewComp->getWidth() > 10
                                         && previewComp->getHeight() > 10));

    const bool selectsDirectories = (flags & FileBrowserComponent::canSelectDirectories) != 0;
    const bool selectsFiles       = (flags & FileBrowserComponent::canSelectFiles) != 0;
    const bool isSave             = (flags & FileBrowserComponent::saveMode) != 0;
    const bool warnAboutOverwrite = (flags & FileBrowserComponent::warnAboutOverwriting) != 0;
    const bool selectMultiple     = (flags & FileBrowserComponent::canSelectMultipleItems) != 0;

    // You've set the flags for both saveMode and openMode!
    jassert (! (isSave && (flags & FileBrowserComponent::openMode) != 0));

   #if JUCE_WINDOWS
    if (useNativeDialogBox && ! (selectsFiles && selectsDirectories))
   #elif JUCE_MAC || JUCE_LINUX
    if (useNativeDialogBox)
   #else
    if (false)
   #endif
    {
        showPlatformDialog (results, title, startingFile, filters,
                            selectsDirectories, selectsFiles, isSave,
                            warnAboutOverwrite, selectMultiple, treatFilePackagesAsDirs,
                            previewComp);
    }
    else
    {
        ignoreUnused (selectMultiple);

        WildcardFileFilter wildcard (selectsFiles ? filters : String(),
                                     selectsDirectories ? "*" : String(),
                                     String());

        FileBrowserComponent browserComponent (flags, startingFile, &wildcard, previewComp);

        FileChooserDialogBox box (title, String(),
                                  browserComponent, warnAboutOverwrite,
                                  browserComponent.findColour (AlertWindow::backgroundColourId));

        if (box.show())
        {
            for (int i = 0; i < browserComponent.getNumSelectedFiles(); ++i)
                results.add (browserComponent.getSelectedFile (i));
        }
    }

    return results.size() > 0;
}
Example #19
0
void Label::textEditorEscapeKeyPressed (TextEditor& ed)
{
    if (editor != nullptr)
    {
        jassert (&ed == editor);
        ignoreUnused (ed);

        editor->setText (textValue.toString(), false);
        hideEditor (true);
    }
}
Example #20
0
    bool tryToCloseDocument (Component* component) override
    {
       #if JUCE_MODAL_LOOPS_PERMITTED
        if (Note* note = dynamic_cast<Note*> (component))
            return note->saveIfNeededAndUserAgrees() != FileBasedDocument::failedToWriteToFile;
       #else
        ignoreUnused (component);
       #endif

        return true;
    }
Example #21
0
ComponentPeer* AudioProcessorEditor::createNewPeer (int styleFlags, void* nativeWindow)
{
   #if JUCE_MODULE_AVAILABLE_juce_audio_plugin_client && JucePlugin_Build_Unity
    if (juce_createUnityPeerFn != nullptr)
    {
        ignoreUnused (styleFlags, nativeWindow);
        return juce_createUnityPeerFn (*this);
    }
   #endif

    return Component::createNewPeer (styleFlags, nativeWindow);
}
Example #22
0
    void prepareToPlay (double sampleRate, int estimatedMaxSizeOfBuffer) override
    {
        ignoreUnused (estimatedMaxSizeOfBuffer);

        lastSampleRate = sampleRate;

        currentRecording.setSize (1, static_cast<int> (std::ceil (kMaxDurationOfRecording * lastSampleRate)));
        samplesRecorded = 0;

        synth.setCurrentPlaybackSampleRate (lastSampleRate);
        reverb.setSampleRate (lastSampleRate);
    }
Example #23
0
    static bool checkError (const OSStatus err, const int lineNum)
    {
        if (err == noErr)
            return true;

       #if JUCE_LOG_COREMIDI_ERRORS
        Logger::writeToLog ("CoreMIDI error: " + String (lineNum) + " - " + String::toHexString ((int) err));
       #endif

        ignoreUnused (lineNum);
        return false;
    }
Example #24
0
void ProjucerLookAndFeel::drawPropertyComponentLabel (Graphics& g, int width, int height, PropertyComponent& component)
{
    ignoreUnused (width);

    g.setColour (component.findColour (defaultTextColourId)
                          .withMultipliedAlpha (component.isEnabled() ? 1.0f : 0.6f));

    auto textWidth = getTextWidthForPropertyComponent (&component);

    g.setFont (getPropertyComponentFont());
    g.drawFittedText (component.getName(), 0, 0, textWidth - 5, height, Justification::centredLeft, 5, 1.0f);
}
ChoicePropertyComponent::ChoicePropertyComponent (const String& name,
                                                  const StringArray& choiceList,
                                                  const Array<var>& correspondingValues)
    : PropertyComponent (name),
      choices (choiceList)
{
    // The array of corresponding values must contain one value for each of the items in
    // the choices array!
    jassert (correspondingValues.size() == choices.size());

    ignoreUnused (correspondingValues);
}
Example #26
0
    //==============================================================================
    void initialise (const String& commandLine) override
    {
        ignoreUnused (commandLine);

        String err = deviceManager.initialiseWithDefaultDevices (1, 1);
        jassert (err.isEmpty());

        deviceManager.addAudioCallback (&player);
        deviceManager.addMidiInputCallback (String(), &player);

        mainWindow = new MainWindow (player, getApplicationName());
    }
Example #27
0
//==============================================================================
int main (int argc, char* argv[])
{
    ignoreUnused (argc, argv);

    ScopedPointer<ConsoleLogger> logger;
    Logger::setCurrentLogger (logger);

    ConsoleUnitTestRunner runner;
    runner.runAllTests();

    return 0;
}
Example #28
0
void ContentSharer::shareData (const MemoryBlock& mb,
                               std::function<void (bool, const String&)> callbackToUse)
{
  #if JUCE_IOS || JUCE_ANDROID
    startNewShare (callbackToUse);
    prepareDataThread.reset (new PrepareDataThread (*this, mb));
  #else
    ignoreUnused (mb);

    if (callbackToUse)
        callbackToUse (false, "Content sharing not available on this platform!");
  #endif
}
Example #29
0
    static void closeSocket (std::atomic<int>& handle, CriticalSection& readLock,
                             bool isListener, int portNumber, std::atomic<bool>& connected) noexcept
    {
        const SocketHandle h = handle.load();
        handle = -1;

       #if JUCE_WINDOWS
        ignoreUnused (portNumber, isListener, readLock);

        if (h != (unsigned) SOCKET_ERROR || connected)
            closesocket (h);

        // make sure any read process finishes before we delete the socket
        CriticalSection::ScopedLockType lock (readLock);
        connected = false;
       #else
        if (connected)
        {
            connected = false;

            if (isListener)
            {
                // need to do this to interrupt the accept() function..
                StreamingSocket temp;
                temp.connect (IPAddress::local().toString(), portNumber, 1000);
            }
        }

        if (h != -1)
        {
            // unblock any pending read requests
            ::shutdown (h, SHUT_RDWR);

            {
                // see man-page of recv on linux about a race condition where the
                // shutdown command is lost if the receiving thread does not have
                // a chance to process before close is called. On Mac OS X shutdown
                // does not unblock a select call, so using a lock here will dead-lock
                // both threads.
               #if JUCE_LINUX || JUCE_ANDROID
                CriticalSection::ScopedLockType lock (readLock);
                ::close (h);
               #else
                ::close (h);
                CriticalSection::ScopedLockType lock (readLock);
              #endif
            }
        }
       #endif
    }
Example #30
0
bool JUCE_API handleManufacturerSpecificVST2Opcode (int32 index, pointer_sized_int value, void* ptr, float)
{
   #if VST3_REPLACEMENT_AVAILABLE
    if ((index == 'stCA' || index == 'stCa') && value == 'FUID' && ptr != nullptr)
    {
        uint8 fuid[16];
        getUUIDForVST2ID  (false, fuid);
        ::memcpy (ptr, fuid, 16);
        return true;
    }
   #else
    ignoreUnused (index, value, ptr);
   #endif
    return false;
}