Compare commits

...

No commits in common. 'main' and 'mastering_effects' have entirely different histories.

  1. 166
      .clang-format
  2. 2
      .gitattributes
  3. 2
      README.md
  4. 1
      android/Android.mk
  5. 92
      android/FAudioGMS_JNI.c
  6. 8
      android/build.ndk.cmd
  7. 10
      gamemaker/extensions/FAudioGMS/AndroidSource/Java/FAudioGMSBridge.java
  8. 106
      gamemaker/extensions/FAudioGMS/AndroidSource/Sdk/org.screwyoyo.faudiogms/src/main/java/org/screwyoyo/faudiogms/FAudioGMSNative.java
  9. BIN
      gamemaker/extensions/FAudioGMS/AndroidSource/libs/arm64-v8a/libFAudioGMS.so
  10. BIN
      gamemaker/extensions/FAudioGMS/AndroidSource/libs/arm64-v8a/libSDL2.so
  11. BIN
      gamemaker/extensions/FAudioGMS/AndroidSource/libs/arm64-v8a/libhidapi.so
  12. BIN
      gamemaker/extensions/FAudioGMS/AndroidSource/libs/armeabi-v7a/libFAudioGMS.so
  13. BIN
      gamemaker/extensions/FAudioGMS/AndroidSource/libs/armeabi-v7a/libSDL2.so
  14. BIN
      gamemaker/extensions/FAudioGMS/AndroidSource/libs/armeabi-v7a/libhidapi.so
  15. BIN
      gamemaker/extensions/FAudioGMS/AndroidSource/libs/x86/libFAudioGMS.so
  16. BIN
      gamemaker/extensions/FAudioGMS/AndroidSource/libs/x86/libSDL2.so
  17. BIN
      gamemaker/extensions/FAudioGMS/AndroidSource/libs/x86/libhidapi.so
  18. BIN
      gamemaker/extensions/FAudioGMS/AndroidSource/libs/x86_64/libFAudioGMS.so
  19. BIN
      gamemaker/extensions/FAudioGMS/AndroidSource/libs/x86_64/libSDL2.so
  20. BIN
      gamemaker/extensions/FAudioGMS/AndroidSource/libs/x86_64/libhidapi.so
  21. BIN
      gamemaker/extensions/FAudioGMS/FAudioGMS.dll
  22. 68
      gamemaker/extensions/FAudioGMS/FAudioGMS.yy
  23. BIN
      gamemaker/extensions/FAudioGMS/libFAudioGMS.so
  24. BIN
      gamemaker/extensions/FAudioGMS/libSDL2-2.0.so.0
  25. 16
      gamemaker/objects/AUDIO/CleanUp_0.gml
  26. 11
      gamemaker/objects/AUDIO/Create_0.gml
  27. 3
      gamemaker/objects/AUDIO/Step_2.gml
  28. 157
      gamemaker/scripts/FAudioGMS_Scripts/FAudioGMS_Scripts.gml
  29. 2
      lib/FAudio
  30. 7954
      lib/dr_wav.h
  31. 1391
      src/FAudioGMS.c
  32. 208
      src/FAudioGMS.h
  33. 12
      visualc/FAudioGMS.vcxproj

166
.clang-format

@ -1,166 +0,0 @@
---
Language: Cpp
# BasedOnStyle: LLVM
AccessModifierOffset: -2
AlignAfterOpenBracket: AlwaysBreak
AlignConsecutiveMacros: None
AlignConsecutiveAssignments: None
AlignConsecutiveBitFields: None
AlignConsecutiveDeclarations: None
AlignEscapedNewlines: Right
AlignOperands: Align
AlignTrailingComments: true
AllowAllArgumentsOnNextLine: false
AllowAllConstructorInitializersOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortEnumsOnASingleLine: true
AllowShortBlocksOnASingleLine: Never
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: All
AllowShortLambdasOnASingleLine: All
AllowShortIfStatementsOnASingleLine: Never
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: MultiLine
AttributeMacros:
- __capability
BinPackArguments: false
BinPackParameters: false
BraceWrapping:
AfterCaseLabel: false
AfterClass: false
AfterControlStatement: Never
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
AfterExternBlock: false
BeforeCatch: false
BeforeElse: false
BeforeLambdaBody: false
BeforeWhile: false
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakBeforeBinaryOperators: None
BreakBeforeConceptDeclarations: true
BreakBeforeBraces: Allman
BreakBeforeInheritanceComma: false
BreakInheritanceList: BeforeColon
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: BeforeColon
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true
ColumnLimit: 100
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DeriveLineEnding: true
DerivePointerAlignment: false
DisableFormat: false
EmptyLineBeforeAccessModifier: LogicalBlock
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
StatementAttributeLikeMacros:
- Q_EMIT
IncludeBlocks: Preserve
IncludeCategories:
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
Priority: 2
SortPriority: 0
CaseSensitive: false
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
Priority: 3
SortPriority: 0
CaseSensitive: false
- Regex: '.*'
Priority: 1
SortPriority: 0
CaseSensitive: false
IncludeIsMainRegex: '(Test)?$'
IncludeIsMainSourceRegex: ''
IndentCaseLabels: false
IndentCaseBlocks: false
IndentGotoLabels: true
IndentPPDirectives: None
IndentExternBlock: NoIndent
IndentRequires: false
IndentWidth: 4
IndentWrappedFunctionNames: false
InsertTrailingCommas: None
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: true
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBinPackProtocolList: Auto
ObjCBlockIndentWidth: 4
ObjCBreakBeforeNestedBlockParam: true
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 1000000
PenaltyIndentedWhitespace: 0
PointerAlignment: Right
ReflowComments: true
SortIncludes: true
SortJavaStaticImport: Before
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeCaseColon: false
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceAroundPointerQualifiers: Default
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyBlock: false
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInConditionalStatement: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
SpaceBeforeSquareBrackets: false
BitFieldColonSpacing: Both
Standard: Latest
StatementMacros:
- Q_UNUSED
- QT_REQUIRE_VERSION
TabWidth: 8
UseCRLF: false
UseTab: Never
WhitespaceSensitiveMacros:
- STRINGIZE
- PP_STRINGIZE
- BOOST_PP_STRINGIZE
- NS_SWIFT_NAME
- CF_SWIFT_NAME
...

2
.gitattributes vendored

@ -1,3 +1 @@
*.dll filter=lfs diff=lfs merge=lfs -text
*.so filter=lfs diff=lfs merge=lfs -text
*.so.0 filter=lfs diff=lfs merge=lfs -text

2
README.md

@ -21,8 +21,6 @@ Make sure the `AUDIO` object is created once at the start of your game.
You can use the documented wrapper functions included in the `.yymps` to control audio,
or you can just use the C API directly and wrap it yourself.
Detailed API documentation can be found [here](http://moonside.games/docs/FAudioGMS/#/latest/).
## Platforms
FAudio itself is cross-platform and has been deployed by hundreds of games across many platforms.

1
android/Android.mk

@ -63,7 +63,6 @@ LOCAL_MODULE := FAudioGMS
# Tell ndk-build we rely on these two fellas:
LOCAL_SHARED_LIBRARIES := SDL2 FAudio_static
LOCAL_C_INCLUDES := $(SDL_PATH)/include $(FAUDIO_PATH)/include $(FAUDIOGMS_PATH)/src
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_C_INCLUDES)
LOCAL_SRC_FILES := $(FAUDIOGMS_PATH)/src/FAudioGMS.c $(LOCAL_PATH)/FAudioGMS_JNI.c
include $(BUILD_SHARED_LIBRARY)

92
android/FAudioGMS_JNI.c

