tracktion-engine 3.0-10-g034fdde4aa5
Tracktion Engine — High level data model for audio applications

« « « Anklang Documentation
Loading...
Searching...
No Matches
tracktion_OutputDevice.cpp
Go to the documentation of this file.
1 /*
2 ,--. ,--. ,--. ,--.
3 ,-' '-.,--.--.,--,--.,---.| |,-.,-' '-.`--' ,---. ,--,--, Copyright 2024
4 '-. .-'| .--' ,-. | .--'| /'-. .-',--.| .-. || \ Tracktion Software
5 | | | | \ '-' \ `--.| \ \ | | | |' '-' '| || | Corporation
6 `---' `--' `--`--'`---'`--'`--' `---' `--' `---' `--''--' www.tracktion.com
7
8 Tracktion Engine uses a GPL/commercial licence - see LICENCE.md for details.
9*/
10
11namespace tracktion { inline namespace engine
12{
13
14OutputDevice::OutputDevice (Engine& e, juce::String t, juce::String n, juce::String idToUse)
15 : engine (e), type (t),
16 deviceID ("out_" + juce::String::toHexString ((t + idToUse).hashCode())),
17 name (n)
18{
19 alias = engine.getPropertyStorage().getPropertyItem (SettingID::invalid, getAliasPropName());
20}
21
22OutputDevice::~OutputDevice()
23{
24}
25
26juce::String OutputDevice::getAliasPropName() const
27{
28 return type + "out_" + name + "_alias";
29}
30
31juce::String OutputDevice::getName() const
32{
33 return name;
34}
35
36juce::String OutputDevice::getAlias() const
37{
38 if (alias.isNotEmpty())
39 return alias;
40
41 return getName();
42}
43
44void OutputDevice::setAlias (const juce::String& a)
45{
46 if (alias != a)
47 {
48 alias = a.substring (0, 40).trim();
49
50 if (alias == getName())
51 alias = {};
52
53 if (alias.isNotEmpty())
54 engine.getPropertyStorage().setPropertyItem (SettingID::invalid, getAliasPropName(), alias);
55 else
56 engine.getPropertyStorage().removePropertyItem (SettingID::invalid, getAliasPropName());
57
58 changed();
59 }
60}
61
62juce::String OutputDevice::getSelectableDescription()
63{
64 return name + " (" + TRANS(type) + ")";
65}
66
67bool OutputDevice::isEnabled() const
68{
69 return enabled;
70}
71
72//==============================================================================
73OutputDeviceInstance::OutputDeviceInstance (OutputDevice& d, EditPlaybackContext& c)
74 : owner (d), context (c), edit (c.edit)
75{
76}
77
78OutputDeviceInstance::~OutputDeviceInstance()
79{
80}
81
82}} // namespace tracktion { inline namespace engine
String trim() const
String substring(int startIndex, int endIndex) const
Base class for audio or midi output devices, to which a track's output can be sent.
#define TRANS(stringLiteral)
juce::String getName(LaunchQType t)
Retuns the name of a LaunchQType for display purposes.