pull/1/head
asb2m10 10 years ago
parent 74bd4fa6b9
commit 6456461700
  1. BIN
      Builds/MacOSX/Dexed.xcodeproj/project.xcworkspace/xcuserdata/asb2m10.xcuserdatad/UserInterfaceState.xcuserstate
  2. 158
      JuceLibraryCode/modules/juce_audio_processors/processors/juce_AudioProcessorParameter.h
  3. 169
      JuceLibraryCode/modules/juce_core/maths/juce_NormalisableRange.h
  4. 147
      JuceLibraryCode/modules/juce_core/system/juce_CompilerSupport.h
  5. 59
      JuceLibraryCode/modules/juce_events/messages/juce_MountedVolumeListChangeDetector.h
  6. 6
      Source/EngineOpl.cpp
  7. 31
      Source/PluginParam.cpp
  8. 8
      Source/PluginProcessor.cpp
  9. 5
      Source/SysexComm.cpp
  10. 4
      Source/SysexComm.h

@ -0,0 +1,158 @@
/*
==============================================================================
This file is part of the JUCE library.
Copyright (c) 2013 - Raw Material Software Ltd.
Permission is granted to use this software under the terms of either:
a) the GPL v2 (or any later version)
b) the Affero GPL v3
Details of these licenses can be found at: www.gnu.org/licenses
JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
------------------------------------------------------------------------------
To release a closed-source product which uses JUCE, commercial licenses are
available: visit www.juce.com for more information.
==============================================================================
*/
#ifndef JUCE_AUDIOPROCESSORPARAMETER_H_INCLUDED
#define JUCE_AUDIOPROCESSORPARAMETER_H_INCLUDED
//==============================================================================
/** An abstract base class for parameter objects that can be added to an
AudioProcessor.
@see AudioProcessor::addParameter
*/
class JUCE_API AudioProcessorParameter
{
public:
AudioProcessorParameter() noexcept;
/** Destructor. */
virtual ~AudioProcessorParameter();
/** Called by the host to find out the value of this parameter.
Hosts will expect the value returned to be between 0 and 1.0.
This could be called quite frequently, so try to make your code efficient.
It's also likely to be called by non-UI threads, so the code in here should
be thread-aware.
*/
virtual float getValue() const = 0;
/** The host will call this method to change the value of one of the filter's parameters.
The host may call this at any time, including during the audio processing
callback, so the filter has to process this very fast and avoid blocking.
If you want to set the value of a parameter internally, e.g. from your
editor component, then don't call this directly - instead, use the
setValueNotifyingHost() method, which will also send a message to
the host telling it about the change. If the message isn't sent, the host
won't be able to automate your parameters properly.
The value passed will be between 0 and 1.0.
*/
virtual void setValue (float newValue) = 0;
/** Your filter can call this when it needs to change one of its parameters.
This could happen when the editor or some other internal operation changes
a parameter. This method will call the setParameter() method to change the
value, and will then send a message to the host telling it about the change.
Note that to make sure the host correctly handles automation, you should call
the beginChangeGesture() and endChangeGesture() methods to tell the host when
the user has started and stopped changing the parameter.
*/
void setValueNotifyingHost (float newValue);
/** Sends a signal to the host to tell it that the user is about to start changing this
parameter.
This allows the host to know when a parameter is actively being held by the user, and
it may use this information to help it record automation.
If you call this, it must be matched by a later call to endChangeGesture().
*/
void beginChangeGesture();
/** Tells the host that the user has finished changing this parameter.
This allows the host to know when a parameter is actively being held by the user,
and it may use this information to help it record automation.
A call to this method must follow a call to beginChangeGesture().
*/
void endChangeGesture();
/** This should return the default value for this parameter. */
virtual float getDefaultValue() const = 0;
/** Returns the name to display for this parameter, which should be made
to fit within the given string length.
*/
virtual String getName (int maximumStringLength) const = 0;
/** Some parameters may be able to return a label string for
their units. For example "Hz" or "%".
*/
virtual String getLabel() const = 0;
/** Returns the number of discrete interval steps that this parameter's range
should be quantised into.
If you want a continuous range of values, don't override this method, and allow
the default implementation to return AudioProcessor::getDefaultNumParameterSteps().
If your parameter is boolean, then you may want to make this return 2.
The value that is returned may or may not be used, depending on the host.
*/
virtual int getNumSteps() const;
/** Returns a textual version of the supplied parameter value.
The default implementation just returns the floating point value
as a string, but this could do anything you need for a custom type
of value.
*/
virtual String getText (float value, int /*maximumStringLength*/) const;
/** Should parse a string and return the appropriate value for it. */
virtual float getValueForText (const String& text) const = 0;
/** This can be overridden to tell the host that this parameter operates in the
reverse direction.
(Not all plugin formats or hosts will actually use this information).
*/
virtual bool isOrientationInverted() const;
/** Returns true if the host can automate this parameter.
By default, this returns true.
*/
virtual bool isAutomatable() const;
/** Should return true if this parameter is a "meta" parameter.
A meta-parameter is a parameter that changes other params. It is used
by some hosts (e.g. AudioUnit hosts).
By default this returns false.
*/
virtual bool isMetaParameter() const;
/** Returns the index of this parameter in its parent processor's parameter list. */
int getParameterIndex() const noexcept { return parameterIndex; }
private:
friend class AudioProcessor;
AudioProcessor* processor;
int parameterIndex;
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (AudioProcessorParameter)
};
#endif // JUCE_AUDIOPROCESSORPARAMETER_H_INCLUDED

