Fix loading OGG files with updated SDL_Sound

This commit is contained in:
Struma 2020-11-21 22:37:07 -05:00 committed by ゾロアーク
parent c4e110881d
commit 65fc1f3f50
4 changed files with 16 additions and 15 deletions

View file

@ -22,11 +22,8 @@
#ifndef ALUTIL_H
#define ALUTIL_H
#ifdef MKXPZ_BUILD_XCODE
#include <OpenAL/al.h>
#else
#include <al.h>
#endif
#include <alext.h>
#include <SDL_audio.h>
#include <assert.h>
@ -210,9 +207,13 @@ inline uint8_t formatSampleSize(int sdlFormat)
case AUDIO_S16LSB :
case AUDIO_S16MSB :
return 2;
case AUDIO_F32LSB :
case AUDIO_F32MSB :
return 4;
default :
assert(!"Unhandled sample format");
assert(!"Unhandled sample format");
}
return 0;
@ -234,6 +235,12 @@ inline ALenum chooseALFormat(int sampleSize, int channelCount)
case 1 : return AL_FORMAT_MONO16;
case 2 : return AL_FORMAT_STEREO16;
}
case 4 :
switch (channelCount)
{
case 1 : return AL_FORMAT_MONO_FLOAT32;
case 2 : return AL_FORMAT_STEREO_FLOAT32;
}
default :
assert(!"Unhandled sample size / channel count");
}

View file

@ -30,16 +30,10 @@
#include <SDL_rect.h>
#ifdef MKXPZ_BUILD_XCODE
#include <OpenAL/al.h>
#include <OpenAL/alc.h>
#else
#include <al.h>
#include <alc.h>
#ifndef USE_MAC_OPENAL
#include <alext.h>
#endif
#endif
#include "sharedstate.h"
#include "graphics.h"

View file

@ -20,13 +20,13 @@
*/
#ifdef MKXPZ_BUILD_XCODE
#include <OpenAL/alc.h>
#include "CocoaHelpers.hpp"
#else
#include <alc.h>
#import "icon.png.xxd"
#endif
#include <alc.h>
#import <SDL.h>
#import <SDL_image.h>
#import <SDL_sound.h>

View file

@ -5,7 +5,7 @@ vorbisfile = dependency('vorbisfile', static: build_static)
sdl2 = dependency('sdl2', static: build_static)
sdl2_ttf = dependency('SDL2_ttf', static: build_static)
sdl2_image = dependency('SDL2_image', static: build_static)
openal = dependency('openal', static: build_static)
openal = dependency('openal', static: build_static, method: 'pkg-config')
zlib = dependency('zlib', static: build_static)