MXVK Vulkan Framework 0.35.0
C++20 Vulkan rendering framework for practical 2D and 3D application development with SDL3.
Loading...
Searching...
No Matches
mxvk_wrap.media.Sound Class Reference

Public Member Functions

None __init__ (self)
 Optional WAV and music playback helper.
None close (self)
int load_wav (self, str|Path path)
int play (self, int sound_id, int loops=0)

Public Attributes

 native = mxvk.Mixer()
 Initialize the audio mixer.

Detailed Description

Definition at line 32 of file media.py.

Constructor & Destructor Documentation

◆ __init__()

None mxvk_wrap.media.Sound.__init__ ( self)

Optional WAV and music playback helper.

Definition at line 35 of file media.py.

35 def __init__(self) -> None:
36 ## @brief Initialize the audio mixer.
37 if not getattr(mxvk, "has_mixer", False):
38 raise RuntimeError("MXVK was built without MIXER support")
39 self.native = mxvk.Mixer()
40 self.native.init()
41
SDL3_mixer-based audio manager.

Member Function Documentation

◆ close()

None mxvk_wrap.media.Sound.close ( self)

Definition at line 50 of file media.py.

50 def close(self) -> None:
51 ## @brief Release mixer resources.
52 if self.native is not None:
53 self.native.cleanup()
54 self.native = None
55
56

◆ load_wav()

int mxvk_wrap.media.Sound.load_wav ( self,
str | Path path )

Definition at line 42 of file media.py.

42 def load_wav(self, path: str | Path) -> int:
43 ## @brief Load a WAV file and return its playback ID.
44 return self.native.load_wav(str(path))
45

◆ play()

int mxvk_wrap.media.Sound.play ( self,
int sound_id,
int loops = 0 )

Definition at line 46 of file media.py.

46 def play(self, sound_id: int, loops: int = 0) -> int:
47 ## @brief Play a loaded WAV and return its mixer channel.
48 return self.native.play_wav(sound_id, loops)
49

Member Data Documentation

◆ native

mxvk_wrap.media.Sound.native = mxvk.Mixer()

Initialize the audio mixer.

Definition at line 39 of file media.py.


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