Please, how to save preset data when i change the parameters in the Editor?
public void SaveVstPreset(int vstHandle, string filePath, float delayTime)
{
//yield return new WaitForSeconds(delayTime);
// Now do your thing here
// Function to save the VST preset to a file
byte[] presetData = BassVst.BASS_VST_GetChunk(vstHandle, true);
if (presetData != null)
{
System.IO.File.WriteAllBytes(filePath + "preset_data.vstpreset", presetData);
Console.WriteLine("Preset data saved successfully!");
}
else
{
Console.WriteLine("Error retrieving preset data!");
}
}
private int YourVstProc(int vstHandle, BASSVSTAction action, int param1, int param2, IntPtr user)
{
switch (action)
{
case BASSVSTAction.BASS_VST_PARAM_CHANGED:
// we get notified that the user has changed some sliders in the editor -
// do what to do here ...
if (vstHandle2 != 0)
{
SaveVstPreset(vstHandle2, UnityEngine.Application.dataPath + @"\..\VSTIplugins\", 1f);
}
break;
case BASSVSTAction.BASS_VST_EDITOR_RESIZED:
// the editor window requests a new size,
// maybe we should resize the window the editor is embedded in?
// the new width/height can be found in param1/param2
if (f != null && !f.IsDisposed)
{
// param1 = width, param2 = height
f.ClientSize = new Size(param1, param2);
}
break;
case BASSVSTAction.BASS_VST_AUDIO_MASTER:
// this is only for people familiar with the VST SDK,
// param1 is a pointer to a BASS_VST_AUDIO_MASTER_PARAM structure
// which contains all information needed
break;
}
return 0;
}
My application freeze and crash, please help.