You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For use in games, would it be possible to make an equivalent of ma_engine_play_sound() that accepts a pointer to data rather than a file on disk? This function is so simple to use and avoids all of the hoop jumping required with the resource manager. Losing access to it if you don't want to be pulling files off disk is a killer.
Till then, any idea why I'm getting the choppy and unreliable sound output from the following? I can't find any documentation describing the correct way to use multiple ma_sound objects, so this is how I've gone about it. Is a compiled-in best guess as to the maximum number of simultaneous sounds I'll ever need really how it's supposed to be done?
Sound gets loaded, a batch of ma_sound's built ahead of time:
ma_decoder m_prDecoder;
ma_sound m_prSound[20];
zipFile = zf->getEntry(m_gameSounds[PROJECTILE_SOUND]);
m_prSoundData = zipFile.readAsBinary();
size = zipFile.getSize();
ma_decoder_init_memory(m_prSoundData, size, NULL, &m_prDecoder);
for (int x = 0; x < 20; x++) {
ma_sound_init_from_data_source(&m_soundEngine, &m_prDecoder, 0, NULL, &m_prSound[x]); // cache of sounds to play
Game objects fire a projectile which triggers a request to play the associated sound:
case PROJECTILE_SOUND:
{
for (int x = 0; x < 20; x++) {
if (ma_sound_is_playing(&m_prSound[x]) == 0) {
std::cout << "prSound instance: " << x << std::endl;
ma_sound_start(&m_prSound[x]);
return;
}
}
}
break;
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
For use in games, would it be possible to make an equivalent of ma_engine_play_sound() that accepts a pointer to data rather than a file on disk? This function is so simple to use and avoids all of the hoop jumping required with the resource manager. Losing access to it if you don't want to be pulling files off disk is a killer.
Till then, any idea why I'm getting the choppy and unreliable sound output from the following? I can't find any documentation describing the correct way to use multiple ma_sound objects, so this is how I've gone about it. Is a compiled-in best guess as to the maximum number of simultaneous sounds I'll ever need really how it's supposed to be done?
Sound gets loaded, a batch of ma_sound's built ahead of time:
Game objects fire a projectile which triggers a request to play the associated sound:
Here is the result:
[url](https://youtu.be/gDDdq3RAOfw)
Beta Was this translation helpful? Give feedback.
All reactions