src/audio/android/SDL_androidaudio.c
author Philipp Wiesemann <philipp.wiesemann@arcor.de>
Mon, 29 Apr 2013 23:54:22 +0200
changeset 7130 28df4f1a1712
parent 7038 7f22b9ba218f
child 7191 75360622e65f
permissions -rw-r--r--
Removed unused variables from C source files.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4718
79aa6c61f33b Added stub android sound system
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
     1
/*
5535
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
     2
  Simple DirectMedia Layer
6885
700f1b25f77f Happy New Year!
Sam Lantinga <slouken@libsdl.org>
parents: 6138
diff changeset
     3
  Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
4718
79aa6c61f33b Added stub android sound system
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
     4
5535
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
     5
  This software is provided 'as-is', without any express or implied
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
     6
  warranty.  In no event will the authors be held liable for any damages
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
     7
  arising from the use of this software.
4718
79aa6c61f33b Added stub android sound system
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
     8
5535
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
     9
  Permission is granted to anyone to use this software for any purpose,
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
    10
  including commercial applications, and to alter it and redistribute it
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
    11
  freely, subject to the following restrictions:
4718
79aa6c61f33b Added stub android sound system
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
    12
5535
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
    13
  1. The origin of this software must not be misrepresented; you must not
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
    14
     claim that you wrote the original software. If you use this software
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
    15
     in a product, an acknowledgment in the product documentation would be
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
    16
     appreciated but is not required.
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
    17
  2. Altered source versions must be plainly marked as such, and must not be
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
    18
     misrepresented as being the original software.
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
    19
  3. This notice may not be removed or altered from any source distribution.
4718
79aa6c61f33b Added stub android sound system
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
    20
*/
79aa6c61f33b Added stub android sound system
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
    21
#include "SDL_config.h"
79aa6c61f33b Added stub android sound system
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
    22
6044
35448a5ea044 Lots of fixes importing SDL source wholesale into a new iOS project
Sam Lantinga <slouken@libsdl.org>
parents: 5579
diff changeset
    23
#if SDL_AUDIO_DRIVER_ANDROID
35448a5ea044 Lots of fixes importing SDL source wholesale into a new iOS project
Sam Lantinga <slouken@libsdl.org>
parents: 5579
diff changeset
    24
4718
79aa6c61f33b Added stub android sound system
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
    25
/* Output audio to Android */
79aa6c61f33b Added stub android sound system
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
    26
79aa6c61f33b Added stub android sound system
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
    27
#include "SDL_audio.h"
79aa6c61f33b Added stub android sound system
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
    28
#include "../SDL_audio_c.h"
79aa6c61f33b Added stub android sound system
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
    29
#include "SDL_androidaudio.h"
4995
9f9bea41e88f Working audio implementation contributed by Joseph Lunderville
Sam Lantinga <slouken@libsdl.org>
parents: 4989
diff changeset
    30
5090
327f181542f1 Include windows.h in a single point in the source, so we can be consistent about the definition of UNICODE and have core utility functions for Windows that all modules can share.
Sam Lantinga <slouken@libsdl.org>
parents: 4996
diff changeset
    31
#include "../../core/android/SDL_android.h"
4724
d86332c0fb9b Working on the sound system
Paul Hunkin <paul@bieh.net>
parents: 4718
diff changeset
    32
4718
79aa6c61f33b Added stub android sound system
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
    33
#include <android/log.h>
79aa6c61f33b Added stub android sound system
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
    34
4995
9f9bea41e88f Working audio implementation contributed by Joseph Lunderville
Sam Lantinga <slouken@libsdl.org>
parents: 4989
diff changeset
    35
static void * audioDevice;
9f9bea41e88f Working audio implementation contributed by Joseph Lunderville
Sam Lantinga <slouken@libsdl.org>
parents: 4989
diff changeset
    36
4718
79aa6c61f33b Added stub android sound system
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
    37
static int
79aa6c61f33b Added stub android sound system
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
    38
AndroidAUD_OpenDevice(_THIS, const char *devname, int iscapture)
79aa6c61f33b Added stub android sound system
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
    39
{
4995
9f9bea41e88f Working audio implementation contributed by Joseph Lunderville
Sam Lantinga <slouken@libsdl.org>
parents: 4989
diff changeset
    40
    SDL_AudioFormat test_format;
7130
28df4f1a1712 Removed unused variables from C source files.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 7038
diff changeset
    41
4995
9f9bea41e88f Working audio implementation contributed by Joseph Lunderville
Sam Lantinga <slouken@libsdl.org>
parents: 4989
diff changeset
    42
    if (iscapture) {
9f9bea41e88f Working audio implementation contributed by Joseph Lunderville
Sam Lantinga <slouken@libsdl.org>
parents: 4989
diff changeset
    43
    	//TODO: implement capture
7038
7f22b9ba218f Changed audio subsystem's OpenDevice interface to return -1 on error.
Ryan C. Gordon <icculus@icculus.org>
parents: 6885
diff changeset
    44
    	return SDL_SetError("Capture not supported on Android");
4995
9f9bea41e88f Working audio implementation contributed by Joseph Lunderville
Sam Lantinga <slouken@libsdl.org>
parents: 4989
diff changeset
    45
    }
9f9bea41e88f Working audio implementation contributed by Joseph Lunderville
Sam Lantinga <slouken@libsdl.org>
parents: 4989
diff changeset
    46
9f9bea41e88f Working audio implementation contributed by Joseph Lunderville
Sam Lantinga <slouken@libsdl.org>
parents: 4989
diff changeset
    47
    if (audioDevice != NULL) {
7038
7f22b9ba218f Changed audio subsystem's OpenDevice interface to return -1 on error.
Ryan C. Gordon <icculus@icculus.org>
parents: 6885
diff changeset
    48
    	return SDL_SetError("Only one audio device at a time please!");
4995
9f9bea41e88f Working audio implementation contributed by Joseph Lunderville
Sam Lantinga <slouken@libsdl.org>
parents: 4989
diff changeset
    49
    }
9f9bea41e88f Working audio implementation contributed by Joseph Lunderville
Sam Lantinga <slouken@libsdl.org>
parents: 4989
diff changeset
    50
9f9bea41e88f Working audio implementation contributed by Joseph Lunderville
Sam Lantinga <slouken@libsdl.org>
parents: 4989
diff changeset
    51
    audioDevice = this;
4724
d86332c0fb9b Working on the sound system
Paul Hunkin <paul@bieh.net>
parents: 4718
diff changeset
    52
d86332c0fb9b Working on the sound system
Paul Hunkin <paul@bieh.net>
parents: 4718
diff changeset
    53
    this->hidden = SDL_malloc(sizeof(*(this->hidden)));
d86332c0fb9b Working on the sound system
Paul Hunkin <paul@bieh.net>
parents: 4718
diff changeset
    54
    if (!this->hidden) {
7038
7f22b9ba218f Changed audio subsystem's OpenDevice interface to return -1 on error.
Ryan C. Gordon <icculus@icculus.org>
parents: 6885
diff changeset
    55
        return SDL_OutOfMemory();
4724
d86332c0fb9b Working on the sound system
Paul Hunkin <paul@bieh.net>
parents: 4718
diff changeset
    56
    }
d86332c0fb9b Working on the sound system
Paul Hunkin <paul@bieh.net>
parents: 4718
diff changeset
    57
    SDL_memset(this->hidden, 0, (sizeof *this->hidden));
d86332c0fb9b Working on the sound system
Paul Hunkin <paul@bieh.net>
parents: 4718
diff changeset
    58
4995
9f9bea41e88f Working audio implementation contributed by Joseph Lunderville
Sam Lantinga <slouken@libsdl.org>
parents: 4989
diff changeset
    59
    test_format = SDL_FirstAudioFormat(this->spec.format);
9f9bea41e88f Working audio implementation contributed by Joseph Lunderville
Sam Lantinga <slouken@libsdl.org>
parents: 4989
diff changeset
    60
    while (test_format != 0) { // no "UNKNOWN" constant
9f9bea41e88f Working audio implementation contributed by Joseph Lunderville
Sam Lantinga <slouken@libsdl.org>
parents: 4989
diff changeset
    61
        if ((test_format == AUDIO_U8) || (test_format == AUDIO_S16LSB)) {
9f9bea41e88f Working audio implementation contributed by Joseph Lunderville
Sam Lantinga <slouken@libsdl.org>
parents: 4989
diff changeset
    62
            this->spec.format = test_format;
4724
d86332c0fb9b Working on the sound system
Paul Hunkin <paul@bieh.net>
parents: 4718
diff changeset
    63
            break;
d86332c0fb9b Working on the sound system
Paul Hunkin <paul@bieh.net>
parents: 4718
diff changeset
    64
        }
4995
9f9bea41e88f Working audio implementation contributed by Joseph Lunderville
Sam Lantinga <slouken@libsdl.org>
parents: 4989
diff changeset
    65
        test_format = SDL_NextAudioFormat();
4724
d86332c0fb9b Working on the sound system
Paul Hunkin <paul@bieh.net>
parents: 4718
diff changeset
    66
    }
4718
79aa6c61f33b Added stub android sound system
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
    67
    
4995
9f9bea41e88f Working audio implementation contributed by Joseph Lunderville
Sam Lantinga <slouken@libsdl.org>
parents: 4989
diff changeset
    68
    if (test_format == 0) {
9f9bea41e88f Working audio implementation contributed by Joseph Lunderville
Sam Lantinga <slouken@libsdl.org>
parents: 4989
diff changeset
    69
    	// Didn't find a compatible format :(
7038
7f22b9ba218f Changed audio subsystem's OpenDevice interface to return -1 on error.
Ryan C. Gordon <icculus@icculus.org>
parents: 6885
diff changeset
    70
    	return SDL_SetError("No compatible audio format!");
4995
9f9bea41e88f Working audio implementation contributed by Joseph Lunderville
Sam Lantinga <slouken@libsdl.org>
parents: 4989
diff changeset
    71
    }
9f9bea41e88f Working audio implementation contributed by Joseph Lunderville
Sam Lantinga <slouken@libsdl.org>
parents: 4989
diff changeset
    72
9f9bea41e88f Working audio implementation contributed by Joseph Lunderville
Sam Lantinga <slouken@libsdl.org>
parents: 4989
diff changeset
    73
    if (this->spec.channels > 1) {
9f9bea41e88f Working audio implementation contributed by Joseph Lunderville
Sam Lantinga <slouken@libsdl.org>
parents: 4989
diff changeset
    74
    	this->spec.channels = 2;
9f9bea41e88f Working audio implementation contributed by Joseph Lunderville
Sam Lantinga <slouken@libsdl.org>
parents: 4989
diff changeset
    75
    } else {
9f9bea41e88f Working audio implementation contributed by Joseph Lunderville
Sam Lantinga <slouken@libsdl.org>
parents: 4989
diff changeset
    76
    	this->spec.channels = 1;
9f9bea41e88f Working audio implementation contributed by Joseph Lunderville
Sam Lantinga <slouken@libsdl.org>
parents: 4989
diff changeset
    77
    }
9f9bea41e88f Working audio implementation contributed by Joseph Lunderville
Sam Lantinga <slouken@libsdl.org>
parents: 4989
diff changeset
    78
9f9bea41e88f Working audio implementation contributed by Joseph Lunderville
Sam Lantinga <slouken@libsdl.org>
parents: 4989
diff changeset
    79
    if (this->spec.freq < 8000) {
9f9bea41e88f Working audio implementation contributed by Joseph Lunderville
Sam Lantinga <slouken@libsdl.org>
parents: 4989
diff changeset
    80
    	this->spec.freq = 8000;
9f9bea41e88f Working audio implementation contributed by Joseph Lunderville
Sam Lantinga <slouken@libsdl.org>
parents: 4989
diff changeset
    81
    }
9f9bea41e88f Working audio implementation contributed by Joseph Lunderville
Sam Lantinga <slouken@libsdl.org>
parents: 4989
diff changeset
    82
    if (this->spec.freq > 48000) {
9f9bea41e88f Working audio implementation contributed by Joseph Lunderville
Sam Lantinga <slouken@libsdl.org>
parents: 4989
diff changeset
    83
    	this->spec.freq = 48000;
9f9bea41e88f Working audio implementation contributed by Joseph Lunderville
Sam Lantinga <slouken@libsdl.org>
parents: 4989
diff changeset
    84
    }
9f9bea41e88f Working audio implementation contributed by Joseph Lunderville
Sam Lantinga <slouken@libsdl.org>
parents: 4989
diff changeset
    85
9f9bea41e88f Working audio implementation contributed by Joseph Lunderville
Sam Lantinga <slouken@libsdl.org>
parents: 4989
diff changeset
    86
    // TODO: pass in/return a (Java) device ID, also whether we're opening for input or output
9f9bea41e88f Working audio implementation contributed by Joseph Lunderville
Sam Lantinga <slouken@libsdl.org>
parents: 4989
diff changeset
    87
    this->spec.samples = Android_JNI_OpenAudioDevice(this->spec.freq, this->spec.format == AUDIO_U8 ? 0 : 1, this->spec.channels, this->spec.samples);
9f9bea41e88f Working audio implementation contributed by Joseph Lunderville
Sam Lantinga <slouken@libsdl.org>
parents: 4989
diff changeset
    88
    SDL_CalculateAudioSpec(&this->spec);
9f9bea41e88f Working audio implementation contributed by Joseph Lunderville
Sam Lantinga <slouken@libsdl.org>
parents: 4989
diff changeset
    89
9f9bea41e88f Working audio implementation contributed by Joseph Lunderville
Sam Lantinga <slouken@libsdl.org>
parents: 4989
diff changeset
    90
    if (this->spec.samples == 0) {
9f9bea41e88f Working audio implementation contributed by Joseph Lunderville
Sam Lantinga <slouken@libsdl.org>
parents: 4989
diff changeset
    91
    	// Init failed?
7038
7f22b9ba218f Changed audio subsystem's OpenDevice interface to return -1 on error.
Ryan C. Gordon <icculus@icculus.org>
parents: 6885
diff changeset
    92
    	return SDL_SetError("Java-side initialization failed!");
4995
9f9bea41e88f Working audio implementation contributed by Joseph Lunderville
Sam Lantinga <slouken@libsdl.org>
parents: 4989
diff changeset
    93
    }
9f9bea41e88f Working audio implementation contributed by Joseph Lunderville
Sam Lantinga <slouken@libsdl.org>
parents: 4989
diff changeset
    94
7038
7f22b9ba218f Changed audio subsystem's OpenDevice interface to return -1 on error.
Ryan C. Gordon <icculus@icculus.org>
parents: 6885
diff changeset
    95
    return 0;
4718
79aa6c61f33b Added stub android sound system
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
    96
}
79aa6c61f33b Added stub android sound system
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
    97
