annotate src/audio/nds/soundcommon.h @ 3976:8582c6a5ca16 SDL-1.2

Added initial support for Nintendo DS, based on the work by Troy Davis (GPF)
author Sam Lantinga <slouken@libsdl.org>
date Mon, 25 Jun 2007 00:50:20 +0000
parents
children a1b03ba2fcd0
rev   line source
3976
8582c6a5ca16 Added initial support for Nintendo DS, based on the work by Troy Davis (GPF)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1 /*
8582c6a5ca16 Added initial support for Nintendo DS, based on the work by Troy Davis (GPF)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
2 SDL - Simple DirectMedia Layer
8582c6a5ca16 Added initial support for Nintendo DS, based on the work by Troy Davis (GPF)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
3 Copyright (C) 1997-2006 Sam Lantinga
8582c6a5ca16 Added initial support for Nintendo DS, based on the work by Troy Davis (GPF)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
4
8582c6a5ca16 Added initial support for Nintendo DS, based on the work by Troy Davis (GPF)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
5 This library is free software; you can redistribute it and/or
8582c6a5ca16 Added initial support for Nintendo DS, based on the work by Troy Davis (GPF)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
6 modify it under the terms of the GNU Lesser General Public
8582c6a5ca16 Added initial support for Nintendo DS, based on the work by Troy Davis (GPF)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
7 License as published by the Free Software Foundation; either
8582c6a5ca16 Added initial support for Nintendo DS, based on the work by Troy Davis (GPF)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
8 version 2.1 of the License, or (at your option) any later version.
8582c6a5ca16 Added initial support for Nintendo DS, based on the work by Troy Davis (GPF)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
9
8582c6a5ca16 Added initial support for Nintendo DS, based on the work by Troy Davis (GPF)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
10 This library is distributed in the hope that it will be useful,
8582c6a5ca16 Added initial support for Nintendo DS, based on the work by Troy Davis (GPF)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
8582c6a5ca16 Added initial support for Nintendo DS, based on the work by Troy Davis (GPF)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
8582c6a5ca16 Added initial support for Nintendo DS, based on the work by Troy Davis (GPF)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
13 Lesser General Public License for more details.
8582c6a5ca16 Added initial support for Nintendo DS, based on the work by Troy Davis (GPF)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
14
8582c6a5ca16 Added initial support for Nintendo DS, based on the work by Troy Davis (GPF)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
15 You should have received a copy of the GNU Lesser General Public
8582c6a5ca16 Added initial support for Nintendo DS, based on the work by Troy Davis (GPF)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
16 License along with this library; if not, write to the Free Software
8582c6a5ca16 Added initial support for Nintendo DS, based on the work by Troy Davis (GPF)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
8582c6a5ca16 Added initial support for Nintendo DS, based on the work by Troy Davis (GPF)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
18
8582c6a5ca16 Added initial support for Nintendo DS, based on the work by Troy Davis (GPF)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
19 Sam Lantinga
8582c6a5ca16 Added initial support for Nintendo DS, based on the work by Troy Davis (GPF)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
20 slouken@libsdl.org
8582c6a5ca16 Added initial support for Nintendo DS, based on the work by Troy Davis (GPF)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
21 */
8582c6a5ca16 Added initial support for Nintendo DS, based on the work by Troy Davis (GPF)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
22 #include "SDL_config.h"
8582c6a5ca16 Added initial support for Nintendo DS, based on the work by Troy Davis (GPF)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
23
8582c6a5ca16 Added initial support for Nintendo DS, based on the work by Troy Davis (GPF)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
24 #ifndef __SOUNDCOMMON_H
8582c6a5ca16 Added initial support for Nintendo DS, based on the work by Troy Davis (GPF)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
25 #define __SOUNDCOMMON_H
8582c6a5ca16 Added initial support for Nintendo DS, based on the work by Troy Davis (GPF)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
26
8582c6a5ca16 Added initial support for Nintendo DS, based on the work by Troy Davis (GPF)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
27 #include <nds.h>
8582c6a5ca16 Added initial support for Nintendo DS, based on the work by Troy Davis (GPF)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
28
8582c6a5ca16 Added initial support for Nintendo DS, based on the work by Troy Davis (GPF)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
29 #define CLOCK (1 << 25)
8582c6a5ca16 Added initial support for Nintendo DS, based on the work by Troy Davis (GPF)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
30
8582c6a5ca16 Added initial support for Nintendo DS, based on the work by Troy Davis (GPF)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
31 #ifdef __cplusplus
8582c6a5ca16 Added initial support for Nintendo DS, based on the work by Troy Davis (GPF)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
32 extern "C" {
8582c6a5ca16 Added initial support for Nintendo DS, based on the work by Troy Davis (GPF)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
33 #endif
8582c6a5ca16 Added initial support for Nintendo DS, based on the work by Troy Davis (GPF)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
34
8582c6a5ca16 Added initial support for Nintendo DS, based on the work by Troy Davis (GPF)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
35 typedef enum
8582c6a5ca16 Added initial support for Nintendo DS, based on the work by Troy Davis (GPF)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
36 {
8582c6a5ca16 Added initial support for Nintendo DS, based on the work by Troy Davis (GPF)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
37 NONE = 0,
8582c6a5ca16 Added initial support for Nintendo DS, based on the work by Troy Davis (GPF)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
38 INIT = 1,
8582c6a5ca16 Added initial support for Nintendo DS, based on the work by Troy Davis (GPF)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
39 MIX = 2,
8582c6a5ca16 Added initial support for Nintendo DS, based on the work by Troy Davis (GPF)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
40 MIXING = 4,
8582c6a5ca16 Added initial support for Nintendo DS, based on the work by Troy Davis (GPF)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
41 STOP = 8
8582c6a5ca16 Added initial support for Nintendo DS, based on the work by Troy Davis (GPF)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
42 }CommandType;
8582c6a5ca16 Added initial support for Nintendo DS, based on the work by Troy Davis (GPF)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
43
8582c6a5ca16 Added initial support for Nintendo DS, based on the work by Troy Davis (GPF)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
44 typedef enum
8582c6a5ca16 Added initial support for Nintendo DS, based on the work by Troy Davis (GPF)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
45 {
8582c6a5ca16 Added initial support for Nintendo DS, based on the work by Troy Davis (GPF)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
46 FIFO_NONE = 0,
8582c6a5ca16 Added initial support for Nintendo DS, based on the work by Troy Davis (GPF)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
47 UPDATEON_ARM9 = 1,
8582c6a5ca16 Added initial support for Nintendo DS, based on the work by Troy Davis (GPF)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
48 MIXCOMPLETE_ONARM9 = 2,
8582c6a5ca16 Added initial support for Nintendo DS, based on the work by Troy Davis (GPF)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
49 }FifoType;
8582c6a5ca16 Added initial support for Nintendo DS, based on the work by Troy Davis (GPF)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
50
8582c6a5ca16 Added initial support for Nintendo DS, based on the work by Troy Davis (GPF)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
51 typedef struct
8582c6a5ca16 Added initial support for Nintendo DS, based on the work by Troy Davis (GPF)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
52 {
8582c6a5ca16 Added initial support for Nintendo DS, based on the work by Troy Davis (GPF)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
53 s8 *mixbuffer;//,*soundbuffer;
8582c6a5ca16 Added initial support for Nintendo DS, based on the work by Troy Davis (GPF)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
54 u32 rate;
8582c6a5ca16 Added initial support for Nintendo DS, based on the work by Troy Davis (GPF)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
55 u32 buffersize;
8582c6a5ca16 Added initial support for Nintendo DS, based on the work by Troy Davis (GPF)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
56 u32 cmd;
8582c6a5ca16 Added initial support for Nintendo DS, based on the work by Troy Davis (GPF)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
57 u8 channel,format;
8582c6a5ca16 Added initial support for Nintendo DS, based on the work by Troy Davis (GPF)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
58 u32 soundcursor,numsamples;
8582c6a5ca16 Added initial support for Nintendo DS, based on the work by Troy Davis (GPF)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
59 s32 prevtimer;
8582c6a5ca16 Added initial support for Nintendo DS, based on the work by Troy Davis (GPF)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
60 s16 period;
8582c6a5ca16 Added initial support for Nintendo DS, based on the work by Troy Davis (GPF)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
61 }S_SoundSystem;
8582c6a5ca16 Added initial support for Nintendo DS, based on the work by Troy Davis (GPF)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
62
8582c6a5ca16 Added initial support for Nintendo DS, based on the work by Troy Davis (GPF)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
63 #define soundsystem ((S_SoundSystem*)((u32)(IPC)+sizeof(TransferRegion)))
8582c6a5ca16 Added initial support for Nintendo DS, based on the work by Troy Davis (GPF)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
64
8582c6a5ca16 Added initial support for Nintendo DS, based on the work by Troy Davis (GPF)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
65 #ifdef ARM9
8582c6a5ca16 Added initial support for Nintendo DS, based on the work by Troy Davis (GPF)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
66 extern void SoundSystemInit(u32 rate,u32 buffersize,u8 channel,u8 format);
8582c6a5ca16 Added initial support for Nintendo DS, based on the work by Troy Davis (GPF)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
67 extern void SoundStartMixer(void);
8582c6a5ca16 Added initial support for Nintendo DS, based on the work by Troy Davis (GPF)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
68 extern void SendCommandToArm7(u32 command);
8582c6a5ca16 Added initial support for Nintendo DS, based on the work by Troy Davis (GPF)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
69 #else
8582c6a5ca16 Added initial support for Nintendo DS, based on the work by Troy Davis (GPF)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
70 extern void SoundVBlankIrq(void);
8582c6a5ca16 Added initial support for Nintendo DS, based on the work by Troy Davis (GPF)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
71 extern void SoundSwapAndMix(void);
8582c6a5ca16 Added initial support for Nintendo DS, based on the work by Troy Davis (GPF)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
72 extern void SoundSetTimer(int period);
8582c6a5ca16 Added initial support for Nintendo DS, based on the work by Troy Davis (GPF)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
73 extern void SoundFifoHandler(void);
8582c6a5ca16 Added initial support for Nintendo DS, based on the work by Troy Davis (GPF)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
74 extern void SendCommandToArm9(u32 command);
8582c6a5ca16 Added initial support for Nintendo DS, based on the work by Troy Davis (GPF)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
75 #endif
8582c6a5ca16 Added initial support for Nintendo DS, based on the work by Troy Davis (GPF)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
76
8582c6a5ca16 Added initial support for Nintendo DS, based on the work by Troy Davis (GPF)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
77 #ifdef __cplusplus
8582c6a5ca16 Added initial support for Nintendo DS, based on the work by Troy Davis (GPF)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
78 }
8582c6a5ca16 Added initial support for Nintendo DS, based on the work by Troy Davis (GPF)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
79 #endif
8582c6a5ca16 Added initial support for Nintendo DS, based on the work by Troy Davis (GPF)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
80 #endif