diff --git a/src/config.c b/src/config.c index d231a52..0449711 100644 --- a/src/config.c +++ b/src/config.c @@ -18,7 +18,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include #include #include "config.h" diff --git a/src/main.c b/src/main.c index 7545389..ce0d066 100644 --- a/src/main.c +++ b/src/main.c @@ -337,8 +337,11 @@ int main(int argc, char **argv){ return -1; } - //game->voice = al_create_voice(44100, ALLEGRO_AUDIO_DEPTH_INT16, 48 ALLEGRO_CHANNEL_CONF_2); - //game->fxmixer = al_create_mixer(44100, ALLEGRO_AUDIO_DEPTH_FLOAT32, 57 ALLEGRO_CHANNEL_CONF_2); + game.audio.voice = al_create_voice(44100, ALLEGRO_AUDIO_DEPTH_INT16, ALLEGRO_CHANNEL_CONF_2); + game.audio.fx = al_create_mixer(44100, ALLEGRO_AUDIO_DEPTH_FLOAT32, ALLEGRO_CHANNEL_CONF_2); + game.audio.music = al_create_mixer(44100, ALLEGRO_AUDIO_DEPTH_FLOAT32, ALLEGRO_CHANNEL_CONF_2); + al_attach_mixer_to_voice(game.audio.fx, game.audio.voice); + al_attach_mixer_to_voice(game.audio.music, game.audio.voice); al_register_event_source(game.event_queue, al_get_display_event_source(game.display)); al_register_event_source(game.event_queue, al_get_timer_event_source(game.timer)); @@ -417,6 +420,9 @@ int main(int argc, char **argv){ al_destroy_event_queue(game.event_queue); al_destroy_font(game.font); al_destroy_font(game.font_console); + al_destroy_mixer(game.audio.fx); + al_destroy_mixer(game.audio.music); + al_destroy_voice(game.audio.voice); al_uninstall_audio(); DeinitConfig(); return 0; diff --git a/src/main.h b/src/main.h index f33efc8..3d3aad5 100644 --- a/src/main.h +++ b/src/main.h @@ -162,6 +162,11 @@ struct Game { struct Map map; struct Level level; struct Pause pause; + struct { + ALLEGRO_VOICE *voice; + ALLEGRO_MIXER *music; + ALLEGRO_MIXER *fx; + } audio; }; /*! \brief Draws text with shadow.