Loading...
Searching...
No Matches
score-plugin-audio/Audio/Settings/Model.hpp
1#pragma once
2#include <Audio/AudioInterface.hpp>
3
4#include <score/plugins/ProjectSettings/ProjectSettingsModel.hpp>
5#include <score/plugins/settingsdelegate/SettingsDelegateModel.hpp>
6
7#include <score_plugin_audio_export.h>
8
9#include <verdigris>
10
11namespace Audio::Settings
12{
13
14enum class ExternalTransport : int8_t
15{
16 None = 0,
17 Client = 1,
18 Master = 2
19};
20
21class SCORE_PLUGIN_AUDIO_EXPORT Model : public score::SettingsDelegateModel
22{
23 W_OBJECT(Model)
24
25 // JACK, MME, WASAPI, ALSA...
26 Audio::AudioFactory::ConcreteKey m_Driver{};
27
28 // For APIs that support setting a name to the inputs / outputs (e.g. JACK)
29 QStringList m_InputNames;
30 QStringList m_OutputNames;
31
32 // Which device to use for input / output
33 QString m_CardIn{};
34 QString m_CardOut{};
35 int m_BufferSize{};
36 int m_Rate{};
37
38 // How many i/o to create if possible
39 int m_DefaultIn{};
40 int m_DefaultOut{};
41
42 // When playing mono audio files, put them as stereo automatically
43 bool m_AutoStereo{true};
44
45 // Auto connect ports to system i/o (mostly relevant for jack)
46 bool m_AutoConnect{true};
47
48 // Use JACK Transport
49 ExternalTransport m_JackTransport{ExternalTransport::None};
50
51public:
52 Model(QSettings& set, const score::ApplicationContext& ctx);
53
54 void changed() E_SIGNAL(SCORE_PLUGIN_AUDIO_EXPORT, changed)
55 SCORE_SETTINGS_PARAMETER_HPP(
56 SCORE_PLUGIN_AUDIO_EXPORT, Audio::AudioFactory::ConcreteKey, Driver)
57 SCORE_SETTINGS_PARAMETER_HPP(SCORE_PLUGIN_AUDIO_EXPORT, QStringList, InputNames)
58 SCORE_SETTINGS_PARAMETER_HPP(SCORE_PLUGIN_AUDIO_EXPORT, QStringList, OutputNames)
59 SCORE_SETTINGS_PARAMETER_HPP(SCORE_PLUGIN_AUDIO_EXPORT, QString, CardIn)
60 SCORE_SETTINGS_PARAMETER_HPP(SCORE_PLUGIN_AUDIO_EXPORT, QString, CardOut)
61 SCORE_SETTINGS_PARAMETER_HPP(SCORE_PLUGIN_AUDIO_EXPORT, int, BufferSize)
62 SCORE_SETTINGS_PARAMETER_HPP(SCORE_PLUGIN_AUDIO_EXPORT, int, Rate)
63 SCORE_SETTINGS_PARAMETER_HPP(SCORE_PLUGIN_AUDIO_EXPORT, int, DefaultIn)
64 SCORE_SETTINGS_PARAMETER_HPP(SCORE_PLUGIN_AUDIO_EXPORT, int, DefaultOut)
65 SCORE_SETTINGS_PARAMETER_HPP(SCORE_PLUGIN_AUDIO_EXPORT, bool, AutoStereo)
66 SCORE_SETTINGS_PARAMETER_HPP(SCORE_PLUGIN_AUDIO_EXPORT, bool, AutoConnect)
67 SCORE_SETTINGS_PARAMETER_HPP(
68 SCORE_PLUGIN_AUDIO_EXPORT, Audio::Settings::ExternalTransport, JackTransport)
69};
70
71SCORE_SETTINGS_PARAMETER(Model, Driver)
72SCORE_SETTINGS_DEFERRED_PARAMETER(Model, InputNames)
73SCORE_SETTINGS_DEFERRED_PARAMETER(Model, OutputNames)
74SCORE_SETTINGS_DEFERRED_PARAMETER(Model, CardIn)
75SCORE_SETTINGS_DEFERRED_PARAMETER(Model, CardOut)
76SCORE_SETTINGS_DEFERRED_PARAMETER(Model, BufferSize)
77SCORE_SETTINGS_DEFERRED_PARAMETER(Model, Rate)
78SCORE_SETTINGS_DEFERRED_PARAMETER(Model, DefaultIn)
79SCORE_SETTINGS_DEFERRED_PARAMETER(Model, DefaultOut)
80SCORE_SETTINGS_DEFERRED_PARAMETER(Model, AutoStereo)
81SCORE_SETTINGS_DEFERRED_PARAMETER(Model, AutoConnect)
82SCORE_SETTINGS_DEFERRED_PARAMETER(Model, JackTransport)
83}
84
85Q_DECLARE_METATYPE(Audio::Settings::ExternalTransport)
86W_REGISTER_ARGTYPE(Audio::Settings::ExternalTransport)
87#undef AUDIO_PARAMETER_HPP
Definition score-plugin-audio/Audio/Settings/Model.hpp:22
Definition SettingsDelegateModel.hpp:16
Used to access all the application-wide state and structures.
Definition ApplicationContext.hpp:24