Kemena3D
Loading...
Searching...
No Matches
kaudio.h
Go to the documentation of this file.
1
5
6#ifndef KAUDIO_H
7#define KAUDIO_H
8
9#include "kexport.h"
10#include "kdatatype.h"
11
12namespace kemena
13{
36 {
37 public:
40
43
44 // --- Playback controls -----------------------------------------------
45
47 void play();
48
50 void stop();
51
53 void pause();
54
56 void resume();
57
58 // --- Properties ------------------------------------------------------
59
64 void setLooping(bool loop);
65
70 void setVolume(float volume);
71
76 void setPitch(float pitch);
77
82 void setPosition(const kVec3 &position);
83
88 void setVelocity(const kVec3 &velocity);
89
94 void setSpatialization(bool enable);
95
96 // --- State queries ---------------------------------------------------
97
99 bool isPlaying() const;
100
102 bool isPaused() const;
103
105 bool isLooping() const;
106
107 // --- Internal init (called by kAudioManager) -------------------------
108
116 bool initFromFile(void *maEngine, const kString &filePath);
117
119 void uninit();
120
121 protected:
122 private:
123 struct Impl;
124 Impl *m_impl;
125 };
126
127} // namespace kemena
128
129#endif // KAUDIO_H
void uninit()
Releases the miniaudio sound resource.
kAudio()
Constructs an empty audio clip; call initFromFile() (via kAudioManager) before use.
void setVolume(float volume)
Sets the playback volume.
void setPosition(const kVec3 &position)
Positions the sound in 3D world space for spatialized audio.
bool isLooping() const
Returns true if the looping flag is set.
void setSpatialization(bool enable)
Enables or disables 3D spatialization for this sound.
void pause()
Pauses playback without resetting the cursor.
bool initFromFile(void *maEngine, const kString &filePath)
Initialises the sound from a file using an existing miniaudio engine.
void play()
Starts or resumes playback from the current position.
bool isPlaying() const
Returns true if the sound is currently playing.
void stop()
Stops playback and resets the cursor to the beginning.
void resume()
Resumes a paused sound. Equivalent to play() if already stopped.
~kAudio()
Destructor; releases the underlying miniaudio sound resource.
void setLooping(bool loop)
Sets the looping flag.
bool isPaused() const
Returns true if the sound is paused.
void setPitch(float pitch)
Sets the playback pitch / speed multiplier.
void setVelocity(const kVec3 &velocity)
Sets the velocity of the audio emitter (used for Doppler shift).
Core type aliases, enumerations, structs, and utility functions used throughout the engine.
Symbol visibility / linkage macro for the Kemena3D library.
#define KEMENA3D_API
Definition kexport.h:35
Top-level Kemena3D engine namespace.
Definition kanimation.h:23
std::string kString
Standard string alias.
Definition kdatatype.h:42
glm::vec3 kVec3
3-component float vector.
Definition kdatatype.h:33