Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file removed .DS_Store
Binary file not shown.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ JuceLibraryCode
Builds
tags

.DS_Store
16 changes: 10 additions & 6 deletions SFZero.jucer
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,21 @@
pluginIsSynth="1" pluginWantsMidiIn="1" pluginProducesMidiOut="0"
pluginSilenceInIsSilenceOut="0" pluginTailLength="0" pluginEditorRequiresKeys="0"
pluginAUExportPrefix="SFZeroDevAU" pluginAUViewClass="SFZeroAU_V1"
pluginRTASCategory="" jucerVersion="4.2.3" defines="" aaxIdentifier="com.yourcompany.SFZero-dev"
pluginAAXCategory="AAX_ePlugInCategory_Dynamics" buildVST3="0"
buildAUv3="0" buildAAX="0" pluginIsMidiEffectPlugin="0" includeBinaryInAppConfig="1">
pluginRTASCategory="" defines="JUCE_MODAL_LOOPS_PERMITTED=1"
aaxIdentifier="com.yourcompany.SFZero-dev" pluginAAXCategory="2"
buildVST3="1" buildAUv3="0" buildAAX="0" pluginIsMidiEffectPlugin="0"
includeBinaryInAppConfig="1" pluginFormats="buildAU,buildStandalone,buildVST3"
pluginCharacteristicsValue="pluginIsSynth,pluginWantsMidiIn"
jucerFormatVersion="1" addUsingNamespaceToJuceHeader="0" buildStandalone="1"
enableIAA="0">
<EXPORTFORMATS>
<XCODE_MAC targetFolder="Builds/MacOSX" objCExtraSuffix="yKK8uA" vstFolder="~/SDKs/vstsdk2.4"
postbuildCommand="">
<CONFIGURATIONS>
<CONFIGURATION name="Debug" isDebug="1" optimisation="1" targetName="SFZero-dev"
osxSDK="default" osxCompatibility="default" osxArchitecture="32BitUniversal"/>
osxSDK="default" osxCompatibility="default"/>
<CONFIGURATION name="Release" isDebug="0" optimisation="2" targetName="SFZero-dev"
osxSDK="default" osxCompatibility="default" osxArchitecture="32BitUniversal"/>
osxSDK="default" osxCompatibility="default"/>
</CONFIGURATIONS>
<MODULEPATHS>
<MODULEPATH id="juce_gui_extra" path="../JUCE/modules"/>
Expand Down Expand Up @@ -89,5 +93,5 @@
<MODULE id="juce_gui_extra" showAllCode="1" useLocalCopy="0"/>
<MODULE id="SFZero" showAllCode="1" useLocalCopy="0"/>
</MODULES>
<JUCEOPTIONS JUCE_QUICKTIME="disabled" JUCE_USE_OGGVORBIS="enabled"/>
<JUCEOPTIONS JUCE_QUICKTIME="disabled" JUCE_USE_OGGVORBIS="1"/>
</JUCERPROJECT>
6 changes: 3 additions & 3 deletions Source/ClickableLabel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@


ClickableLabel::ClickableLabel(
const String& componentName,
const String& labelText)
const juce::String& componentName,
const juce::String& labelText)
: Label(componentName, labelText)
{
}
Expand All @@ -31,7 +31,7 @@ void ClickableLabel::removeClickListener(ClickListener* listener)
}