79aa6c61f33b Added stub android sound system
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
    98
static void
79aa6c61f33b Added stub android sound system
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
    99
AndroidAUD_PlayDevice(_THIS)
79aa6c61f33b Added stub android sound system
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
   100
{
4996
8d7315668e35 Fixed audio buffer lifecycle and implemented audio shutdown
Sam Lantinga <slouken@libsdl.org>
parents: 4995
diff changeset
   101
    Android_JNI_WriteAudioBuffer();
4718
79aa6c61f33b Added stub android sound system
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
   102
}
79aa6c61f33b Added stub android sound system
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
   103
79aa6c61f33b Added stub android sound system
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
   104
static Uint8 *
79aa6c61f33b Added stub android sound system
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
   105
AndroidAUD_GetDeviceBuf(_THIS)
79aa6c61f33b Added stub android sound system
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
   106
{
4996
8d7315668e35 Fixed audio buffer lifecycle and implemented audio shutdown
Sam Lantinga <slouken@libsdl.org>
parents: 4995
diff changeset
   107
    return Android_JNI_GetAudioBuffer();
4718
79aa6c61f33b Added stub android sound system
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
   108
}
79aa6c61f33b Added stub android sound system
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
   109
79aa6c61f33b Added stub android sound system
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
   110
static void
79aa6c61f33b Added stub android sound system
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
   111