@ -0,0 +1,169 @@
/*
==============================================================================
This file is part of the juce_core module of the JUCE library.
Copyright (c) 2013 - Raw Material Software Ltd.
Permission to use, copy, modify, and/or distribute this software for any purpose with
or without fee is hereby granted, provided that the above copyright notice and this
permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN
NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
------------------------------------------------------------------------------
NOTE! This permissive ISC license applies ONLY to files within the juce_core module!
All other JUCE modules are covered by a dual GPL/commercial license, so if you are
using any other modules, be sure to check that you also comply with their license.
For more details, visit www.juce.com
==============================================================================
*/
#ifndef JUCE_NORMALISABLERANGE_H_INCLUDED
#define JUCE_NORMALISABLERANGE_H_INCLUDED
//==============================================================================
/**
Represents a mapping between an arbitrary range of values and a
normalised 0->1 range.
The properties of the mapping also include an optional snapping interval
and skew-factor.
@see Range
*/
template<typename ValueType>
class NormalisableRange
{
public:
/** Creates a continuous range that performs a dummy mapping. */
NormalisableRange() noexcept : start(), end (1), interval(), skew (static_cast<ValueType> (1)) {}
/** Creates a copy of another range. */
NormalisableRange (const NormalisableRange& other) noexcept
: start (other.start), end (other.end),
interval (other.interval), skew (other.skew)
{
checkInvariants();
}
/** Creates a copy of another range. */
NormalisableRange& operator= (const NormalisableRange& other) noexcept
{
start = other.start;
end = other.end;
interval = other.interval;
skew = other.skew;
checkInvariants();
return *this;
}
/** Creates a NormalisableRange with a given range, interval and skew factor. */
NormalisableRange (ValueType rangeStart,
ValueType rangeEnd,
ValueType intervalValue,
ValueType skewFactor) noexcept
: start (rangeStart), end (rangeEnd),
interval (intervalValue), skew (skewFactor)
{
checkInvariants();
}
/** Creates a NormalisableRange with a given range and interval, but a dummy skew-factor. */
NormalisableRange (ValueType rangeStart,
ValueType rangeEnd,
ValueType intervalValue) noexcept
: start (rangeStart), end (rangeEnd),
interval (intervalValue), skew (static_cast<ValueType> (1))
{
checkInvariants();
}
/** Creates a NormalisableRange with a given range, continuous interval, but a dummy skew-factor. */
NormalisableRange (ValueType rangeStart,
ValueType rangeEnd) noexcept
: start (rangeStart), end (rangeEnd),
interval(), skew (static_cast<ValueType> (1))
{
checkInvariants();
}
/** Uses the properties of this mapping to convert a non-normalised value to
its 0->1 representation.
*/
ValueType convertTo0to1 (ValueType v) const noexcept
{
ValueType proportion = (v - start) / (end - start);
if (skew != static_cast<ValueType> (1))
proportion = pow (proportion, skew);
return proportion;
}
/** Uses the properties of this mapping to convert a normalised 0->1 value to
its full-range representation.
*/
ValueType convertFrom0to1 (ValueType proportion) const noexcept
{
if (skew != static_cast<ValueType> (1) && proportion > ValueType())
proportion = exp (log (proportion) / skew);
return start + (end - start) * proportion;
}
/** Takes a non-normalised value and snaps it based on the interval property of
this NormalisedRange. */
ValueType snapToLegalValue (ValueType v) const noexcept
{
if (interval > ValueType())
v = start + interval * std::floor ((v - start) / interval + static_cast<ValueType> (0.5));
if (v <= start || end <= start)
return start;
if (v >= end)
return end;
return v;
}
/** The start of the non-normalised range. */
ValueType start;
/** The end of the non-normalised range. */
ValueType end;
/** The snapping interval that should be used (in non-normalised value). Use 0 for a continuous range. */
ValueType interval;
/** An optional skew factor that alters the way values are distribute across the range.
The skew factor lets you skew the mapping logarithmically so that larger or smaller
values are given a larger proportion of the avilable space.
A factor of 1.0 has no skewing effect at all. If the factor is < 1.0, the lower end
of the range will fill more of the slider's length; if the factor is > 1.0, the upper
end of the range will be expanded.
*/
ValueType skew;
private:
void checkInvariants() const
{
jassert (end > start);
jassert (interval >= ValueType());
jassert (skew > ValueType());
}
};
#endif // JUCE_NORMALISABLERANGE_H_INCLUDED

