123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- #ifndef DD_SOUND_H
- #define DD_SOUND_H
- #if DD_PLATFORM_ANDROID
- #else
- #include <SDL2/SDL.h>
- #include <SDL2/SDL_mixer.h>
- #endif
- extern int dd_hasAudio;
- /*
- * support audio formats
- */
- enum dd_audio_format {
- DD_AUDIO_FORMAT_WAV,
- };
- /* sound element
- * meant for small-size sound effects
- */
- struct dd_sound {
- #if DD_PLATFORM_ANDROID
- char filename[100];
- int index;
- #else
- Mix_Chunk *sound;
- #endif
- int playingChannel;
- void (*load)(struct dd_sound *, const char *filename, enum dd_audio_format format);
- void (*clean)(struct dd_sound *);
- void (*play)(struct dd_sound *);
- void (*playLoop)(struct dd_sound *, int loops);
- void (*stop)(struct dd_sound *);
- void (*setVolume)(struct dd_sound *, int volume);
- };
- void dd_sound_create(struct dd_sound *);
- void dd_sound_load(struct dd_sound *, const char *filename, enum dd_audio_format format);
- void dd_sound_clean(struct dd_sound *);
- void dd_sound_play(struct dd_sound *);
- void dd_sound_playLoop(struct dd_sound *, int loops);
- void dd_sound_stop(struct dd_sound *);
- void dd_sound_setVolume(struct dd_sound *, int volume);
- #endif
|