AndroidAUD_CloseDevice(_THIS)
79aa6c61f33b Added stub android sound system
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
   112
{
4995
9f9bea41e88f Working audio implementation contributed by Joseph Lunderville
Sam Lantinga <slouken@libsdl.org>
parents: 4989
diff changeset
   113
    if (this->hidden != NULL) {
9f9bea41e88f Working audio implementation contributed by Joseph Lunderville
Sam Lantinga <slouken@libsdl.org>
parents: 4989
diff changeset
   114
    	SDL_free(this->hidden);
9f9bea41e88f Working audio implementation contributed by Joseph Lunderville
Sam Lantinga <slouken@libsdl.org>
parents: 4989
diff changeset
   115
    	this->hidden = NULL;
9f9bea41e88f Working audio implementation contributed by Joseph Lunderville
Sam Lantinga <slouken@libsdl.org>
parents: 4989
diff changeset
   116
    }
9f9bea41e88f Working audio implementation contributed by Joseph Lunderville
Sam Lantinga <slouken@libsdl.org>
parents: 4989
diff changeset
   117
	Android_JNI_CloseAudioDevice();
9f9bea41e88f Working audio implementation contributed by Joseph Lunderville
Sam Lantinga <slouken@libsdl.org>
parents: 4989
diff changeset
   118
9f9bea41e88f Working audio implementation contributed by Joseph Lunderville
Sam Lantinga <slouken@libsdl.org>
parents: 4989
diff changeset
   119
    if (audioDevice == this) {
9f9bea41e88f Working audio implementation contributed by Joseph Lunderville
Sam Lantinga <slouken@libsdl.org>
parents: 4989
diff changeset
   120
    	audioDevice = NULL;
9f9bea41e88f Working audio implementation contributed by Joseph Lunderville
Sam Lantinga <slouken@libsdl.org>
parents: 4989
diff changeset
   121
    }
4718
79aa6c61f33b Added stub android sound system
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
   122
}
79aa6c61f33b Added stub android sound system
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
   123