@ -0,0 +1,147 @@
/*
==============================================================================
This file is part of the juce_core module of the JUCE library.
Copyright (c) 2013 - Raw Material Software Ltd.
Permission to use, copy, modify, and/or distribute this software for any purpose with
or without fee is hereby granted, provided that the above copyright notice and this
permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN
NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
------------------------------------------------------------------------------
NOTE! This permissive ISC license applies ONLY to files within the juce_core module!
All other JUCE modules are covered by a dual GPL/commercial license, so if you are
using any other modules, be sure to check that you also comply with their license.
For more details, visit www.juce.com
==============================================================================
*/
#ifndef JUCE_COMPILERSUPPORT_H_INCLUDED
#define JUCE_COMPILERSUPPORT_H_INCLUDED
/* This file has some checks to see whether the compiler supports various C++11/14 features,
When these aren't available, the code defines a few workarounds, so that we can still use
some of the newer language features like nullptr and noexcept, even on old compilers.
*/
//==============================================================================
// GCC
#if (__cplusplus >= 201103L || defined (__GXX_EXPERIMENTAL_CXX0X__)) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 405
#define JUCE_COMPILER_SUPPORTS_NOEXCEPT 1
#define JUCE_COMPILER_SUPPORTS_NULLPTR 1
#define JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS 1
#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 407 && ! defined (JUCE_COMPILER_SUPPORTS_OVERRIDE_AND_FINAL)
#define JUCE_COMPILER_SUPPORTS_OVERRIDE_AND_FINAL 1
#endif
#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 407 && ! defined (JUCE_DELETED_FUNCTION)
#define JUCE_DELETED_FUNCTION = delete
#endif
#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 406 && ! defined (JUCE_COMPILER_SUPPORTS_LAMBDAS)
#define JUCE_COMPILER_SUPPORTS_LAMBDAS 1
#endif
#endif
//==============================================================================
// Clang
#if JUCE_CLANG && defined (__has_feature)
#if __has_feature (cxx_nullptr)
#define JUCE_COMPILER_SUPPORTS_NULLPTR 1
#endif
#if __has_feature (cxx_noexcept)
#define JUCE_COMPILER_SUPPORTS_NOEXCEPT 1
#endif
#if __has_feature (cxx_rvalue_references)
#define JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS 1
#endif
#if __has_feature (cxx_deleted_functions)
#define JUCE_DELETED_FUNCTION = delete
#endif
#if __has_feature (cxx_lambdas) \
&& ((JUCE_MAC && defined (MAC_OS_X_VERSION_10_8) && MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_8) \
|| (JUCE_IOS && defined (__IPHONE_7_0) && __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_7_0) \
|| ! (JUCE_MAC || JUCE_IOS))
#define JUCE_COMPILER_SUPPORTS_LAMBDAS 1
#endif
#ifndef JUCE_COMPILER_SUPPORTS_OVERRIDE_AND_FINAL
#define JUCE_COMPILER_SUPPORTS_OVERRIDE_AND_FINAL 1
#endif
#ifndef JUCE_COMPILER_SUPPORTS_ARC
#define JUCE_COMPILER_SUPPORTS_ARC 1
#endif
#endif
//==============================================================================
// MSVC
#ifdef _MSC_VER
#if _MSC_VER >= 1600
#define JUCE_COMPILER_SUPPORTS_NULLPTR 1
#define JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS 1
#endif
#if _MSC_VER >= 1700
#define JUCE_COMPILER_SUPPORTS_OVERRIDE_AND_FINAL 1
#define JUCE_COMPILER_SUPPORTS_LAMBDAS 1
#endif
#if _MSC_VER >= 1900
#define JUCE_COMPILER_SUPPORTS_NOEXCEPT 1
#define JUCE_DELETED_FUNCTION = delete
#endif
#endif
//==============================================================================
// Declare some fake versions of nullptr and noexcept, for older compilers:
#ifndef JUCE_DELETED_FUNCTION
/** This macro can be placed after a method declaration to allow the use of
the C++11 feature "= delete" on all compilers.
On newer compilers that support it, it does the C++11 "= delete", but on
older ones it's just an empty definition.
*/
#define JUCE_DELETED_FUNCTION
#endif
#if ! DOXYGEN
#if ! JUCE_COMPILER_SUPPORTS_NOEXCEPT
#ifdef noexcept
#undef noexcept
#endif
#define noexcept throw()
#if defined (_MSC_VER) && _MSC_VER > 1600
#define _ALLOW_KEYWORD_MACROS 1 // (to stop VC2012 complaining)
#endif
#endif
#if ! JUCE_COMPILER_SUPPORTS_NULLPTR
#ifdef nullptr
#undef nullptr
#endif
#define nullptr (0)
#endif
#if ! JUCE_COMPILER_SUPPORTS_OVERRIDE_AND_FINAL
#undef override
#define override
#endif
#endif
#endif // JUCE_COMPILERSUPPORT_H_INCLUDED

