Browse Source

Add CycleShifter plugin

master
falkTX 8 years ago
parent
commit
9ccc27feba
13 changed files with 2006 additions and 0 deletions
  1. +2
    -0
      Makefile
  2. +3
    -0
      README.md
  3. +1386
    -0
      plugins/CycleShifter/DistrhoArtworkCycleShifter.cpp
  4. +20
    -0
      plugins/CycleShifter/DistrhoArtworkCycleShifter.hpp
  5. +197
    -0
      plugins/CycleShifter/DistrhoPluginCycleShifter.cpp
  6. +116
    -0
      plugins/CycleShifter/DistrhoPluginCycleShifter.hpp
  7. +37
    -0
      plugins/CycleShifter/DistrhoPluginInfo.h
  8. +118
    -0
      plugins/CycleShifter/DistrhoUICycleShifter.cpp
  9. +74
    -0
      plugins/CycleShifter/DistrhoUICycleShifter.hpp
  10. +53
    -0
      plugins/CycleShifter/Makefile
  11. BIN
      plugins/CycleShifter/Screenshot.png
  12. BIN
      plugins/CycleShifter/artwork/back.png
  13. BIN
      plugins/CycleShifter/artwork/slider.png

+ 2
- 0
Makefile View File

@@ -17,6 +17,7 @@ endif

plugins: libs
$(MAKE) all -C plugins/AmplitudeImposer
$(MAKE) all -C plugins/CycleShifter
$(MAKE) all -C plugins/SoulForce

gen: plugins dpf/utils/lv2_ttl_generator
@@ -36,6 +37,7 @@ ifeq ($(HAVE_DGL),true)
endif
$(MAKE) clean -C dpf/utils/lv2-ttl-generator
$(MAKE) clean -C plugins/AmplitudeImposer
$(MAKE) clean -C plugins/CycleShifter
$(MAKE) clean -C plugins/SoulForce

# --------------------------------------------------------------


+ 3
- 0
README.md View File

