MCPcopy Create free account
hub / github.com/audacity/audacity / LoadFXP

Method LoadFXP

libraries/lib-vst/VSTWrapper.cpp:931–981  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

929}
930
931bool VSTWrapper::LoadFXP(const wxFileName & fn)
932{
933 bool ret = false;
934
935 // Try to open the file...will be closed automatically when method returns
936 wxFFile f(fn.GetFullPath(), wxT("rb"));
937 if (!f.IsOpened())
938 {
939 return false;
940 }
941
942 // Allocate memory for the contents
943 ArrayOf<unsigned char> data{ size_t(f.Length()) };
944 if (!data)
945 {
946 using namespace BasicUI;
947 ShowMessageBox(
948 XO("Unable to allocate memory when loading presets file."),
949 MessageBoxOptions{}
950 .Caption(XO("Error Loading VST Presets")));
951 return false;
952 }
953 unsigned char *bptr = data.get();
954
955 do
956 {
957 // Read in the whole file
958 ssize_t len = f.Read((void *) bptr, f.Length());
959 if (f.Error())
960 {
961 using namespace BasicUI;
962 ShowMessageBox(
963 XO("Unable to read presets file."),
964 MessageBoxOptions{}
965 .Caption(XO("Error Loading VST Presets")));
966 break;
967 }
968
969 // Get (or default) currently selected program
970 int i = 0; //mProgram->GetCurrentSelection();
971 if (i < 0)
972 {
973 i = 0; // default to first program
974 }
975
976 // Go verify and set the program
977 ret = LoadFXProgram(&bptr, len, i, false);
978 } while (false);
979
980 return ret;
981}
982
983bool VSTWrapper::LoadFXProgram(unsigned char **bptr, ssize_t & len, int index, bool dryrun)
984{

Callers

nothing calls this directly

Calls 6

ShowMessageBoxFunction · 0.85
IsOpenedMethod · 0.80
LengthMethod · 0.80
getMethod · 0.45
ReadMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected