Sound Bakery  v0.1.0
Open-source audio middleware for games
Loading...
Searching...
No Matches
sbk::engine::parameter< parameter_type > Class Template Reference

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

#include <parameter.h>

Inheritance diagram for sbk::engine::parameter< parameter_type >:
Collaboration diagram for sbk::engine::parameter< parameter_type >:

Public Types

using parameter_property = sbk::core::property< parameter_type >
 Defines the underlying property type used to store and broadcast values.
 
using local_parameter = std::pair< sbk_id, parameter_property >
 Defines the type used for passing local versions/variations of this parameter.
 
using local_parameter_value_pair = std::pair< sbk_id, parameter_type >
 Defines an ID to a parameter and a value for that parameter.
 

Public Member Functions

 parameter (parameter_type min, parameter_type max)
 Creates a parameter with min and max values set.
 
parameter_type get () const
 Get the current value of the parameter.
 
parameter_type get_default () const
 
void set (parameter_type value)
 Set the value of the parameter.
 
void set_default (parameter_type value)
 
parameter_property::property_changed_delegate & get_delegate ()
 Get the parameter delegate that fires when changing the value.
 
local_parameter create_local_parameter_from_this () const
 Copies this parameter to a runtime version, suitable for handling unique variations per game object etc.
 
- Public Member Functions inherited from sbk::core::database_object
auto get_database_id () const -> sbk_id
 
auto get_database_name () const -> std::string_view
 
auto get_editor_hidden () const -> bool
 
auto set_database_id (sbk_id id) -> void
 
auto set_database_name (std::string_view name) -> void
 
auto set_editor_hidden (bool hidden) -> void
 
 operator sbk_id () const
 
auto get_on_update_id () -> MulticastDelegate< sbk_id, sbk_id > &
 
auto get_on_update_name () -> MulticastDelegate< std::string_view, std::string_view > &
 
- Public Member Functions inherited from sbk::core::object
template<typename T >
auto casted_shared_from_this () -> std::shared_ptr< T >
 
template<typename T >
auto try_convert_object () noexcept -> T *
 Gets the most derived type of this object and upcasts it to T.
 
template<typename T >
auto try_convert_object () const noexcept -> const T *
 Const version of try_convert_object.
 
auto destroy () -> void
 
auto get_object_type () const -> rttr::type
 
auto get_owner () const -> object_owner *
 
auto get_owner_object () const -> object *
 
auto get_on_destroy () -> MulticastDelegate< object * > &
 
auto get_flags () const -> object_flags
 
auto set_flags (object_flags flagsToSet) -> void
 
auto clear_flags (object_flags flagsToClear) -> void
 
auto has_flag (object_flags flagsToCheck) -> bool
 
template<class archive_class >
void serialize (archive_class &archive, const unsigned int fileVersion)
 
- Public Member Functions inherited from sbk::core::object_owner
auto create_runtime_object (const rttr::type &type) -> std::shared_ptr< object >
 
auto create_database_object (const rttr::type &type, bool addToDatabase=true) -> std::shared_ptr< database_object >
 
template<typename T >
auto create_runtime_object () -> std::shared_ptr< T >
 
template<typename T >
auto create_database_object (bool addToDatabase=true) -> std::shared_ptr< T >
 
auto add_reference_to_object (std::shared_ptr< database_object > &object) -> void
 
auto remove_object (const std::shared_ptr< object > &object) -> std::vector< std::shared_ptr< sbk::core::object > >::iterator
 
auto destroy_all () -> void
 
auto get_objects () -> std::vector< std::shared_ptr< object > > &
 
auto get_objects () const -> const std::vector< std::shared_ptr< object > > &
 
auto get_objects_size () const -> std::size_t
 

Detailed Description

template<typename parameter_type>
class sbk::engine::parameter< parameter_type >

Defines a database object with a changeable property.

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

Member Typedef Documentation

◆ local_parameter

template<typename parameter_type >
using sbk::engine::parameter< parameter_type >::local_parameter = std::pair<sbk_id, parameter_property>

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.

◆ local_parameter_value_pair

template<typename parameter_type >
using sbk::engine::parameter< parameter_type >::local_parameter_value_pair = std::pair<sbk_id, parameter_type>

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

Used when setting the value on a parameter. Local parameter values are not intended for storage. Rather, they are intended to be passed as parameters for setting for permanent versions of the parameter.

Constructor & Destructor Documentation

◆ parameter()

template<typename parameter_type >
sbk::engine::parameter< parameter_type >::parameter ( parameter_type  min,
parameter_type  max 
)
inline

Creates a parameter with min and max values set.

Parameters
minvalue of the parameter.
maxvalue of the parameter.

Member Function Documentation

◆ create_local_parameter_from_this()

template<typename parameter_type >
local_parameter sbk::engine::parameter< parameter_type >::create_local_parameter_from_this ( ) 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 parameter_type >
void sbk::engine::parameter< parameter_type >::set ( parameter_type  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: