@@ -14,6 +14,7 @@ libs: | |||
plugins: libs | |||
$(MAKE) all -C plugins/openav-ducka | |||
$(MAKE) all -C plugins/openav-roomy | |||
$(MAKE) all -C plugins/Info | |||
$(MAKE) all -C plugins/Meters | |||
$(MAKE) all -C plugins/Parameters | |||
$(MAKE) all -C plugins/States | |||
@@ -31,6 +32,7 @@ clean: | |||
$(MAKE) clean -C dpf/utils/lv2-ttl-generator | |||
$(MAKE) clean -C plugins/openav-ducka | |||
$(MAKE) clean -C plugins/openav-roomy | |||
$(MAKE) clean -C plugins/Info | |||
$(MAKE) clean -C plugins/Meters | |||
$(MAKE) clean -C plugins/Parameters | |||
$(MAKE) clean -C plugins/States | |||
@@ -1 +1 @@ | |||
Subproject commit 9d11894caad99141cd926134e9bbe7f2e9949c93 | |||
Subproject commit 087afb6134acaedf270d10fc482e2df50b7d43e3 |
@@ -0,0 +1,54 @@ | |||
/* | |||
* DISTRHO Plugin Framework (DPF) | |||
* Copyright (C) 2012-2014 Filipe Coelho <falktx@falktx.com> | |||
* | |||
* 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. | |||
*/ | |||
#ifndef DISTRHO_PLUGIN_INFO_H_INCLUDED | |||
#define DISTRHO_PLUGIN_INFO_H_INCLUDED | |||
#define DISTRHO_PLUGIN_NAME "Info" | |||
#define DISTRHO_PLUGIN_HAS_UI 1 | |||
#define DISTRHO_PLUGIN_IS_RT_SAFE 1 | |||
#define DISTRHO_PLUGIN_IS_SYNTH 0 | |||
#define DISTRHO_PLUGIN_NUM_INPUTS 2 | |||
#define DISTRHO_PLUGIN_NUM_OUTPUTS 2 | |||
#define DISTRHO_PLUGIN_WANT_LATENCY 0 | |||
#define DISTRHO_PLUGIN_WANT_PROGRAMS 0 | |||
#define DISTRHO_PLUGIN_WANT_STATE 0 | |||
#define DISTRHO_PLUGIN_WANT_TIMEPOS 1 | |||
#define DISTRHO_PLUGIN_URI "http://distrho.sf.net/examples/Info" | |||
#define DISTRHO_UI_USE_NANOVG 1 | |||
enum Parameters { | |||
kParameterBufferSize = 0, | |||
kParameterTimePlaying, | |||
kParameterTimeFrame, | |||
kParameterTimeValidBBT, | |||
kParameterTimeBar, | |||
kParameterTimeBeat, | |||
kParameterTimeTick, | |||
kParameterTimeBarStartTick, | |||
kParameterTimeBeatsPerBar, | |||
kParameterTimeBeatType, | |||
kParameterTimeTicksPerBeat, | |||
kParameterTimeBeatsPerMinute, | |||
kParameterCount | |||
}; | |||
#endif // DISTRHO_PLUGIN_INFO_H_INCLUDED |
@@ -0,0 +1,234 @@ | |||
/* | |||
* DISTRHO Plugin Framework (DPF) | |||
* Copyright (C) 2012-2014 Filipe Coelho <falktx@falktx.com> | |||
* | |||
* 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. | |||
*/ | |||
#include "DistrhoPlugin.hpp" | |||
START_NAMESPACE_DISTRHO | |||
// ----------------------------------------------------------------------------------------------------------- | |||
/** | |||
Plugin to demonstrate parameter outputs using meters. | |||
*/ | |||
class ExamplePluginInfo : public Plugin | |||
{ | |||
public: | |||
ExamplePluginInfo() | |||
: Plugin(kParameterCount, 0, 0) | |||
{ | |||
std::memset(fParameters, 0, sizeof(float)*kParameterCount); | |||
} | |||
protected: | |||
/* -------------------------------------------------------------------------------------------------------- | |||
* Information */ | |||
/** | |||
Get the plugin label. | |||
A plugin label follows the same rules as Parameter::symbol, with the exception that it can start with numbers. | |||
*/ | |||
const char* d_getLabel() const override | |||
{ | |||
return "info"; | |||
} | |||
/** | |||
Get the plugin author/maker. | |||
*/ | |||
const char* d_getMaker() const override | |||
{ | |||
return "DISTRHO"; | |||
} | |||
/** | |||
Get the plugin license name (a single line of text). | |||
*/ | |||
const char* d_getLicense() const override | |||
{ | |||
return "ISC"; | |||
} | |||
/** | |||
Get the plugin version, in hexadecimal. | |||
TODO format to be defined | |||
*/ | |||
uint32_t d_getVersion() const override | |||
{ | |||
return 0x1000; | |||
} | |||
/** | |||
Get the plugin unique Id. | |||
This value is used by LADSPA, DSSI and VST plugin formats. | |||
*/ | |||
int64_t d_getUniqueId() const override | |||
{ | |||
return d_cconst('d', 'N', 'f', 'o'); | |||
} | |||
/* -------------------------------------------------------------------------------------------------------- | |||
* Init */ | |||
/** | |||
Initialize the parameter @a index. | |||
This function will be called once, shortly after the plugin is created. | |||
*/ | |||
void d_initParameter(uint32_t index, Parameter& parameter) override | |||
{ | |||
parameter.hints = kParameterIsAutomable|kParameterIsOutput; | |||
parameter.ranges.def = 0.0f; | |||
parameter.ranges.min = 0.0f; | |||
parameter.ranges.max = 16777216.0f; | |||
switch (index) | |||
{ | |||
case kParameterBufferSize: | |||
parameter.name = "BufferSize"; | |||
parameter.symbol = "buffer_size"; | |||
break; | |||
case kParameterTimePlaying: | |||
parameter.hints |= kParameterIsBoolean; | |||
parameter.name = "TimePlaying"; | |||
parameter.symbol = "time_playing"; | |||
parameter.ranges.min = 0.0f; | |||
parameter.ranges.max = 1.0f; | |||
break; | |||
case kParameterTimeFrame: | |||
parameter.name = "TimeFrame"; | |||
parameter.symbol = "time_frame"; | |||
break; | |||
case kParameterTimeValidBBT: | |||
parameter.hints |= kParameterIsBoolean; | |||
parameter.name = "TimeValidBBT"; | |||
parameter.symbol = "time_validbbt"; | |||
parameter.ranges.min = 0.0f; | |||
parameter.ranges.max = 1.0f; | |||
break; | |||
case kParameterTimeBar: | |||
parameter.name = "TimeBar"; | |||
parameter.symbol = "time_bar"; | |||
break; | |||
case kParameterTimeBeat: | |||
parameter.name = "TimeBeat"; | |||
parameter.symbol = "time_beat"; | |||
break; | |||
case kParameterTimeTick: | |||
parameter.name = "TimeTick"; | |||
parameter.symbol = "time_tick"; | |||
break; | |||
case kParameterTimeBarStartTick: | |||
parameter.name = "TimeBarStartTick"; | |||
parameter.symbol = "time_barstarttick"; | |||
break; | |||
case kParameterTimeBeatsPerBar: | |||
parameter.name = "TimeBeatsPerBar"; | |||
parameter.symbol = "time_beatsperbar"; | |||
break; | |||
case kParameterTimeBeatType: | |||
parameter.name = "TimeBeatType"; | |||
parameter.symbol = "time_beattype"; | |||
break; | |||
case kParameterTimeTicksPerBeat: | |||
parameter.name = "TimeTicksPerBeat"; | |||
parameter.symbol = "time_ticksperbeat"; | |||
break; | |||
case kParameterTimeBeatsPerMinute: | |||
parameter.name = "TimeBeatsPerMinute"; | |||
parameter.symbol = "time_beatsperminute"; | |||
break; | |||
} | |||
} | |||
/* -------------------------------------------------------------------------------------------------------- | |||
* Internal data */ | |||
/** | |||
Get the current value of a parameter. | |||
*/ | |||
float d_getParameterValue(uint32_t index) const override | |||
{ | |||
return fParameters[index]; | |||
} | |||
/** | |||
Change a parameter value. | |||
*/ | |||
void d_setParameterValue(uint32_t, float) override | |||
{ | |||
// this is only called for input paramters, which we have none of. | |||
} | |||
/* -------------------------------------------------------------------------------------------------------- | |||
* Process */ | |||
/** | |||
Run/process function for plugins without MIDI input. | |||
*/ | |||
void d_run(const float** inputs, float** outputs, uint32_t frames) override | |||
{ | |||
/** | |||
This plugin does nothing, it just demonstrates information usage. | |||
So here we directly copy inputs over outputs, leaving the audio untouched. | |||
We need to be careful in case the host re-uses the same buffer for both ins and outs. | |||
*/ | |||
if (outputs[0] != inputs[0]) | |||
std::memcpy(outputs[0], inputs[0], sizeof(float)*frames); | |||
if (outputs[1] != inputs[1]) | |||
std::memcpy(outputs[1], inputs[1], sizeof(float)*frames); | |||
// set info | |||
fParameters[kParameterBufferSize] = d_getBufferSize(); | |||
const TimePosition& timePos(d_getTimePosition()); | |||
fParameters[kParameterTimePlaying] = timePos.playing ? 1.0f : 0.0f; | |||
fParameters[kParameterTimeFrame] = timePos.frame; | |||
fParameters[kParameterTimeValidBBT] = timePos.bbt.valid ? 1.0f : 0.0f; | |||
fParameters[kParameterTimeBar] = timePos.bbt.bar; | |||
fParameters[kParameterTimeBeat] = timePos.bbt.beat; | |||
fParameters[kParameterTimeTick] = timePos.bbt.tick; | |||
fParameters[kParameterTimeBarStartTick] = timePos.bbt.barStartTick; | |||
fParameters[kParameterTimeBeatsPerBar] = timePos.bbt.beatsPerBar; | |||
fParameters[kParameterTimeBeatType] = timePos.bbt.beatType; | |||
fParameters[kParameterTimeTicksPerBeat] = timePos.bbt.ticksPerBeat; | |||
fParameters[kParameterTimeBeatsPerMinute] = timePos.bbt.beatsPerMinute; | |||
} | |||
// ------------------------------------------------------------------------------------------------------- | |||
private: | |||
// Parameters | |||
float fParameters[kParameterCount]; | |||
/** | |||
Set our plugin class as non-copyable and add a leak detector just in case. | |||
*/ | |||
DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(ExamplePluginInfo) | |||
}; | |||
/* ------------------------------------------------------------------------------------------------------------ | |||
* Plugin entry point, called by DPF to create a new plugin instance. */ | |||
Plugin* createPlugin() | |||
{ | |||
return new ExamplePluginInfo(); | |||
} | |||
// ----------------------------------------------------------------------------------------------------------- | |||
END_NAMESPACE_DISTRHO |
@@ -0,0 +1,221 @@ | |||
/* | |||
* DISTRHO Plugin Framework (DPF) | |||
* Copyright (C) 2012-2014 Filipe Coelho <falktx@falktx.com> | |||
* | |||
* 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. | |||
*/ | |||
#include "DistrhoPluginInfo.h" | |||
#include "DistrhoUI.hpp" | |||
START_NAMESPACE_DISTRHO | |||
// ----------------------------------------------------------------------------------------------------------- | |||
class ExampleUIInfo : public UI | |||
{ | |||
public: | |||
ExampleUIInfo() | |||
: UI() | |||
{ | |||
std::memset(fParameters, 0, sizeof(float)*kParameterCount); | |||
std::memset(fStrBuf, 0, sizeof(char)*(0xff+1)); | |||
fSampleRate = d_getSampleRate(); | |||
fFont = createFont("sans", "/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf"); | |||
setSize(405, 256); | |||
} | |||
protected: | |||
/* -------------------------------------------------------------------------------------------------------- | |||
* DSP/Plugin Callbacks */ | |||
/** | |||
A parameter has changed on the plugin side. | |||
This is called by the host to inform the UI about parameter changes. | |||
*/ | |||
void d_parameterChanged(uint32_t index, float value) override | |||
{ | |||
fParameters[index] = value; | |||
repaint(); | |||
} | |||
/* -------------------------------------------------------------------------------------------------------- | |||
* DSP/Plugin Callbacks (optional) */ | |||
/** | |||
Optional callback to inform the UI about a sample rate change on the plugin side. | |||
*/ | |||
void d_sampleRateChanged(double newSampleRate) | |||
{ | |||
fSampleRate = newSampleRate; | |||
repaint(); | |||
} | |||
/* -------------------------------------------------------------------------------------------------------- | |||
* Widget Callbacks */ | |||
/** | |||
The NanoVG drawing function. | |||
*/ | |||
void onNanoDisplay() override | |||
{ | |||
static const float lineHeight = 20; | |||
fontSize(15.0f); | |||
textLineHeight(lineHeight); | |||
float x = 0; | |||
float y = 15; | |||
// buffer size | |||
drawLeft(x, y, "Buffer Size:"); | |||
drawRight(x, y, getTextBufInt(fParameters[kParameterBufferSize])); | |||
y+=lineHeight; | |||
// sample rate | |||
drawLeft(x, y, "Sample Rate:"); | |||
drawRight(x, y, getTextBufFloat(fSampleRate)); | |||
y+=lineHeight; | |||
// nothing | |||
y+=lineHeight; | |||
// time stuff | |||
drawLeft(x, y, "Playing:"); | |||
drawRight(x, y, (fParameters[kParameterTimePlaying] > 0.5f) ? "Yes" : "No"); | |||
y+=lineHeight; | |||
drawLeft(x, y, "Frame:"); | |||
drawRight(x, y, getTextBufInt(fParameters[kParameterTimeFrame])); | |||
y+=lineHeight; | |||
drawLeft(x, y, "Time:"); | |||
drawRight(x, y, getTextBufTime(fParameters[kParameterTimeFrame])); | |||
y+=lineHeight; | |||
// BBT | |||
x = 200; | |||
y = 15; | |||
const bool validBBT(fParameters[kParameterTimeValidBBT] > 0.5f); | |||
drawLeft(x, y, "BBT Valid:"); | |||
drawRight(x, y, validBBT ? "Yes" : "No"); | |||
y+=lineHeight; | |||
if (! validBBT) | |||
return; | |||
drawLeft(x, y, "Bar:"); | |||
drawRight(x, y, getTextBufInt(fParameters[kParameterTimeBar])); | |||
y+=lineHeight; | |||
drawLeft(x, y, "Beat:"); | |||
drawRight(x, y, getTextBufInt(fParameters[kParameterTimeBeat])); | |||
y+=lineHeight; | |||
drawLeft(x, y, "Tick:"); | |||
drawRight(x, y, getTextBufInt(fParameters[kParameterTimeTick])); | |||
y+=lineHeight; | |||
drawLeft(x, y, "Bar Start Tick:"); | |||
drawRight(x, y, getTextBufFloat(fParameters[kParameterTimeBarStartTick])); | |||
y+=lineHeight; | |||
drawLeft(x, y, "Beats Per Bar:"); | |||
drawRight(x, y, getTextBufFloat(fParameters[kParameterTimeBeatsPerBar])); | |||
y+=lineHeight; | |||
drawLeft(x, y, "Beat Type:"); | |||
drawRight(x, y, getTextBufFloat(fParameters[kParameterTimeBeatType])); | |||
y+=lineHeight; | |||
drawLeft(x, y, "Ticks Per Beat:"); | |||
drawRight(x, y, getTextBufFloat(fParameters[kParameterTimeTicksPerBeat])); | |||
y+=lineHeight; | |||
drawLeft(x, y, "BPM:"); | |||
drawRight(x, y, getTextBufFloat(fParameters[kParameterTimeBeatsPerMinute])); | |||
y+=lineHeight; | |||
} | |||
// ------------------------------------------------------------------------------------------------------- | |||
private: | |||
// Parameters | |||
float fParameters[kParameterCount]; | |||
double fSampleRate; | |||
FontId fFont; | |||
// temp buf for text | |||
char fStrBuf[0xff+1]; | |||
const char* getTextBufInt(const int value) | |||
{ | |||
std::snprintf(fStrBuf, 0xff, "%i", value); | |||
return fStrBuf; | |||
} | |||
const char* getTextBufFloat(const float value) | |||
{ | |||
std::snprintf(fStrBuf, 0xff, "%.1f", value); | |||
return fStrBuf; | |||
} | |||
const char* getTextBufTime(const uint64_t frame) | |||
{ | |||
const uint32_t time = frame / uint64_t(fSampleRate); | |||
const uint32_t secs = time % 60; | |||
const uint32_t mins = (time / 60) % 60; | |||
const uint32_t hrs = (time / 3600) % 60; | |||
std::snprintf(fStrBuf, 0xff, "%02i:%02i:%02i", hrs, mins, secs); | |||
return fStrBuf; | |||
} | |||
void drawLeft(const float x, const float y, const char* const text) | |||
{ | |||
beginPath(); | |||
fillColor(200,200,200); | |||
textAlign(Align(ALIGN_RIGHT|ALIGN_TOP)); | |||
textBox(x, y, 100, text, nullptr); | |||
closePath(); | |||
} | |||
void drawRight(const float x, const float y, const char* const text) | |||
{ | |||
beginPath(); | |||
fillColor(255,255,255); | |||
textAlign(Align(ALIGN_LEFT|ALIGN_TOP)); | |||
textBox(x+105, y, 100, text, nullptr); | |||
closePath(); | |||
} | |||
/** | |||
Set our UI class as non-copyable and add a leak detector just in case. | |||
*/ | |||
DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(ExampleUIInfo) | |||
}; | |||
/* ------------------------------------------------------------------------------------------------------------ | |||
* UI entry point, called by DPF to create a new UI instance. */ | |||
UI* createUI() | |||
{ | |||
return new ExampleUIInfo(); | |||
} | |||
// ----------------------------------------------------------------------------------------------------------- | |||
END_NAMESPACE_DISTRHO |
@@ -0,0 +1,35 @@ | |||
#!/usr/bin/make -f | |||
# Makefile for DISTRHO Plugins # | |||
# ---------------------------- # | |||
# Created by falkTX | |||
# | |||
# -------------------------------------------------------------- | |||
# Project name, used for binaries | |||
NAME = d_info | |||
# -------------------------------------------------------------- | |||
# Files to build | |||
OBJS_DSP = \ | |||
ExamplePluginInfo.cpp.o | |||
OBJS_UI = \ | |||
ExampleUIInfo.cpp.o | |||
# -------------------------------------------------------------- | |||
# Do some magic | |||
include ../Makefile.mk | |||
# -------------------------------------------------------------- | |||
# Enable all possible plugin types | |||
ifeq ($(LINUX),true) | |||
all: jack dssi lv2_sep vst | |||
else | |||
all: dssi lv2_sep vst | |||
endif | |||
# -------------------------------------------------------------- |
@@ -0,0 +1,8 @@ | |||
# Information example | |||
This example will show how to get several times of information using DPF.<br/> | |||
The plugin will not do any audio processing.<br/> | |||
In this example the Plugin will have a lot of parameter outputs which the UI uses to get info from.<br/> | |||
This includes buffer-size and time position. Sample-rate can be access directly from the UI.<br/> | |||
The UI will show this information as text.<br/> |