gogins / csound-vst3-opcodes

The "vst3" opcodes enable Csound to host VST3 plugin instruments and effects.
GNU General Public License v3.0
5 stars 2 forks source link

Test VST3 opcodes #2

Closed gogins closed 4 years ago

gogins commented 4 years ago

Instead of VST2 presets and programs, VST3 uses units and programs that are implemented under IEditorController. It seems program list data is saved in a PresetFile. A component can support unit preset data via the IUnitData interface or the IProgramListData interface, but the host doesn't need to care about that.

When a plugin (rather, Component and Controller) saves its "complete state," that means the number of its current program and the state of all the parameters and metadata for that program only. There is an ambiguity between the terms "program" and "preset" but the VST3 SDK continues to use "preset" for persistent programs, so I also will do that.

There is no external preset storage in the VST3 SDK, but there is a MemoryStream that grows. The PresetFile can write to and read from a MemoryStream. Its buffer can than be written to or read from external storage.

For Csound, typical use cases can be supported by loading and saving individual programs, so I am going to remove the bank load and save.

gogins commented 4 years ago

Sound is now good! It basically seems to be working.

gogins commented 4 years ago

The host's ability to open a plugin's editor window was written with no thought at all of avoiding main. I may not be able to use or adapt this code. But first I will try just calling main.

gogins commented 4 years ago

I am leaving GUI support out of the initial release.

gogins commented 4 years ago

One more run of valgrind:

==8386== 
==8386== HEAP SUMMARY:
==8386==     in use at exit: 170,368 bytes in 226 blocks
==8386==   total heap usage: 46,083 allocs, 45,857 frees, 23,212,483 bytes allocated
==8386== 
==8386== LEAK SUMMARY:
==8386==    definitely lost: 9,480 bytes in 12 blocks
==8386==    indirectly lost: 4,408 bytes in 32 blocks
==8386==      possibly lost: 0 bytes in 0 blocks
==8386==    still reachable: 156,480 bytes in 182 blocks
==8386==         suppressed: 0 bytes in 0 blocks
==8386== Rerun with --leak-check=full to see details of leaked memory
==8386== 
==8386== For counts of detected and suppressed errors, rerun with: -v
==8386== Use --track-origins=yes to see where uninitialised values come from
==8386== ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 0 from 0)

The 2 errors are in the mda Ambience plugin, not directly in my opcodes.

gogins commented 4 years ago

One more run of callgrind. Not too bad. Not much overhead between the vst-opcodes code csound::OpcodeBase<VST3AUDIO>::audio and the actual plugin code (non-virtual thunk). callgrind