summaryrefslogtreecommitdiff
path: root/vst
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2016-01-28 14:58:41 +0100
committerBent Bisballe Nyeng <deva@aasimon.org>2016-01-28 14:58:41 +0100
commit413c0703722835e48b98b85b8ded32f1f43555bb (patch)
tree9d195d00c020ed96e1a5ad2a10ed8e044d7623a9 /vst
parent2087facd3727c52069ad65c5b791f24cba3101a2 (diff)
Style fixes
Diffstat (limited to 'vst')
-rw-r--r--vst/drumgizmo_vst.cc129
1 files changed, 79 insertions, 50 deletions
diff --git a/vst/drumgizmo_vst.cc b/vst/drumgizmo_vst.cc
index 8c40b2f..c974a2a 100644
--- a/vst/drumgizmo_vst.cc
+++ b/vst/drumgizmo_vst.cc
@@ -85,7 +85,7 @@ void DGEditor::idle()
AudioEffect* createEffectInstance(audioMasterCallback audioMaster)
{
- DEBUG(dgeditor, "%s\n", __PRETTY_FUNCTION__);
+ DEBUG(vst, "%s\n", __PRETTY_FUNCTION__);
return new DrumGizmoVst(audioMaster);
}
@@ -123,9 +123,9 @@ DrumGizmoVst::DrumGizmoVst(audioMasterCallback audioMaster)
printf("Error: %d\n", status);
}
- INFO(example, "We are up and running");
+ INFO(vst, "We are up and running");
- DEBUG(dgeditor, "%s\n", __PRETTY_FUNCTION__);
+ DEBUG(vst, "%s\n", __PRETTY_FUNCTION__);
pos = 0;
buffer = nullptr;
@@ -181,17 +181,26 @@ DrumGizmoVst::DrumGizmoVst(audioMasterCallback audioMaster)
DrumGizmoVst::~DrumGizmoVst()
{
- DEBUG(dgeditor, "%s\n", __PRETTY_FUNCTION__);
+ DEBUG(vst, "%s\n", __PRETTY_FUNCTION__);
DEBUG(vst, "~DrumGizmoVst(1)\n");
if(drumgizmo)
+ {
delete drumgizmo;
+ }
+
DEBUG(vst, "~DrumGizmoVst(2)\n");
if(input)
+ {
delete input;
+ }
+
DEBUG(vst, "~DrumGizmoVst(3)\n");
if(output)
+ {
delete output;
+ }
+
DEBUG(vst, "~DrumGizmoVst(4)\n");
hug_close();
@@ -199,7 +208,7 @@ DrumGizmoVst::~DrumGizmoVst()
VstInt32 DrumGizmoVst::getChunk(void** data, bool isPreset)
{
- DEBUG(dgeditor, "%s - data: %p isPreset: %d\n",
+ DEBUG(vst, "%s - data: %p isPreset: %d\n",
__PRETTY_FUNCTION__, *data, isPreset ? 1 : 0);
std::string cfg = drumgizmo->configString();
DEBUG(vst, "drumgizmo->config := %s\n", cfg.c_str());
@@ -210,7 +219,7 @@ VstInt32 DrumGizmoVst::getChunk(void** data, bool isPreset)
VstInt32 DrumGizmoVst::setChunk(void* data, VstInt32 byteSize, bool isPreset)
{
- DEBUG(dgeditor, "%s\n", __PRETTY_FUNCTION__);
+ DEBUG(vst, "%s\n", __PRETTY_FUNCTION__);
std::string config;
config.append((const char*)data, (size_t)byteSize);
@@ -228,21 +237,21 @@ VstInt32 DrumGizmoVst::setChunk(void* data, VstInt32 byteSize, bool isPreset)
void DrumGizmoVst::setProgram(VstInt32 program)
{
- DEBUG(dgeditor, "%s\n", __PRETTY_FUNCTION__);
+ DEBUG(vst, "%s\n", __PRETTY_FUNCTION__);
}
void DrumGizmoVst::setProgramName(char* name)
{
- DEBUG(dgeditor, "%s\n", __PRETTY_FUNCTION__);
+ DEBUG(vst, "%s\n", __PRETTY_FUNCTION__);
}
void DrumGizmoVst::getProgramName(char* name)
{
- DEBUG(dgeditor, "%s\n", __PRETTY_FUNCTION__);
+ DEBUG(vst, "%s\n", __PRETTY_FUNCTION__);
name[0] = '\0';
}
void DrumGizmoVst::getParameterLabel(VstInt32 index, char* label)
{
- DEBUG(dgeditor, "%s\n", __PRETTY_FUNCTION__);
+ DEBUG(vst, "%s\n", __PRETTY_FUNCTION__);
label[0] = '\0';
/*
switch(index)
@@ -268,7 +277,7 @@ void DrumGizmoVst::getParameterLabel(VstInt32 index, char* label)
void DrumGizmoVst::getParameterDisplay(VstInt32 index, char* text)
{
- DEBUG(dgeditor, "%s\n", __PRETTY_FUNCTION__);
+ DEBUG(vst, "%s\n", __PRETTY_FUNCTION__);
text[0] = 0;
/*
switch(index)
@@ -304,7 +313,7 @@ void DrumGizmoVst::getParameterDisplay(VstInt32 index, char* text)
void DrumGizmoVst::getParameterName(VstInt32 index, char* label)
{
- DEBUG(dgeditor, "%s\n", __PRETTY_FUNCTION__);
+ DEBUG(vst, "%s\n", __PRETTY_FUNCTION__);
/*
switch(index)
{
@@ -328,13 +337,13 @@ void DrumGizmoVst::getParameterName(VstInt32 index, char* label)
void DrumGizmoVst::setParameter(VstInt32 index, float value)
{
- DEBUG(dgeditor, "%s\n", __PRETTY_FUNCTION__);
+ DEBUG(vst, "%s\n", __PRETTY_FUNCTION__);
/*
DrumGizmoVstProgram *ap = &programs[curProgram];
switch(index)
{
case kWaveform1: fWaveform1 = ap->fWaveform1 = value; break;
- case kFreq1: fFreq1 = ap->fFreq1 = value; break;
+ case kFreq1: fFreq1 = ap->fFreq1 = value; break;
case kVolume1: fVolume1 = ap->fVolume1 = value; break;
case kWaveform2: fWaveform2 = ap->fWaveform2 = value; break;
case kFreq2: fFreq2 = ap->fFreq2 = value; break;
@@ -346,7 +355,7 @@ void DrumGizmoVst::setParameter(VstInt32 index, float value)
float DrumGizmoVst::getParameter(VstInt32 index)
{
- DEBUG(dgeditor, "%s\n", __PRETTY_FUNCTION__);
+ DEBUG(vst, "%s\n", __PRETTY_FUNCTION__);
float value = 0;
/*
switch(index)
@@ -363,10 +372,10 @@ float DrumGizmoVst::getParameter(VstInt32 index)
return value;
}
-bool DrumGizmoVst::getOutputProperties(
- VstInt32 index, VstPinProperties* properties)
+bool DrumGizmoVst::getOutputProperties(VstInt32 index,
+ VstPinProperties* properties)
{
- DEBUG(dgeditor, "%s\n", __PRETTY_FUNCTION__);
+ DEBUG(vst, "%s\n", __PRETTY_FUNCTION__);
if(index < NUM_OUTPUTS)
{
vst_strncpy(properties->label, "Channel ", 63);
@@ -381,92 +390,108 @@ bool DrumGizmoVst::getOutputProperties(
return false;
}
-bool DrumGizmoVst::getProgramNameIndexed(
- VstInt32 category, VstInt32 index, char* text)
+bool DrumGizmoVst::getProgramNameIndexed(VstInt32 category, VstInt32 index,
+ char* text)
{
- DEBUG(dgeditor, "%s\n", __PRETTY_FUNCTION__);
+ DEBUG(vst, "%s\n", __PRETTY_FUNCTION__);
return false;
}
bool DrumGizmoVst::getEffectName(char* name)
{
- DEBUG(dgeditor, "%s\n", __PRETTY_FUNCTION__);
+ DEBUG(vst, "%s\n", __PRETTY_FUNCTION__);
vst_strncpy(name, "DrumGizmo4", kVstMaxEffectNameLen);
return true;
}
bool DrumGizmoVst::getVendorString(char* text)
{
- DEBUG(dgeditor, "%s\n", __PRETTY_FUNCTION__);
+ DEBUG(vst, "%s\n", __PRETTY_FUNCTION__);
vst_strncpy(text, "Aasimon.org", kVstMaxVendorStrLen);
return true;
}
bool DrumGizmoVst::getProductString(char* text)
{
- DEBUG(dgeditor, "%s\n", __PRETTY_FUNCTION__);
+ DEBUG(vst, "%s\n", __PRETTY_FUNCTION__);
vst_strncpy(text, "Vst Synth", kVstMaxProductStrLen);
return true;
}
VstInt32 DrumGizmoVst::getVendorVersion()
{
- DEBUG(dgeditor, "%s\n", __PRETTY_FUNCTION__);
+ DEBUG(vst, "%s\n", __PRETTY_FUNCTION__);
return 1000;
}
VstInt32 DrumGizmoVst::canDo(char* text)
{
- DEBUG(dgeditor, "%s\n", __PRETTY_FUNCTION__);
+ DEBUG(vst, "%s\n", __PRETTY_FUNCTION__);
if(!strcmp(text, "receiveVstEvents"))
+ {
return 1;
+ }
+
if(!strcmp(text, "receiveVstMidiEvent"))
+ {
return 1;
+ }
+
// if(!strcmp(text, "midiProgramNames")) return 1;
return -1; // explicitly can't do; 0 => don't know
}
VstInt32 DrumGizmoVst::getNumMidiInputChannels()
{
- DEBUG(dgeditor, "%s\n", __PRETTY_FUNCTION__);
+ DEBUG(vst, "%s\n", __PRETTY_FUNCTION__);
return 1; // we are monophonic
}
VstInt32 DrumGizmoVst::getNumMidiOutputChannels()
{
- DEBUG(dgeditor, "%s\n", __PRETTY_FUNCTION__);
+ DEBUG(vst, "%s\n", __PRETTY_FUNCTION__);
return 0; // no MIDI output back to Host app
}
-VstInt32 DrumGizmoVst::getMidiProgramName(
- VstInt32 channel, MidiProgramName* mpn)
+VstInt32 DrumGizmoVst::getMidiProgramName(VstInt32 channel,
+ MidiProgramName* mpn)
{
- DEBUG(dgeditor, "%s\n", __PRETTY_FUNCTION__);
+ DEBUG(vst, "%s\n", __PRETTY_FUNCTION__);
VstInt32 prg = mpn->thisProgramIndex;
- if(prg < 0 || prg >= 128)
+ if((prg < 0) || (prg >= 128))
+ {
return 0;
+ }
+
fillProgram(channel, prg, mpn);
if(channel == 9)
+ {
return 1;
+ }
+
return 128L;
}
-VstInt32 DrumGizmoVst::getCurrentMidiProgram(
- VstInt32 channel, MidiProgramName* mpn)
+VstInt32 DrumGizmoVst::getCurrentMidiProgram(VstInt32 channel,
+ MidiProgramName* mpn)
{
- DEBUG(dgeditor, "%s\n", __PRETTY_FUNCTION__);
- if(channel < 0 || channel >= 16 || !mpn)
+ DEBUG(vst, "%s\n", __PRETTY_FUNCTION__);
+ if((channel < 0) || (channel >= 16) || !mpn)
+ {
return -1;
+ }
+
VstInt32 prg = 0;
mpn->thisProgramIndex = prg;
fillProgram(channel, prg, mpn);
+
return prg;
}
-void DrumGizmoVst::fillProgram(
- VstInt32 channel, VstInt32 prg, MidiProgramName* mpn)
+void DrumGizmoVst::fillProgram(VstInt32 channel, VstInt32 prg,
+ MidiProgramName* mpn)
{
- DEBUG(dgeditor, "%s\n", __PRETTY_FUNCTION__);
+ DEBUG(vst, "%s\n", __PRETTY_FUNCTION__);
mpn->midiBankMsb = mpn->midiBankLsb = -1;
mpn->reserved = 0;
mpn->flags = 0;
@@ -476,10 +501,10 @@ void DrumGizmoVst::fillProgram(
mpn->parentCategoryIndex = 0;
}
-VstInt32 DrumGizmoVst::getMidiProgramCategory(
- VstInt32 channel, MidiProgramCategory* cat)
+VstInt32 DrumGizmoVst::getMidiProgramCategory(VstInt32 channel,
+ MidiProgramCategory* cat)
{
- DEBUG(dgeditor, "%s\n", __PRETTY_FUNCTION__);
+ DEBUG(vst, "%s\n", __PRETTY_FUNCTION__);
cat->parentCategoryIndex = -1; // -1:no parent category
cat->flags = 0; // reserved, none defined yet, zero.
// VstInt32 category = cat->thisCategoryIndex;
@@ -498,7 +523,7 @@ bool DrumGizmoVst::getMidiKeyName(VstInt32 channel, MidiKeyName* key)
// if keyName is "" the standard name of the key will be displayed.
// if false is returned, no MidiKeyNames defined for 'thisProgramIndex'.
{
- DEBUG(dgeditor, "%s\n", __PRETTY_FUNCTION__);
+ DEBUG(vst, "%s\n", __PRETTY_FUNCTION__);
// key->thisProgramIndex; // >= 0. fill struct for this program index.
// key->thisKeyNumber; // 0 - 127. fill struct for this key number.
key->keyName[0] = 0;
@@ -509,28 +534,28 @@ bool DrumGizmoVst::getMidiKeyName(VstInt32 channel, MidiKeyName* key)
void DrumGizmoVst::setSampleRate(float sampleRate)
{
- DEBUG(dgeditor, "%s\n", __PRETTY_FUNCTION__);
+ DEBUG(vst, "%s\n", __PRETTY_FUNCTION__);
AudioEffectX::setSampleRate(sampleRate);
drumgizmo->setSamplerate(sampleRate);
}
void DrumGizmoVst::setBlockSize(VstInt32 blockSize)
{
- DEBUG(dgeditor, "%s\n", __PRETTY_FUNCTION__);
+ DEBUG(vst, "%s\n", __PRETTY_FUNCTION__);
AudioEffectX::setBlockSize(blockSize);
}
void DrumGizmoVst::initProcess()
{
- DEBUG(dgeditor, "%s\n", __PRETTY_FUNCTION__);
+ DEBUG(vst, "%s\n", __PRETTY_FUNCTION__);
// drumgizmo->loadkit(getenv("DRUMGIZMO_DRUMKIT"));
drumgizmo->init();
}
-void DrumGizmoVst::processReplacing(
- float** inputs, float** outputs, VstInt32 sampleFrames)
+void DrumGizmoVst::processReplacing(float** inputs, float** outputs,
+ VstInt32 sampleFrames)
{
- DEBUG(dgeditor, "%s\n", __PRETTY_FUNCTION__);
+ DEBUG(vst, "%s\n", __PRETTY_FUNCTION__);
long lvl = getCurrentProcessLevel();
// 0 = realtime/normal
// 1 = non-realtime/rendering
@@ -542,9 +567,13 @@ void DrumGizmoVst::processReplacing(
if(buffer_size != (size_t)sampleFrames)
{
if(buffer)
+ {
free(buffer);
+ }
+
buffer_size = sampleFrames;
buffer = (sample_t*)malloc(sizeof(sample_t) * buffer_size);
+
drumgizmo->setFrameSize(buffer_size);
}
@@ -555,7 +584,7 @@ void DrumGizmoVst::processReplacing(
VstInt32 DrumGizmoVst::processEvents(VstEvents* ev)
{
- DEBUG(dgeditor, "%s\n", __PRETTY_FUNCTION__);
+ DEBUG(vst, "%s\n", __PRETTY_FUNCTION__);
input->processEvents(ev);
return 1;
}