Sound effects cannot be repeated? #518
Replies: 3 comments 7 replies
-
had the same or related issue earlier and this is quite common, you should use |
Beta Was this translation helpful? Give feedback.
-
Moving this to the discussion section. You need a separate A common technique is to load all of your sounds initially at load time and store a cache of |
Beta Was this translation helpful? Give feedback.
-
@mackron it would be nice to add this to the documentation as this seems to be used commonly, particularly in games. |
Beta Was this translation helpful? Give feedback.
-
Hello, I'm making a C++ game under Linux, kernel 5.15 LTS
Everything is initialized correctly. I've noticed that when the player fires the gun, the sound plays, but if the enemy is also shooting, the sound of their gun is not heard (it is the same ma_sound object). The sound is played by both entities, but the new sound starts only when the previous finished playing. I'm reading the documentation again, and the reddit, but I cannot find an example of repeating sounds. Here is my initialization code:
` // Initialize the audio context
// Use default backend priorities
audioContextInitResult = ma_context_init(nullptr, 0U, nullptr, &audioContext);
// for (ma_uint32 device = 0U; device < playbackDevicesCount; device++)${}$ , default? {}\n", device, playbackDevicesInfo[device].name, playbackDevicesInfo[device].isDefault);
// fmt::print(" - audio device: {}, name:
`
Is it possible to repeat sounds?
Beta Was this translation helpful? Give feedback.
All reactions