BsOAPlugin.cpp 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
  2. //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
  3. #include "BsOAPrerequisites.h"
  4. #include "Audio/BsAudioManager.h"
  5. #include "BsOAAudio.h"
  6. #include "BsOAImporter.h"
  7. #include "Importer/BsImporter.h"
  8. namespace bs
  9. {
  10. class OAFactory : public AudioFactory
  11. {
  12. public:
  13. void startUp() override
  14. {
  15. Audio::startUp<OAAudio>();
  16. }
  17. void shutDown() override
  18. {
  19. Audio::shutDown();
  20. }
  21. };
  22. /** Returns a name of the plugin. */
  23. extern "C" BS_PLUGIN_EXPORT const char* getPluginName()
  24. {
  25. static const char* pluginName = "OpenAudio";
  26. return pluginName;
  27. }
  28. /** Entry point to the plugin. Called by the engine when the plugin is loaded. */
  29. extern "C" BS_PLUGIN_EXPORT void* loadPlugin()
  30. {
  31. OAImporter* importer = bs_new<OAImporter>();
  32. Importer::instance()._registerAssetImporter(importer);
  33. return bs_new<OAFactory>();
  34. }
  35. /** Exit point of the plugin. Called by the engine before the plugin is unloaded. */
  36. extern "C" BS_PLUGIN_EXPORT void unloadPlugin(OAFactory* instance)
  37. {
  38. bs_delete(instance);
  39. }
  40. }