@ -27,11 +27,6 @@
/* These are the Native -> JNI conv wrappers, they must only be built for Android */
#ifdef __ANDROID__
/* no mangling please */
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#include <jni.h>
#include <FAudioGMS.h>
@ -94,23 +89,23 @@ Java_org_screwyoyo_faudiogms_FAudioGMSNative_FAudioGMS_1StaticSound_1Destroy
JNIEXPORT jdouble JNICALL
Java_org_screwyoyo_faudiogms_FAudioGMSNative_FAudioGMS_1StreamingSound_1LoadOGG
(JNIEnv* jniEnv, jclass jniThis, jstring _filepath, jdouble _bufferSizeInBytes)
(JNIEnv* jniEnv, jclass jniThis, jstring _filepath)
{
jboolean isCopy;
const char* filepath;
jdouble ret;
filepath = (*jniEnv)->GetStringUTFChars(jniEnv, _filepath, &isCopy);
ret = FAudioGMS_StreamingSound_LoadOGG((char *)filepath, _bufferSizeInBytes);
ret = FAudioGMS_StreamingSound_LoadOGG((char *)filepath);
(*jniEnv)->ReleaseStringUTFChars(jniEnv, _filepath, filepath);
return ret;
}
JNIEXPORT jdouble JNICALL
Java_org_screwyoyo_faudiogms_FAudioGMSNative_FAudioGMS_1SoundInstance_1Play
(JNIEnv* jniEnv, jclass jniThis, jdouble _soundInstanceID)
(JNIEnv* jniEnv, jclass jniThis, jdouble _soundInstanceID, jdouble _loop)
{
FAudioGMS_SoundInstance_Play(_soundInstanceID);
FAudioGMS_SoundInstance_Play(_soundInstanceID, _loop);
return NOTHING;
}
@ -130,38 +125,6 @@ Java_org_screwyoyo_faudiogms_FAudioGMSNative_FAudioGMS_1SoundInstance_1Stop
return NOTHING;
}
JNIEXPORT jdouble JNICALL
Java_org_screwyoyo_faudiogms_FAudioGMSNative_FAudioGMS_1SoundInstance_1QueueSyncPlay
(JNIEnv* jniEnv, jclass jniThis, jdouble _soundInstanceID)
{
FAudioGMS_SoundInstance_QueueSyncPlay(_soundInstanceID);
return NOTHING;
}
JNIEXPORT jdouble JNICALL
Java_org_screwyoyo_faudiogms_FAudioGMSNative_FAudioGMS_1SoundInstance_1SyncPlay
(JNIEnv* jniEnv, jclass jniThis)
{
FAudioGMS_SoundInstance_SyncPlay();
return NOTHING;
}
JNIEXPORT jdouble JNICALL
Java_org_screwyoyo_faudiogms_FAudioGMSNative_FAudioGMS_1SoundInstance_1SetPlayRegion
(JNIEnv* jniEnv, jclass jniThis, jdouble _soundInstanceID, jdouble _startInMilliseconds, jdouble _endInMilliseconds)
{
FAudioGMS_SoundInstance_SetPlayRegion(_soundInstanceID, _startInMilliseconds, _endInMilliseconds);
return NOTHING;
}
JNIEXPORT jdouble JNICALL
Java_org_screwyoyo_faudiogms_FAudioGMSNative_FAudioGMS_1SoundInstance_1SetLoop
(JNIEnv* jniEnv, jclass jniThis, jdouble _soundInstanceID, jdouble _loop)
{
FAudioGMS_SoundInstance_SetLoop(_soundInstanceID, _loop);
return NOTHING;
}
JNIEXPORT jdouble JNICALL
Java_org_screwyoyo_faudiogms_FAudioGMSNative_FAudioGMS_1SoundInstance_1SetPan
(JNIEnv* jniEnv, jclass jniThis, jdouble _soundInstanceID, jdouble _pan)
@ -202,14 +165,6 @@ Java_org_screwyoyo_faudiogms_FAudioGMSNative_FAudioGMS_1SoundInstance_1Set3DVelo
return NOTHING;
}
JNIEXPORT jdouble JNICALL
Java_org_screwyoyo_faudiogms_FAudioGMSNative_FAudioGMS_1SoundInstance_1Set3DOrientation
(JNIEnv* jniEnv, jclass jniThis, jdouble _soundInstanceID, jdouble _xFront, jdouble _yFront, jdouble _zFront, jdouble _xTop, jdouble _yTop, jdouble _zTop)
{
FAudioGMS_SoundInstance_Set3DOrientation(_soundInstanceID, _xFront, _yFront, _zFront, _xTop, _yTop, _zTop);
return NOTHING;
}
JNIEXPORT jdouble JNICALL
Java_org_screwyoyo_faudiogms_FAudioGMSNative_FAudioGMS_1SoundInstance_1SetTrackPositionInSeconds
(JNIEnv* jniEnv, jclass jniThis, jdouble _soundInstanceID, jdouble _trackPositionInSeconds)
@ -250,14 +205,6 @@ Java_org_screwyoyo_faudiogms_FAudioGMSNative_FAudioGMS_1SoundInstance_1SetBandPa
return NOTHING;
}
JNIEXPORT jdouble JNICALL
Java_org_screwyoyo_faudiogms_FAudioGMSNative_FAudioGMS_1SoundInstance_1QueueSoundInstance
(JNIEnv* jniEnv, jclass jniThis, jdouble _soundInstanceID, jdouble _queueSoundInstanceID)
{
FAudioGMS_SoundInstance_QueueSoundInstance(_soundInstanceID, _queueSoundInstanceID);
return NOTHING;
}
JNIEXPORT jdouble JNICALL
Java_org_screwyoyo_faudiogms_FAudioGMSNative_FAudioGMS_1SoundInstance_1GetPitch
(JNIEnv* jniEnv, jclass jniThis, jdouble _soundInstanceID)
@ -351,7 +298,8 @@ Java_org_screwyoyo_faudiogms_FAudioGMSNative_FAudioGMS_1EffectChain_1AddReverb
_reverbGain,
_decayTime,
_density,
_roomSize);
_roomSize
);
return NOTHING;
}
@ -379,22 +327,6 @@ Java_org_screwyoyo_faudiogms_FAudioGMSNative_FAudioGMS_1SoundInstance_1SetEffect
return NOTHING;
}
JNIEXPORT jdouble JNICALL
Java_org_screwyoyo_faudiogms_FAudioGMSNative_FAudioGMS_1SetMasteringEffectChain
(JNIEnv* jniEnv, jclass jniThis, jdouble _effectChainID, double _effectGain)
{
FAudioGMS_SetMasteringEffectChain(_effectChainID, _effectGain);
return NOTHING;
}
JNIEXPORT jdouble JNICALL
Java_org_screwyoyo_faudiogms_FAudioGMSNative_FAudioGMS_1SetMasteringEffectGain
(JNIEnv* jniEnv, jclass jniThis, jdouble _effectGain)
{
FAudioGMS_SetMasteringEffectGain(_effectGain);
return NOTHING;
}
JNIEXPORT jdouble JNICALL
Java_org_screwyoyo_faudiogms_FAudioGMSNative_FAudioGMS_1SetListenerPosition
(JNIEnv* jniEnv, jclass jniThis, jdouble _x, jdouble _y, jdouble _z)
@ -411,14 +343,6 @@ Java_org_screwyoyo_faudiogms_FAudioGMSNative_FAudioGMS_1SetListenerVelocity
return NOTHING;
}
JNIEXPORT jdouble JNICALL
Java_org_screwyoyo_faudiogms_FAudioGMSNative_FAudioGMS_1SetListenerOrientation
(JNIEnv* jniEnv, jclass jniThis, jdouble _xFront, jdouble _yFront, jdouble _zFront, jdouble _xTop, jdouble _yTop, jdouble _zTop)
{
FAudioGMS_SetListenerOrientation(_xFront, _yFront, _zFront, _xTop, _yTop, _zTop);
return NOTHING;
}
JNIEXPORT jdouble JNICALL
Java_org_screwyoyo_faudiogms_FAudioGMSNative_FAudioGMS_1PauseAll
(JNIEnv* jniEnv, jclass jniThis)
@ -459,10 +383,6 @@ Java_org_screwyoyo_faudiogms_FAudioGMSNative_FAudioGMS_1Destroy
return NOTHING;
}
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __ANDROID__ */
/* Do nothing for other platforms, because they, thankly, do not require JNI bindings... */

8
android/build.ndk.cmd

@ -1,8 +0,0 @@
cd /d %~dp0
mkdir buildandroid
call ndk-build NDK_PROJECT_PATH=null APP_BUILD_SCRIPT=Android.mk APP_ABI="armeabi-v7a arm64-v8a x86 x86_64" APP_PLATFORM=android-16 APP_MODULES="SDL2 FAudio_static FAudioGMS" NDK_OUT=buildandroid\obj NDK_LIBS_OUT=buildandroid\lib
xcopy /e /r /y buildandroid\lib ..\gamemaker\extensions\FAudioGMS\AndroidSource\libs
rd /s /q buildandroid

10
gamemaker/extensions/FAudioGMS/AndroidSource/Java/FAudioGMSBridge.java

@ -22,14 +22,12 @@ import android.content.res.AssetManager;
public class FAudioGMSBridge extends FAudioGMSNative implements IExtensionBase
{
public SDLActivity sdl;
public boolean handlenativepause; /* automatically pause all sounds on onPause or not? */
public boolean paused; /* are we currently paused */
public boolean paused;
public FAudioGMSBridge()
{
super();
handlenativepause = true; /* set this to false if you wish to handle pauses manually */
paused = false; /* this one must be false at initialization */
paused = false;
SDL.setContext(RunnerJNILib.GetApplicationContext());
sdl = new SDLActivity();
}
@ -64,7 +62,7 @@ public class FAudioGMSBridge extends FAudioGMSNative implements IExtensionBase
public void onPause()
{
sdl.onPause();
if (handlenativepause && !paused)
if (!paused)
{
paused = true;
FAudioGMS_PauseAll();
@ -74,7 +72,7 @@ public class FAudioGMSBridge extends FAudioGMSNative implements IExtensionBase
public void onResume()
{
sdl.onResume();
if (handlenativepause && paused)
if (paused)
{
paused = false;
FAudioGMS_ResumeAll();

106
gamemaker/extensions/FAudioGMS/AndroidSource/Sdk/org.screwyoyo.faudiogms/src/main/java/org/screwyoyo/faudiogms/FAudioGMSNative.java

@ -12,74 +12,27 @@ public class FAudioGMSNative
/* exactly as in FAudioGMS_JNI.c: */
public native double FAudioGMS_Init(double spatialDistanceScale, double timestep);
public native double FAudioGMS_StaticSound_LoadWAV(
String filePath); /* returns a static sound ID */
public native double FAudioGMS_StaticSound_CreateSoundInstance(
double staticSoundID); /* returns a sound instance ID */
public native double FAudioGMS_StaticSound_LoadWAV(String filePath);
public native double FAudioGMS_StaticSound_CreateSoundInstance(double staticSoundID);
public native double FAudioGMS_StaticSound_Destroy(double staticSoundID);
/* returns a sound instance ID */
public native double FAudioGMS_StreamingSound_LoadOGG(
String filepath,
double bufferSizeInBytes); /* if 0 is passed we will use a sensible default*/
public native double FAudioGMS_StreamingSound_LoadOGG(String filepath);
public native double FAudioGMS_SoundInstance_Play(double soundInstanceID);
public native double FAudioGMS_SoundInstance_Play(double soundInstanceID, double loop);
public native double FAudioGMS_SoundInstance_Pause(double soundInstanceID);
public native double FAudioGMS_SoundInstance_Stop(double soundInstanceID);
public native double FAudioGMS_SoundInstance_QueueSyncPlay(double soundInstanceID);
public native double FAudioGMS_SoundInstance_SyncPlay();
public native double FAudioGMS_SoundInstance_SetPlayRegion(
double soundInstanceID,
double startInMilliseconds,
double endInMilliseconds);
public native double FAudioGMS_SoundInstance_SetLoop(double soundInstanceID, double loop);
public native double FAudioGMS_SoundInstance_SetPan(double soundInstanceID, double pan);
public native double FAudioGMS_SoundInstance_SetPitch(double soundInstanceID, double pitch);
public native double FAudioGMS_SoundInstance_SetVolume(double soundInstanceID, double volume);
public native double FAudioGMS_SoundInstance_Set3DPosition(
double soundInstanceID,
double x,
double y,
double z);
public native double FAudioGMS_SoundInstance_Set3DVelocity(
double soundInstanceID,
double xVelocity,
double yVelocity,
double zVelocity);
public native double FAudioGMS_SoundInstance_Set3DOrientation(
double soundInstanceID,
double xFront,
double yFront,
double zFront,
double xTop,
double yTop,
double zTop);
public native double FAudioGMS_SoundInstance_SetTrackPositionInSeconds(
double soundInstanceID,
double trackPositionInSeconds);
public native double FAudioGMS_SoundInstance_SetVolumeOverTime(
double soundInstanceID,
double volume,
double milliseconds);
public native double FAudioGMS_SoundInstance_SetLowPassFilter(
double soundInstanceID,
double lowPassFilter,
double Q);
public native double FAudioGMS_SoundInstance_SetHighPassFilter(
double soundInstanceID,
double highPassFilter,
double Q);
public native double FAudioGMS_SoundInstance_SetBandPassFilter(
double soundInstanceID,
double bandPassFilter,
double Q);
public native double FAudioGMS_SoundInstance_QueueSoundInstance(
double soundInstanceID,
double queueSoundInstanceID);
public native double FAudioGMS_SoundInstance_Set3DPosition(double soundInstanceID, double x, double y, double z);
public native double FAudioGMS_SoundInstance_Set3DVelocity(double soundInstanceID, double xVelocity, double yVelocity, double zVelocity);
public native double FAudioGMS_SoundInstance_SetTrackPositionInSeconds(double soundInstanceID, double trackPositionInSeconds);
public native double FAudioGMS_SoundInstance_SetVolumeOverTime(double soundInstanceID, double volume, double milliseconds);
public native double FAudioGMS_SoundInstance_SetLowPassFilter(double soundInstanceID, double lowPassFilter, double Q);
public native double FAudioGMS_SoundInstance_SetHighPassFilter(double soundInstanceID, double highPassFilter, double Q);
public native double FAudioGMS_SoundInstance_SetBandPassFilter(double soundInstanceID, double bandPassFilter, double Q);
public native double FAudioGMS_SoundInstance_GetPitch(double soundInstanceID);
public native double FAudioGMS_SoundInstance_GetVolume(double soundInstanceID);
public native double FAudioGMS_SoundInstance_GetTrackLengthInSeconds(double soundInstanceID);
@ -105,41 +58,22 @@ public class FAudioGMSNative
double reverbGain,
double decayTime,
double density,
double roomSize);
double roomSize
);
public native double FAudioGMS_EffectChain_Destroy(double effectChainID);
/*
* NOTE: Any changes to the effect chain will NOT apply after this is set!
* You MUST call SetEffectChain again if you make changes to the effect
* chain parameters!
* You MUST call SetEffectChain again if you make changes to the effect chain parameters!
*/
public native double FAudioGMS_SoundInstance_SetEffectChain(
double soundInstanceID,
double effectChainID,
double effectGain);
public native double FAudioGMS_SoundInstance_SetEffectGain(
double soundInstanceID,
double effectGain);
public native double FAudioGMS_SoundInstance_SetEffectChain(double soundInstanceID, double effectChainID, double effectGain);
public native double FAudioGMS_SoundInstance_SetEffectGain(double soundInstanceID, double effectGain);
public native double FAudioGMS_SetMasteringEffectChain(double effectChainID, double effectGain);
public native double FAudioGMS_SetMasteringEffectGain(double effectGain);
public native double FAudioGMS_SetListenerPosition(double x, double y, double z);
public native double FAudioGMS_SetListenerVelocity(
double xVelocity,
double yVelocity,
double zVelocity);
public native double FAudioGMS_SetListenerOrientation(
double xFront,
double yFront,
double zFront,
double xTop,
double yTop,
double zTop);
public native double FAudioGMS_SetListenerVelocity(double xVelocity, double yVelocity, double zVelocity);
public native double FAudioGMS_PauseAll(); /* useful for mobile platforms, etc
*/
public native double FAudioGMS_ResumeAll(); /* same as above */
public native double FAudioGMS_PauseAll(); /* mobile platforms, man... */
public native double FAudioGMS_ResumeAll(); /* same thing here */
public native double FAudioGMS_StopAll();
public native double FAudioGMS_Update();

BIN
gamemaker/extensions/FAudioGMS/AndroidSource/libs/arm64-v8a/libFAudioGMS.so

Binary file not shown.

BIN
gamemaker/extensions/FAudioGMS/AndroidSource/libs/arm64-v8a/libSDL2.so

Binary file not shown.

BIN
gamemaker/extensions/FAudioGMS/AndroidSource/libs/arm64-v8a/libhidapi.so

Binary file not shown.

BIN
gamemaker/extensions/FAudioGMS/AndroidSource/libs/armeabi-v7a/libFAudioGMS.so

Binary file not shown.

BIN
gamemaker/extensions/FAudioGMS/AndroidSource/libs/armeabi-v7a/libSDL2.so

Binary file not shown.

BIN
gamemaker/extensions/FAudioGMS/AndroidSource/libs/armeabi-v7a/libhidapi.so

Binary file not shown.

BIN
gamemaker/extensions/FAudioGMS/AndroidSource/libs/x86/libFAudioGMS.so

Binary file not shown.

BIN
gamemaker/extensions/FAudioGMS/AndroidSource/libs/x86/libSDL2.so

Binary file not shown.

BIN
gamemaker/extensions/FAudioGMS/AndroidSource/libs/x86/libhidapi.so

Binary file not shown.

BIN
gamemaker/extensions/FAudioGMS/AndroidSource/libs/x86_64/libFAudioGMS.so

Binary file not shown.

BIN
gamemaker/extensions/FAudioGMS/AndroidSource/libs/x86_64/libSDL2.so

Binary file not shown.

BIN
gamemaker/extensions/FAudioGMS/AndroidSource/libs/x86_64/libhidapi.so

Binary file not shown.

BIN
gamemaker/extensions/FAudioGMS/FAudioGMS.dll (Stored with Git LFS)

Binary file not shown.

68
gamemaker/extensions/FAudioGMS/FAudioGMS.yy

@ -7,7 +7,7 @@
"packageId": "",
"productId": "",
"author": "",
"date": "2021-10-21T16:46:44.6241287-07:00",
"date": "2021-10-22T04:46:44.6241287+05:00",
"license": "",
"description": "",
"helpfile": "",
@ -25,7 +25,8 @@
{"externalName":"FAudioGMS_StaticSound_LoadWAV","kind":1,"help":"FAudioGMS_StaticSound_LoadWAV(filePath)","hidden":false,"returnType":2,"argCount":0,"args":[
1,
],"resourceVersion":"1.0","name":"FAudioGMS_StaticSound_LoadWAV","tags":[],"resourceType":"GMExtensionFunction",},
{"externalName":"FAudioGMS_SoundInstance_Play","kind":1,"help":"FAudioGMS_SoundInstance_Play(id)","hidden":false,"returnType":2,"argCount":0,"args":[
{"externalName":"FAudioGMS_SoundInstance_Play","kind":1,"help":"FAudioGMS_SoundInstance_Play(id, loop)","hidden":false,"returnType":2,"argCount":0,"args":[
2,
2,
],"resourceVersion":"1.0","name":"FAudioGMS_SoundInstance_Play","tags":[],"resourceType":"GMExtensionFunction",},
{"externalName":"FAudioGMS_SoundInstance_Pause","kind":1,"help":"FAudioGMS_SoundInstance_Pause(id)","hidden":false,"returnType":2,"argCount":0,"args":[
@ -55,9 +56,8 @@
2,
2,
],"resourceVersion":"1.0","name":"FAudioGMS_SetListenerPosition","tags":[],"resourceType":"GMExtensionFunction",},
{"externalName":"FAudioGMS_StreamingSound_LoadOGG","kind":1,"help":"FAudioGMS_StreamingSound_LoadOGG(filePath, bufferSizeInBytes)","hidden":false,"returnType":2,"argCount":0,"args":[
{"externalName":"FAudioGMS_StreamingSound_LoadOGG","kind":1,"help":"FAudioGMS_StreamingSound_LoadOGG(filePath)","hidden":false,"returnType":2,"argCount":0,"args":[
1,
2,
],"resourceVersion":"1.0","name":"FAudioGMS_StreamingSound_LoadOGG","tags":[],"resourceType":"GMExtensionFunction",},
{"externalName":"FAudioGMS_SoundInstance_SetPan","kind":1,"help":"FAudioGMS_SoundInstance_SetPan(soundInstanceID, pan)","hidden":false,"returnType":2,"argCount":0,"args":[
2,
@ -77,10 +77,10 @@
2,
],"resourceVersion":"1.0","name":"FAudioGMS_SoundInstance_SetVolumeOverTime","tags":[],"resourceType":"GMExtensionFunction",},
{"externalName":"FAudioGMS_StopAll","kind":1,"help":"FAudioGMS_StopAll()","hidden":false,"returnType":2,"argCount":0,"args":[],"resourceVersion":"1.0","name":"FAudioGMS_StopAll","tags":[],"resourceType":"GMExtensionFunction",},
{"externalName":"FAudioGMS_SoundInstance_SetTrackPositionInSeconds","kind":1,"help":"FAudioGMS_SoundInstance_SetTrackPositionInSeconds(soundInstanceID, trackPositionInSeconds)","hidden":false,"returnType":2,"argCount":0,"args":[
{"externalName":"FAudioGMS_SoundInstance_SetTrackPosition","kind":1,"help":"FAudioGMS_SoundInstance_SetTrackPosition(soundInstanceID, trackPositionInSeconds)","hidden":false,"returnType":2,"argCount":0,"args":[
2,
2,
],"resourceVersion":"1.0","name":"FAudioGMS_SoundInstance_SetTrackPositionInSeconds","tags":[],"resourceType":"GMExtensionFunction",},
],"resourceVersion":"1.0","name":"FAudioGMS_SoundInstance_SetTrackPosition","tags":[],"resourceType":"GMExtensionFunction",},
{"externalName":"FAudioGMS_SoundInstance_GetTrackLengthInSeconds","kind":1,"help":"FAudioGMS_SoundInstance_GetTrackLengthInSeconds(soundInstanceID)","hidden":false,"returnType":2,"argCount":0,"args":[
2,
],"resourceVersion":"1.0","name":"FAudioGMS_SoundInstance_GetTrackLengthInSeconds","tags":[],"resourceType":"GMExtensionFunction",},
@ -157,51 +157,10 @@
],"resourceVersion":"1.0","name":"FAudioGMS_SetListenerVelocity","tags":[],"resourceType":"GMExtensionFunction",},
{"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",},
{"externalName":"FAudioGMS_SoundInstance_SetPlayRegion","kind":1,"help":"FAudioGMS_SoundInstance_SetPlayRegion(soundInstanceID, startInMilliseconds, endInMilliseconds)","hidden":false,"returnType":2,"argCount":0,"args":[
2,
2,
2,
],"resourceVersion":"1.0","name":"FAudioGMS_SoundInstance_SetPlayRegion","tags":[],"resourceType":"GMExtensionFunction",},
{"externalName":"FAudioGMS_SetMasteringEffectChain","kind":1,"help":"FAudioGMS_SetMasteringEffectChain(effectChainID, effectGain)","hidden":false,"returnType":2,"argCount":0,"args":[
2,
2,
],"resourceVersion":"1.0","name":"FAudioGMS_SetMasteringEffectChain","tags":[],"resourceType":"GMExtensionFunction",},
{"externalName":"FAudioGMS_SetMasteringEffectGain","kind":1,"help":"FAudioGMS_SetMasteringEffectGain(effectGain)","hidden":false,"returnType":2,"argCount":0,"args":[
2,
],"resourceVersion":"1.0","name":"FAudioGMS_SetMasteringEffectGain","tags":[],"resourceType":"GMExtensionFunction",},
{"externalName":"FAudioGMS_SoundInstance_SetLoop","kind":1,"help":"FAudioGMS_SoundInstance_SetLoop(soundInstanceID, loop)","hidden":false,"returnType":2,"argCount":0,"args":[
2,
2,
],"resourceVersion":"1.0","name":"FAudioGMS_SoundInstance_SetLoop","tags":[],"resourceType":"GMExtensionFunction",},
{"externalName":"FAudioGMS_SoundInstance_QueueSoundInstance","kind":1,"help":"FAudioGMS_SoundInstance_QueueSoundInstance(soundInstanceID, queueSoundInstanceID)","hidden":false,"returnType":2,"argCount":0,"args":[
2,
2,
],"resourceVersion":"1.0","name":"FAudioGMS_SoundInstance_QueueSoundInstance","tags":[],"resourceType":"GMExtensionFunction",},
{"externalName":"FAudioGMS_SoundInstance_QueueSyncPlay","kind":1,"help":"FAudioGMS_SoundInstance_QueueSyncPlay(soundInstanceID)","hidden":false,"returnType":2,"argCount":0,"args":[
2,
],"resourceVersion":"1.0","name":"FAudioGMS_SoundInstance_QueueSyncPlay","tags":[],"resourceType":"GMExtensionFunction",},
{"externalName":"FAudioGMS_SoundInstance_SyncPlay","kind":1,"help":"FAudioGMS_SoundInstance_SyncPlay()","hidden":false,"returnType":2,"argCount":0,"args":[],"resourceVersion":"1.0","name":"FAudioGMS_SoundInstance_SyncPlay","tags":[],"resourceType":"GMExtensionFunction",},
{"externalName":"FAudioGMS_SoundInstance_Set3DOrientation","kind":1,"help":"FAudioGMS_SoundInstance_Set3DOrientation(soundInstanceID, xFront, yFront, zFront, xTop, yTop, zTop)","hidden":false,"returnType":2,"argCount":0,"args":[
2,
2,
2,
2,
2,
2,
2,
],"resourceVersion":"1.0","name":"FAudioGMS_SoundInstance_Set3DOrientation","tags":[],"resourceType":"GMExtensionFunction",},
{"externalName":"FAudioGMS_SetListenerOrientation","kind":1,"help":"FAudioGMS_SetListenerOrientation(xFront, yFront, zFront, xTop, yTop, zTop)","hidden":false,"returnType":2,"argCount":0,"args":[
2,
2,
2,
2,
2,
2,
],"resourceVersion":"1.0","name":"FAudioGMS_SetListenerOrientation","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",},
{"TargetMask":3,"resourceVersion":"1.0","name":"FAudioGMSAndroidDummy.ext","tags":[],"resourceType":"GMProxyFile",},
{"TargetMask":7,"resourceVersion":"1.0","name":"libSDL2-2.0.so.0","tags":[],"resourceType":"GMProxyFile",},
],"copyToTargets":200,"order":[
{"name":"FAudioGMS_Init","path":"extensions/FAudioGMS/FAudioGMS.yy",},
{"name":"FAudioGMS_StaticSound_LoadWAV","path":"extensions/FAudioGMS/FAudioGMS.yy",},
@ -211,17 +170,12 @@
{"name":"FAudioGMS_SoundInstance_Play","path":"extensions/FAudioGMS/FAudioGMS.yy",},
{"name":"FAudioGMS_SoundInstance_Pause","path":"extensions/FAudioGMS/FAudioGMS.yy",},
{"name":"FAudioGMS_SoundInstance_Stop","path":"extensions/FAudioGMS/FAudioGMS.yy",},
{"name":"FAudioGMS_SoundInstance_QueueSyncPlay","path":"extensions/FAudioGMS/FAudioGMS.yy",},
{"name":"FAudioGMS_SoundInstance_SyncPlay","path":"extensions/FAudioGMS/FAudioGMS.yy",},
{"name":"FAudioGMS_SoundInstance_SetLoop","path":"extensions/FAudioGMS/FAudioGMS.yy",},
{"name":"FAudioGMS_SoundInstance_SetPan","path":"extensions/FAudioGMS/FAudioGMS.yy",},
{"name":"FAudioGMS_SoundInstance_SetPitch","path":"extensions/FAudioGMS/FAudioGMS.yy",},
{"name":"FAudioGMS_SoundInstance_SetVolume","path":"extensions/FAudioGMS/FAudioGMS.yy",},
{"name":"FAudioGMS_SoundInstance_Set3DPosition","path":"extensions/FAudioGMS/FAudioGMS.yy",},
{"name":"FAudioGMS_SoundInstance_Set3DVelocity","path":"extensions/FAudioGMS/FAudioGMS.yy",},
{"name":"FAudioGMS_SoundInstance_Set3DOrientation","path":"extensions/FAudioGMS/FAudioGMS.yy",},
{"name":"FAudioGMS_SoundInstance_SetTrackPositionInSeconds","path":"extensions/FAudioGMS/FAudioGMS.yy",},
{"name":"FAudioGMS_SoundInstance_SetPlayRegion","path":"extensions/FAudioGMS/FAudioGMS.yy",},
{"name":"FAudioGMS_SoundInstance_SetTrackPosition","path":"extensions/FAudioGMS/FAudioGMS.yy",},
{"name":"FAudioGMS_SoundInstance_SetVolumeOverTime","path":"extensions/FAudioGMS/FAudioGMS.yy",},
{"name":"FAudioGMS_SoundInstance_SetLowPassFilter","path":"extensions/FAudioGMS/FAudioGMS.yy",},
{"name":"FAudioGMS_SoundInstance_SetHighPassFilter","path":"extensions/FAudioGMS/FAudioGMS.yy",},
@ -230,7 +184,6 @@
{"name":"FAudioGMS_SoundInstance_GetVolume","path":"extensions/FAudioGMS/FAudioGMS.yy",},
{"name":"FAudioGMS_SoundInstance_GetTrackLengthInSeconds","path":"extensions/FAudioGMS/FAudioGMS.yy",},
{"name":"FAudioGMS_SoundInstance_GetTrackPositionInSeconds","path":"extensions/FAudioGMS/FAudioGMS.yy",},
{"name":"FAudioGMS_SoundInstance_QueueSoundInstance","path":"extensions/FAudioGMS/FAudioGMS.yy",},
{"name":"FAudioGMS_SoundInstance_Destroy","path":"extensions/FAudioGMS/FAudioGMS.yy",},
{"name":"FAudioGMS_SoundInstance_DestroyWhenFinished","path":"extensions/FAudioGMS/FAudioGMS.yy",},
{"name":"FAudioGMS_EffectChain_Create","path":"extensions/FAudioGMS/FAudioGMS.yy",},
@ -239,11 +192,8 @@
{"name":"FAudioGMS_EffectChain_Destroy","path":"extensions/FAudioGMS/FAudioGMS.yy",},
{"name":"FAudioGMS_SoundInstance_SetEffectChain","path":"extensions/FAudioGMS/FAudioGMS.yy",},
{"name":"FAudioGMS_SoundInstance_SetEffectGain","path":"extensions/FAudioGMS/FAudioGMS.yy",},
{"name":"FAudioGMS_SetMasteringEffectChain","path":"extensions/FAudioGMS/FAudioGMS.yy",},
{"name":"FAudioGMS_SetMasteringEffectGain","path":"extensions/FAudioGMS/FAudioGMS.yy",},
{"name":"FAudioGMS_SetListenerPosition","path":"extensions/FAudioGMS/FAudioGMS.yy",},
{"name":"FAudioGMS_SetListenerVelocity","path":"extensions/FAudioGMS/FAudioGMS.yy",},
{"name":"FAudioGMS_SetListenerOrientation","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",},
@ -292,4 +242,4 @@
"name": "FAudioGMS",
"tags": [],
"resourceType": "GMExtension",
}
}

BIN
gamemaker/extensions/FAudioGMS/libFAudioGMS.so

Binary file not shown.

BIN
gamemaker/extensions/FAudioGMS/libSDL2-2.0.so.0

Binary file not shown.

16
gamemaker/objects/AUDIO/CleanUp_0.gml

@ -1,17 +1 @@
/// @description Clean up all resources when the game is about to end.
/* Destroy sound instances first: */
// sndInst.Stop();
// sndInst.Destroy();
// sndInst = undefined;
/* Only then destroy static sounds: */
// snd.Destroy();
// snd = undefined;
/* And only then, destroy effect chains */
effChain.Destroy();
effChain = undefined;
/* Finish up the system */
FAudioGMS_Destroy();

11
gamemaker/objects/AUDIO/Create_0.gml

@ -1,15 +1,6 @@
/// @description Initialize audio.
/* First initialize the system: */
var spatialDistanceScale = 50; // makes "3D" audio louder
var timestep = game_get_speed(gamespeed_microseconds) / 1000000; // default, autodetect from GM timestep.
FAudioGMS_Init(spatialDistanceScale, timestep);
FAudioGMS_Init(spatialDistanceScale, 1 / 60);
/* Init Effects Chains Here */
effChain = new EffectChain();
effChain.AddDefaultReverb();
/* Load Audio Assets Here */
// snd = LoadStaticSound("go-go-go-tigerblood.wav");
// sndInst = snd.Play();
// sndInst.SetEffectChain(effChain, 1); // apply default reverb to the instance.

3
gamemaker/objects/AUDIO/Step_2.gml

@ -1,2 +1 @@
/// @description MUST be called once per frame!
FAudioGMS_Update();
FAudioGMS_Update();

157
gamemaker/scripts/FAudioGMS_Scripts/FAudioGMS_Scripts.gml

@ -18,33 +18,20 @@ function LoadStaticSound(filename)
function StaticSound(_staticSoundID) constructor
{
staticSoundID = _staticSoundID;
// Create a sound instance from this static sound.
static CreateSoundInstance = function()
{
var instanceID = FAudioGMS_StaticSound_CreateSoundInstance(staticSoundID);
var instance = new SoundInstance(instanceID);
return instance;
}
// Plays and returns a sound instance!
// Returns a sound instance!
// MUST be destroyed when you aren't referencing it any more or you will leak memory!
static Play = function(pan = 0, pitch = 1, volume = 1, loop = false, loopStartInMilliseconds = 0, loopEndInMilliseconds = 0)
static Play = function(pan = 0, pitch = 1, volume = 1, loop = false)
{
var instanceID = FAudioGMS_StaticSound_CreateSoundInstance(staticSoundID);
var instance = new SoundInstance(instanceID);
instance.SetLoop(loop);
if (loop)
{
instance.SetPlayRegion(loopStartInMilliseconds, loopEndInMilliseconds);
}
instance.SetPan(pan);
instance.SetPitch(pitch);
instance.SetVolume(volume);
instance.Play();
instance.Play(loop);
return instance;
}
// Automatically destroys the SoundInstance when playback is finished.
// Does NOT return an instance!
static PlayOneOff = function(pan = 0, pitch = 1, volume = 1)
@ -52,21 +39,20 @@ function StaticSound(_staticSoundID) constructor
var instance = Play(pan, pitch, volume, false);
instance.DestroyWhenFinished();
}
// Plays and returns a sound instance!
// Returns a sound instance!
// MUST be destroyed when you aren't referencing it any more or you will leak memory!
static PlaySpatial = function(xPosition, yPosition, zPosition, pitch = 1, volume = 1, loop = false)
{
var instanceID = FAudioGMS_StaticSound_CreateSoundInstance(staticSoundID);
var instance = new SoundInstance(instanceID);
instance.SetLoop(loop);
instance.Set3DPosition(xPosition, yPosition, zPosition);
instance.SetPitch(pitch);
instance.SetVolume(volume);
instance.Play(loop);
return instance;
}
// Automatically destroys the SoundInstance when playback is finished.
// Does NOT return an instance!
static PlaySpatialOneOff = function(xPosition, yPosition, zPosition, pitch = 1, volume = 1)
@ -80,7 +66,7 @@ function StaticSound(_staticSoundID) constructor
// If you call this while there are still instances of the StaticSound, you are going to have a bad time.
static Destroy = function()
{
FAudioGMS_StaticSound_Destroy(staticSoundID);
FAudioGMS_StaticSound_Destroy(staticSoundID);
}
}
@ -88,10 +74,10 @@ function StaticSound(_staticSoundID) constructor
// The audio is streamed off the disk, so only a small amount of memory is used at a time.
// Good for things like music or voiceover playback.
// Note that StreamingSounds are SoundInstances.
function LoadStreamingSound(filename, bufferSizeInBytes = 0)
function LoadStreamingSound(filename)
{
var filePath = GetPathPrepend() + "audio/streaming/" + filename;
soundInstanceID = FAudioGMS_StreamingSound_LoadOGG(filePath, bufferSizeInBytes);
soundInstanceID = FAudioGMS_StreamingSound_LoadOGG(filePath);
return new SoundInstance(soundInstanceID);
}
@ -100,60 +86,48 @@ function SoundInstance(_soundInstanceID) constructor
soundInstanceID = _soundInstanceID;
// Plays the sound or resumes from pause.
static Play = function()
static Play = function(loop = false)
{
FAudioGMS_SoundInstance_Play(soundInstanceID);
FAudioGMS_SoundInstance_Play(soundInstanceID, loop);
}
// Pauses playback.
static Pause = function()
{
FAudioGMS_SoundInstance_Pause(soundInstanceID);
}
// Stops playback completely. If Play is called it will resume from the beginning of the sound.
static Stop = function()
{
FAudioGMS_SoundInstance_Stop(soundInstanceID);
FAudioGMS_SoundInstance_Stop(soundInstanceID);
}
// Sets the 3-dimensional position of the sound. You probably want to use SetListenerPosition too.
static Set3DPosition = function(xPosition, yPosition, zPosition)
{
FAudioGMS_SoundInstance_Set3DPosition(soundInstanceID, xPosition, yPosition, zPosition);
FAudioGMS_SoundInstance_Set3DPosition(soundInstanceID, xPosition, yPosition, zPosition);
}
// Sets the 3-dimensional velocity of the sound. You probably want to use SetListenerVelocity too.
static Set3DVelocity = function(xVelocity, yVelocity, zVelocity)
{
FAudioGMS_SoundInstance_Set3DVelocity(soundInstanceID, xVelocity, yVelocity, zVelocity);
FAudioGMS_SoundInstance_Set3DVelocity(soundInstanceID, xVelocity, yVelocity, zVelocity);
}
// Sets the 3-dimensional orientation of the sound.
static Set3DOrientation = function(xFront, yFront, zFront, xTop, yTop, zTop)
{
FAudioGMS_SoundInstance_Set3DOrientation(soundInstanceID, xFront, yFront, zFront, xTop, yTop, zTop);
}
// Sets whether the sound instance loops (true) or does not (false).
static SetLoop = function(loop)
{
FAudioGMS_SoundInstance_SetLoop(soundInstanceID, loop);
}
// Sets the panning value of the sound. -1 is farthest left, 1 is farthest right, 0 is center.
// NOTE: This is ignored if you have called Set3DPosition.
static SetPan = function(pan)
{
FAudioGMS_SoundInstance_SetPan(soundInstanceID, pan);
FAudioGMS_SoundInstance_SetPan(soundInstanceID, pan);
}
// Sets the pitch of the sound. Default is 1. Lower than 1 is pitched down, higher than 1 is pitched up.
static SetPitch = function(pitch)
{
FAudioGMS_SoundInstance_SetPitch(soundInstanceID, pitch);
FAudioGMS_SoundInstance_SetPitch(soundInstanceID, pitch);
}
// Sets the volume of the sound. Default is 1. Lower than 1 is quieter, greater than 1 is louder.
// If you set the milliseconds value then this will fade over time.
static SetVolume = function(volume, milliseconds = 0)
@ -164,28 +138,16 @@ function SoundInstance(_soundInstanceID) constructor
}
else
{
FAudioGMS_SoundInstance_SetVolume(soundInstanceID, volume);
FAudioGMS_SoundInstance_SetVolume(soundInstanceID, volume);
}
}
// Sets the position of track playback.
// Sets the position of track playback.
static SetTrackPosition = function(seconds)
{
FAudioGMS_SoundInstance_SetTrackPositionInSeconds(soundInstanceID, seconds);
FAudioGMS_SoundInstance_SetTrackPosition(soundInstanceID, seconds);
}
// Queues this sound instance for playing in sync.
static QueueSyncPlay = function()
{
FAudioGMS_SoundInstance_QueueSyncPlay(soundInstanceID);
}
// Sets the playback region for the sound instance.
static SetPlayRegion = function(loopStartInMilliseconds, loopEndInMilliseconds)
{
FAudioGMS_SoundInstance_SetPlayRegion(soundInstanceID, loopStartInMilliseconds, loopEndInMilliseconds);
}
// Sets a low pass filter on the sound.
// frequency: 0.0 <-> 1.0. 1.0 means all sound gets through.
// Q: set this to 1 unless you know what you're doing
@ -193,7 +155,7 @@ function SoundInstance(_soundInstanceID) constructor
{
FAudioGMS_SoundInstance_SetLowPassFilter(soundInstanceID, frequency, Q);
}
// Sets a high pass filter on the sound.
// frequency: 0.0 <-> 1.0. 0.0 means all sound gets through.
// Q: set this to 1 unless you know what you're doing
@ -201,7 +163,7 @@ function SoundInstance(_soundInstanceID) constructor
{
FAudioGMS_SoundInstance_SetHighPassFilter(soundInstanceID, frequency, Q);
}
// Sets a band pass filter ont he sound.
// frequency: 0.0 <-> 1.0
// Q: set this to 1 unless you know what you're doing
@ -209,7 +171,7 @@ function SoundInstance(_soundInstanceID) constructor
{
FAudioGMS_SoundInstance_SetBandPassFilter(soundInstanceID, frequency, Q);
}
// Sets an effect chain on the sound.
// Gain is how much the effect chain "affects" the sound. 1.0 is max.
// NOTE: Any changes to the effect chain will NOT apply automatically after this is set!
@ -218,75 +180,64 @@ function SoundInstance(_soundInstanceID) constructor
{
FAudioGMS_SoundInstance_SetEffectChain(soundInstanceID, effectChain.effectChainID, gain);
}
// Sets the effect gain of the current effect chain.
// Does nothing if no effect chain is set.
static SetEffectGain = function(gain)
{
FAudioGMS_SoundInstance_SetEffectGain(soundInstanceID, gain);
}
static QueueSoundInstance = function(queueSoundInstance)
{
FAudioGMS_SoundInstance_QueueSoundInstance(soundInstanceID, queueSoundInstance.soundInstanceID);
}
// Gets the pitch of the sound.
static GetPitch = function()
{
return FAudioGMS_SoundInstance_GetPitch(soundInstanceID);
return FAudioGMS_SoundInstance_GetPitch(soundInstanceID);
}
// Gets the volume of the sound.
static GetVolume = function()
{
return FAudioGMS_SoundInstance_GetVolume(soundInstanceID);
return FAudioGMS_SoundInstance_GetVolume(soundInstanceID);
}
// Gets the total length of the track.
static GetTrackLengthInSeconds = function()
{
return FAudioGMS_SoundInstance_GetTrackLengthInSeconds(soundInstanceID);
return FAudioGMS_SoundInstance_GetTrackLengthInSeconds(soundInstanceID);
}
// Gets the current track position.
static GetTrackPositionInSeconds = function()
{
return FAudioGMS_SoundInstance_GetTrackPositionInSeconds(soundInstanceID);
}
// Destroys the FAudioGMS sound instance.
// If you use the SoundInstance after calling this you are going to have a bad time.
static Destroy = function()
{
FAudioGMS_SoundInstance_Destroy(soundInstanceID);
FAudioGMS_SoundInstance_Destroy(soundInstanceID);
}
// Sets the FAudioGMS sound instance to destroy itself when playback is done.
// Calling this on a looping sound is not a good idea.
// If you use the SoundInstance after calling this you might have a bad time.
static DestroyWhenFinished = function()
{
FAudioGMS_SoundInstance_DestroyWhenFinished(soundInstanceID);
FAudioGMS_SoundInstance_DestroyWhenFinished(soundInstanceID);
}
SetPan(0);
SetPitch(1);
SetVolume(1);
}
// Plays the sound instance queue.
function SyncPlay()
{
FAudioGMS_SoundInstance_SyncPlay();
}
// Effect chains allow you to modify sound playback using audio effects.
// Right now only reverb is implemented, but more effects will probably come later.
function EffectChain() constructor
{
effectChainID = FAudioGMS_EffectChain_Create();
// Adds a reverb effect to the effect chain.
static AddReverb = function(
wetDryMix,
@ -322,7 +273,7 @@ function EffectChain() constructor
roomSize
);
}
// Adds a default reverb effect to the effect chain.
// This is a good place to start if you don't know what all the reverb params do.
static AddDefaultReverb = function()
@ -345,12 +296,12 @@ function EffectChain() constructor
100
);
}
// Destroys the FAudioGMS effect chain.
// If you use the EffectChain after calling this you are going to have a bad time.
static Destroy = function()
{
FAudioGMS_EffectChain_Destroy(effectChainID);
FAudioGMS_EffectChain_Destroy(effectChainID);
}
}
@ -363,17 +314,11 @@ function SetListenerPosition(xPosition, yPosition, zPosition)
// Sets the velocity of the listener for 3D audio.
function SetListenerVelocity(xVelocity, yVelocity, zVelocity)
{
FAudioGMS_SetListenerVelocity(xVelocity, yVelocity, zVelocity);
}
// Sets the orientation of the listener for 3D audio.
function SetListenerOrientation(xFront, yFront, zFront, xTop, yTop, zTop)
{
FAudioGMS_SetListenerOrientation(xFront, yFront, zFront, xTop, yTop, zTop);
FAudioGMS_SetListenerVelocity(xVelocity, yVelocity, zVelocity);
}
// Stops all audio playback.
// Stops all audio playback.
function StopAllAudio()
{
FAudioGMS_StopAll();
FAudioGMS_StopAll();
}

2
lib/FAudio

@ -1 +1 @@
Subproject commit caf9754455b8ad0f6df5d024203940e9b6e3f47e
Subproject commit 28528bc885581bad58050517d78848cb206b2aa3

7954
lib/dr_wav.h

File diff suppressed because it is too large Load Diff

1391
src/FAudioGMS.c

File diff suppressed because it is too large Load Diff

208
src/FAudioGMS.h

@ -36,144 +36,80 @@
#endif
#ifdef __cplusplus
extern "C"
{
extern "C" {
#endif /* __cplusplus */
FAUDIOGMSAPI void FAudioGMS_Init(double spatialDistanceScale, double timestep);
FAUDIOGMSAPI double FAudioGMS_StaticSound_LoadWAV(
char *filePath); /* returns a static sound ID */
FAUDIOGMSAPI double FAudioGMS_StaticSound_CreateSoundInstance(
double staticSoundID); /* returns a sound instance ID */
FAUDIOGMSAPI void FAudioGMS_StaticSound_Destroy(double staticSoundID);
/* returns a sound instance ID */
FAUDIOGMSAPI double FAudioGMS_StreamingSound_LoadOGG(
char *filepath,
double bufferSizeInBytes); /* if 0 is passed we will use a sensible default*/
FAUDIOGMSAPI void FAudioGMS_SoundInstance_Play(double soundInstanceID);
FAUDIOGMSAPI void FAudioGMS_SoundInstance_Pause(double soundInstanceID);
FAUDIOGMSAPI void FAudioGMS_SoundInstance_Stop(double soundInstanceID);
FAUDIOGMSAPI void FAudioGMS_SoundInstance_QueueSyncPlay(double soundInstanceID);
FAUDIOGMSAPI void FAudioGMS_SoundInstance_SyncPlay();
FAUDIOGMSAPI void FAudioGMS_SoundInstance_SetPlayRegion(
double soundInstanceID,
double startInMilliseconds,
double endInMilliseconds);
FAUDIOGMSAPI void FAudioGMS_SoundInstance_SetLoop(double soundInstanceID, double loop);
FAUDIOGMSAPI void FAudioGMS_SoundInstance_SetPan(double soundInstanceID, double pan);
FAUDIOGMSAPI void FAudioGMS_SoundInstance_SetPitch(double soundInstanceID, double pitch);
FAUDIOGMSAPI void FAudioGMS_SoundInstance_SetVolume(double soundInstanceID, double volume);
FAUDIOGMSAPI void FAudioGMS_SoundInstance_Set3DPosition(
double soundInstanceID,
double x,
double y,
double z);
FAUDIOGMSAPI void FAudioGMS_SoundInstance_Set3DVelocity(
double soundInstanceID,
double xVelocity,
double yVelocity,
double zVelocity);
FAUDIOGMSAPI void FAudioGMS_SoundInstance_Set3DOrientation(
double soundInstanceID,
double xFront,
double yFront,
double zFront,
double xTop,
double yTop,
double zTop);
FAUDIOGMSAPI void FAudioGMS_SoundInstance_SetTrackPositionInSeconds(
double soundInstanceID,
double trackPositionInSeconds);
FAUDIOGMSAPI void FAudioGMS_SoundInstance_SetVolumeOverTime(
double soundInstanceID,
double volume,
double milliseconds);
FAUDIOGMSAPI void FAudioGMS_SoundInstance_SetLowPassFilter(
double soundInstanceID,
double lowPassFilter,
double Q);
FAUDIOGMSAPI void FAudioGMS_SoundInstance_SetHighPassFilter(
double soundInstanceID,
double highPassFilter,
double Q);
FAUDIOGMSAPI void FAudioGMS_SoundInstance_SetBandPassFilter(
double soundInstanceID,
double bandPassFilter,
double Q);
FAUDIOGMSAPI void FAudioGMS_SoundInstance_QueueSoundInstance(
double soundInstanceID,
double queueSoundInstanceID);
FAUDIOGMSAPI double FAudioGMS_SoundInstance_GetPitch(double soundInstanceID);
FAUDIOGMSAPI double FAudioGMS_SoundInstance_GetVolume(double soundInstanceID);
FAUDIOGMSAPI double FAudioGMS_SoundInstance_GetTrackLengthInSeconds(double soundInstanceID);
FAUDIOGMSAPI double FAudioGMS_SoundInstance_GetTrackPositionInSeconds(double soundInstanceID);
FAUDIOGMSAPI void FAudioGMS_SoundInstance_Destroy(double soundInstanceID);
FAUDIOGMSAPI void FAudioGMS_SoundInstance_DestroyWhenFinished(double soundInstanceID);
FAUDIOGMSAPI double FAudioGMS_EffectChain_Create();
FAUDIOGMSAPI void FAudioGMS_EffectChain_AddDefaultReverb(double effectChainID);
FAUDIOGMSAPI void FAudioGMS_EffectChain_AddReverb(
double effectChainID,
double wetDryMix,
double reflectionsDelay,
double reverbDelay,
double earlyDiffusion,
double lateDiffusion,
double lowEQGain,
double lowEQCutoff,
double highEQGain,
double highEQCutoff,
double reflectionsGain,
double reverbGain,
double decayTime,
double density,
double roomSize);
FAUDIOGMSAPI void FAudioGMS_EffectChain_Destroy(double effectChainID);
/*
* NOTE: Any changes to the effect chain will NOT apply after this is set!
* You MUST call SetEffectChain again if you make changes to the effect
* chain parameters!
*/
FAUDIOGMSAPI void FAudioGMS_SoundInstance_SetEffectChain(
double soundInstanceID,
double effectChainID,
double effectGain);
FAUDIOGMSAPI void FAudioGMS_SoundInstance_SetEffectGain(
double soundInstanceID,
double effectGain);
FAUDIOGMSAPI void FAudioGMS_SetMasteringEffectChain(double effectChainID, double effectGain);
FAUDIOGMSAPI void FAudioGMS_SetMasteringEffectGain(double effectGain);
FAUDIOGMSAPI void FAudioGMS_SetListenerPosition(double x, double y, double z);
FAUDIOGMSAPI void FAudioGMS_SetListenerVelocity(
double xVelocity,
double yVelocity,
double zVelocity);
FAUDIOGMSAPI void FAudioGMS_SetListenerOrientation(
double xFront,
double yFront,
double zFront,
double xTop,
double yTop,
double zTop);
FAUDIOGMSAPI void FAudioGMS_PauseAll(); /* useful for mobile platforms, etc
*/
FAUDIOGMSAPI void FAudioGMS_ResumeAll(); /* same as above */
FAUDIOGMSAPI void FAudioGMS_StopAll();
FAUDIOGMSAPI void FAudioGMS_Update();
FAUDIOGMSAPI void FAudioGMS_Destroy();
FAUDIOGMSAPI void FAudioGMS_Init(double spatialDistanceScale, double timestep);
FAUDIOGMSAPI double FAudioGMS_StaticSound_LoadWAV(char *filePath); /* returns a static sound ID */
FAUDIOGMSAPI double FAudioGMS_StaticSound_CreateSoundInstance(double staticSoundID); /* returns a sound instance ID */
FAUDIOGMSAPI void FAudioGMS_StaticSound_Destroy(double staticSoundID);
FAUDIOGMSAPI double FAudioGMS_StreamingSound_LoadOGG(char* filepath); /* returns a sound instance ID */
FAUDIOGMSAPI void FAudioGMS_SoundInstance_Play(double soundInstanceID, double loop);
FAUDIOGMSAPI void FAudioGMS_SoundInstance_Pause(double soundInstanceID);
FAUDIOGMSAPI void FAudioGMS_SoundInstance_Stop(double soundInstanceID);
FAUDIOGMSAPI void FAudioGMS_SoundInstance_SetPan(double soundInstanceID, double pan);
FAUDIOGMSAPI void FAudioGMS_SoundInstance_SetPitch(double soundInstanceID, double pitch);
FAUDIOGMSAPI void FAudioGMS_SoundInstance_SetVolume(double soundInstanceID, double volume);
FAUDIOGMSAPI void FAudioGMS_SoundInstance_Set3DPosition(double soundInstanceID, double x, double y, double z);
FAUDIOGMSAPI void FAudioGMS_SoundInstance_Set3DVelocity(double soundInstanceID, double xVelocity, double yVelocity, double zVelocity);
FAUDIOGMSAPI void FAudioGMS_SoundInstance_SetTrackPositionInSeconds(double soundInstanceID, double trackPositionInSeconds);
FAUDIOGMSAPI void FAudioGMS_SoundInstance_SetVolumeOverTime(double soundInstanceID, double volume, double milliseconds);
FAUDIOGMSAPI void FAudioGMS_SoundInstance_SetLowPassFilter(double soundInstanceID, double lowPassFilter, double Q);
FAUDIOGMSAPI void FAudioGMS_SoundInstance_SetHighPassFilter(double soundInstanceID, double highPassFilter, double Q);
FAUDIOGMSAPI void FAudioGMS_SoundInstance_SetBandPassFilter(double soundInstanceID, double bandPassFilter, double Q);
FAUDIOGMSAPI double FAudioGMS_SoundInstance_GetPitch(double soundInstanceID);
FAUDIOGMSAPI double FAudioGMS_SoundInstance_GetVolume(double soundInstanceID);
FAUDIOGMSAPI double FAudioGMS_SoundInstance_GetTrackLengthInSeconds(double soundInstanceID);
FAUDIOGMSAPI double FAudioGMS_SoundInstance_GetTrackPositionInSeconds(double soundInstanceID);
FAUDIOGMSAPI void FAudioGMS_SoundInstance_Destroy(double soundInstanceID);
FAUDIOGMSAPI void FAudioGMS_SoundInstance_DestroyWhenFinished(double soundInstanceID);
FAUDIOGMSAPI double FAudioGMS_EffectChain_Create();
FAUDIOGMSAPI void FAudioGMS_EffectChain_AddDefaultReverb(double effectChainID);
FAUDIOGMSAPI void FAudioGMS_EffectChain_AddReverb(
double effectChainID,
double wetDryMix,
double reflectionsDelay,
double reverbDelay,
double earlyDiffusion,
double lateDiffusion,
double lowEQGain,
double lowEQCutoff,
double highEQGain,
double highEQCutoff,
double reflectionsGain,
double reverbGain,
double decayTime,
double density,
double roomSize
);
FAUDIOGMSAPI void FAudioGMS_EffectChain_Destroy(double effectChainID);
/*
* NOTE: Any changes to the effect chain will NOT apply after this is set!
* You MUST call SetEffectChain again if you make changes to the effect chain parameters!
*/
FAUDIOGMSAPI void FAudioGMS_SoundInstance_SetEffectChain(double soundInstanceID, double effectChainID, double effectGain);
FAUDIOGMSAPI void FAudioGMS_SoundInstance_SetEffectGain(double soundInstanceID, double effectGain);
FAUDIOGMSAPI void FAudioGMS_SetMasteringEffectChain(double effectChainID, double effectGain);
FAUDIOGMSAPI void FAudioGMS_SetMasteringEffectGain(double effectGain);
FAUDIOGMSAPI void FAudioGMS_SetListenerPosition(double x, double y, double z);
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_Update();
FAUDIOGMSAPI void FAudioGMS_Destroy();
#ifdef __cplusplus
}

12
visualc/FAudioGMS.vcxproj

@ -39,14 +39,13 @@
<PlatformToolset>v142</PlatformToolset>
</PropertyGroup>
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>ClangCL</PlatformToolset>
</PropertyGroup>
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<PlatformToolset>v142</PlatformToolset>
</PropertyGroup>
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<PlatformToolset>v142</PlatformToolset>
<UseOfMfc>false</UseOfMfc>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
@ -90,23 +89,20 @@
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>false</FunctionLevelLinking>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<RuntimeLibrary Condition="'$(Configuration)|$(Platform)'=='Release|x64'">MultiThreaded</RuntimeLibrary>