comparison src/audio/nds/SDL_ndsaudio.c @ 2680:4135aa9c5645 gsoc2008_nds

More work on the accelerated 2D video driver, beginnings of sprite-based rendering support. Also some initial work on an audio driver.
author Darren Alton <dalton@stevens.edu>
date Sat, 19 Jul 2008 17:37:19 +0000
parents
children 2190b873ff00
comparison
equal deleted inserted replaced
2679:bc3e3e889f6d 2680:4135aa9c5645
1 /*
2 SDL - Simple DirectMedia Layer
3 Copyright (C) 1997-2006 Sam Lantinga
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18
19 Sam Lantinga
20 slouken@libsdl.org
21
22 This file written by Ryan C. Gordon (icculus@icculus.org)
23 */
24 #include "SDL_config.h"
25
26 /* Output audio to NDS */
27
28 #include <nds.h>
29
30 #include "SDL_audio.h"
31 #include "../SDL_audio_c.h"
32 #include "SDL_ndsaudio.h"
33
34 static int
35 NDSAUD_OpenDevice(_THIS, const char *devname, int iscapture)
36 {
37 return 1; /* always succeeds. */
38 }
39
40 static void
41 NDSAUD_PlayDevice(_THIS)
42 {
43 TransferSoundData* sound = SDL_malloc(sizeof(TransferSoundData));
44 if(!sound) {
45 SDL_OutOfMemory();
46 }
47 sound->data = NULL; /* pointer to raw audio data */
48 sound->len = 0; /* size of raw data pointed to above */
49 sound->rate = 22050; /* sample rate = 22050Hz */
50 sound->vol = 127; /* volume [0..127] for [min..max] */
51 sound->pan = 64; /* balance [0..127] for [left..right] */
52 sound->format = 0; /* 0 for 16-bit, 1 for 8-bit */
53 /* stub */
54 }
55
56
57 static Uint8 *
58 NDSAUD_GetDeviceBuf(_THIS)
59 {
60 /* stub */
61 }
62
63 static void
64 NDSAUD_WaitDevice(_THIS)
65 {
66 /* stub */
67 }
68
69 static void
70 NDSAUD_CloseDevice(_THIS)
71 {
72 /* stub */
73 }
74
75 static int
76 NDSAUD_Init(SDL_AudioDriverImpl * impl)
77 {
78 /* Set the function pointers */
79 impl->OpenDevice = NDSAUD_OpenDevice;
80 impl->PlayDevice = NDSAUD_PlayDevice;
81 impl->WaitDevice = NDSAUD_WaitDevice;
82 impl->GetDeviceBuf = NDSAUD_GetDeviceBuf;
83 impl->CloseDevice = NDSAUD_CloseDevice;
84 impl->OnlyHasDefaultOutputDevice = 1;
85 return 1;
86 }
87
88 AudioBootStrap NDSAUD_bootstrap = {
89 "nds", "SDL NDS audio driver", NDSAUD_Init, 1
90 };
91
92 /* vi: set ts=4 sw=4 expandtab: */