Files
o3de/Gems/AudioSystem/Code/Source/Editor/AudioControl.h
T
bosnichd 3defbce31b Remove legacy serialization and QPropertyTree (#684)
Remove:
- CryCommon/CryExtension/*
- CryCommon/Serialization/*
- Sandbox/Plugins/EditorCommon/QPropertyTree/*
- All related CryCommon interfaces
- All CrySystem implementations
- Various related Editor classes
2021-05-11 09:31:02 -06:00

135 lines
4.2 KiB
C++

/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
// Original file Copyright Crytek GMBH or its affiliates, used under license.
#pragma once
#include <ACETypes.h>
#include <AzCore/std/string/string_view.h>
#include <IAudioConnection.h>
#include <IAudioSystemControl.h>
#include <ISystem.h>
#include <IXml.h>
namespace AudioControls
{
class CATLControlsModel;
//-------------------------------------------------------------------------------------------//
struct SRawConnectionData
{
SRawConnectionData(XmlNodeRef node, bool isValid)
: m_xmlNode(node)
, m_isValid(isValid)
{}
XmlNodeRef m_xmlNode;
// indicates if the connection is valid for the currently loaded middleware
bool m_isValid;
};
using TXmlNodeList = AZStd::vector<SRawConnectionData>;
//-------------------------------------------------------------------------------------------//
class CATLControl
{
friend class CAudioControlsLoader;
friend class CAudioControlsWriter;
friend class CUndoControlModified;
public:
CATLControl() = default;
CATLControl(const AZStd::string& controlName, CID id, EACEControlType type, CATLControlsModel* atlControlsModel);
~CATLControl();
CID GetId() const;
AZStd::string GetName() const;
CATLControl* GetParent() const;
AZStd::string GetScope() const;
EACEControlType GetType() const;
bool HasScope() const;
bool IsAutoLoad() const;
void SetAutoLoad(bool isAutoLoad);
void SetName(const AZStd::string_view name);
void SetParent(CATLControl* parent);
void SetScope(const AZStd::string_view scope);
size_t ChildCount() const
{
return m_children.size();
}
CATLControl* GetChild(size_t index) const
{
return (index < m_children.size() ? m_children[index] : nullptr);
}
void AddChild(CATLControl* childControl)
{
if (childControl)
{
m_children.push_back(childControl);
}
}
void RemoveChild(CATLControl* childControl)
{
if (childControl)
{
m_children.erase(AZStd::remove(m_children.begin(), m_children.end(), childControl), m_children.end());
}
}
size_t ConnectionCount() const;
TConnectionPtr GetConnectionAt(size_t index) const;
TConnectionPtr GetConnection(CID id) const;
TConnectionPtr GetConnection(IAudioSystemControl* middlewareControl) const;
void AddConnection(TConnectionPtr connection);
void RemoveConnection(TConnectionPtr connection);
void RemoveConnection(IAudioSystemControl* middlewareControl);
void ClearConnections();
void ReloadConnections();
bool IsFullyConnected() const;
void SignalControlAboutToBeModified();
void SignalControlModified();
void SignalConnectionAdded(IAudioSystemControl* middlewareControl);
void SignalConnectionRemoved(IAudioSystemControl* middlewareControl);
private:
void SetId(CID id);
void SetType(EACEControlType type);
CID m_id = ACE_INVALID_CID;
EACEControlType m_type = eACET_TRIGGER;
AZStd::string m_name;
AZStd::string m_scope;
AZStd::vector<TConnectionPtr> m_connectedControls;
AZStd::vector<CATLControl*> m_children;
CATLControlsModel* m_atlControlsModel = nullptr;
CATLControl* m_parent = nullptr;
bool m_isAutoLoad = true;
// All the raw connection nodes. Used for reloading the data when switching middleware.
TXmlNodeList m_connectionNodes;
};
} // namespace AudioControls