mirror of
https://github.com/mauiaaron/apple2.git
synced 2025-01-11 14:30:08 +00:00
First cut at getting audio working on Mac
This commit is contained in:
parent
13d17af838
commit
e941d5b10f
@ -119,6 +119,14 @@
|
||||
779F562319DA59D600A6F107 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 773B3D241956885A0085CE5F /* MainMenu.xib */; };
|
||||
779F562919E4FE9E00A6F107 /* Basic.vsh in Resources */ = {isa = PBXBuildFile; fileRef = 779F562719E4FE9E00A6F107 /* Basic.vsh */; };
|
||||
779F562A19E4FE9E00A6F107 /* Basic.fsh in Resources */ = {isa = PBXBuildFile; fileRef = 779F562819E4FE9E00A6F107 /* Basic.fsh */; };
|
||||
779F565819EAF66E00A6F107 /* alhelpers.c in Sources */ = {isa = PBXBuildFile; fileRef = 779F564719EAF66E00A6F107 /* alhelpers.c */; };
|
||||
779F565919EAF66E00A6F107 /* AY8910.c in Sources */ = {isa = PBXBuildFile; fileRef = 779F564919EAF66E00A6F107 /* AY8910.c */; };
|
||||
779F565A19EAF66E00A6F107 /* mockingboard.c in Sources */ = {isa = PBXBuildFile; fileRef = 779F564C19EAF66E00A6F107 /* mockingboard.c */; };
|
||||
779F565B19EAF66E00A6F107 /* soundcore-openal.c in Sources */ = {isa = PBXBuildFile; fileRef = 779F564F19EAF66E00A6F107 /* soundcore-openal.c */; };
|
||||
779F565C19EAF66E00A6F107 /* soundcore.c in Sources */ = {isa = PBXBuildFile; fileRef = 779F565119EAF66E00A6F107 /* soundcore.c */; };
|
||||
779F565D19EAF66E00A6F107 /* speaker.c in Sources */ = {isa = PBXBuildFile; fileRef = 779F565319EAF66E00A6F107 /* speaker.c */; };
|
||||
779F565E19EAF66E00A6F107 /* win-shim.c in Sources */ = {isa = PBXBuildFile; fileRef = 779F565619EAF66E00A6F107 /* win-shim.c */; };
|
||||
779F566019EAF6D000A6F107 /* OpenAL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 779F565F19EAF6D000A6F107 /* OpenAL.framework */; };
|
||||
77E1C0B319D72700004344E0 /* vectorUtil.c in Sources */ = {isa = PBXBuildFile; fileRef = 77E1C0A919D72700004344E0 /* vectorUtil.c */; };
|
||||
77E1C0B419D72700004344E0 /* sourceUtil.c in Sources */ = {isa = PBXBuildFile; fileRef = 77E1C0AB19D72700004344E0 /* sourceUtil.c */; };
|
||||
77E1C0B519D72700004344E0 /* modelUtil.c in Sources */ = {isa = PBXBuildFile; fileRef = 77E1C0AD19D72700004344E0 /* modelUtil.c */; };
|
||||
@ -205,6 +213,24 @@
|
||||
779F561B19D78B8200A6F107 /* renderer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = renderer.h; sourceTree = "<group>"; };
|
||||
779F562719E4FE9E00A6F107 /* Basic.vsh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; path = Basic.vsh; sourceTree = "<group>"; };
|
||||
779F562819E4FE9E00A6F107 /* Basic.fsh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; path = Basic.fsh; sourceTree = "<group>"; };
|
||||
779F564719EAF66E00A6F107 /* alhelpers.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = alhelpers.c; sourceTree = "<group>"; };
|
||||
779F564819EAF66E00A6F107 /* alhelpers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = alhelpers.h; sourceTree = "<group>"; };
|
||||
779F564919EAF66E00A6F107 /* AY8910.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = AY8910.c; sourceTree = "<group>"; };
|
||||
779F564A19EAF66E00A6F107 /* AY8910.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AY8910.h; sourceTree = "<group>"; };
|
||||
779F564B19EAF66E00A6F107 /* ds-shim.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "ds-shim.h"; sourceTree = "<group>"; };
|
||||
779F564C19EAF66E00A6F107 /* mockingboard.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mockingboard.c; sourceTree = "<group>"; };
|
||||
779F564D19EAF66E00A6F107 /* mockingboard.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mockingboard.h; sourceTree = "<group>"; };
|
||||
779F564E19EAF66E00A6F107 /* peripherals.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = peripherals.h; sourceTree = "<group>"; };
|
||||
779F564F19EAF66E00A6F107 /* soundcore-openal.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "soundcore-openal.c"; sourceTree = "<group>"; };
|
||||
779F565019EAF66E00A6F107 /* soundcore-openal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "soundcore-openal.h"; sourceTree = "<group>"; };
|
||||
779F565119EAF66E00A6F107 /* soundcore.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = soundcore.c; sourceTree = "<group>"; };
|
||||
779F565219EAF66E00A6F107 /* soundcore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = soundcore.h; sourceTree = "<group>"; };
|
||||
779F565319EAF66E00A6F107 /* speaker.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = speaker.c; sourceTree = "<group>"; };
|
||||
779F565419EAF66E00A6F107 /* speaker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = speaker.h; sourceTree = "<group>"; };
|
||||
779F565519EAF66E00A6F107 /* SSI263Phonemes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SSI263Phonemes.h; sourceTree = "<group>"; };
|
||||
779F565619EAF66E00A6F107 /* win-shim.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "win-shim.c"; sourceTree = "<group>"; };
|
||||
779F565719EAF66E00A6F107 /* win-shim.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "win-shim.h"; sourceTree = "<group>"; };
|
||||
779F565F19EAF6D000A6F107 /* OpenAL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenAL.framework; path = System/Library/Frameworks/OpenAL.framework; sourceTree = SDKROOT; };
|
||||
77E1C0A819D72700004344E0 /* vectorUtil.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = vectorUtil.h; path = video_util/vectorUtil.h; sourceTree = "<group>"; };
|
||||
77E1C0A919D72700004344E0 /* vectorUtil.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = vectorUtil.c; path = video_util/vectorUtil.c; sourceTree = "<group>"; };
|
||||
77E1C0AA19D72700004344E0 /* sourceUtil.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = sourceUtil.h; path = video_util/sourceUtil.h; sourceTree = "<group>"; };
|
||||
@ -230,6 +256,7 @@
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
779F566019EAF6D000A6F107 /* OpenAL.framework in Frameworks */,
|
||||
4ADC521A19E8CA4500186B36 /* libz.1.1.3.dylib in Frameworks */,
|
||||
4ADC521B19E8CA4500186B36 /* Cocoa.framework in Frameworks */,
|
||||
);
|
||||
@ -296,6 +323,7 @@
|
||||
773B3D0E1956885A0085CE5F /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
779F565F19EAF6D000A6F107 /* OpenAL.framework */,
|
||||
773B3DCA1956903D0085CE5F /* libz.1.1.3.dylib */,
|
||||
773B3D0F1956885A0085CE5F /* Cocoa.framework */,
|
||||
773B3D2E1956885A0085CE5F /* XCTest.framework */,
|
||||
@ -386,6 +414,7 @@
|
||||
773B3D4519568A570085CE5F /* src */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
779F564619EAF66E00A6F107 /* audio */,
|
||||
773B3D4719568A570085CE5F /* apple2.h */,
|
||||
773B3D5C19568A570085CE5F /* common.h */,
|
||||
773B3D5D19568A570085CE5F /* cpu-supp.c */,
|
||||
@ -469,6 +498,30 @@
|
||||
path = x86;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
779F564619EAF66E00A6F107 /* audio */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
779F564719EAF66E00A6F107 /* alhelpers.c */,
|
||||
779F564819EAF66E00A6F107 /* alhelpers.h */,
|
||||
779F564919EAF66E00A6F107 /* AY8910.c */,
|
||||
779F564A19EAF66E00A6F107 /* AY8910.h */,
|
||||
779F564B19EAF66E00A6F107 /* ds-shim.h */,
|
||||
779F564C19EAF66E00A6F107 /* mockingboard.c */,
|
||||
779F564D19EAF66E00A6F107 /* mockingboard.h */,
|
||||
779F564E19EAF66E00A6F107 /* peripherals.h */,
|
||||
779F564F19EAF66E00A6F107 /* soundcore-openal.c */,
|
||||
779F565019EAF66E00A6F107 /* soundcore-openal.h */,
|
||||
779F565119EAF66E00A6F107 /* soundcore.c */,
|
||||
779F565219EAF66E00A6F107 /* soundcore.h */,
|
||||
779F565319EAF66E00A6F107 /* speaker.c */,
|
||||
779F565419EAF66E00A6F107 /* speaker.h */,
|
||||
779F565519EAF66E00A6F107 /* SSI263Phonemes.h */,
|
||||
779F565619EAF66E00A6F107 /* win-shim.c */,
|
||||
779F565719EAF66E00A6F107 /* win-shim.h */,
|
||||
);
|
||||
path = audio;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
77E1C09E19D726B8004344E0 /* Shaders */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
@ -679,7 +732,7 @@
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "\"$SRCROOT/../src/x86/genglue\" \"$SRCROOT/../src/disk.c\" \"$SRCROOT/../src/misc.c\" \"$SRCROOT/../src/display.c\" \"$SRCROOT/../src/vm.c\" > \"$SRCROOT/../src/x86/glue.S\"";
|
||||
shellScript = "\"$SRCROOT/../src/x86/genglue\" \"$SRCROOT/../src/disk.c\" \"$SRCROOT/../src/misc.c\" \"$SRCROOT/../src/display.c\" \"$SRCROOT/../src/vm.c\" \"$SRCROOT/../src/audio/mockingboard.c\" > \"$SRCROOT/../src/x86/glue.S\"";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
773B3DC919568BF20085CE5F /* ShellScript */ = {
|
||||
@ -766,6 +819,8 @@
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
773B3DBF19568A570085CE5F /* cpu.S in Sources */,
|
||||
779F565D19EAF66E00A6F107 /* speaker.c in Sources */,
|
||||
779F565B19EAF66E00A6F107 /* soundcore-openal.c in Sources */,
|
||||
773B3DB019568A570085CE5F /* prefs.c in Sources */,
|
||||
773B3DA419568A570085CE5F /* display.c in Sources */,
|
||||
773B3DA319568A570085CE5F /* disk.c in Sources */,
|
||||
@ -778,17 +833,22 @@
|
||||
77E1C0B619D72700004344E0 /* matrixUtil.c in Sources */,
|
||||
77E1C0C519D7298F004344E0 /* EmulatorGLView.m in Sources */,
|
||||
773B3DAE19568A570085CE5F /* opcodes.c in Sources */,
|
||||
779F565C19EAF66E00A6F107 /* soundcore.c in Sources */,
|
||||
779DD827195764E200DF89E5 /* rom-shim.c in Sources */,
|
||||
773B3DC319568A570085CE5F /* zlib-helpers.c in Sources */,
|
||||
77E1C0B719D72700004344E0 /* imageUtil.m in Sources */,
|
||||
773B3DA219568A570085CE5F /* darwin-shim.c in Sources */,
|
||||
77E1C0B519D72700004344E0 /* modelUtil.c in Sources */,
|
||||
773B3DAC19568A570085CE5F /* debug.l in Sources */,
|
||||
779F565E19EAF66E00A6F107 /* win-shim.c in Sources */,
|
||||
779F565919EAF66E00A6F107 /* AY8910.c in Sources */,
|
||||
77E1C0C619D7298F004344E0 /* EmulatorFullscreenWindow.m in Sources */,
|
||||
773B3DA519568A570085CE5F /* font.c in Sources */,
|
||||
773B3DA019568A570085CE5F /* cpu-supp.c in Sources */,
|
||||
779F561C19D7929100A6F107 /* glvideo.c in Sources */,
|
||||
779F565A19EAF66E00A6F107 /* mockingboard.c in Sources */,
|
||||
77E1C0B419D72700004344E0 /* sourceUtil.c in Sources */,
|
||||
779F565819EAF66E00A6F107 /* alhelpers.c in Sources */,
|
||||
773B3DBE19568A570085CE5F /* vm.c in Sources */,
|
||||
773B3DC019568A570085CE5F /* darwin-glue.S in Sources */,
|
||||
773B3D1C1956885A0085CE5F /* main.m in Sources */,
|
||||
@ -1018,6 +1078,7 @@
|
||||
"APPLE2IX=1",
|
||||
"DEBUGGER=1",
|
||||
"KEYPAD_JOYSTICK=1",
|
||||
"AUDIO_ENABLED=1",
|
||||
);
|
||||
HEADER_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
@ -1044,6 +1105,7 @@
|
||||
"APPLE2IX=1",
|
||||
"DEBUGGER=1",
|
||||
"KEYPAD_JOYSTICK=1",
|
||||
"AUDIO_ENABLED=1",
|
||||
);
|
||||
HEADER_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
|
@ -28,9 +28,14 @@
|
||||
* finding an appropriate buffer format, and getting readable strings for
|
||||
* channel configs and sample types. */
|
||||
|
||||
#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 "common.h"
|
||||
#include "audio/alhelpers.h"
|
||||
@ -86,116 +91,3 @@ void CloseAL(void)
|
||||
alcDestroyContext(ctx);
|
||||
alcCloseDevice(device);
|
||||
}
|
||||
|
||||
const char *ChannelsName(ALenum chans)
|
||||
{
|
||||
switch(chans)
|
||||
{
|
||||
case AL_MONO_SOFT: return "Mono";
|
||||
case AL_STEREO_SOFT: return "Stereo";
|
||||
case AL_REAR_SOFT: return "Rear";
|
||||
case AL_QUAD_SOFT: return "Quadraphonic";
|
||||
case AL_5POINT1_SOFT: return "5.1 Surround";
|
||||
case AL_6POINT1_SOFT: return "6.1 Surround";
|
||||
case AL_7POINT1_SOFT: return "7.1 Surround";
|
||||
}
|
||||
return "Unknown Channels";
|
||||
}
|
||||
|
||||
const char *TypeName(ALenum type)
|
||||
{
|
||||
switch(type)
|
||||
{
|
||||
case AL_BYTE_SOFT: return "S8";
|
||||
case AL_UNSIGNED_BYTE_SOFT: return "U8";
|
||||
case AL_SHORT_SOFT: return "S16";
|
||||
case AL_UNSIGNED_SHORT_SOFT: return "U16";
|
||||
case AL_INT_SOFT: return "S32";
|
||||
case AL_UNSIGNED_INT_SOFT: return "U32";
|
||||
case AL_FLOAT_SOFT: return "Float32";
|
||||
case AL_DOUBLE_SOFT: return "Float64";
|
||||
}
|
||||
return "Unknown Type";
|
||||
}
|
||||
|
||||
const char *FormatName(ALenum format)
|
||||
{
|
||||
switch (format)
|
||||
{
|
||||
case AL_FORMAT_MONO8: return "MONO8";
|
||||
case AL_FORMAT_MONO16: return "MONO16";
|
||||
case AL_FORMAT_STEREO8: return "STEREO8";
|
||||
case AL_FORMAT_STEREO16: return "STEREO16";
|
||||
|
||||
case AL_FORMAT_QUAD8: return "QUAD8";
|
||||
case AL_FORMAT_QUAD16: return "QUAD16";
|
||||
case AL_FORMAT_QUAD32: return "QUAD32";
|
||||
case AL_FORMAT_REAR8: return "REAR8";
|
||||
case AL_FORMAT_REAR16: return "REAR16";
|
||||
case AL_FORMAT_REAR32: return "REAR32";
|
||||
case AL_FORMAT_51CHN8: return "51CHN8";
|
||||
case AL_FORMAT_51CHN16: return "51CHN16";
|
||||
case AL_FORMAT_51CHN32: return "51CHN32";
|
||||
case AL_FORMAT_61CHN8: return "61CHN8";
|
||||
case AL_FORMAT_61CHN16: return "61CHN16";
|
||||
case AL_FORMAT_61CHN32: return "61CHN32";
|
||||
case AL_FORMAT_71CHN8: return "71CHN8";
|
||||
case AL_FORMAT_71CHN16: return "71CHN16";
|
||||
case AL_FORMAT_71CHN32: return "71CHN32";
|
||||
case AL_FORMAT_WAVE_EXT: return "WAVE_EXT";
|
||||
case AL_FORMAT_IMA_ADPCM_MONO16_EXT: return "IMA_ADPCM_MONO16_EXT";
|
||||
case AL_FORMAT_IMA_ADPCM_STEREO16_EXT: return "IMA_ADPCM_STEREO16_EXT";
|
||||
case AL_FORMAT_VORBIS_EXT: return "VORBIS_EXT";
|
||||
case AL_FORMAT_MONO_FLOAT32: return "MONO_FLOAT32";
|
||||
case AL_FORMAT_STEREO_FLOAT32: return "STEREO_FLOAT32";
|
||||
case AL_FORMAT_MONO_DOUBLE_EXT: return "MONO_DOUBLE_EXT";
|
||||
case AL_FORMAT_STEREO_DOUBLE_EXT: return "STEREO_DOUBLE_EXT";
|
||||
case AL_FORMAT_MONO_MULAW_EXT: return "MONO_MULAW(_EXT)";
|
||||
//case AL_FORMAT_MONO_MULAW: return "MONO_MULAW";
|
||||
case AL_FORMAT_STEREO_MULAW_EXT: return "STEREO_MULAW(_EXT)";
|
||||
//case AL_FORMAT_STEREO_MULAW: return "STEREO_MULAW";
|
||||
case AL_FORMAT_QUAD8_LOKI: return "QUAD8_LOKI";
|
||||
case AL_FORMAT_QUAD16_LOKI: return "QUAD16_LOKI";
|
||||
case AL_FORMAT_QUAD_MULAW: return "QUAD_MULAW";
|
||||
case AL_FORMAT_REAR_MULAW: return "REAR_MULAW";
|
||||
case AL_FORMAT_51CHN_MULAW: return "51CHN_MULAW";
|
||||
case AL_FORMAT_61CHN_MULAW: return "61CHN_MULAW";
|
||||
case AL_FORMAT_71CHN_MULAW: return "71CHN_MULAW";
|
||||
case AL_FORMAT_MONO_IMA4: return "MONO_IMA4";
|
||||
case AL_FORMAT_STEREO_IMA4: return "STEREO_IMA4";
|
||||
}
|
||||
return "Unknown Format";
|
||||
}
|
||||
|
||||
ALsizei FramesToBytes(ALsizei size, ALenum channels, ALenum type)
|
||||
{
|
||||
switch(channels)
|
||||
{
|
||||
case AL_MONO_SOFT: size *= 1; break;
|
||||
case AL_STEREO_SOFT: size *= 2; break;
|
||||
case AL_REAR_SOFT: size *= 2; break;
|
||||
case AL_QUAD_SOFT: size *= 4; break;
|
||||
case AL_5POINT1_SOFT: size *= 6; break;
|
||||
case AL_6POINT1_SOFT: size *= 7; break;
|
||||
case AL_7POINT1_SOFT: size *= 8; break;
|
||||
}
|
||||
|
||||
switch(type)
|
||||
{
|
||||
case AL_BYTE_SOFT: size *= sizeof(ALbyte); break;
|
||||
case AL_UNSIGNED_BYTE_SOFT: size *= sizeof(ALubyte); break;
|
||||
case AL_SHORT_SOFT: size *= sizeof(ALshort); break;
|
||||
case AL_UNSIGNED_SHORT_SOFT: size *= sizeof(ALushort); break;
|
||||
case AL_INT_SOFT: size *= sizeof(ALint); break;
|
||||
case AL_UNSIGNED_INT_SOFT: size *= sizeof(ALuint); break;
|
||||
case AL_FLOAT_SOFT: size *= sizeof(ALfloat); break;
|
||||
case AL_DOUBLE_SOFT: size *= sizeof(ALdouble); break;
|
||||
}
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
ALsizei BytesToFrames(ALsizei size, ALenum channels, ALenum type)
|
||||
{
|
||||
return size / FramesToBytes(1, channels, type);
|
||||
}
|
||||
|
@ -12,23 +12,6 @@
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/* Some helper functions to get the name from the channel and type enums. */
|
||||
const char *ChannelsName(ALenum chans);
|
||||
const char *TypeName(ALenum type);
|
||||
const char *FormatName(ALenum format);
|
||||
|
||||
/* Helpers to convert frame counts and byte lengths. */
|
||||
ALsizei FramesToBytes(ALsizei size, ALenum channels, ALenum type);
|
||||
ALsizei BytesToFrames(ALsizei size, ALenum channels, ALenum type);
|
||||
|
||||
/* Loads samples into a buffer using the standard alBufferData call, but with a
|
||||
* LPALBUFFERSAMPLESSOFT-compatible prototype. Assumes internalformat is valid
|
||||
* for alBufferData, and that channels and type match it. */
|
||||
void AL_APIENTRY wrap_BufferSamples(ALuint buffer, ALuint samplerate,
|
||||
ALenum internalformat, ALsizei samples,
|
||||
ALenum channels, ALenum type,
|
||||
const ALvoid *data);
|
||||
|
||||
/* Easy device init/deinit functions. */
|
||||
ALCcontext* InitAL(void);
|
||||
void CloseAL(void);
|
||||
|
@ -133,6 +133,12 @@ typedef struct IDirectSoundBuffer {
|
||||
|
||||
#define DSSCL_NORMAL 0x00000001
|
||||
|
||||
#if defined(FAILED)
|
||||
#undef FAILED
|
||||
#endif
|
||||
#if defined(SUCCEEDED)
|
||||
#undef SUCCEEDED
|
||||
#endif
|
||||
static inline bool FAILED(HRESULT x) { return x != DS_OK; }
|
||||
static inline bool SUCCEEDED(HRESULT x) { return x == DS_OK; }
|
||||
|
||||
|
@ -14,9 +14,14 @@
|
||||
|
||||
#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
|
||||
|
||||
#undef DSBVOLUME_MIN
|
||||
#define DSBVOLUME_MIN 0
|
||||
|
@ -27,7 +27,9 @@ pthread_t CreateThread(void* unused_lpThreadAttributes, int unused_dwStackSize,
|
||||
bool SetThreadPriority(pthread_t thread, int unused_nPriority)
|
||||
{
|
||||
// assuming time critical ...
|
||||
|
||||
#if defined(__APPLE__)
|
||||
#warning possible FIXME possible TODO : set thread priority in Darwin/Mach ?
|
||||
#else
|
||||
int policy = sched_getscheduler(getpid());
|
||||
|
||||
int prio = 0;
|
||||
@ -43,12 +45,22 @@ bool SetThreadPriority(pthread_t thread, int unused_nPriority)
|
||||
ERRLOG("OOPS pthread_setschedprio");
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
bool GetExitCodeThread(pthread_t thread, unsigned long *lpExitCode)
|
||||
{
|
||||
#if defined(__APPLE__)
|
||||
int err = 0;
|
||||
if ( (err = pthread_join(thread, NULL)) ) {
|
||||
ERRLOG("OOPS pthread_join");
|
||||
}
|
||||
if (lpExitCode) {
|
||||
*lpExitCode = err;
|
||||
}
|
||||
#else
|
||||
if (pthread_tryjoin_np(thread, NULL))
|
||||
{
|
||||
if (lpExitCode)
|
||||
@ -60,6 +72,7 @@ bool GetExitCodeThread(pthread_t thread, unsigned long *lpExitCode)
|
||||
{
|
||||
*lpExitCode = 0;
|
||||
}
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -14,6 +14,10 @@
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#ifdef __APPLE__
|
||||
#import <MacTypes.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* This is mostly a shim for Windows-related stuff but also contains some AppleWin-isms
|
||||
*
|
||||
@ -22,13 +26,19 @@
|
||||
// 2013/09/19 - http://msdn.microsoft.com/en-us/library/windows/desktop/aa383751(v=vs.85).aspx
|
||||
|
||||
typedef unsigned long DWORD;
|
||||
#ifdef __APPLE__
|
||||
typedef UInt32 ULONG;
|
||||
typedef SInt32 HRESULT;
|
||||
typedef signed char BOOL;
|
||||
#else
|
||||
typedef unsigned long ULONG;
|
||||
typedef long LONG;
|
||||
typedef long HRESULT;
|
||||
typedef bool BOOL;
|
||||
#endif
|
||||
typedef long LONG;
|
||||
typedef unsigned int UINT;
|
||||
typedef uint32_t UINT32;
|
||||
typedef uint64_t UINT64;
|
||||
typedef bool BOOL;
|
||||
typedef char TCHAR;
|
||||
typedef uint8_t UCHAR;
|
||||
typedef int16_t INT16;
|
||||
@ -45,7 +55,9 @@ typedef DWORD *LPDWORD;
|
||||
|
||||
typedef char *GUID; // HACK
|
||||
typedef GUID IID;
|
||||
#if !defined(__APPLE__)
|
||||
typedef IID* REFIID;
|
||||
#endif
|
||||
|
||||
typedef GUID *LPGUID;
|
||||
typedef char *LPCSTR;
|
||||
@ -67,9 +79,12 @@ typedef void* HANDLE;
|
||||
#define CALLBACK
|
||||
#define FAR
|
||||
|
||||
typedef bool BOOL;
|
||||
#if !defined(TRUE)
|
||||
#define TRUE true
|
||||
#endif
|
||||
#if !defined(FALSE)
|
||||
#define FALSE false
|
||||
#endif
|
||||
|
||||
extern FILE *g_fh;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user