comparison src/audio/android/SDL_androidaudio.c @ 4718:79aa6c61f33b

Added stub android sound system
author Paul Hunkin <paul@bieh.net>
date Tue, 27 Jul 2010 11:34:43 +0200
parents
children d86332c0fb9b
comparison
equal deleted inserted replaced
4717:191f4693d0c1 4718:79aa6c61f33b
1 /*
2 SDL - Simple DirectMedia Layer
3 Copyright (C) 1997-2010 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 Android */
27
28 #include "SDL_audio.h"
29 #include "../SDL_audio_c.h"
30 #include "SDL_androidaudio.h"
31
32 #include <android/log.h>
33
34 static int
35 AndroidAUD_OpenDevice(_THIS, const char *devname, int iscapture)
36 {
37 //TODO: Sample rates etc
38 __android_log_print(ANDROID_LOG_INFO, "SDL", "AndroidAudio Open\n");
39
40 return 1;
41 }
42
43 static void
44 AndroidAUD_PlayDevice(_THIS)
45 {
46 __android_log_print(ANDROID_LOG_INFO, "SDL", "AndroidAudio Play\n");
47
48
49
50 //playGenericSound(this->hidden->mixbuf, this->hidden->mixlen);
51
52 #if 0
53 // sound->data = this->hidden->mixbuf;/* pointer to raw audio data */
54 // sound->len = this->hidden->mixlen; /* size of raw data pointed to above */
55 // sound->rate = 22050; /* sample rate = 22050Hz */
56 // sound->vol = 127; /* volume [0..127] for [min..max] */
57 // sound->pan = 64; /* balance [0..127] for [left..right] */
58 // sound->format = 0; /* 0 for 16-bit, 1 for 8-bit */
59 // playSound(sound);
60 #endif
61 }
62
63
64 static Uint8 *
65 AndroidAUD_GetDeviceBuf(_THIS)
66 {
67 return this->hidden->mixbuf; /* is this right? */
68 }
69
70 static void
71 AndroidAUD_WaitDevice(_THIS)
72 {
73 /* stub */
74 }
75
76 static void
77 AndroidAUD_CloseDevice(_THIS)
78 {
79 /* stub */
80 }
81
82 static int
83 AndroidAUD_Init(SDL_AudioDriverImpl * impl)
84 {
85 /* Set the function pointers */
86 impl->OpenDevice = AndroidAUD_OpenDevice;
87 impl->PlayDevice = AndroidAUD_PlayDevice;
88 impl->WaitDevice = AndroidAUD_WaitDevice;
89 impl->GetDeviceBuf = AndroidAUD_GetDeviceBuf;
90 impl->CloseDevice = AndroidAUD_CloseDevice;
91
92 /* and the capabilities */
93 impl->HasCaptureSupport = 0; //TODO
94 impl->OnlyHasDefaultOutputDevice = 1;
95 impl->OnlyHasDefaultInputDevice = 1;
96
97 __android_log_print(ANDROID_LOG_INFO, "SDL","Audio init\n");
98
99 return 1; /* this audio target is available. */
100 }
101
102 AudioBootStrap ANDROIDAUD_bootstrap = {
103 "android", "SDL Android audio driver", AndroidAUD_Init, 0 /*1? */
104 };
105
106 /* vi: set ts=4 sw=4 expandtab: */