Sound Bakery  v0.1.0
Open-source audio middleware for games
Loading...
Searching...
No Matches
SB::Engine::Parameter< ParameterType > Class Template Reference

Defines a database object with a changeable property. More...

#include <parameter.h>

Inheritance diagram for SB::Engine::Parameter< ParameterType >:
Collaboration diagram for SB::Engine::Parameter< ParameterType >:

Public Types

using ParameterProperty = SB::Core::Property< ParameterType >
 Defines the underlying property type used to store and broadcast values.
 
using LocalParameter = std::pair< SB_ID, ParameterProperty >
 Defines the type used for passing local versions/variations of this parameter.
 
using LocalParameterValuePair = std::pair< SB_ID, ParameterType >
 Defines an ID to a parameter and a value for that parameter.
 

Public Member Functions

 Parameter (ParameterType min, ParameterType max)
 Creates a Parameter with min and max values set.
 
ParameterType get () const
 Get the current value of the parameter.
 
ParameterType getDefault () const
 
void set (ParameterType value)
 Set the value of the parameter.
 
void setDefault (ParameterType value)
 
ParameterProperty::PropertyChangedDelegategetDelegate ()
 Get the parameter delegate that fires when changing the value.
 
LocalParameter createLocalParameterFromThis () const
 Copies this Parameter to a runtime version, suitable for handling unique variations per game object etc.
 
- Public Member Functions inherited from SB::Core::DatabaseObject
SB_ID getDatabaseID () const
 
void setDatabaseID (SB_ID id)
 
std::string_view getDatabaseName () const
 
void setDatabaseName (std::string_view name)
 
bool getEditorHidden () const
 
void setEditorHidden (bool hidden)
 
 operator SB_ID () const
 
- Public Member Functions inherited from SB::Core::Object
template<typename T >
TtryConvertObject () noexcept
 Gets the most derived type of this object and upcasts it to T.
 
template<typename T >
const TtryConvertObject () const noexcept
 
rttr::type getType () const
 
- Public Member Functions inherited from SB::Core::ObjectUtilities
SB::Engine::SystemgetSystem () const
 
sc_systemgetChef () const
 
ma_enginegetMini () const
 
- Public Member Functions inherited from SB::Core::DatabaseObjectUtilities
virtual void onLoaded ()
 
virtual void onProjectLoaded ()
 
virtual void onDestroy ()
 

Protected Attributes

ParameterType m_defaultValue
 
SB::Core::Property< ParameterType > m_property
 

Additional Inherited Members

- Public Attributes inherited from SB::Core::ObjectUtilities
std::string m_debugName
 

Detailed Description

template<typename ParameterType>
class SB::Engine::Parameter< ParameterType >

Defines a database object with a changeable property.

Used for changing effect parameters, choosing sounds and anything else.

Member Typedef Documentation

◆ LocalParameter

template<typename ParameterType >
using SB::Engine::Parameter< ParameterType >::LocalParameter = std::pair<SB_ID, ParameterProperty>

Defines the type used for passing local versions/variations of this parameter.

Uses a SB_ID for the parameter ID instead of DatabasePtr<T> to help when used in child classes.

◆ LocalParameterValuePair

template<typename ParameterType >
using SB::Engine::Parameter< ParameterType >::LocalParameterValuePair = std::pair<SB_ID, ParameterType>

Defines an ID to a parameter and a value for that parameter.

Used when setting the value on a parameter.

Constructor & Destructor Documentation

◆ Parameter()

template<typename ParameterType >
SB::Engine::Parameter< ParameterType >::Parameter ( ParameterType  min,
ParameterType  max 
)
inline

Creates a Parameter with min and max values set.

Parameters
minvalue of the parameter.
maxvalue of the parameter.

Member Function Documentation

◆ createLocalParameterFromThis()

template<typename ParameterType >
LocalParameter SB::Engine::Parameter< ParameterType >::createLocalParameterFromThis ( ) const
inline

Copies this Parameter to a runtime version, suitable for handling unique variations per game object etc.

Returns
The runtime version of this Parameter.

◆ set()

template<typename ParameterType >
void SB::Engine::Parameter< ParameterType >::set ( ParameterType  value)
inline

Set the value of the parameter.

This sets the internal property and will therefore call any bound delegates.


The documentation for this class was generated from the following file: