PauseAll and ResumeAll + some linux stuff

pull/1/head
cosmonaut 2021-10-29 13:47:26 -07:00
parent 4ccbf5c79e
commit 6be41108a6
7 changed files with 65 additions and 15 deletions

View File

@ -38,6 +38,9 @@ I will not be supporting 32-bit Windows. Catch up to 2004 and switch to 64-bit.
- Xbox One - Xbox One
- iOS - iOS
## Kind of Supported
- Android (nik provided android build scripts but I will not help you if it breaks, sorry, Android sucks)
### Not Supported ### Not Supported
- Windows (32-bit) - Windows (32-bit)
- HTML5 (if someone wants to try this go ahead but I'm not touching that garbage with a 10 foot pole) - HTML5 (if someone wants to try this go ahead but I'm not touching that garbage with a 10 foot pole)

View File

@ -155,7 +155,12 @@
2, 2,
2, 2,
],"resourceVersion":"1.0","name":"FAudioGMS_SetListenerVelocity","tags":[],"resourceType":"GMExtensionFunction",}, ],"resourceVersion":"1.0","name":"FAudioGMS_SetListenerVelocity","tags":[],"resourceType":"GMExtensionFunction",},
],"constants":[],"ProxyFiles":[],"copyToTargets":64,"order":[ {"externalName":"FAudioGMS_PauseAll","kind":1,"help":"FAudioGMS_PauseAll()","hidden":false,"returnType":2,"argCount":0,"args":[],"resourceVersion":"1.0","name":"FAudioGMS_PauseAll","tags":[],"resourceType":"GMExtensionFunction",},
{"externalName":"FAudioGMS_ResumeAll","kind":1,"help":"FAudioGMS_ResumeAll()","hidden":false,"returnType":2,"argCount":0,"args":[],"resourceVersion":"1.0","name":"FAudioGMS_ResumeAll","tags":[],"resourceType":"GMExtensionFunction",},
],"constants":[],"ProxyFiles":[
{"TargetMask":7,"resourceVersion":"1.0","name":"libFAudioGMS.so","tags":[],"resourceType":"GMProxyFile",},
{"TargetMask":7,"resourceVersion":"1.0","name":"libSDL2.so","tags":[],"resourceType":"GMProxyFile",},
],"copyToTargets":192,"order":[
{"name":"FAudioGMS_Init","path":"extensions/FAudioGMS/FAudioGMS.yy",}, {"name":"FAudioGMS_Init","path":"extensions/FAudioGMS/FAudioGMS.yy",},
{"name":"FAudioGMS_StaticSound_LoadWAV","path":"extensions/FAudioGMS/FAudioGMS.yy",}, {"name":"FAudioGMS_StaticSound_LoadWAV","path":"extensions/FAudioGMS/FAudioGMS.yy",},
{"name":"FAudioGMS_StaticSound_CreateSoundInstance","path":"extensions/FAudioGMS/FAudioGMS.yy",}, {"name":"FAudioGMS_StaticSound_CreateSoundInstance","path":"extensions/FAudioGMS/FAudioGMS.yy",},
@ -188,6 +193,8 @@
{"name":"FAudioGMS_SoundInstance_SetEffectGain","path":"extensions/FAudioGMS/FAudioGMS.yy",}, {"name":"FAudioGMS_SoundInstance_SetEffectGain","path":"extensions/FAudioGMS/FAudioGMS.yy",},
{"name":"FAudioGMS_SetListenerPosition","path":"extensions/FAudioGMS/FAudioGMS.yy",}, {"name":"FAudioGMS_SetListenerPosition","path":"extensions/FAudioGMS/FAudioGMS.yy",},
{"name":"FAudioGMS_SetListenerVelocity","path":"extensions/FAudioGMS/FAudioGMS.yy",}, {"name":"FAudioGMS_SetListenerVelocity","path":"extensions/FAudioGMS/FAudioGMS.yy",},
{"name":"FAudioGMS_ResumeAll","path":"extensions/FAudioGMS/FAudioGMS.yy",},
{"name":"FAudioGMS_PauseAll","path":"extensions/FAudioGMS/FAudioGMS.yy",},
{"name":"FAudioGMS_StopAll","path":"extensions/FAudioGMS/FAudioGMS.yy",}, {"name":"FAudioGMS_StopAll","path":"extensions/FAudioGMS/FAudioGMS.yy",},
{"name":"FAudioGMS_Update","path":"extensions/FAudioGMS/FAudioGMS.yy",}, {"name":"FAudioGMS_Update","path":"extensions/FAudioGMS/FAudioGMS.yy",},
{"name":"FAudioGMS_Destroy","path":"extensions/FAudioGMS/FAudioGMS.yy",}, {"name":"FAudioGMS_Destroy","path":"extensions/FAudioGMS/FAudioGMS.yy",},
@ -221,7 +228,7 @@
"tvosThirdPartyFrameworkEntries": [], "tvosThirdPartyFrameworkEntries": [],
"IncludedResources": [], "IncludedResources": [],
"androidPermissions": [], "androidPermissions": [],
"copyToTargets": 64, "copyToTargets": 192,
"iosCocoaPods": "", "iosCocoaPods": "",
"tvosCocoaPods": "", "tvosCocoaPods": "",
"iosCocoaPodDependencies": "", "iosCocoaPodDependencies": "",

BIN
gamemaker/extensions/FAudioGMS/libFAudioGMS.so (Stored with Git LFS) Normal file

Binary file not shown.

BIN
gamemaker/extensions/FAudioGMS/libSDL2.so (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -3,7 +3,7 @@
// Playing a StaticSound returns a SoundInstance. // Playing a StaticSound returns a SoundInstance.
function LoadStaticSound(filename) function LoadStaticSound(filename)
{ {
var filePath = "audio\\static\\" + filename; var filePath = working_directory + "audio/static/" + filename;
var staticSoundID = FAudioGMS_StaticSound_LoadWAV(filePath); var staticSoundID = FAudioGMS_StaticSound_LoadWAV(filePath);
return new StaticSound(staticSoundID); return new StaticSound(staticSoundID);
} }

View File

@ -200,6 +200,8 @@ typedef struct FAudioGMS_SoundInstance
F3DAUDIO_EMITTER* emitter; /* must not be NULL if is3D */ F3DAUDIO_EMITTER* emitter; /* must not be NULL if is3D */
float stereoAzimuth[2]; float stereoAzimuth[2];
uint8_t isGlobalPaused;
union union
{ {
FAudioGMS_StaticSound *staticSound; /* static sounds are loaded separately, so they do not belong to the instance */ FAudioGMS_StaticSound *staticSound; /* static sounds are loaded separately, so they do not belong to the instance */
@ -583,13 +585,6 @@ static void FAudioGMS_INTERNAL_SoundInstance_SetVolume(FAudioGMS_SoundInstance*
FAudioVoice_SetVolume(instance->handle, volume, 0); FAudioVoice_SetVolume(instance->handle, volume, 0);
} }
static void FAudioGMS_INTERNAL_SoundInstance_SetProperties(FAudioGMS_SoundInstance* instance, double pan, double pitch, double volume)
{
FAudioGMS_INTERNAL_SoundInstance_SetPan(instance, pan);
FAudioGMS_INTERNAL_SoundInstance_SetPitch(instance, pitch);
FAudioGMS_INTERNAL_SoundInstance_SetVolume(instance, volume);
}
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,
@ -602,6 +597,7 @@ static FAudioGMS_SoundInstance* FAudioGMS_INTERNAL_SoundInstance_Init(
instance->isStatic = isStatic; instance->isStatic = isStatic;
instance->loop = 0; instance->loop = 0;
instance->destroyOnFinish = 0; instance->destroyOnFinish = 0;
instance->isGlobalPaused = 0;
instance->format.wFormatTag = FAUDIO_FORMAT_IEEE_FLOAT; instance->format.wFormatTag = FAUDIO_FORMAT_IEEE_FLOAT;
instance->format.wBitsPerSample = 32; instance->format.wBitsPerSample = 32;
@ -966,12 +962,9 @@ void FAudioGMS_SoundInstance_Play(double soundInstanceID, double loop)
} }
} }
void FAudioGMS_SoundInstance_Pause(double soundInstanceID) static void FAudioGMS_INTERNAL_SoundInstance_Pause(FAudioGMS_SoundInstance* instance)
{ {
RETURN_ON_NULL_DEVICE() if (instance != NULL)
FAudioGMS_SoundInstance* instance = FAudioGMS_INTERNAL_LookupSoundInstance((uint32_t)soundInstanceID);
if (instance != NULL)
{ {
if (instance->soundState == SoundState_Playing) if (instance->soundState == SoundState_Playing)
{ {
@ -985,6 +978,13 @@ void FAudioGMS_SoundInstance_Pause(double soundInstanceID)
} }
} }
void FAudioGMS_SoundInstance_Pause(double soundInstanceID)
{
RETURN_ON_NULL_DEVICE()
FAudioGMS_SoundInstance* instance = FAudioGMS_INTERNAL_LookupSoundInstance((uint32_t)soundInstanceID);
FAudioGMS_INTERNAL_SoundInstance_Pause(instance);
}
static void FAudioGMS_INTERNAL_SoundInstance_Stop(FAudioGMS_SoundInstance* instance) static void FAudioGMS_INTERNAL_SoundInstance_Stop(FAudioGMS_SoundInstance* instance)
{ {
if (instance != NULL) if (instance != NULL)
@ -1639,6 +1639,38 @@ void FAudioGMS_Update()
} }
} }
void FAudioGMS_PauseAll()
{
RETURN_ON_NULL_DEVICE()
uint32_t i;
for (i = 0; i < device->soundInstanceCount; i += 1)
{
FAudioGMS_SoundInstance *instance = device->soundInstances[i];
if (instance != NULL)
{
instance->isGlobalPaused = 1;
FAudioGMS_INTERNAL_SoundInstance_Pause(instance);
}
}
}
void FAudioGMS_ResumeAll()
{
RETURN_ON_NULL_DEVICE()
uint32_t i;
for (i = 0; i < device->soundInstanceCount; i += 1)
{
FAudioGMS_SoundInstance *instance = device->soundInstances[i];
if (instance != NULL && instance->isGlobalPaused)
{
instance->isGlobalPaused = 0;
FAudioGMS_INTERNAL_SoundInstance_Play(instance);
}
}
}
void FAudioGMS_StopAll() void FAudioGMS_StopAll()
{ {
RETURN_ON_NULL_DEVICE() RETURN_ON_NULL_DEVICE()

View File

@ -101,6 +101,8 @@ FAUDIOGMSAPI void FAudioGMS_SoundInstance_SetEffectGain(double soundInstanceID,
FAUDIOGMSAPI void FAudioGMS_SetListenerPosition(double x, double y, double z); FAUDIOGMSAPI void FAudioGMS_SetListenerPosition(double x, double y, double z);
FAUDIOGMSAPI void FAudioGMS_SetListenerVelocity(double xVelocity, double yVelocity, double zVelocity); FAUDIOGMSAPI void FAudioGMS_SetListenerVelocity(double xVelocity, double yVelocity, double zVelocity);
FAUDIOGMSAPI void FAudioGMS_PauseAll(); /* useful for mobile platforms, etc */
FAUDIOGMSAPI void FAudioGMS_ResumeAll(); /* same as above */
FAUDIOGMSAPI void FAudioGMS_StopAll(); FAUDIOGMSAPI void FAudioGMS_StopAll();
FAUDIOGMSAPI void FAudioGMS_Update(); FAUDIOGMSAPI void FAudioGMS_Update();