From: jsancho Date: Tue, 12 Oct 2010 07:57:58 +0000 (+0000) Subject: (no commit message) X-Git-Url: https://git.jsancho.org/?a=commitdiff_plain;h=fd0956a0072b3db8808880bd3d4dbf17d941265d;p=gacela.git --- diff --git a/Makefile b/Makefile index 72e5898..d73950b 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ LIBS = -lSDL -lSDL_image -lSDL_mixer -lSDL_gfx -lGL -lGLU -lftgl OBJ = gacela.o gacela_misc.o gacela_SDL.o gacela_GL.o gacela_FTGL.o \ gacela_draw.o gacela_ttf.o gacela_events.o gacela_mobs.o \ - gacela_widgets.o + gacela_widgets.o gacela_sound.o GCL_OBJ = $(OBJ:%.o=\"%.o\") diff --git a/gacela.lisp b/gacela.lisp index 45fc027..31fe8ab 100644 --- a/gacela.lisp +++ b/gacela.lisp @@ -138,7 +138,7 @@ (let ((audio nil)) (defun init-audio () - (cond ((null audio) (progn (init-sdl) (setq audio (Mix_OpenAudio 22050 2 4096)))) + (cond ((null audio) (progn (init-sdl) (setq audio (Mix_OpenAudio 22050 MIX_DEFAULT_FORMAT 2 4096)))) (t audio))) (defun quit-audio () @@ -296,7 +296,7 @@ (defun quit-game () (free-all-resources) -; (quit-audio) + (quit-audio) (quit-video-mode) (quit-all-mobs) ; (clear-events) diff --git a/gacela_SDL.lisp b/gacela_SDL.lisp index 1d113aa..3ced5c3 100644 --- a/gacela_SDL.lisp +++ b/gacela_SDL.lisp @@ -68,6 +68,8 @@ (mapcconst int "int" "SDL_LIL_ENDIAN") (mapcconst int "int" "SDL_BIG_ENDIAN") +(mapcconst int "int" "MIX_DEFAULT_FORMAT") + ;;; SDL Functions (defcfun "int gacela_SDL_Init (int flags)" 0 "return SDL_Init (flags);") @@ -148,6 +150,45 @@ (defcfun "int gacela_zoomSurface (int src, double zoomx, double zoomy, int smooth)" 0 "return zoomSurface (src, zoomx, zoomy, smooth);") +(defcfun "int gacela_Mix_OpenAudio (int frequency, int format, int channels, int chunksize)" 0 + "return Mix_OpenAudio (frequency, format, channels, chunksize);") + +(defcfun "int gacela_Mix_LoadMUS (char *file)" 0 + "return Mix_LoadMUS (file);") + +(defcfun "int gacela_Mix_LoadWAV (char *file)" 0 + "return Mix_LoadWAV (file);") + +(defcfun "int gacela_Mix_PlayChannel (int channel, int chunk, int loops)" 0 + "return Mix_PlayChannel (channel, chunk, loops);") + +(defcfun "int gacela_Mix_PlayMusic (int music, int loops)" 0 + "return Mix_PlayMusic (music, loops);") + +(defcfun "int gacela_Mix_PlayingMusic (void)" 0 + "return Mix_PlayingMusic ();") + +(defcfun "int gacela_Mix_PausedMusic (void)" 0 + "return Mix_PausedMusic ();") + +(defcfun "void gacela_Mix_PauseMusic (void)" 0 + "Mix_PauseMusic ();") + +(defcfun "void gacela_Mix_ResumeMusic (void)" 0 + "Mix_ResumeMusic ();") + +(defcfun "int gacela_Mix_HaltMusic (void)" 0 + "return Mix_HaltMusic ();") + +(defcfun "void gacela_Mix_FreeMusic (int music)" 0 + "Mix_FreeMusic (music);") + +(defcfun "void gacela_Mix_FreeChunk (int chunk)" 0 + "Mix_FreeChunk (chunk);") + +(defcfun "void gacela_Mix_CloseAudio (void)" 0 + "Mix_CloseAudio ();") + (defentry SDL_Init (int) (int "gacela_SDL_Init")) (defentry SDL_Quit () (void "gacela_SDL_Quit")) (defentry SDL_SetVideoMode (int int int int) (int "gacela_SDL_SetVideoMode")) @@ -171,19 +212,19 @@ ;(defentry TTF_OpenFont (string int) (int "gacela_TTF_OpenFont")) ;(defentry TTF_CloseFont (int) (void "gacela_TTF_CloseFont")) ;(defentry TTF_Quit () (void "gacela_TTF_Quit")) -;(defentry Mix_OpenAudio (int int int) (int "gacela_Mix_OpenAudio")) -;(defentry Mix_LoadMUS (string) (int "gacela_Mix_LoadMUS")) -;(defentry Mix_LoadWAV (string) (int "gacela_Mix_LoadWAV")) -;(defentry Mix_PlayChannel (int int int) (int "gacela_Mix_PlayChannel")) -;(defentry Mix_PlayMusic (int int) (int "gacela_Mix_PlayMusic")) -;(defentry Mix_PlayingMusic () (int "gacela_Mix_PlayingMusic")) -;(defentry Mix_PausedMusic () (int "gacela_Mix_PausedMusic")) -;(defentry Mix_PauseMusic () (void "gacela_Mix_PauseMusic")) -;(defentry Mix_ResumeMusic () (void "gacela_Mix_ResumeMusic")) -;(defentry Mix_HaltMusic () (int "gacela_Mix_HaltMusic")) -;(defentry Mix_FreeMusic (int) (void "gacela_Mix_FreeMusic")) -;(defentry Mix_FreeChunk (int) (void "gacela_Mix_FreeChunk")) -;(defentry Mix_CloseAudio () (void "gacela_Mix_CloseAudio")) +(defentry Mix_OpenAudio (int int int int) (int "gacela_Mix_OpenAudio")) +(defentry Mix_LoadMUS (string) (int "gacela_Mix_LoadMUS")) +(defentry Mix_LoadWAV (string) (int "gacela_Mix_LoadWAV")) +(defentry Mix_PlayChannel (int int int) (int "gacela_Mix_PlayChannel")) +(defentry Mix_PlayMusic (int int) (int "gacela_Mix_PlayMusic")) +(defentry Mix_PlayingMusic () (int "gacela_Mix_PlayingMusic")) +(defentry Mix_PausedMusic () (int "gacela_Mix_PausedMusic")) +(defentry Mix_PauseMusic () (void "gacela_Mix_PauseMusic")) +(defentry Mix_ResumeMusic () (void "gacela_Mix_ResumeMusic")) +(defentry Mix_HaltMusic () (int "gacela_Mix_HaltMusic")) +(defentry Mix_FreeMusic (int) (void "gacela_Mix_FreeMusic")) +(defentry Mix_FreeChunk (int) (void "gacela_Mix_FreeChunk")) +(defentry Mix_CloseAudio () (void "gacela_Mix_CloseAudio")) ;(defentry free (int) (void "gacela_free")) (defentry SDL_GL_SwapBuffers () (void "gacela_SDL_GL_SwapBuffers")) (defentry SDL_EnableKeyRepeat (int int) (int "gacela_SDL_EnableKeyRepeat")) diff --git a/gacela_sound.lisp b/gacela_sound.lisp new file mode 100644 index 0000000..ae9b72b --- /dev/null +++ b/gacela_sound.lisp @@ -0,0 +1,22 @@ +;;; Gacela, a GNU Common Lisp extension for fast games development +;;; Copyright (C) 2009 by Javier Sancho Fernandez +;;; +;;; This program is free software: you can redistribute it and/or modify +;;; it under the terms of the GNU General Public License as published by +;;; the Free Software Foundation, either version 3 of the License, or +;;; (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program. If not, see . + + +(eval-when (compile load eval) + (when (not (find-package 'gacela)) (make-package 'gacela :nicknames '(gg) :use '(lisp))) + (in-package 'gacela :nicknames '(gg) :use '(lisp))) + +