Some more work on the audio driver. gsoc2008_nds
authorDarren Alton <dalton@stevens.edu>
Thu, 21 Aug 2008 12:38:21 +0000
branchgsoc2008_nds
changeset 2697c9121b04cffa
parent 2696 0b395a60deff
child 2698 e1da92da346c
Some more work on the audio driver.
Makefile.ds
include/SDL_config.h.in
src/audio/nds/SDL_ndsaudio.c
     1.1 --- a/Makefile.ds	Mon Aug 18 07:29:52 2008 +0000
     1.2 +++ b/Makefile.ds	Thu Aug 21 12:38:21 2008 +0000
     1.3 @@ -28,13 +28,14 @@
     1.4  		-DARM9 -D__NDS__ -I$(DEVKITPRO)/libnds/include -DENABLE_NDS -DNO_SIGNAL_H -DDISABLE_THREADS -DPACKAGE=\"SDL\" -DVERSION=\"1.3\" -DHAVE_ALLOCA_H=1 -DHAVE_ALLOCA=1 \
     1.5  		-Iinclude -Isrc -Isrc/audio -Isrc/cdrom -Isrc/endian -Isrc/events -Isrc/joystick -Isrc/thread/nds -Isrc/thread -Isrc/timer -Isrc/video
     1.6  
     1.7 +#src/audio/disk/SDL_diskaudio.c \
     1.8 +#src/audio/dummy/SDL_dummyaudio.c \
     1.9 +
    1.10  SRCS = \
    1.11  src/SDL.c \
    1.12  src/SDL_compat.c \
    1.13  src/SDL_error.c \
    1.14  src/SDL_fatal.c \
    1.15 -src/audio/disk/SDL_diskaudio.c \
    1.16 -src/audio/dummy/SDL_dummyaudio.c \
    1.17  src/audio/nds/SDL_ndsaudio.c \
    1.18  src/audio/SDL_audio.c \
    1.19  src/audio/SDL_audiocvt.c \
     2.1 --- a/include/SDL_config.h.in	Mon Aug 18 07:29:52 2008 +0000
     2.2 +++ b/include/SDL_config.h.in	Thu Aug 21 12:38:21 2008 +0000
     2.3 @@ -176,6 +176,7 @@
     2.4  #undef SDL_AUDIO_DRIVER_MMEAUDIO
     2.5  #undef SDL_AUDIO_DRIVER_NAS
     2.6  #undef SDL_AUDIO_DRIVER_NAS_DYNAMIC
     2.7 +#undef SDL_AUDIO_DRIVER_NDS
     2.8  #undef SDL_AUDIO_DRIVER_OSS
     2.9  #undef SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H
    2.10  #undef SDL_AUDIO_DRIVER_PAUDIO
    2.11 @@ -210,6 +211,7 @@
    2.12  #undef SDL_JOYSTICK_IOKIT
    2.13  #undef SDL_JOYSTICK_LINUX
    2.14  #undef SDL_JOYSTICK_MINT
    2.15 +#undef SDL_JOYSTICK_NDS
    2.16  #undef SDL_JOYSTICK_OS2
    2.17  #undef SDL_JOYSTICK_RISCOS
    2.18  #undef SDL_JOYSTICK_WINMM
    2.19 @@ -228,6 +230,7 @@
    2.20  /* Enable various threading systems */
    2.21  #undef SDL_THREAD_BEOS
    2.22  #undef SDL_THREAD_DC
    2.23 +#undef SDL_THREAD_NDS
    2.24  #undef SDL_THREAD_OS2
    2.25  #undef SDL_THREAD_PTH
    2.26  #undef SDL_THREAD_PTHREAD
    2.27 @@ -241,6 +244,7 @@
    2.28  #undef SDL_TIMER_DC
    2.29  #undef SDL_TIMER_DUMMY
    2.30  #undef SDL_TIMER_MINT
    2.31 +#undef SDL_TIMER_NDS
    2.32  #undef SDL_TIMER_OS2
    2.33  #undef SDL_TIMER_RISCOS
    2.34  #undef SDL_TIMER_UNIX
    2.35 @@ -258,6 +262,7 @@
    2.36  #undef SDL_VIDEO_DRIVER_GEM
    2.37  #undef SDL_VIDEO_DRIVER_IPOD
    2.38  #undef SDL_VIDEO_DRIVER_NANOX
    2.39 +#undef SDL_VIDEO_DRIVER_NDS
    2.40  #undef SDL_VIDEO_DRIVER_OS2FS
    2.41  #undef SDL_VIDEO_DRIVER_PHOTON
    2.42  #undef SDL_VIDEO_DRIVER_PS2GS
     3.1 --- a/src/audio/nds/SDL_ndsaudio.c	Mon Aug 18 07:29:52 2008 +0000
     3.2 +++ b/src/audio/nds/SDL_ndsaudio.c	Thu Aug 21 12:38:21 2008 +0000
     3.3 @@ -31,6 +31,8 @@
     3.4  #include "../SDL_audio_c.h"
     3.5  #include "SDL_ndsaudio.h"
     3.6  
     3.7 +#define TRACE printf
     3.8 +
     3.9  static int
    3.10  NDSAUD_OpenDevice(_THIS, const char *devname, int iscapture)
    3.11  {
    3.12 @@ -44,6 +46,7 @@
    3.13      }
    3.14      SDL_memset(this->hidden, 0, (sizeof *this->hidden));
    3.15  
    3.16 +    TRACE("+NDSAUD_OpenDevice\n");
    3.17      while ((!valid_datatype) && (test_format)) {
    3.18          this->spec.format = test_format;
    3.19          switch (test_format) {
    3.20 @@ -63,6 +66,7 @@
    3.21                      64,     /* panning/balance */
    3.22                      0);     /* sound format*/
    3.23  
    3.24 +    TRACE("-NDSAUD_OpenDevice\n");
    3.25      return 1;
    3.26  }
    3.27  
    3.28 @@ -73,9 +77,11 @@
    3.29      if(!sound) {
    3.30          SDL_OutOfMemory();
    3.31      }
    3.32 +    TRACE("+NDSAUD_PlayDevice\n");
    3.33  
    3.34      playGenericSound(this->hidden->mixbuf, this->hidden->mixlen);
    3.35  
    3.36 +    TRACE("-NDSAUD_PlayDevice\n");
    3.37  //    sound->data = this->hidden->mixbuf;/* pointer to raw audio data */
    3.38  //    sound->len = this->hidden->mixlen; /* size of raw data pointed to above */
    3.39  //    sound->rate = 22050; /* sample rate = 22050Hz */
    3.40 @@ -89,6 +95,7 @@
    3.41  static Uint8 *
    3.42  NDSAUD_GetDeviceBuf(_THIS)
    3.43  {   /* is this right? */
    3.44 +    TRACE("!NDSAUD_GetDeviceBuf\n");
    3.45      return this->hidden->mixbuf;
    3.46  }
    3.47  
    3.48 @@ -96,29 +103,39 @@
    3.49  NDSAUD_WaitDevice(_THIS)
    3.50  {
    3.51      /* stub */
    3.52 +    TRACE("!NDSAUD_WaitDevice\n");
    3.53  }
    3.54  
    3.55  static void
    3.56  NDSAUD_CloseDevice(_THIS)
    3.57  {
    3.58      /* stub */
    3.59 +    TRACE("!NDSAUD_CloseDevice\n");
    3.60  }
    3.61  
    3.62  static int
    3.63  NDSAUD_Init(SDL_AudioDriverImpl * impl)
    3.64  {
    3.65 +    TRACE("+NDSAUD_Init\n");
    3.66 +
    3.67      /* Set the function pointers */
    3.68      impl->OpenDevice = NDSAUD_OpenDevice;
    3.69      impl->PlayDevice = NDSAUD_PlayDevice;
    3.70      impl->WaitDevice = NDSAUD_WaitDevice;
    3.71      impl->GetDeviceBuf = NDSAUD_GetDeviceBuf;
    3.72      impl->CloseDevice = NDSAUD_CloseDevice;
    3.73 +
    3.74 +    /* and the capabilities */
    3.75 +    impl->HasCaptureSupport = 1;
    3.76      impl->OnlyHasDefaultOutputDevice = 1;
    3.77 +    impl->OnlyHasDefaultInputDevice = 1;
    3.78 +
    3.79 +    TRACE("-NDSAUD_Init\n");
    3.80      return 1;
    3.81  }
    3.82  
    3.83  AudioBootStrap NDSAUD_bootstrap = {
    3.84 -    "nds", "SDL NDS audio driver", NDSAUD_Init, 1
    3.85 +    "nds", "SDL NDS audio driver", NDSAUD_Init, 0 /*1?*/
    3.86  };
    3.87  
    3.88  /* vi: set ts=4 sw=4 expandtab: */