load wav with SDL + fix building and linking

main
cosmonaut 2021-11-17 22:10:31 -08:00
parent 6d8c80064c
commit c6e3879a67
4 changed files with 83 additions and 8038 deletions

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -26,8 +26,6 @@
#include "SDL.h" #include "SDL.h"
#define DISABLE_XNASONG
#include "FAudioGMS.h" #include "FAudioGMS.h"
#include "F3DAudio.h" #include "F3DAudio.h"
@ -36,14 +34,6 @@
#include "FAudio.h" #include "FAudio.h"
#define DR_WAV_IMPLEMENTATION
#define DRWAV_MALLOC(sz) SDL_malloc((sz))
#define DRWAV_REALLOC(p, sz) SDL_realloc((p), (sz))
#define DRWAV_FREE(p) SDL_free((p))
#define DRWAV_COPY_MEMORY(dst, src, sz) SDL_memcpy((dst), (src), (sz))
#define DRWAV_ZERO_MEMORY(p, sz) SDL_memset((p), 0, (sz))
#include "../lib/dr_wav.h"
/* stb vorbis defines. this is kind of a mess but oh well */ /* stb vorbis defines. this is kind of a mess but oh well */
#include "../lib/FAudio/src/FAudio_internal.h" #include "../lib/FAudio/src/FAudio_internal.h"
@ -102,12 +92,9 @@
#define STB_VORBIS_NO_INTEGER_CONVERSION 1 #define STB_VORBIS_NO_INTEGER_CONVERSION 1
#include "../lib/FAudio/src/stb_vorbis.h" #include "../lib/FAudio/src/stb_vorbis.h"
#include <stdio.h>
static inline void Log(char *string) static inline void Log(char *string)
{ {
printf("%s\n", string); SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "%s\n", string);
fflush(stdout);
} }
typedef struct IdStack typedef struct IdStack
@ -182,9 +169,8 @@ typedef struct FAudioGMS_Voice
typedef struct FAudioGMS_StaticSound typedef struct FAudioGMS_StaticSound
{ {
uint32_t id; uint32_t id;
SDL_AudioSpec spec;
FAudioBuffer buffer; FAudioBuffer buffer;
uint32_t channels;
uint32_t samplesPerSecond;
uint32_t lengthInSeconds; uint32_t lengthInSeconds;
} FAudioGMS_StaticSound; } FAudioGMS_StaticSound;
@ -280,8 +266,14 @@ typedef struct FAudioGMS_Device
static FAudioGMS_Device *device = NULL; static FAudioGMS_Device *device = NULL;
/* Game Maker doesn't let us control execution order on clean up so we have this /* Game Maker doesn't let us control execution order on clean up so we have these
* stupid macro to help us not crash on exit */ * stupid macros to help us not crash on exit */
#define RETURN_ON_NULL_DEVICE_VOID \
if (device == NULL) \
{ \
return; \
}
#define RETURN_ON_NULL_DEVICE(x) \ #define RETURN_ON_NULL_DEVICE(x) \
if (device == NULL) \ if (device == NULL) \
{ \ { \
@ -530,41 +522,30 @@ void FAudioGMS_Init(double spatialDistanceScale, double timestep)
device->timestep = timestep; device->timestep = timestep;
Log("FAudio initialized successfully!"); Log("FAudio initialized successfully!");
printf("Device: %ls\n", device->deviceDetails.DisplayName);
fflush(stdout);
} }
double FAudioGMS_StaticSound_LoadWAV(char *filePath) double FAudioGMS_StaticSound_LoadWAV(char *filePath)
{ {
RETURN_ON_NULL_DEVICE(-1.0) RETURN_ON_NULL_DEVICE(-1.0)
drwav_uint64 frameCount;
FAudioGMS_StaticSound *sound = SDL_malloc(sizeof(FAudioGMS_StaticSound)); FAudioGMS_StaticSound *sound = SDL_malloc(sizeof(FAudioGMS_StaticSound));
float *pSampleData = drwav_open_file_and_read_pcm_frames_f32(
filePath, if (SDL_LoadWAV(filePath, &sound->spec, &sound->buffer.pAudioData, &sound->buffer.AudioBytes) == NULL)
&sound->channels,
&sound->samplesPerSecond,
&frameCount,
NULL);
if (pSampleData == NULL)
{ {
Log("Error opening WAV file: "); Log("Error opening WAV file: ");
Log(filePath); Log(filePath);
SDL_free(sound);
return -1; return -1;
} }
sound->buffer.AudioBytes = (uint32_t)(frameCount * sound->channels * sizeof(float));
sound->buffer.Flags = 0; sound->buffer.Flags = 0;
sound->buffer.LoopBegin = 0; sound->buffer.LoopBegin = 0;
sound->buffer.LoopCount = 0; sound->buffer.LoopCount = 0;
sound->buffer.LoopLength = 0; sound->buffer.LoopLength = 0;
sound->buffer.PlayBegin = 0; sound->buffer.PlayBegin = 0;
sound->buffer.PlayLength = frameCount; sound->buffer.PlayLength = sound->buffer.AudioBytes / (uint16_t)(sound->spec.channels * SDL_AUDIO_BITSIZE(sound->spec.format) / 8);
sound->buffer.pAudioData = (uint8_t *)pSampleData;
sound->buffer.pContext = NULL; sound->buffer.pContext = NULL;
sound->lengthInSeconds = frameCount / sound->samplesPerSecond; sound->lengthInSeconds = sound->buffer.PlayLength / sound->spec.freq;
if (device->staticSoundIndexStack.count > 0) if (device->staticSoundIndexStack.count > 0)
{ {
@ -704,6 +685,7 @@ static void FAudioGMS_INTERNAL_SoundInstance_SetVolume(
static FAudioGMS_SoundInstance *FAudioGMS_INTERNAL_SoundInstance_Init( static FAudioGMS_SoundInstance *FAudioGMS_INTERNAL_SoundInstance_Init(
uint32_t channelCount, uint32_t channelCount,
uint32_t samplesPerSecond, uint32_t samplesPerSecond,
uint16_t bitSize,
uint8_t isStatic) uint8_t isStatic)
{ {
FAudioGMS_SoundInstance *instance = SDL_malloc(sizeof(FAudioGMS_SoundInstance)); FAudioGMS_SoundInstance *instance = SDL_malloc(sizeof(FAudioGMS_SoundInstance));
@ -717,12 +699,24 @@ static FAudioGMS_SoundInstance *FAudioGMS_INTERNAL_SoundInstance_Init(
instance->destroyTimerActive = 0; instance->destroyTimerActive = 0;
instance->isGlobalPaused = 0; instance->isGlobalPaused = 0;
instance->format.wFormatTag = FAUDIO_FORMAT_IEEE_FLOAT; if (isStatic)
instance->format.wBitsPerSample = 32; {
instance->format.wFormatTag = FAUDIO_FORMAT_PCM;
instance->format.wBitsPerSample = bitSize;
instance->format.nChannels = channelCount; instance->format.nChannels = channelCount;
instance->format.nBlockAlign = (uint16_t)(4 * channelCount); instance->format.nBlockAlign = (uint16_t)(channelCount * instance->format.wBitsPerSample / 8);
instance->format.nSamplesPerSec = samplesPerSecond; instance->format.nSamplesPerSec = samplesPerSecond;
instance->format.nAvgBytesPerSec = instance->format.nBlockAlign * samplesPerSecond; instance->format.nAvgBytesPerSec = instance->format.nBlockAlign * samplesPerSecond;
}
else
{
instance->format.wFormatTag = FAUDIO_FORMAT_IEEE_FLOAT;
instance->format.wBitsPerSample = bitSize;
instance->format.nChannels = channelCount;
instance->format.nBlockAlign = (uint16_t)(channelCount * instance->format.wBitsPerSample / 8);
instance->format.nSamplesPerSec = samplesPerSecond;
instance->format.nAvgBytesPerSec = instance->format.nBlockAlign * samplesPerSecond;
}
instance->voice.sends.SendCount = 1; instance->voice.sends.SendCount = 1;
instance->voice.sends.pSends = SDL_malloc(sizeof(FAudioSendDescriptor)); instance->voice.sends.pSends = SDL_malloc(sizeof(FAudioSendDescriptor));
@ -806,8 +800,9 @@ static FAudioGMS_SoundInstance *FAudioGMS_INTERNAL_SoundInstance_CreateFromStati
FAudioGMS_StaticSound *staticSound) FAudioGMS_StaticSound *staticSound)
{ {
FAudioGMS_SoundInstance *instance = FAudioGMS_INTERNAL_SoundInstance_Init( FAudioGMS_SoundInstance *instance = FAudioGMS_INTERNAL_SoundInstance_Init(
staticSound->channels, staticSound->spec.channels,
staticSound->samplesPerSecond, staticSound->spec.freq,
SDL_AUDIO_BITSIZE(staticSound->spec.format),
1); 1);
instance->isStatic = 1; instance->isStatic = 1;
@ -978,7 +973,7 @@ static void FAudioGMS_INTERNAL_Apply3D(FAudioGMS_SoundInstance *instance)
static void FAudioGMS_INTERNAL_SoundInstance_AddBuffer(FAudioGMS_SoundInstance *instance) static void FAudioGMS_INTERNAL_SoundInstance_AddBuffer(FAudioGMS_SoundInstance *instance)
{ {
uint32_t defaultRequestedSampleCount = instance->format.nSamplesPerSec / 4; uint32_t defaultRequestedSampleCount = instance->format.nSamplesPerSec / 10; /* FIXME: make this configurable */
uint32_t requestedSampleCount = defaultRequestedSampleCount; uint32_t requestedSampleCount = defaultRequestedSampleCount;
if (instance->playLength != 0) if (instance->playLength != 0)
@ -1053,7 +1048,7 @@ double FAudioGMS_StreamingSound_LoadOGG(char *filePath)
stb_vorbis_info info = stb_vorbis_get_info(fileHandle); stb_vorbis_info info = stb_vorbis_get_info(fileHandle);
FAudioGMS_SoundInstance *instance = FAudioGMS_SoundInstance *instance =
FAudioGMS_INTERNAL_SoundInstance_Init(info.channels, info.sample_rate, 0); FAudioGMS_INTERNAL_SoundInstance_Init(info.channels, info.sample_rate, 32, 0);
instance->soundData.streamingSound.fileHandle = fileHandle; instance->soundData.streamingSound.fileHandle = fileHandle;
instance->soundData.streamingSound.info = info; instance->soundData.streamingSound.info = info;
@ -1165,7 +1160,7 @@ static void FAudioGMS_INTERNAL_SoundInstance_Play(FAudioGMS_SoundInstance *insta
void FAudioGMS_SoundInstance_Play(double soundInstanceID) void FAudioGMS_SoundInstance_Play(double soundInstanceID)
{ {
RETURN_ON_NULL_DEVICE() RETURN_ON_NULL_DEVICE_VOID
FAudioGMS_SoundInstance *instance = FAudioGMS_SoundInstance *instance =
FAudioGMS_INTERNAL_LookupSoundInstance((uint32_t)soundInstanceID); FAudioGMS_INTERNAL_LookupSoundInstance((uint32_t)soundInstanceID);
@ -1197,7 +1192,7 @@ static void FAudioGMS_INTERNAL_SoundInstance_Pause(FAudioGMS_SoundInstance *inst
void FAudioGMS_SoundInstance_Pause(double soundInstanceID) void FAudioGMS_SoundInstance_Pause(double soundInstanceID)
{ {
RETURN_ON_NULL_DEVICE() RETURN_ON_NULL_DEVICE_VOID
FAudioGMS_SoundInstance *instance = FAudioGMS_SoundInstance *instance =
FAudioGMS_INTERNAL_LookupSoundInstance((uint32_t)soundInstanceID); FAudioGMS_INTERNAL_LookupSoundInstance((uint32_t)soundInstanceID);
FAudioGMS_INTERNAL_SoundInstance_Pause(instance); FAudioGMS_INTERNAL_SoundInstance_Pause(instance);
@ -1233,7 +1228,7 @@ static void FAudioGMS_INTERNAL_SoundInstance_Stop(FAudioGMS_SoundInstance *insta
void FAudioGMS_SoundInstance_Stop(double soundInstanceID) void FAudioGMS_SoundInstance_Stop(double soundInstanceID)
{ {
RETURN_ON_NULL_DEVICE() RETURN_ON_NULL_DEVICE_VOID
FAudioGMS_SoundInstance *instance = FAudioGMS_SoundInstance *instance =
FAudioGMS_INTERNAL_LookupSoundInstance((uint32_t)soundInstanceID); FAudioGMS_INTERNAL_LookupSoundInstance((uint32_t)soundInstanceID);
FAudioGMS_INTERNAL_SoundInstance_Stop(instance); FAudioGMS_INTERNAL_SoundInstance_Stop(instance);
@ -1241,7 +1236,7 @@ void FAudioGMS_SoundInstance_Stop(double soundInstanceID)
void FAudioGMS_SoundInstance_SetLoop(double soundInstanceID, double loop) void FAudioGMS_SoundInstance_SetLoop(double soundInstanceID, double loop)
{ {
RETURN_ON_NULL_DEVICE() RETURN_ON_NULL_DEVICE_VOID
FAudioGMS_SoundInstance *instance = FAudioGMS_SoundInstance *instance =
FAudioGMS_INTERNAL_LookupSoundInstance((uint32_t)soundInstanceID); FAudioGMS_INTERNAL_LookupSoundInstance((uint32_t)soundInstanceID);
@ -1261,7 +1256,7 @@ void FAudioGMS_SoundInstance_SetLoop(double soundInstanceID, double loop)
void FAudioGMS_SoundInstance_SetPan(double soundInstanceID, double pan) void FAudioGMS_SoundInstance_SetPan(double soundInstanceID, double pan)
{ {
RETURN_ON_NULL_DEVICE() RETURN_ON_NULL_DEVICE_VOID
FAudioGMS_SoundInstance *instance = FAudioGMS_SoundInstance *instance =
FAudioGMS_INTERNAL_LookupSoundInstance((uint32_t)soundInstanceID); FAudioGMS_INTERNAL_LookupSoundInstance((uint32_t)soundInstanceID);
@ -1273,7 +1268,7 @@ void FAudioGMS_SoundInstance_SetPan(double soundInstanceID, double pan)
void FAudioGMS_SoundInstance_SetPitch(double soundInstanceID, double pitch) void FAudioGMS_SoundInstance_SetPitch(double soundInstanceID, double pitch)
{ {
RETURN_ON_NULL_DEVICE() RETURN_ON_NULL_DEVICE_VOID
FAudioGMS_SoundInstance *instance = FAudioGMS_SoundInstance *instance =
FAudioGMS_INTERNAL_LookupSoundInstance((uint32_t)soundInstanceID); FAudioGMS_INTERNAL_LookupSoundInstance((uint32_t)soundInstanceID);
@ -1285,7 +1280,7 @@ void FAudioGMS_SoundInstance_SetPitch(double soundInstanceID, double pitch)
void FAudioGMS_SoundInstance_SetVolume(double soundInstanceID, double volume) void FAudioGMS_SoundInstance_SetVolume(double soundInstanceID, double volume)
{ {
RETURN_ON_NULL_DEVICE() RETURN_ON_NULL_DEVICE_VOID
FAudioGMS_SoundInstance *instance = FAudioGMS_SoundInstance *instance =
FAudioGMS_INTERNAL_LookupSoundInstance((uint32_t)soundInstanceID); FAudioGMS_INTERNAL_LookupSoundInstance((uint32_t)soundInstanceID);
@ -1298,7 +1293,7 @@ void FAudioGMS_SoundInstance_SetVolume(double soundInstanceID, double volume)
void FAudioGMS_SoundInstance_Set3DPosition(double soundInstanceID, double x, double y, double z) void FAudioGMS_SoundInstance_Set3DPosition(double soundInstanceID, double x, double y, double z)
{ {
RETURN_ON_NULL_DEVICE() RETURN_ON_NULL_DEVICE_VOID
FAudioGMS_SoundInstance *instance = FAudioGMS_SoundInstance *instance =
FAudioGMS_INTERNAL_LookupSoundInstance((uint32_t)soundInstanceID); FAudioGMS_INTERNAL_LookupSoundInstance((uint32_t)soundInstanceID);
@ -1325,7 +1320,7 @@ void FAudioGMS_SoundInstance_Set3DVelocity(
double yVelocity, double yVelocity,
double zVelocity) double zVelocity)
{ {
RETURN_ON_NULL_DEVICE() RETURN_ON_NULL_DEVICE_VOID
FAudioGMS_SoundInstance *instance = FAudioGMS_SoundInstance *instance =
FAudioGMS_INTERNAL_LookupSoundInstance((uint32_t)soundInstanceID); FAudioGMS_INTERNAL_LookupSoundInstance((uint32_t)soundInstanceID);
@ -1348,17 +1343,17 @@ void FAudioGMS_SoundInstance_SetTrackPositionInSeconds(
double soundInstanceID, double soundInstanceID,
double trackPositionInSeconds) double trackPositionInSeconds)
{ {
RETURN_ON_NULL_DEVICE() RETURN_ON_NULL_DEVICE_VOID
FAudioGMS_SoundInstance *instance = FAudioGMS_SoundInstance *instance =
FAudioGMS_INTERNAL_LookupSoundInstance((uint32_t)soundInstanceID); FAudioGMS_INTERNAL_LookupSoundInstance((uint32_t)soundInstanceID);
if (instance != NULL) if (instance != NULL)
{ {
uint32_t sampleFrame = uint32_t sampleFrame =
instance->soundData.staticSound->samplesPerSecond * trackPositionInSeconds; instance->soundData.staticSound->spec.freq * trackPositionInSeconds;
FAudioGMS_SoundState currentState = instance->soundState; FAudioGMS_SoundState currentState = instance->soundState;
if (currentState == SoundState_Playing) if (currentState == SoundState_Playing || !instance->isStatic)
{ {
FAudioSourceVoice_Stop(instance->voice.handle, 0, 0); FAudioSourceVoice_Stop(instance->voice.handle, 0, 0);
FAudioSourceVoice_FlushSourceBuffers(instance->voice.handle); FAudioSourceVoice_FlushSourceBuffers(instance->voice.handle);
@ -1406,7 +1401,7 @@ void FAudioGMS_SoundInstance_SetPlayRegion(
double startInMilliseconds, double startInMilliseconds,
double endInMilliseconds) double endInMilliseconds)
{ {
RETURN_ON_NULL_DEVICE() RETURN_ON_NULL_DEVICE_VOID
FAudioGMS_SoundInstance *instance = FAudioGMS_SoundInstance *instance =
FAudioGMS_INTERNAL_LookupSoundInstance((uint32_t)soundInstanceID); FAudioGMS_INTERNAL_LookupSoundInstance((uint32_t)soundInstanceID);
@ -1462,7 +1457,7 @@ void FAudioGMS_SoundInstance_SetVolumeOverTime(
double volume, double volume,
double milliseconds) double milliseconds)
{ {
RETURN_ON_NULL_DEVICE() RETURN_ON_NULL_DEVICE_VOID
FAudioGMS_SoundInstance *instance = FAudioGMS_SoundInstance *instance =
FAudioGMS_INTERNAL_LookupSoundInstance((uint32_t)soundInstanceID); FAudioGMS_INTERNAL_LookupSoundInstance((uint32_t)soundInstanceID);
@ -1554,7 +1549,7 @@ double FAudioGMS_SoundInstance_GetTrackPositionInSeconds(double soundInstanceID)
void FAudioGMS_SetListenerPosition(double x, double y, double z) void FAudioGMS_SetListenerPosition(double x, double y, double z)
{ {
RETURN_ON_NULL_DEVICE() RETURN_ON_NULL_DEVICE_VOID
device->listener.Position.x = x; device->listener.Position.x = x;
device->listener.Position.y = y; device->listener.Position.y = y;
device->listener.Position.z = z; device->listener.Position.z = z;
@ -1562,7 +1557,7 @@ void FAudioGMS_SetListenerPosition(double x, double y, double z)
void FAudioGMS_SetListenerVelocity(double xVelocity, double yVelocity, double zVelocity) void FAudioGMS_SetListenerVelocity(double xVelocity, double yVelocity, double zVelocity)
{ {
RETURN_ON_NULL_DEVICE() RETURN_ON_NULL_DEVICE_VOID
device->listener.Velocity.x = xVelocity; device->listener.Velocity.x = xVelocity;
device->listener.Velocity.y = yVelocity; device->listener.Velocity.y = yVelocity;
device->listener.Velocity.z = zVelocity; device->listener.Velocity.z = zVelocity;
@ -1595,7 +1590,7 @@ static void FAudioGMS_INTERNAL_SoundInstance_Destroy(FAudioGMS_SoundInstance *in
void FAudioGMS_SoundInstance_Destroy(double soundInstanceID) void FAudioGMS_SoundInstance_Destroy(double soundInstanceID)
{ {
RETURN_ON_NULL_DEVICE() RETURN_ON_NULL_DEVICE_VOID
FAudioGMS_SoundInstance *instance = FAudioGMS_SoundInstance *instance =
FAudioGMS_INTERNAL_LookupSoundInstance((uint32_t)soundInstanceID); FAudioGMS_INTERNAL_LookupSoundInstance((uint32_t)soundInstanceID);
@ -1607,7 +1602,7 @@ void FAudioGMS_SoundInstance_Destroy(double soundInstanceID)
void FAudioGMS_SoundInstance_DestroyWhenFinished(double soundInstanceID) void FAudioGMS_SoundInstance_DestroyWhenFinished(double soundInstanceID)
{ {
RETURN_ON_NULL_DEVICE() RETURN_ON_NULL_DEVICE_VOID
FAudioGMS_SoundInstance *instance = FAudioGMS_SoundInstance *instance =
FAudioGMS_INTERNAL_LookupSoundInstance((uint32_t)soundInstanceID); FAudioGMS_INTERNAL_LookupSoundInstance((uint32_t)soundInstanceID);
@ -1624,14 +1619,14 @@ static void FAudioGMS_INTERNAL_StaticSound_Destroy(FAudioGMS_StaticSound *sound)
{ {
device->staticSounds[sound->id] = NULL; device->staticSounds[sound->id] = NULL;
IdStack_Push(&device->staticSoundIndexStack, sound->id); IdStack_Push(&device->staticSoundIndexStack, sound->id);
SDL_free((void *)sound->buffer.pAudioData); SDL_FreeWAV(sound->buffer.pAudioData);
SDL_free(sound); SDL_free(sound);
} }
} }
void FAudioGMS_StaticSound_Destroy(double staticSoundID) void FAudioGMS_StaticSound_Destroy(double staticSoundID)
{ {
RETURN_ON_NULL_DEVICE() RETURN_ON_NULL_DEVICE_VOID
FAudioGMS_StaticSound *sound = FAudioGMS_INTERNAL_LookupStaticSound((uint32_t)staticSoundID); FAudioGMS_StaticSound *sound = FAudioGMS_INTERNAL_LookupStaticSound((uint32_t)staticSoundID);
FAudioGMS_INTERNAL_StaticSound_Destroy(sound); FAudioGMS_INTERNAL_StaticSound_Destroy(sound);
} }
@ -1737,7 +1732,7 @@ static void FAudioGMS_INTERNAL_EffectChain_AddReverb(
void FAudioGMS_EffectChain_AddDefaultReverb(double effectChainID) void FAudioGMS_EffectChain_AddDefaultReverb(double effectChainID)
{ {
RETURN_ON_NULL_DEVICE() RETURN_ON_NULL_DEVICE_VOID
FAudioGMS_EffectChain *effectChain = FAudioGMS_EffectChain *effectChain =
FAudioGMS_INTERNAL_LookupEffectChain((uint32_t)effectChainID); FAudioGMS_INTERNAL_LookupEffectChain((uint32_t)effectChainID);
@ -1790,7 +1785,7 @@ void FAudioGMS_EffectChain_AddReverb(
double density, double density,
double roomSize) double roomSize)
{ {
RETURN_ON_NULL_DEVICE() RETURN_ON_NULL_DEVICE_VOID
FAudioGMS_EffectChain *effectChain = FAudioGMS_EffectChain *effectChain =
FAudioGMS_INTERNAL_LookupEffectChain((uint32_t)effectChainID); FAudioGMS_INTERNAL_LookupEffectChain((uint32_t)effectChainID);
@ -1853,7 +1848,7 @@ static void FAudioGMS_INTERNAL_Voice_SetEffectGain(FAudioGMS_Voice *voice, float
void FAudioGMS_SoundInstance_SetEffectGain(double soundInstanceID, double effectGain) void FAudioGMS_SoundInstance_SetEffectGain(double soundInstanceID, double effectGain)
{ {
RETURN_ON_NULL_DEVICE() RETURN_ON_NULL_DEVICE_VOID
FAudioGMS_SoundInstance *instance = FAudioGMS_SoundInstance *instance =
FAudioGMS_INTERNAL_LookupSoundInstance((uint32_t)soundInstanceID); FAudioGMS_INTERNAL_LookupSoundInstance((uint32_t)soundInstanceID);
@ -1900,7 +1895,7 @@ void FAudioGMS_SoundInstance_SetEffectChain(
double effectChainID, double effectChainID,
double effectGain) double effectGain)
{ {
RETURN_ON_NULL_DEVICE() RETURN_ON_NULL_DEVICE_VOID
FAudioGMS_SoundInstance *instance = FAudioGMS_SoundInstance *instance =
FAudioGMS_INTERNAL_LookupSoundInstance((uint32_t)soundInstanceID); FAudioGMS_INTERNAL_LookupSoundInstance((uint32_t)soundInstanceID);
FAudioGMS_EffectChain *effectChain = FAudioGMS_EffectChain *effectChain =
@ -1916,7 +1911,7 @@ void FAudioGMS_SoundInstance_SetEffectChain(
void FAudioGMS_SetMasteringEffectChain(double effectChainID, double effectGain) void FAudioGMS_SetMasteringEffectChain(double effectChainID, double effectGain)
{ {
RETURN_ON_NULL_DEVICE() RETURN_ON_NULL_DEVICE_VOID
FAudioGMS_EffectChain *effectChain = FAudioGMS_EffectChain *effectChain =
FAudioGMS_INTERNAL_LookupEffectChain((uint32_t)effectChainID); FAudioGMS_INTERNAL_LookupEffectChain((uint32_t)effectChainID);
@ -1928,7 +1923,7 @@ void FAudioGMS_SetMasteringEffectChain(double effectChainID, double effectGain)
void FAudioGMS_SetMasteringEffectGain(double effectGain) void FAudioGMS_SetMasteringEffectGain(double effectGain)
{ {
RETURN_ON_NULL_DEVICE() RETURN_ON_NULL_DEVICE_VOID
if (device->fauxMasteringVoice.effectChainAttached) if (device->fauxMasteringVoice.effectChainAttached)
{ {
FAudioGMS_INTERNAL_Voice_SetEffectGain(&device->fauxMasteringVoice, effectGain); FAudioGMS_INTERNAL_Voice_SetEffectGain(&device->fauxMasteringVoice, effectGain);
@ -1951,7 +1946,7 @@ static void FAudioGMS_INTERNAL_EffectChain_Destroy(FAudioGMS_EffectChain *effect
void FAudioGMS_EffectChain_Destroy(double effectChainID) void FAudioGMS_EffectChain_Destroy(double effectChainID)
{ {
RETURN_ON_NULL_DEVICE() RETURN_ON_NULL_DEVICE_VOID
FAudioGMS_EffectChain *effectChain = FAudioGMS_EffectChain *effectChain =
FAudioGMS_INTERNAL_LookupEffectChain((uint32_t)effectChainID); FAudioGMS_INTERNAL_LookupEffectChain((uint32_t)effectChainID);
@ -1963,7 +1958,7 @@ void FAudioGMS_EffectChain_Destroy(double effectChainID)
void FAudioGMS_Update() void FAudioGMS_Update()
{ {
RETURN_ON_NULL_DEVICE() RETURN_ON_NULL_DEVICE_VOID
uint32_t i; uint32_t i;
for (i = 0; i < device->soundInstanceCount; i += 1) for (i = 0; i < device->soundInstanceCount; i += 1)
@ -2019,7 +2014,7 @@ void FAudioGMS_Update()
void FAudioGMS_PauseAll() void FAudioGMS_PauseAll()
{ {
RETURN_ON_NULL_DEVICE() RETURN_ON_NULL_DEVICE_VOID
uint32_t i; uint32_t i;
for (i = 0; i < device->soundInstanceCount; i += 1) for (i = 0; i < device->soundInstanceCount; i += 1)
@ -2035,7 +2030,7 @@ void FAudioGMS_PauseAll()
void FAudioGMS_ResumeAll() void FAudioGMS_ResumeAll()
{ {
RETURN_ON_NULL_DEVICE() RETURN_ON_NULL_DEVICE_VOID
uint32_t i; uint32_t i;
for (i = 0; i < device->soundInstanceCount; i += 1) for (i = 0; i < device->soundInstanceCount; i += 1)
@ -2051,7 +2046,7 @@ void FAudioGMS_ResumeAll()
void FAudioGMS_StopAll() void FAudioGMS_StopAll()
{ {
RETURN_ON_NULL_DEVICE() RETURN_ON_NULL_DEVICE_VOID
uint32_t i; uint32_t i;
for (i = 0; i < device->soundInstanceCount; i += 1) for (i = 0; i < device->soundInstanceCount; i += 1)
@ -2062,7 +2057,7 @@ void FAudioGMS_StopAll()
void FAudioGMS_Destroy() void FAudioGMS_Destroy()
{ {
RETURN_ON_NULL_DEVICE() RETURN_ON_NULL_DEVICE_VOID
uint32_t i; uint32_t i;
for (i = 0; i < device->soundInstanceCount; i += 1) for (i = 0; i < device->soundInstanceCount; i += 1)

View File

@ -46,6 +46,7 @@
</PropertyGroup> </PropertyGroup>
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<PlatformToolset>v142</PlatformToolset> <PlatformToolset>v142</PlatformToolset>
<UseOfMfc>false</UseOfMfc>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings"> <ImportGroup Label="ExtensionSettings">
@ -89,20 +90,23 @@
<ClCompile> <ClCompile>
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization> <Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking> <FunctionLevelLinking>false</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions> <IntrinsicFunctions>true</IntrinsicFunctions>
<RuntimeLibrary Condition="'$(Configuration)|$(Platform)'=='Release|x64'">MultiThreaded</RuntimeLibrary>
</ClCompile> </ClCompile>
<Link> <Link>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<OptimizeReferences>true</OptimizeReferences> <OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies Condition="'$(Configuration)|$(Platform)'=='Release|x64'">SetupAPI.lib;Version.lib;Winmm.lib;Imm32.lib;libucrt.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies Condition="'$(Configuration)|$(Platform)'=='Release|x64'">libucrt.lib;SetupAPI.lib;Version.lib;Winmm.lib;Imm32.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link> </Link>
<ProjectReference>
<UseLibraryDependencyInputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</UseLibraryDependencyInputs>
</ProjectReference>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="..\src\FAudioGMS.c" /> <ClCompile Include="..\src\FAudioGMS.c" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="..\lib\dr_wav.h" />
<ClInclude Include="..\src\FAudioGMS.h" /> <ClInclude Include="..\src\FAudioGMS.h" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>