private void loadFm(string[] args, string bankpath, byte[] Programs, byte[] DrumPrograms)
{
bool ISdrum = args[4] == "d" ? true : false;
int start = int.Parse(args[2]);
int end = int.Parse(args[3]);
List<int> Indices = new List<int>();
if (ISdrum == false)
{
if (Programs == null)
{
for (int i = start; i <= end; i++)
{
Indices.Add(i);
}
}
else
{
for (int x2 = 0; x2 < Programs.Length; x2++)
{
if (Programs[x2] >= start && Programs[x2] <= end)
{
Indices.Add(Programs[x2]);
}
}
}
}
else
{
if (DrumPrograms == null)
{
for (int i = start; i <= end; i++)
{
Indices.Add(i);
}
}
else
{
for (int x2 = 0; x2 < DrumPrograms.Length; x2++)
{
if (DrumPrograms[x2] >= start && Programs[x2] <= end)
{
Indices.Add(DrumPrograms[x2]);
}
}
}
}
if (Indices.Count > 0)
{
Instrument inst;
inst = new FMInstrument(bankpath + args[0] + ".prg", SampleRate_);
//Resample if necessary
if (SampleRate_ > 0)
inst.enforceSampleRate(SampleRate_);
//Loop through where to add the instruments
for (int i = 0; i < Indices.Count; i++)
{
//Decide which bank to add too
if (ISdrum == true)
DrumBank[Indices[i]] = inst;
else
Bank[Indices[i]] = inst;
}
}
}