SDLInterface.hpp
1 #pragma once
2 #include <Audio/AudioInterface.hpp>
3 #include <Audio/Settings/Model.hpp>
4 #include <Audio/Settings/View.hpp>
5 
6 #include <ossia/audio/sdl_protocol.hpp>
7 
8 #include <QWidget>
9 
10 namespace Audio
11 {
12 
13 #if defined(OSSIA_AUDIO_SDL)
14 class SDLFactory final : public AudioFactory
15 {
16  SCORE_CONCRETE("28b88e91-c5f0-4f13-834f-aa333d14aa81")
17 public:
18  ~SDLFactory() override { }
19  bool available() const noexcept override { return true; }
20  void
21  initialize(Audio::Settings::Model& set, const score::ApplicationContext& ctx) override
22  {
23  }
24 
25  QString prettyName() const override { return QObject::tr("SDL"); };
26  std::shared_ptr<ossia::audio_engine> make_engine(
27  const Audio::Settings::Model& set, const score::ApplicationContext& ctx) override
28  {
29  int rate = set.getRate();
30  int bs = set.getBufferSize();
31 #if defined(__EMSCRIPTEN__)
32  rate = 48000;
33  bs = 1024;
34 #endif
35  return std::make_shared<ossia::sdl_protocol>(rate, bs);
36  }
37 
38  QWidget* make_settings(
40  score::SettingsCommandDispatcher& m_disp, QWidget* parent) override
41  {
42  return nullptr;
43  }
44 };
45 #endif
46 }
Definition: AudioInterface.hpp:28
Definition: SDLInterface.hpp:15
Definition: score-plugin-audio/Audio/Settings/Model.hpp:22
Definition: score-plugin-audio/Audio/Settings/View.hpp:19
Definition: SettingsCommandDispatcher.hpp:10
Used to access all the application-wide state and structures.
Definition: ApplicationContext.hpp:24