@@ -11,5 +11,8 @@ This collection currently includes:<br/>
Amplitude Imposer:<br/>
![Amplitude Imposer](https://raw.githubusercontent.com/DISTRHO/ndc-Plugs/master/plugins/AmplitudeImposer/Screenshot.png "Amplitude Imposer")<br/>

CycleShifter<br/>
![Cycle Shifter](https://raw.githubusercontent.com/DISTRHO/ndc-Plugs/master/plugins/CycleShifter/Screenshot.png "Cycle Shifter")<br/>

Soul Force:<br/>
![Soul Force](https://raw.githubusercontent.com/DISTRHO/ndc-Plugs/master/plugins/SoulForce/Screenshot.png "Soul Force")<br/>

+ 1386
- 0
plugins/CycleShifter/DistrhoArtworkCycleShifter.cpp
File diff suppressed because it is too large
View File


+ 20
- 0
plugins/CycleShifter/DistrhoArtworkCycleShifter.hpp View File

@@ -0,0 +1,20 @@
/* (Auto-generated binary data file). */

#ifndef BINARY_DISTRHOARTWORKCYCLESHIFTER_HPP
#define BINARY_DISTRHOARTWORKCYCLESHIFTER_HPP

namespace DistrhoArtworkCycleShifter
{
extern const char* backData;
const unsigned int backDataSize = 57352;
const unsigned int backWidth = 268;
const unsigned int backHeight = 107;

extern const char* sliderData;
const unsigned int sliderDataSize = 392;
const unsigned int sliderWidth = 14;
const unsigned int sliderHeight = 14;
}

#endif // BINARY_DISTRHOARTWORKCYCLESHIFTER_HPP


+ 197
- 0
plugins/CycleShifter/DistrhoPluginCycleShifter.cpp View File

@@ -0,0 +1,197 @@
/*
* DISTRHO CycleShifter, a DPF'ied CycleShifter.
* Copyright (C) 2004 Niall Moody
* Copyright (C) 2015 Filipe Coelho <falktx@falktx.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
#include "DistrhoPluginCycleShifter.hpp"
START_NAMESPACE_DISTRHO
// -----------------------------------------------------------------------
DistrhoPluginCycleShifter::DistrhoPluginCycleShifter()
: Plugin(kParameterCount, 1, 0), // 1 program, 0 states
fNewCycleVolume(1.0f),
fInputVolume(1.0f),
OutIndex(0),
InCount(0),
ReadWrite(false),
EnvOld(0.0f)
{
std::memset(CycleBuffer, 0, sizeof(float)*BUFFER_SIZE);
}
// -----------------------------------------------------------------------
// Init
void DistrhoPluginCycleShifter::d_initParameter(uint32_t index, Parameter& parameter)
{
parameter.hints = kParameterIsAutomable;
parameter.ranges.min = 0.0f;
parameter.ranges.max = 1.0f;
switch (index)
{
case kParameterNewCycleVolume:
parameter.name = "New Cycle Vol";
parameter.symbol = "ncvolume";
parameter.ranges.def = 1.0f;
break;
case kParameterInputVolume:
parameter.name = "Input Vol";
parameter.symbol = "ipvolume";
parameter.ranges.def = 1.0f;
break;
}
}
void DistrhoPluginCycleShifter::d_initProgramName(uint32_t index, d_string& programName)
{
switch(index)
{
case 0:
programName = "Default";
break;
}
}
// -----------------------------------------------------------------------
// Internal data
float DistrhoPluginCycleShifter::d_getParameterValue(uint32_t index) const
{
switch(index)
{
case kParameterNewCycleVolume:
return fNewCycleVolume;
case kParameterInputVolume:
return fInputVolume;
default:
return 0.0f;
}
}
void DistrhoPluginCycleShifter::d_setParameterValue(uint32_t index, float value)
{
switch(index)
{
case kParameterNewCycleVolume:
fNewCycleVolume = value;
break;
case kParameterInputVolume:
fInputVolume = value;
break;
}
}
void DistrhoPluginCycleShifter::d_setProgram(uint32_t index)
{
switch(index)
{
case 0:
fNewCycleVolume = 1.0f;
fInputVolume = 1.0f;
break;
}
}
// -----------------------------------------------------------------------
// Process
void DistrhoPluginCycleShifter::d_activate()
{
std::memset(CycleBuffer, 0, sizeof(float)*BUFFER_SIZE);
OutIndex = 0;
InCount = 0;
ReadWrite = false;
EnvOld = 0.0f;
}
void DistrhoPluginCycleShifter::d_run(const float** inputs, float** outputs, uint32_t frames)
{
const float* in = inputs[0];
/**/ float* out = outputs[0];
for (uint32_t i=0; i<frames; ++i)
*out++ = DoProcess(*in++);
}
// -----------------------------------------------------------------------
// Borrowed this from Toby Bear's Delphi template - it maybe adds a bit to cpu
// usage, but it makes things simpler...
// -----------------------------------------------------------------------
float DistrhoPluginCycleShifter::DoProcess(float a)
{
const float tempval = a;
if (! ReadWrite) // if we're in read mode
{
if (InCount == 0) // if we're waiting for the start of a new cycle to read
{
if (EnvOld < 0.0f && tempval >= 0.0f) // as soon as the input goes past 0 we start reading
{
CycleBuffer[InCount++] = tempval;
}
}
else if (! (EnvOld < 0.0f && tempval >= 0.0f)) // if we've not reached the end of the cycle yet
{
CycleBuffer[InCount] = tempval;
if (++InCount >= BUFFER_SIZE) // if we've reached the end of the buffer
{
InCount = BUFFER_SIZE;
ReadWrite = true; // we're in write mode now
}
}
else // we've reached the end of the cycle
{
CycleBuffer[InCount++] = 0.0f;
ReadWrite = true;
}
a *= fInputVolume;
}
else // we're in write mode
{
a = (a*fInputVolume) + (CycleBuffer[OutIndex]*fNewCycleVolume);
if (++OutIndex == InCount) // we've reached the end of our stored cycle
{
InCount = 0;
OutIndex = 0;
ReadWrite = false;
}
}
EnvOld = tempval;
return a;
}
// -----------------------------------------------------------------------
Plugin* createPlugin()
{
return new DistrhoPluginCycleShifter();
}
// -----------------------------------------------------------------------
END_NAMESPACE_DISTRHO

+ 116
- 0
plugins/CycleShifter/DistrhoPluginCycleShifter.hpp View File

@@ -0,0 +1,116 @@
/*
* DISTRHO CycleShifter, a DPF'ied CycleShifter.
* Copyright (C) 2004 Niall Moody
* Copyright (C) 2015 Filipe Coelho <falktx@falktx.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
#ifndef DISTRHO_PLUGIN_CYCLE_SHIFTER_HPP_INCLUDED
#define DISTRHO_PLUGIN_CYCLE_SHIFTER_HPP_INCLUDED
#include "DistrhoPlugin.hpp"
#define BUFFER_SIZE 11025
START_NAMESPACE_DISTRHO
// -----------------------------------------------------------------------
class DistrhoPluginCycleShifter : public Plugin
{
public:
enum Parameters {
kParameterNewCycleVolume,
kParameterInputVolume,
kParameterCount
};
DistrhoPluginCycleShifter();
protected:
// -------------------------------------------------------------------
// Information
const char* d_getLabel() const noexcept override
{
return "CycleShifter";
}
const char* d_getMaker() const noexcept override
{
return "ndc Plugs";
}
const char* d_getLicense() const noexcept override
{
return "MIT";
}
uint32_t d_getVersion() const noexcept override
{
return 0x1000;
}
int64_t d_getUniqueId() const noexcept override
{
return d_cconst('C', 'S', 'f', 't');
}
// -------------------------------------------------------------------
// Init
void d_initParameter(uint32_t index, Parameter& parameter) override;
void d_initProgramName(uint32_t index, d_string& programName) override;
// -------------------------------------------------------------------
// Internal data
float d_getParameterValue(uint32_t index) const override;
void d_setParameterValue(uint32_t index, float value) override;
void d_setProgram(uint32_t index) override;
// -------------------------------------------------------------------
// Process
void d_activate() override;
void d_run(const float** inputs, float** outputs, uint32_t frames) override;
// -------------------------------------------------------------------
private:
float fNewCycleVolume;
float fInputVolume;
float CycleBuffer[BUFFER_SIZE]; // buffer to store the cycle in
int OutIndex; // index for playing the buffer
int InCount; // counts how many samples we've recorded
bool ReadWrite; // 0=read, 1=write
float EnvOld; // last (input) sample - used to determine zero-crossings
float DoProcess(float a);
DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(DistrhoPluginCycleShifter)
};
// -----------------------------------------------------------------------
END_NAMESPACE_DISTRHO
#endif // DISTRHO_PLUGIN_CYCLE_SHIFTER_HPP_INCLUDED

+ 37
- 0
plugins/CycleShifter/DistrhoPluginInfo.h View File

@@ -0,0 +1,37 @@
/*
* DISTRHO CycleShifter, a DPF'ied CycleShifter.
* Copyright (C) 2004 Niall Moody
* Copyright (C) 2015 Filipe Coelho <falktx@falktx.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/

#ifndef DISTRHO_PLUGIN_INFO_H_INCLUDED
#define DISTRHO_PLUGIN_INFO_H_INCLUDED

#define DISTRHO_PLUGIN_NAME "Cycle Shifter"
#define DISTRHO_PLUGIN_URI "http://www.niallmoody.com/ndcplugs/cycleshifter.htm"

#define DISTRHO_PLUGIN_HAS_UI 1
#define DISTRHO_PLUGIN_IS_RT_SAFE 1
#define DISTRHO_PLUGIN_NUM_INPUTS 1
#define DISTRHO_PLUGIN_NUM_OUTPUTS 1
#define DISTRHO_PLUGIN_WANT_PROGRAMS 1

#endif // DISTRHO_PLUGIN_INFO_H_INCLUDED

+ 118
- 0
plugins/CycleShifter/DistrhoUICycleShifter.cpp View File

@@ -0,0 +1,118 @@
/*
* DISTRHO CycleShifter, a DPF'ied CycleShifter.
* Copyright (C) 2004 Niall Moody
* Copyright (C) 2015 Filipe Coelho <falktx@falktx.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/

#include "DistrhoUICycleShifter.hpp"
#include "DistrhoPluginCycleShifter.hpp"

START_NAMESPACE_DISTRHO

namespace Art = DistrhoArtworkCycleShifter;

// -----------------------------------------------------------------------

DistrhoUICycleShifter::DistrhoUICycleShifter()
: UI(Art::backWidth, Art::backHeight),
fImgBackground(Art::backData, Art::backWidth, Art::backHeight, GL_LUMINANCE)
{
// sliders
Image sliderImage(Art::sliderData, Art::sliderWidth, Art::sliderHeight, GL_LUMINANCE);

fSliderNewCycleVol = new ImageSlider(this, sliderImage);
fSliderNewCycleVol->setId(DistrhoPluginCycleShifter::kParameterNewCycleVolume);
fSliderNewCycleVol->setStartPos(6, 49);
fSliderNewCycleVol->setEndPos(247, 49);
fSliderNewCycleVol->setRange(0.0f, 1.0f);
fSliderNewCycleVol->setCallback(this);

fSliderInputVol = new ImageSlider(this, sliderImage);
fSliderInputVol->setId(DistrhoPluginCycleShifter::kParameterInputVolume);
fSliderInputVol->setStartPos(6, 80);
fSliderInputVol->setEndPos(247, 80);
fSliderInputVol->setRange(0.0f, 1.0f);
fSliderInputVol->setCallback(this);

// set initial values
d_programChanged(0);
}

// -----------------------------------------------------------------------
// DSP Callbacks

void DistrhoUICycleShifter::d_parameterChanged(uint32_t index, float value)
{
switch (index)
{
case DistrhoPluginCycleShifter::kParameterNewCycleVolume:
fSliderNewCycleVol->setValue(value);
break;
case DistrhoPluginCycleShifter::kParameterInputVolume:
fSliderInputVol->setValue(value);
break;
}
}

void DistrhoUICycleShifter::d_programChanged(uint32_t index)
{
switch(index)
{
case 0:
fSliderNewCycleVol->setValue(1.0f);
fSliderInputVol->setValue(1.0f);
break;
}
}

// -----------------------------------------------------------------------
// Widget Callbacks

void DistrhoUICycleShifter::imageSliderDragStarted(ImageSlider* slider)
{
d_editParameter(slider->getId(), true);
}

void DistrhoUICycleShifter::imageSliderDragFinished(ImageSlider* slider)
{
d_editParameter(slider->getId(), false);
}

void DistrhoUICycleShifter::imageSliderValueChanged(ImageSlider* slider, float value)
{
d_setParameterValue(slider->getId(), value);
}

void DistrhoUICycleShifter::onDisplay()
{
fImgBackground.draw();
}

// -----------------------------------------------------------------------

UI* createUI()
{
return new DistrhoUICycleShifter();
}

// -----------------------------------------------------------------------

END_NAMESPACE_DISTRHO

+ 74
- 0
plugins/CycleShifter/DistrhoUICycleShifter.hpp View File

@@ -0,0 +1,74 @@
/*
* DISTRHO CycleShifter, a DPF'ied CycleShifter.
* Copyright (C) 2004 Niall Moody
* Copyright (C) 2015 Filipe Coelho <falktx@falktx.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/

#ifndef DISTRHO_UI_CYCLE_SHIFTER_HPP_INCLUDED
#define DISTRHO_UI_CYCLE_SHIFTER_HPP_INCLUDED

#include "DistrhoUI.hpp"

#include "ImageSlider.hpp"

#include "DistrhoArtworkCycleShifter.hpp"

using DGL::Image;
using DGL::ImageSlider;

START_NAMESPACE_DISTRHO

// -----------------------------------------------------------------------

class DistrhoUICycleShifter : public UI,
public ImageSlider::Callback
{
public:
DistrhoUICycleShifter();

protected:
// -------------------------------------------------------------------
// DSP Callbacks

void d_parameterChanged(uint32_t index, float value) override;
void d_programChanged(uint32_t index) override;

// -------------------------------------------------------------------
// Widget Callbacks

void imageSliderDragStarted(ImageSlider* slider) override;
void imageSliderDragFinished(ImageSlider* slider) override;
void imageSliderValueChanged(ImageSlider* slider, float value) override;

void onDisplay() override;

private:
Image fImgBackground;
ScopedPointer<ImageSlider> fSliderNewCycleVol, fSliderInputVol;

DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(DistrhoUICycleShifter)
};

// -----------------------------------------------------------------------

END_NAMESPACE_DISTRHO

#endif // DISTRHO_UI_CYCLE_SHIFTER_HPP_INCLUDED

+ 53
- 0
plugins/CycleShifter/Makefile View File

@@ -0,0 +1,53 @@
#!/usr/bin/make -f
# Makefile for DISTRHO Plugins #
# ---------------------------- #
# Created by falkTX
#

# --------------------------------------------------------------
# Project name, used for binaries

NAME = CycleShifter

# --------------------------------------------------------------
# Files to build

OBJS_DSP = \
DistrhoPluginCycleShifter.cpp.o

OBJS_UI = \
DistrhoArtworkCycleShifter.cpp.o \
DistrhoUICycleShifter.cpp.o

# --------------------------------------------------------------
# Do some magic

include ../Makefile.mk

# --------------------------------------------------------------
# Enable all possible plugin types

ifeq ($(HAVE_JACK),true)
TARGETS += jack
endif

ifeq ($(LINUX),true)
TARGETS += ladspa
ifeq ($(HAVE_DGL),true)
ifeq ($(HAVE_LIBLO),true)
TARGETS += dssi
endif
endif
endif

ifeq ($(HAVE_DGL),true)
TARGETS += lv2_sep
else
TARGETS += lv2_dsp
endif

TARGETS += vst

all: $(TARGETS)

# --------------------------------------------------------------

BIN
plugins/CycleShifter/Screenshot.png View File

Before After
Width: 268  |  Height: 107  |  Size: 5.4KB

BIN
plugins/CycleShifter/artwork/back.png View File

Before After
Width: 268  |  Height: 107  |  Size: 1.8KB

BIN
plugins/CycleShifter/artwork/slider.png View File

Before After
Width: 14  |  Height: 14  |  Size: 260B

Loading…
Cancel
Save