SBI loading working, but Release build doesn't initialize..
This commit is contained in:
parent
b1d907e9b8
commit
28e122f581
6 changed files with 36 additions and 18 deletions
|
@ -10,6 +10,10 @@
|
|||
pluginAAXCategory="AAX_ePlugInCategory_Dynamics" jucerVersion="3.1.0">
|
||||
<MAINGROUP id="TOefyq" name="JuceOPLVSTi">
|
||||
<GROUP id="{DCA755EB-7953-0641-E719-95C7850E5B2B}" name="Source">
|
||||
<FILE id="LVSdHL" name="InstrumentLoader.h" compile="0" resource="0"
|
||||
file="Source/InstrumentLoader.h"/>
|
||||
<FILE id="SX7G0u" name="SbiLoader.cpp" compile="1" resource="0" file="Source/SbiLoader.cpp"/>
|
||||
<FILE id="g2OCfO" name="SbiLoader.h" compile="0" resource="0" file="Source/SbiLoader.h"/>
|
||||
<FILE id="CGPOGV" name="IntFloatParameter.cpp" compile="1" resource="0"
|
||||
file="Source/IntFloatParameter.cpp"/>
|
||||
<FILE id="uAEGVV" name="IntFloatParameter.h" compile="0" resource="0"
|
||||
|
|
|
@ -1410,14 +1410,11 @@ void PluginGui::buttonClicked (Button* buttonThatWasClicked)
|
|||
|
||||
bool PluginGui::isInterestedInFileDrag (const StringArray& files)
|
||||
{
|
||||
// TODO: check extensions?
|
||||
return 1 == files.size();
|
||||
return 1 == files.size() && files[0].toLowerCase().endsWith(".sbi");
|
||||
}
|
||||
|
||||
void PluginGui::fileDragEnter (const StringArray& files, int x, int y)
|
||||
{
|
||||
//somethingIsBeingDraggedOver = true;
|
||||
//repaint();
|
||||
}
|
||||
|
||||
void PluginGui::fileDragMove (const StringArray& files, int x, int y)
|
||||
|
@ -1426,8 +1423,6 @@ void PluginGui::buttonClicked (Button* buttonThatWasClicked)
|
|||
|
||||
void PluginGui::fileDragExit (const StringArray& files)
|
||||
{
|
||||
//somethingIsBeingDraggedOver = false;
|
||||
//repaint();
|
||||
}
|
||||
|
||||
void PluginGui::filesDropped (const StringArray& files, int x, int y)
|
||||
|
@ -1435,10 +1430,6 @@ void PluginGui::buttonClicked (Button* buttonThatWasClicked)
|
|||
if (isInterestedInFileDrag(files)) {
|
||||
processor->loadInstrumentFromFile(files[0]);
|
||||
}
|
||||
//message = "files dropped: " + files.joinIntoString ("\n");
|
||||
|
||||
//somethingIsBeingDraggedOver = false;
|
||||
//repaint();
|
||||
}
|
||||
//[/MiscUserCode]
|
||||
|
||||
|
|
|
@ -465,26 +465,43 @@ void JuceOplvstiAudioProcessor::loadInstrumentFromFile(String filename)
|
|||
FILE* f = fopen(filename.toUTF8(), "rb");
|
||||
unsigned char buf[MAX_INSTRUMENT_FILE_SIZE_BYTES];
|
||||
int n = fread(buf, 1, MAX_INSTRUMENT_FILE_SIZE_BYTES, f);
|
||||
fclose(f);
|
||||
SbiLoader* loader = new SbiLoader();
|
||||
loader->loadInstrumentData(n, buf, this);
|
||||
fclose(f);
|
||||
updateGuiIfPresent();
|
||||
}
|
||||
|
||||
void JuceOplvstiAudioProcessor::setParametersByRegister(int register_base, int op, uint8 value)
|
||||
{
|
||||
const String operators[] = {"Modulator", "Carrier"};
|
||||
register_base &= 0xF0;
|
||||
switch (register_base) {
|
||||
case 0x20:
|
||||
setEnumParameter(operators[op] + " Tremolo", (value & 0x80) ? 1 : 0);
|
||||
setEnumParameter(operators[op] + " Vibrato", (value & 0x40) ? 1 : 0);
|
||||
setEnumParameter(operators[op] + " Sustain", (value & 0x20) ? 1 : 0);
|
||||
setEnumParameter(operators[op] + " Keyscale Rate", (value & 0x10) ? 1 : 0);
|
||||
setEnumParameter(operators[op] + " Frequency Multiplier", value & 0x0f);
|
||||
break;
|
||||
case 0x40:
|
||||
setEnumParameter(operators[op] + " Keyscale Level", (value & 0xc0) >> 6);
|
||||
setEnumParameter(operators[op] + " Attenuation", value & 0x3f);
|
||||
break;
|
||||
case 0x60:
|
||||
setIntParameter(operators[op] + " Attack", (value & 0xf0) >> 4);
|
||||
setIntParameter(operators[op] + " Decay", value & 0x0f);
|
||||
break;
|
||||
case 0x80:
|
||||
setIntParameter(operators[op] + " Sustain Level", (value & 0xf0) >> 4);
|
||||
setIntParameter(operators[op] + " Release", value & 0x0f);
|
||||
break;
|
||||
case 0xC0:
|
||||
setIntParameter("Modulator Feedback", (value & 0xe) >> 1);
|
||||
setEnumParameter("Algorithm", value & 0x1);
|
||||
break;
|
||||
case 0xE0:
|
||||
printf("Setting wave to %d", value & 0x7);
|
||||
setEnumParameter(operators[op] + " Wave", value & 0x7);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -559,6 +576,14 @@ int JuceOplvstiAudioProcessor::getCurrentProgram()
|
|||
return i_program;
|
||||
}
|
||||
|
||||
void JuceOplvstiAudioProcessor::updateGuiIfPresent()
|
||||
{
|
||||
PluginGui* gui = (PluginGui*)getActiveEditor();
|
||||
if (gui) {
|
||||
gui->updateFromParameters();
|
||||
}
|
||||
}
|
||||
|
||||
void JuceOplvstiAudioProcessor::setCurrentProgram (int index)
|
||||
{
|
||||
i_program = index;
|
||||
|
@ -566,10 +591,7 @@ void JuceOplvstiAudioProcessor::setCurrentProgram (int index)
|
|||
for (unsigned int i = 0; i < params.size() && i < v_params.size(); i++) {
|
||||
setParameter(i, v_params[i]);
|
||||
}
|
||||
PluginGui* gui = (PluginGui*)getActiveEditor();
|
||||
if (gui) {
|
||||
gui->updateFromParameters();
|
||||
}
|
||||
updateGuiIfPresent();
|
||||
}
|
||||
|
||||
const String JuceOplvstiAudioProcessor::getProgramName (int index)
|
||||
|
|
|
@ -52,6 +52,8 @@ public:
|
|||
void loadInstrumentFromFile(String filename);
|
||||
void setParametersByRegister(int register_base, int op, uint8 value);
|
||||
|
||||
void updateGuiIfPresent();
|
||||
|
||||
const String getParameterName (int index);
|
||||
const String getParameterText (int index);
|
||||
|
||||
|
|
|
@ -7,8 +7,8 @@ SbiLoader::SbiLoader(void)
|
|||
|
||||
void SbiLoader::loadInstrumentData(int n, const unsigned char* data, JuceOplvstiAudioProcessor *proc)
|
||||
{
|
||||
if (strncmp("SBI", (const char*)data, 3)) {
|
||||
data += 40;
|
||||
if (0 == strncmp("SBI", (const char*)data, 3)) {
|
||||
data += 36;
|
||||
proc->setParametersByRegister(0x20, 0, data[0]);
|
||||
proc->setParametersByRegister(0x20, 1, data[1]);
|
||||
proc->setParametersByRegister(0x40, 0, data[2]);
|
||||
|
|
|
@ -34,7 +34,6 @@ Hiopl::Hiopl(int buflen) {
|
|||
}
|
||||
|
||||
void Hiopl::Generate(int length, short* buffer) {
|
||||
//printf("Generating %d samples\n", length);
|
||||
adlib->Generate(length, Buf32);
|
||||
for (int i = 0; i < length; i++) {
|
||||
buffer[i] = (short)(Buf32[i]);
|
||||
|
|
Loading…
Reference in a new issue