示例#1
0
int GMSynthDLL::LoadSoundBank(const char *alias, const char *fileName, int preload, float scl)
{
	SoundBank *sb = 0;
	sb = SoundBank::SoundBankList.FindBank(alias);
	if (sb != NULL)
	{
		sb->Unlock();
		sb = 0;
	}
	if (SFFile::IsSF2File(fileName))
	{
		SFFile file;
		sb = file.LoadSoundBank(fileName, preload);
	}
	else if (DLSFile::IsDLSFile(fileName))
	{
		DLSFile file;
		sb = file.LoadSoundBank(fileName, preload);
	}
	else
		return GMSYNTH_ERR_FILETYPE;

	if (sb == NULL)
		return GMSYNTH_ERR_FILEOPEN;

	sb->Lock();
	sb->name = alias;
	SoundBank::SoundBankList.Insert(sb);
	inmgr.SetSoundBank(sb, scl);
	sbnk = sb;
	return GMSYNTH_NOERROR;
}