void ClickableLabel::mouseUp(const MouseEvent& e)
void ClickableLabel::mouseUp(const juce::MouseEvent& e)
{
bool goodClick =
e.mouseWasClicked() && contains(e.getPosition()) && !e.mods.isPopupMenu();
Expand Down
12 changes: 6 additions & 6 deletions Source/ClickableLabel.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
#ifndef __CLICKABLELABEL_H_F4AC0009__
#define __CLICKABLELABEL_H_F4AC0009__

#include "../JuceLibraryCode/JuceHeader.h"
#include <JuceHeader.h>

class ClickableLabel : public Label {
class ClickableLabel : public juce::Label {
public:
ClickableLabel(
const String& componentName = String::empty,
const String& labelText = String::empty);
const juce::String& componentName = {},
const juce::String& labelText = {});

class JUCE_API ClickListener {
public:
Expand All @@ -30,9 +30,9 @@ class ClickableLabel : public Label {
void removeClickListener(ClickListener* listener);

protected:
ListenerList<ClickListener> clickListeners;
juce::ListenerList<ClickListener> clickListeners;

void mouseUp(const MouseEvent& e);
void mouseUp(const juce::MouseEvent& e) override;
};


Expand Down
102 changes: 47 additions & 55 deletions Source/SFZeroAudioProcessor.cpp
Original file line number Diff line number Diff line change
@@ -1,34 +1,27 @@
#include "SFZeroAudioProcessor.h"
#include "SFZeroEditor.h"
#include "SFZSound.h"
#include "SF2Sound.h"
#include "SFZVoice.h"
#include "SFZDebug.h"

using namespace SFZero;


SFZeroAudioProcessor::SFZeroAudioProcessor()
: loadProgress(0.0), loadThread(this)
{
#if JUCE_DEBUG
setupLogging(
FileLogger::createDefaultAppLogger(
SFZero::setupLogging(
juce::FileLogger::createDefaultAppLogger(
"SFZero", "SFZero.log", "SFZero started"));
#endif

formatManager.registerFormat(new WavAudioFormat(), false);
formatManager.registerFormat(new OggVorbisAudioFormat(), false);
formatManager.registerFormat(new juce::WavAudioFormat(), false);
formatManager.registerFormat(new juce::OggVorbisAudioFormat(), false);

for (int i = 0; i < 128; ++i)
synth.addVoice(new SFZVoice());
synth.addVoice(new SFZero::SFZVoice());
}

SFZeroAudioProcessor::~SFZeroAudioProcessor()
{
}

const String SFZeroAudioProcessor::getName() const
const juce::String SFZeroAudioProcessor::getName() const
{
return JucePlugin_Name;
}
Expand All @@ -47,40 +40,40 @@ void SFZeroAudioProcessor::setParameter(int index, float newValue)
{
}

const String SFZeroAudioProcessor::getParameterName(int index)
const juce::String SFZeroAudioProcessor::getParameterName(int index)
{
return String::empty;
return {};
}

const String SFZeroAudioProcessor::getParameterText(int index)
const juce::String SFZeroAudioProcessor::getParameterText(int index)
{
return String::empty;
return {};
}


void SFZeroAudioProcessor::setSfzFile(File* newSfzFile)
void SFZeroAudioProcessor::setSfzFile(const juce::File& newSfzFile)
{
sfzFile = *newSfzFile;
sfzFile = newSfzFile;
loadSound();
}


void SFZeroAudioProcessor::setSfzFileThreaded(File* newSfzFile)
void SFZeroAudioProcessor::setSfzFileThreaded(const juce::File& newSfzFile)
{
loadThread.stopThread(2000);
sfzFile = *newSfzFile;
sfzFile = newSfzFile;
loadThread.startThread();
}


const String SFZeroAudioProcessor::getInputChannelName(int channelIndex) const
const juce::String SFZeroAudioProcessor::getInputChannelName(int channelIndex) const
{
return String(channelIndex + 1);
return juce::String(channelIndex + 1);
}

const String SFZeroAudioProcessor::getOutputChannelName(int channelIndex) const
const juce::String SFZeroAudioProcessor::getOutputChannelName(int channelIndex) const
{
return String(channelIndex + 1);
return juce::String(channelIndex + 1);
}

bool SFZeroAudioProcessor::isInputChannelStereoPair(int index) const
Expand Down Expand Up @@ -139,12 +132,12 @@ void SFZeroAudioProcessor::setCurrentProgram(int index)
{
}

const String SFZeroAudioProcessor::getProgramName(int index)
const juce::String SFZeroAudioProcessor::getProgramName(int index)
{
return String::empty;
return {};
}

void SFZeroAudioProcessor::changeProgramName(int index, const String& newName)
void SFZeroAudioProcessor::changeProgramName(int index, const juce::String& newName)
{
}

Expand All @@ -163,7 +156,7 @@ void SFZeroAudioProcessor::releaseResources()
}


void SFZeroAudioProcessor::processBlock(AudioSampleBuffer& buffer, MidiBuffer& midiMessages)
void SFZeroAudioProcessor::processBlock(juce::AudioSampleBuffer& buffer, juce::MidiBuffer& midiMessages)
{
int numSamples = buffer.getNumSamples();
keyboardState.processNextMidiBuffer(midiMessages, 0, numSamples, true);
Expand All @@ -176,42 +169,42 @@ bool SFZeroAudioProcessor::hasEditor() const
return true; // (change this to false if you choose to not supply an editor)
}

AudioProcessorEditor* SFZeroAudioProcessor::createEditor()
juce::AudioProcessorEditor* SFZeroAudioProcessor::createEditor()
{
return new SFZeroEditor(this);
}


void SFZeroAudioProcessor::getStateInformation(MemoryBlock& destData)
void SFZeroAudioProcessor::getStateInformation(juce::MemoryBlock& destData)
{
// There's something weird about JUCE's DynamicObjects that doesn't allow
// them to be used as stack-allocated variables.
DynamicObject::Ptr state = new DynamicObject();
juce::DynamicObject::Ptr state = new juce::DynamicObject();
state->setProperty("sfzFilePath", sfzFile.getFullPathName());
SFZSound* sound = getSound();
auto sound = getSound();
if (sound) {
int subsound = sound->selectedSubsound();
if (subsound != 0)
state->setProperty("subsound", subsound);
}

MemoryOutputStream out(destData, false);
JSON::writeToStream(out, var(state));
juce::MemoryOutputStream out(destData, false);
juce::JSON::writeToStream(out, juce::var(state));
}

void SFZeroAudioProcessor::setStateInformation(const void* data, int sizeInBytes)
{
MemoryInputStream in(data, sizeInBytes, false);
var state = JSON::parse(in);
var pathVar = state["sfzFilePath"];
juce::MemoryInputStream in(data, sizeInBytes, false);
juce::var state = juce::JSON::parse(in);
juce::var pathVar = state["sfzFilePath"];
if (pathVar.isString()) {
String sfzFilePath = pathVar.toString();
juce::String sfzFilePath = pathVar.toString();
if (!sfzFilePath.isEmpty()) {
File file(sfzFilePath);
setSfzFile(&file);
SFZSound* sound = getSound();
juce::File file(sfzFilePath);
setSfzFile(file);
auto sound = getSound();
if (sound) {
var subsoundVar = state["subsound"];
juce::var subsoundVar = state["subsound"];
if (subsoundVar.isInt())
sound->useSubsound(int(subsoundVar));
}
Expand All @@ -220,10 +213,10 @@ void SFZeroAudioProcessor::setStateInformation(const void* data, int sizeInBytes
}


SFZSound* SFZeroAudioProcessor::getSound()
SFZero::SFZSound* SFZeroAudioProcessor::getSound()
{
SynthesiserSound* sound = synth.getSound(0);
return dynamic_cast<SFZSound*>(sound);
auto sound = synth.getSound(0).get();
return dynamic_cast<SFZero::SFZSound*>(sound);
}


Expand All @@ -233,7 +226,7 @@ int SFZeroAudioProcessor::numVoicesUsed()
}


String SFZeroAudioProcessor::voiceInfoString()
juce::String SFZeroAudioProcessor::voiceInfoString()
{
return synth.voiceInfoString();
}
Expand All @@ -242,13 +235,13 @@ String SFZeroAudioProcessor::voiceInfoString()
#if JUCE_DEBUG
void SFZeroAudioProcessor::relayLogMessages()
{
relayFifoLogMessages();
SFZero::relayFifoLogMessages();
}
#endif



void SFZeroAudioProcessor::loadSound(Thread* thread)
void SFZeroAudioProcessor::loadSound(juce::Thread* thread)
{
loadProgress = 0.0;
synth.clearSounds();
Expand All @@ -258,12 +251,11 @@ void SFZeroAudioProcessor::loadSound(Thread* thread)
return;
}

SFZSound* sound;
String extension = sfzFile.getFileExtension();
if (extension == ".sf2" || extension == ".SF2")
sound = new SF2Sound(sfzFile);
SFZero::SFZSound* sound;
if (sfzFile.hasFileExtension (".sf2"))
sound = new SFZero::SF2Sound(sfzFile);
else
sound = new SFZSound(sfzFile);
sound = new SFZero::SFZSound(sfzFile);
sound->loadRegions();
sound->loadSamples(&formatManager, &loadProgress, thread);
if (thread && thread->threadShouldExit()) {
Expand All @@ -289,7 +281,7 @@ void SFZeroAudioProcessor::LoadThread::run()



AudioProcessor* JUCE_CALLTYPE createPluginFilter()
juce::AudioProcessor* JUCE_CALLTYPE createPluginFilter()
{
return new SFZeroAudioProcessor();
}
Expand Down
Loading