Author Topic: How to use Bass Vst GetChunk properly?  (Read 176 times)

obiwan45

  • Posts: 1
How to use Bass Vst GetChunk properly?
« on: 9 Sep '18 - 11:15 »
How to use Bass Vst GetChunk properly?

BASS_VST_GetChunk gets the application crashed when called. Please Help! :(

Code: [Select]
   
BASS_VST_PLUGIN* this_ = refHandle(vstHandle);
   if (this_ == NULL)
      RETURN_ERROR(BASS_ERROR_HANDLE);
   DWORD error = BASS_OK;


   CFxBank b;

   


   if (this_->aeffect->flags & effFlagsProgramChunks)
   {

      OutputDebugString("flags true");



      OutputDebugString("entering GetChunk");

   

   DWORD len = 0;

      void * chunk = BASS_VST_GetChunk(vstHandle, 0, &len);


         if (len > 0)
         {
            FILE* fp = _wfopen((LPCWSTR)fname, L"wb");
            if (fwrite(chunk, 1, len, fp) != len)
            {
               OutputDebugString("Error saving chunk to file.\n");
            }
            fclose(fp);
         }

   

   

      OutputDebugString("flags true -- End condition");

     

      return true;
   }