2
0
Fork 0

SBI loading working, but Release build doesn't initialize..

This commit is contained in:
bruce 2013-11-13 23:18:47 +08:00
parent b1d907e9b8
commit 28e122f581
6 changed files with 36 additions and 18 deletions

View file

@ -10,6 +10,10 @@
pluginAAXCategory="AAX_ePlugInCategory_Dynamics" jucerVersion="3.1.0"> pluginAAXCategory="AAX_ePlugInCategory_Dynamics" jucerVersion="3.1.0">
<MAINGROUP id="TOefyq" name="JuceOPLVSTi"> <MAINGROUP id="TOefyq" name="JuceOPLVSTi">
<GROUP id="{DCA755EB-7953-0641-E719-95C7850E5B2B}" name="Source"> <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 id="CGPOGV" name="IntFloatParameter.cpp" compile="1" resource="0"
file="Source/IntFloatParameter.cpp"/> file="Source/IntFloatParameter.cpp"/>
<FILE id="uAEGVV" name="IntFloatParameter.h" compile="0" resource="0" <FILE id="uAEGVV" name="IntFloatParameter.h" compile="0" resource="0"

View file

@ -1410,14 +1410,11 @@ void PluginGui::buttonClicked (Button* buttonThatWasClicked)
bool PluginGui::isInterestedInFileDrag (const StringArray& files) bool PluginGui::isInterestedInFileDrag (const StringArray& files)
{ {
// TODO: check extensions? return 1 == files.size() && files[0].toLowerCase().endsWith(".sbi");
return 1 == files.size();
} }
void PluginGui::fileDragEnter (const StringArray& files, int x, int y) void PluginGui::fileDragEnter (const StringArray& files, int x, int y)
{ {
//somethingIsBeingDraggedOver = true;
//repaint();
} }
void PluginGui::fileDragMove (const StringArray& files, int x, int y) 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) void PluginGui::fileDragExit (const StringArray& files)
{ {
//somethingIsBeingDraggedOver = false;
//repaint();
} }
void PluginGui::filesDropped (const StringArray& files, int x, int y) void PluginGui::filesDropped (const StringArray& files, int x, int y)
@ -1435,10 +1430,6 @@ void PluginGui::buttonClicked (Button* buttonThatWasClicked)
if (isInterestedInFileDrag(files)) { if (isInterestedInFileDrag(files)) {
processor->loadInstrumentFromFile(files[0]); processor->loadInstrumentFromFile(files[0]);
} }
//message = "files dropped: " + files.joinIntoString ("\n");
//somethingIsBeingDraggedOver = false;
//repaint();
} }
//[/MiscUserCode] //[/MiscUserCode]

View file

@ -465,26 +465,43 @@ void JuceOplvstiAudioProcessor::loadInstrumentFromFile(String filename)
FILE* f = fopen(filename.toUTF8(), "rb"); FILE* f = fopen(filename.toUTF8(), "rb");
unsigned char buf[MAX_INSTRUMENT_FILE_SIZE_BYTES]; unsigned char buf[MAX_INSTRUMENT_FILE_SIZE_BYTES];
int n = fread(buf, 1, MAX_INSTRUMENT_FILE_SIZE_BYTES, f); int n = fread(buf, 1, MAX_INSTRUMENT_FILE_SIZE_BYTES, f);
fclose(f);
SbiLoader* loader = new SbiLoader(); SbiLoader* loader = new SbiLoader();
loader->loadInstrumentData(n, buf, this); loader->loadInstrumentData(n, buf, this);
fclose(f); updateGuiIfPresent();
} }
void JuceOplvstiAudioProcessor::setParametersByRegister(int register_base, int op, uint8 value) void JuceOplvstiAudioProcessor::setParametersByRegister(int register_base, int op, uint8 value)
{ {
const String operators[] = {"Modulator", "Carrier"};
register_base &= 0xF0; register_base &= 0xF0;
switch (register_base) { switch (register_base) {
case 0x20: 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; break;
case 0x40: case 0x40:
setEnumParameter(operators[op] + " Keyscale Level", (value & 0xc0) >> 6);
setEnumParameter(operators[op] + " Attenuation", value & 0x3f);
break; break;
case 0x60: case 0x60:
setIntParameter(operators[op] + " Attack", (value & 0xf0) >> 4);
setIntParameter(operators[op] + " Decay", value & 0x0f);
break; break;
case 0x80: case 0x80:
setIntParameter(operators[op] + " Sustain Level", (value & 0xf0) >> 4);
setIntParameter(operators[op] + " Release", value & 0x0f);
break; break;
case 0xC0: case 0xC0:
setIntParameter("Modulator Feedback", (value & 0xe) >> 1);
setEnumParameter("Algorithm", value & 0x1);
break; break;
case 0xE0: case 0xE0:
printf("Setting wave to %d", value & 0x7);
setEnumParameter(operators[op] + " Wave", value & 0x7);
break; break;
default: default:
break; break;
@ -559,6 +576,14 @@ int JuceOplvstiAudioProcessor::getCurrentProgram()
return i_program; return i_program;
} }
void JuceOplvstiAudioProcessor::updateGuiIfPresent()
{
PluginGui* gui = (PluginGui*)getActiveEditor();
if (gui) {
gui->updateFromParameters();
}
}
void JuceOplvstiAudioProcessor::setCurrentProgram (int index) void JuceOplvstiAudioProcessor::setCurrentProgram (int index)
{ {
i_program = 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++) { for (unsigned int i = 0; i < params.size() && i < v_params.size(); i++) {
setParameter(i, v_params[i]); setParameter(i, v_params[i]);
} }
PluginGui* gui = (PluginGui*)getActiveEditor(); updateGuiIfPresent();
if (gui) {
gui->updateFromParameters();
}
} }
const String JuceOplvstiAudioProcessor::getProgramName (int index) const String JuceOplvstiAudioProcessor::getProgramName (int index)

View file

@ -52,6 +52,8 @@ public:
void loadInstrumentFromFile(String filename); void loadInstrumentFromFile(String filename);
void setParametersByRegister(int register_base, int op, uint8 value); void setParametersByRegister(int register_base, int op, uint8 value);
void updateGuiIfPresent();
const String getParameterName (int index); const String getParameterName (int index);
const String getParameterText (int index); const String getParameterText (int index);

View file

@ -7,8 +7,8 @@ SbiLoader::SbiLoader(void)
void SbiLoader::loadInstrumentData(int n, const unsigned char* data, JuceOplvstiAudioProcessor *proc) void SbiLoader::loadInstrumentData(int n, const unsigned char* data, JuceOplvstiAudioProcessor *proc)
{ {
if (strncmp("SBI", (const char*)data, 3)) { if (0 == strncmp("SBI", (const char*)data, 3)) {
data += 40; data += 36;
proc->setParametersByRegister(0x20, 0, data[0]); proc->setParametersByRegister(0x20, 0, data[0]);
proc->setParametersByRegister(0x20, 1, data[1]); proc->setParametersByRegister(0x20, 1, data[1]);
proc->setParametersByRegister(0x40, 0, data[2]); proc->setParametersByRegister(0x40, 0, data[2]);

View file

@ -34,7 +34,6 @@ Hiopl::Hiopl(int buflen) {
} }
void Hiopl::Generate(int length, short* buffer) { void Hiopl::Generate(int length, short* buffer) {
//printf("Generating %d samples\n", length);
adlib->Generate(length, Buf32); adlib->Generate(length, Buf32);
for (int i = 0; i < length; i++) { for (int i = 0; i < length; i++) {
buffer[i] = (short)(Buf32[i]); buffer[i] = (short)(Buf32[i]);