#include "L4AUDLVL.h"

bool PRESET_isImplemented(int bank, int presetn)
{
	PRESETINFO preset = allPresets[bank-1][presetn];

	if (preset.sampleNum <= 0 || preset.sampleNum >= 5)
	{
		return false;
	}

	for (int i=0; i < preset.sampleNum; i++)
	{
		if (preset.samples[i].implemented)
		{
			return true;
		}
	}

	return false;
}

int PRESET_getNumSamples(int bank, int preset)
{
	return allPresets[bank-1][preset].sampleNum;
}

SAMPLEINFO PRESET_getSampleInfo(int bank, int preset, int sampleInd)
{
	SAMPLEINFO default;
	default.chan = SampleChannel::CHANNEL_CENTER;
	default.file = "";
	default.implemented = false;
	default.loop = SampleLoop::LoopAtWill;

	if (sampleInd < 0 || sampleInd >= allPresets[bank-1][preset].sampleNum)
	{
		return default;
	}

	return allPresets[bank-1][preset].samples[sampleInd];
}

void PRESET_setBufferIndex(int bank, int preset, int sampleInd, int index)
{
	allPresets[bank-1][preset].samples[sampleInd].bufferIndex = index;
}