src/audio/coreaudio/SDL_coreaudio.h
author Sam Lantinga <slouken@libsdl.org>
Sun, 01 Jan 2017 18:33:28 -0800
changeset 10737 3406a0f8b041
parent 10357 e9c3e64fdc84
child 11022 ad26a063ffff
permissions -rw-r--r--
Updated copyright for 2017
slouken@935
     1
/*
slouken@5535
     2
  Simple DirectMedia Layer
slouken@10737
     3
  Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
slouken@935
     4
slouken@5535
     5
  This software is provided 'as-is', without any express or implied
slouken@5535
     6
  warranty.  In no event will the authors be held liable for any damages
slouken@5535
     7
  arising from the use of this software.
slouken@935
     8
slouken@5535
     9
  Permission is granted to anyone to use this software for any purpose,
slouken@5535
    10
  including commercial applications, and to alter it and redistribute it
slouken@5535
    11
  freely, subject to the following restrictions:
slouken@935
    12
slouken@5535
    13
  1. The origin of this software must not be misrepresented; you must not
slouken@5535
    14
     claim that you wrote the original software. If you use this software
slouken@5535
    15
     in a product, an acknowledgment in the product documentation would be
slouken@5535
    16
     appreciated but is not required.
slouken@5535
    17
  2. Altered source versions must be plainly marked as such, and must not be
slouken@5535
    18
     misrepresented as being the original software.
slouken@5535
    19
  3. This notice may not be removed or altered from any source distribution.
slouken@935
    20
*/
icculus@8093
    21
#include "../../SDL_internal.h"
slouken@935
    22
slouken@935
    23
#ifndef _SDL_coreaudio_h
slouken@935
    24
#define _SDL_coreaudio_h
slouken@935
    25
slouken@1361
    26
#include "../SDL_sysaudio.h"
slouken@935
    27
icculus@5596
    28
#if !defined(__IPHONEOS__)
icculus@5596
    29
#define MACOSX_COREAUDIO 1
icculus@5596
    30
#endif
icculus@5596
    31
icculus@5605
    32
#if MACOSX_COREAUDIO
icculus@5605
    33
#include <CoreAudio/CoreAudio.h>
icculus@5605
    34
#include <CoreServices/CoreServices.h>
slime73@10346
    35
#else
slime73@10346
    36
#import <AVFoundation/AVFoundation.h>
slime73@10357
    37
#import <UIKit/UIApplication.h>
icculus@5605
    38
#endif
icculus@5605
    39
icculus@10309
    40
#include <AudioToolbox/AudioToolbox.h>
icculus@5605
    41
#include <AudioUnit/AudioUnit.h>
icculus@5605
    42
icculus@2049
    43
/* Hidden "this" pointer for the audio functions */
slouken@7191
    44
#define _THIS   SDL_AudioDevice *this
slouken@935
    45
slouken@1895
    46
struct SDL_PrivateAudioData
slouken@1895
    47
{
icculus@10309
    48
    SDL_Thread *thread;
icculus@10309
    49
    AudioQueueRef audioQueue;
icculus@10309
    50
    AudioQueueBufferRef audioBuffer[2];
slouken@1895
    51
    void *buffer;
slouken@1895
    52
    UInt32 bufferOffset;
slouken@1895
    53
    UInt32 bufferSize;
icculus@10309
    54
    AudioStreamBasicDescription strdesc;
icculus@10309
    55
    SDL_sem *ready_semaphore;
icculus@10309
    56
    char *thread_error;
icculus@10309
    57
    SDL_atomic_t shutdown;
icculus@5596
    58
#if MACOSX_COREAUDIO
icculus@2049
    59
    AudioDeviceID deviceID;
slime73@10357
    60
#else
slime73@10357
    61
    SDL_bool interrupted;
slime73@10357
    62
    CFTypeRef interruption_listener;
icculus@5596
    63
#endif
slouken@935
    64
};
slouken@935
    65
slouken@935
    66
#endif /* _SDL_coreaudio_h */
slouken@1895
    67
/* vi: set ts=4 sw=4 expandtab: */