79aa6c61f33b Added stub android sound system
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
   124
static int
79aa6c61f33b Added stub android sound system
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
   125
AndroidAUD_Init(SDL_AudioDriverImpl * impl)
79aa6c61f33b Added stub android sound system
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
   126
{
79aa6c61f33b Added stub android sound system
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
   127
    /* Set the function pointers */
79aa6c61f33b Added stub android sound system
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
   128
    impl->OpenDevice = AndroidAUD_OpenDevice;
79aa6c61f33b Added stub android sound system
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
   129
    impl->PlayDevice = AndroidAUD_PlayDevice;
79aa6c61f33b Added stub android sound system
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
   130
    impl->GetDeviceBuf = AndroidAUD_GetDeviceBuf;
79aa6c61f33b Added stub android sound system
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
   131
    impl->CloseDevice = AndroidAUD_CloseDevice;
79aa6c61f33b Added stub android sound system
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
   132
79aa6c61f33b Added stub android sound system
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
   133
    /* and the capabilities */
4995
9f9bea41e88f Working audio implementation contributed by Joseph Lunderville
Sam Lantinga <slouken@libsdl.org>
parents: 4989
diff changeset
   134
    impl->ProvidesOwnCallbackThread = 1;
4718
79aa6c61f33b Added stub android sound system
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
   135
    impl->HasCaptureSupport = 0; //TODO
79aa6c61f33b Added stub android sound system
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
   136
    impl->OnlyHasDefaultOutputDevice = 1;
79aa6c61f33b Added stub android sound system
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
   137
    impl->OnlyHasDefaultInputDevice = 1;
79aa6c61f33b Added stub android sound system
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
   138
79aa6c61f33b Added stub android sound system
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
   139
    return 1;   /* this audio target is available. */
79aa6c61f33b Added stub android sound system
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
   140
}
79aa6c61f33b Added stub android sound system
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
   141
79aa6c61f33b Added stub android sound system
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
   142
AudioBootStrap ANDROIDAUD_bootstrap = {
5579
c8862e1bc41f Removed comment questioning the code's correctness (the answer: it's correct).
Ryan C. Gordon <icculus@icculus.org>
parents: 5535
diff changeset
   143
    "android", "SDL Android audio driver", AndroidAUD_Init, 0
4718
79aa6c61f33b Added stub android sound system
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
   144
};
79aa6c61f33b Added stub android sound system
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
   145
4995
9f9bea41e88f Working audio implementation contributed by Joseph Lunderville
Sam Lantinga <slouken@libsdl.org>
parents: 4989
diff changeset
   146
/* Called by the Java code to start the audio processing on a thread */
9f9bea41e88f Working audio implementation contributed by Joseph Lunderville
Sam Lantinga <slouken@libsdl.org>
parents: 4989
diff changeset
   147
void
9f9bea41e88f Working audio implementation contributed by Joseph Lunderville
Sam Lantinga <slouken@libsdl.org>
parents: 4989
diff changeset
   148
Android_RunAudioThread()
9f9bea41e88f Working audio implementation contributed by Joseph Lunderville
Sam Lantinga <slouken@libsdl.org>
parents: 4989
diff changeset
   149
{
9f9bea41e88f Working audio implementation contributed by Joseph Lunderville
Sam Lantinga <slouken@libsdl.org>
parents: 4989
diff changeset
   150
	SDL_RunAudio(audioDevice);
9f9bea41e88f Working audio implementation contributed by Joseph Lunderville
Sam Lantinga <slouken@libsdl.org>
parents: 4989
diff changeset
   151
}
9f9bea41e88f Working audio implementation contributed by Joseph Lunderville
Sam Lantinga <slouken@libsdl.org>
parents: 4989
diff changeset
   152
6044
35448a5ea044 Lots of fixes importing SDL source wholesale into a new iOS project
Sam Lantinga <slouken@libsdl.org>
parents: 5579
diff changeset
   153
#endif /* SDL_AUDIO_DRIVER_ANDROID */
35448a5ea044 Lots of fixes importing SDL source wholesale into a new iOS project
Sam Lantinga <slouken@libsdl.org>
parents: 5579
diff changeset
   154
4718
79aa6c61f33b Added stub android sound system
Paul Hunkin <paul@bieh.net>
parents:
diff changeset
   155
/* vi: set ts=4 sw=4 expandtab: */