@ -0,0 +1,59 @@
/*
==============================================================================
This file is part of the JUCE library.
Copyright (c) 2013 - Raw Material Software Ltd.
Permission is granted to use this software under the terms of either:
a) the GPL v2 (or any later version)
b) the Affero GPL v3
Details of these licenses can be found at: www.gnu.org/licenses
JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
------------------------------------------------------------------------------
To release a closed-source product which uses JUCE, commercial licenses are
available: visit www.juce.com for more information.
==============================================================================
*/
#ifndef JUCE_MOUNTEDVOLUMELISTCHANGEDETECTOR_H_INCLUDED
#define JUCE_MOUNTEDVOLUMELISTCHANGEDETECTOR_H_INCLUDED
#if JUCE_MAC || JUCE_WINDOWS || defined (DOXYGEN)
//==============================================================================
/**
An instance of this class will provide callbacks when drives are
mounted or unmounted on the system.
Just inherit from this class and implement the pure virtual method
to get the callbacks, there's no need to do anything else.
@see File::findFileSystemRoots()
*/
class JUCE_API MountedVolumeListChangeDetector
{
public:
MountedVolumeListChangeDetector();
virtual ~MountedVolumeListChangeDetector();
/** This method is called when a volume is mounted or unmounted. */
virtual void mountedVolumeListChanged() = 0;
private:
JUCE_PUBLIC_IN_DLL_BUILD (struct Pimpl)
friend struct ContainerDeletePolicy<Pimpl>;
ScopedPointer<Pimpl> pimpl;
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MountedVolumeListChangeDetector)
};
#endif
#endif // JUCE_MOUNTEDVOLUMELISTCHANGEDETECTOR_H_INCLUDED

