Refactor : hide non-public OpenAL internal API

This commit is contained in:
Aaron Culliney 2015-06-13 14:00:52 -07:00
parent ec4ff3de10
commit 7fd1b350c2
3 changed files with 49 additions and 67 deletions

View File

@ -17,8 +17,8 @@ noinst_HEADERS = src/common.h src/cpu.h src/disk.h src/glue.h \
src/meta/debug.h \
\
src/audio/alhelpers.h src/audio/AY8910.h src/audio/mockingboard.h \
src/audio/peripherals.h src/audio/soundcore.h src/audio/soundcore-openal.h \
src/audio/speaker.h src/audio/SSI263Phonemes.h
src/audio/peripherals.h src/audio/soundcore.h src/audio/speaker.h \
src/audio/SSI263Phonemes.h
noinst_PROGRAMS = genfont genrom

View File

@ -15,11 +15,52 @@
// there is a need to track any changes/fixes implemented in AppleWin...
#include "common.h"
#include "audio/soundcore-openal.h"
#ifdef __APPLE__
# import <OpenAL/al.h>
# import <OpenAL/alc.h>
#else
# include <AL/al.h>
# include <AL/alc.h>
# include <AL/alext.h>
#endif
#include "audio/alhelpers.h"
static long OpenALCreateSoundBuffer(AudioParams_s *params, ALSoundBufferStruct **soundbuf_struct, void *extra_data);
static long OpenALDestroySoundBuffer(ALSoundBufferStruct **soundbuf_struct);
#define OPENAL_NUM_BUFFERS 4
typedef struct IDirectSoundBuffer ALSoundBufferStruct;
typedef struct ALPlayBuf {
const ALuint bufid; // the hash id
ALuint bytes; // bytes to play
UT_hash_handle hh; // make this struct hashable
struct ALPlayBuf *_avail_next;
} ALPlayBuf;
typedef struct ALVoice {
ALuint source;
// playing data
ALPlayBuf *queued_buffers;
ALint _queued_total_bytes; // a maximum estimate -- actual value depends on OpenAL query
// working data buffer
ALbyte *data;
ALsizei index; // working buffer byte index
ALsizei buffersize; // working buffer size (and OpenAL buffersize)
// available buffers
ALPlayBuf *avail_buffers;
ALsizei replay_index;
// sample parameters
ALenum format;
ALenum channels;
ALenum type;
ALuint rate;
} ALVoice;
typedef struct ALVoices {
const ALuint source;
@ -29,6 +70,9 @@ typedef struct ALVoices {
static ALVoices *voices = NULL;
static long OpenALCreateSoundBuffer(AudioParams_s *params, ALSoundBufferStruct **soundbuf_struct, void *extra_data);
static long OpenALDestroySoundBuffer(ALSoundBufferStruct **soundbuf_struct);
// ----------------------------------------------------------------------------
// uthash of OpenAL buffers

View File

@ -1,62 +0,0 @@
/*
* Apple // emulator for *nix
*
* This software package is subject to the GNU General Public License
* version 2 or later (your choice) as published by the Free Software
* Foundation.
*
* THERE ARE NO WARRANTIES WHATSOEVER.
*
*/
#ifndef _SOUNDCORE_OPENAL_H_
#define _SOUNDCORE_OPENAL_H_
#include "common.h"
#ifdef __APPLE__
#import <OpenAL/al.h>
#import <OpenAL/alc.h>
#else
#include <AL/al.h>
#include <AL/alc.h>
#include <AL/alext.h>
#endif
typedef struct IDirectSoundBuffer ALSoundBufferStruct;
struct ALPlayBuf;
typedef struct ALPlayBuf {
const ALuint bufid; // the hash id
ALuint bytes; // bytes to play
UT_hash_handle hh; // make this struct hashable
struct ALPlayBuf *_avail_next;
} ALPlayBuf;
#define OPENAL_NUM_BUFFERS 4
typedef struct ALVoice {
ALuint source;
// playing data
ALPlayBuf *queued_buffers;
ALint _queued_total_bytes; // a maximum estimate -- actual value depends on OpenAL query
// working data buffer
ALbyte *data;
ALsizei index; // working buffer byte index
ALsizei buffersize; // working buffer size (and OpenAL buffersize)
// available buffers
ALPlayBuf *avail_buffers;
ALsizei replay_index;
// sample parameters
ALenum format;
ALenum channels;
ALenum type;
ALuint rate;
} ALVoice;
#endif /* whole file */