NWengine 0.9
Loading...
Searching...
No Matches
AudioEmitter Class Reference

The AudioEmitter class represents a component that emits audio in a game object. More...

#include <AudioEmitter.h>

Inheritance diagram for AudioEmitter:
GameComponent Serialized

Public Member Functions

 AudioEmitter ()
 AudioEmitter constructor.
 
 AudioEmitter (GameObject *attachedObj)
 AudioEmitter constructor with attached game object.
 
 ~AudioEmitter ()
 AudioEmitter destructor.
 
void SetSound (const std::string &path)
 SetSound sets the sound path for the AudioEmitter.
 
void SetSound (const Sound *snd)
 SetSound sets the sound for the AudioEmitter.
 
int Serialize (std::fstream *data, int offset) override
 Serialize serializes the AudioEmitter data.
 
int Deserialize (std::fstream *data, int offset) override
 Deserialize deserializes the AudioEmitter data.
 
- Public Member Functions inherited from GameComponent
virtual void Update ()
 Update the game component.
 
virtual void Start ()
 Start the game component.
 
virtual void SetGameObject (void *go)
 Set the GameObject associated with the game component.
 
virtual voidGetGameObject ()
 Get the GameObject associated with the game component.
 
virtual ~GameComponent ()
 Destructor for the game component.
 
- Public Member Functions inherited from Serialized
 Serialized ()
 Default constructor for Serialized class.
 

Static Public Member Functions

static std::string GetType ()
 GetType returns the type of the AudioEmitter component.
 
- Static Public Member Functions inherited from GameComponent
static std::string GetType ()
 Get the type of the game component.
 

Public Attributes

GameObjectattachedObj = nullptr
 attachedObj The game object that the AudioEmitter is attached to.
 
Soundsound = nullptr
 sound The sound object of the AudioEmitter.
 
int volume = 100
 volume The volume of the AudioEmitter. Should be clamped from 0.0 to 1.0.
 
float frequency = 1.0f
 frequency The frequency of the AudioEmitter.
 
bool isLooping = false
 isLooping Indicates whether the AudioEmitter is looping or not.
 

Static Public Attributes

static std::map< GameObject *, AudioEmitter * > componentList
 componentList A map of game objects and their corresponding AudioEmitter components.
 

Detailed Description

The AudioEmitter class represents a component that emits audio in a game object.

Represents an audio emitter component that can be attached to a game object.

Constructor & Destructor Documentation

◆ AudioEmitter()

AudioEmitter::AudioEmitter ( GameObject * attachedObj)

AudioEmitter constructor with attached game object.

Parameters
attachedObjThe game object to attach the AudioEmitter to.

Member Function Documentation

◆ Deserialize()

int AudioEmitter::Deserialize ( std::fstream * data,
int offset )
overridevirtual

Deserialize deserializes the AudioEmitter data.

Parameters
dataThe file stream to read the serialized data from.
offsetThe offset in the file stream to start reading the serialized data.
Returns
The number of bytes read.

Reimplemented from Serialized.

◆ GetType()

static std::string AudioEmitter::GetType ( )
inlinestatic

GetType returns the type of the AudioEmitter component.

Returns
The type of the AudioEmitter component.

◆ Serialize()

int AudioEmitter::Serialize ( std::fstream * data,
int offset )
overridevirtual

Serialize serializes the AudioEmitter data.

Parameters
dataThe file stream to write the serialized data to.
offsetThe offset in the file stream to start writing the serialized data.
Returns
The number of bytes written.

Reimplemented from Serialized.

◆ SetSound() [1/2]

void AudioEmitter::SetSound ( const Sound * snd)

SetSound sets the sound for the AudioEmitter.

Parameters
sndThe sound object.

◆ SetSound() [2/2]

void AudioEmitter::SetSound ( const std::string & path)

SetSound sets the sound path for the AudioEmitter.

Parameters
pathThe path of the sound file.

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