test_plugins_1.cpp 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #include "tests.h"
  2. waf_test_use("plugin_base")
  3. #include "core/PluginIndex.h"
  4. #include "core/PluginManager.h"
  5. #include "io/FileSoundInput.h"
  6. struct TestPlugin {
  7. TestPlugin() {
  8. }
  9. PluginIndex host;
  10. PluginManager manager;
  11. };
  12. #define SAMPLE_WINDOW 4096
  13. int main(int argc, char** argv){
  14. try {
  15. TestPlugin plugins;
  16. plugins.host.add_path("/home/fanch/Programmation/audio_renderer/debug/src/plugins/");
  17. //plugins.host.add_path("/usr/lib/ladspa");
  18. plugins.host.update();
  19. PluginEntry& plugin = plugins.host.load_from_path("/home/fanch/Programmation/audio_renderer/debug/src/plugins/libaudio_to_midi.so");
  20. //printf("Add plugin\n");
  21. FileSoundInput fsi("/home/fanch/Programmation/LADSPA/audio_to_midi/snd/yafs1.wav", SAMPLE_WINDOW);
  22. plugins.manager.set_rate(44100, SAMPLE_WINDOW);
  23. plugins.manager.add_plugin(plugin);
  24. LADSPA_Data* buffer = plugins.manager.get_input();
  25. int count = 0;
  26. while ((buffer = fsi.next(buffer))){
  27. plugins.manager.run(buffer);
  28. count ++;
  29. if(count>1000){
  30. break;
  31. }
  32. }
  33. printf("fin\n");
  34. delete[] buffer;
  35. } catch (const char* x) {
  36. printf("Erreur: %s\n", x);
  37. }
  38. }