@ -124,7 +124,7 @@ void EngineOpl::compute(int32_t *output, const int32_t *input, int32_t phase0, i
for (int i = 0; i < N; i++) {
gain += dgain;
int32_t y = oplSin( (phase+input[i]) >> 14, gain);
int32_t y = oplSin((phase+input[i]) >> 14, gain);
output[i] = (y << 14) + adder[i];
phase += freq;
}
@ -138,7 +138,7 @@ void EngineOpl::compute_pure(int32_t *output, int32_t phase0, int32_t freq, int3
for (int i = 0; i < N; i++) {
gain += dgain;
int32_t y = oplSin( phase >> 14, gain);
int32_t y = oplSin(phase >> 14, gain);
output[i] = (y << 14) + adder[i];
phase += freq;
}
@ -158,7 +158,7 @@ void EngineOpl::compute_fb(int32_t *output, int32_t phase0, int32_t freq,
gain += dgain;
int32_t scaled_fb = (y0 + y) >> (fb_shift + 1);
y0 = y;
y = oplSin( (phase+scaled_fb) >> 14, gain) << 14;
y = oplSin((phase+scaled_fb) >> 14, gain) << 14;
output[i] = y + adder[i];
phase += freq;
}

@ -29,10 +29,10 @@
// Custom displays
class CtrlDXLabel : public CtrlDX {
StringArray labels;
public:
StringArray labels;
CtrlDXLabel(String name, int steps, int offset) : CtrlDX(name, steps, offset, 0) {
CtrlDXLabel(String name, int steps, int offset, StringArray &labels) : CtrlDX(name, steps, offset, 0) {
this->labels = labels;
};
String getValueDisplay() {
@ -311,14 +311,15 @@ void DexedAudioProcessor::initCtrl() {
lfoSync = new CtrlDX("LFO KEY SYNC", 2, 141);
ctrl.add(lfoSync);
CtrlDXLabel *t = new CtrlDXLabel("LFO WAVE", 6, 142);
t->labels.add("TRIANGE");
t->labels.add("SAW DOWN");
t->labels.add("SAW UP");
t->labels.add("SQUARE");
t->labels.add("SINE");
t->labels.add("S&HOLD");
lfoWaveform = t;
StringArray lbl;
lbl.add("TRIANGE");
lbl.add("SAW DOWN");
lbl.add("SAW UP");
lbl.add("SQUARE");
lbl.add("SINE");
lbl.add("S&HOLD");
lfoWaveform = new CtrlDXLabel("LFO WAVE", 6, 142, lbl);
ctrl.add(lfoWaveform);
transpose = new CtrlDXTranspose("MIDDLE C", 49, 144);
@ -411,16 +412,12 @@ void DexedAudioProcessor::initCtrl() {
String sclLeftCurve;
sclLeftCurve << opName << " L KEY SCALE";
t = new CtrlDXLabel(sclLeftCurve, 4, opTarget + 11);
t->labels = keyScaleLabels;
opCtrl[opVal].sclLeftCurve = t;
opCtrl[opVal].sclLeftCurve = new CtrlDXLabel(sclLeftCurve, 4, opTarget + 11, keyScaleLabels);
ctrl.add(opCtrl[opVal].sclLeftCurve);
String sclRightCurve;
sclRightCurve << opName << " R KEY SCALE";
t = new CtrlDXLabel(sclRightCurve, 4, opTarget + 12);
t->labels = keyScaleLabels;
opCtrl[opVal].sclRightCurve = t;
opCtrl[opVal].sclRightCurve = new CtrlDXLabel(sclRightCurve, 4, opTarget + 12, keyScaleLabels);
ctrl.add(opCtrl[opVal].sclRightCurve);
String sclRate;

@ -141,10 +141,10 @@ void DexedAudioProcessor::releaseResources() {
void DexedAudioProcessor::processBlock(AudioSampleBuffer& buffer, MidiBuffer& midiMessages) {
int numSamples = buffer.getNumSamples();
int i = 0;
int i;
if ( refreshVoice ) {
for(int i=0;i<MAX_ACTIVE_NOTES;i++) {
for(i=0;i < MAX_ACTIVE_NOTES;i++) {
if ( voices[i].live )
voices[i].dx7_note->update(data, voices[i].midi_note);
}
@ -160,7 +160,7 @@ void DexedAudioProcessor::processBlock(AudioSampleBuffer& buffer, MidiBuffer& mi
float *channelData = buffer.getSampleData(0);
// flush first events
for (i = 0; i < numSamples && i < extra_buf_size; i++) {
for (i=0; i < numSamples && i < extra_buf_size; i++) {
channelData[i] = extra_buf[i];
}
@ -226,7 +226,7 @@ void DexedAudioProcessor::processBlock(AudioSampleBuffer& buffer, MidiBuffer& mi
}
fx.process(channelData, numSamples);
for(int i=0; i<numSamples; i++) {
for(i=0; i<numSamples; i++) {
float s = std::abs(channelData[i]);
const double decayFactor = 0.99992;

@ -151,8 +151,3 @@ int SysexComm::send(const MidiMessage &message) {
void SysexComm::playBuffer(MidiBuffer &keyboardEvents, int numSamples ) {
noteOutput.addEvents(keyboardEvents, 0, numSamples, 0);
}
void SysexComm::handleAsyncUpdate() {
}

@ -23,7 +23,7 @@
#include "../JuceLibraryCode/JuceHeader.h"
class SysexComm : public AsyncUpdater {
class SysexComm {
MidiInput *input;
MidiOutput *output;
String inputName;
@ -56,8 +56,6 @@ public :
}
int send(const MidiMessage& message);
void handleAsyncUpdate();
void playBuffer(MidiBuffer &keyboardEvents, int numSamples);
};

Loading…
Cancel
Save