diff --git a/.gitignore b/.gitignore index 2918c65..6897ebb 100644 --- a/.gitignore +++ b/.gitignore @@ -55,3 +55,12 @@ sysinfo.txt # Crashlytics generated file crashlytics-build.properties +# FMOD Integration files +/FMOD +/Assets/FMODStudioCache.asset +/Assets/FMODStudioCache.asset.meta +/Assets/StreamingAssets/*.bank.* +/Assets/StreamingAssets/*.strings.bank +/Assets/StreamingAssets/Users/ +fmod.log +fmod_editor.log diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..91bf348 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "FMODProject"] + path = FMODProject + url = https://github.com/mfdeveloper/Death.Hawaii.Fmod diff --git a/Assets/Editor Default Resources.meta b/Assets/Editor Default Resources.meta new file mode 100644 index 0000000..ae9c1e4 --- /dev/null +++ b/Assets/Editor Default Resources.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 3ee4b3a2cdd464a27a9af7ab08ce5a2a +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Editor Default Resources/FMOD.meta b/Assets/Editor Default Resources/FMOD.meta new file mode 100755 index 0000000..adac2d4 --- /dev/null +++ b/Assets/Editor Default Resources/FMOD.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 0098ee476320b9141b1c92a2ddc5f9fa +folderAsset: yes +timeCreated: 1447698325 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Editor Default Resources/FMOD/AddIcon.png b/Assets/Editor Default Resources/FMOD/AddIcon.png new file mode 100755 index 0000000..49521d5 Binary files /dev/null and b/Assets/Editor Default Resources/FMOD/AddIcon.png differ diff --git a/Assets/Editor Default Resources/FMOD/AddIcon.png.meta b/Assets/Editor Default Resources/FMOD/AddIcon.png.meta new file mode 100755 index 0000000..4b19942 --- /dev/null +++ b/Assets/Editor Default Resources/FMOD/AddIcon.png.meta @@ -0,0 +1,57 @@ +fileFormatVersion: 2 +guid: 3300e81f02e64924eb7cb7782713b126 +timeCreated: 1455151837 +licenseType: Free +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + linearTexture: 1 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 7 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -3 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: 1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + allowsAlphaSplitting: 0 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 1 + textureType: 2 + buildTargetSettings: [] + spriteSheet: + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Editor Default Resources/FMOD/ArrowDown.png b/Assets/Editor Default Resources/FMOD/ArrowDown.png new file mode 100755 index 0000000..aa71046 Binary files /dev/null and b/Assets/Editor Default Resources/FMOD/ArrowDown.png differ diff --git a/Assets/Editor Default Resources/FMOD/ArrowDown.png.meta b/Assets/Editor Default Resources/FMOD/ArrowDown.png.meta new file mode 100755 index 0000000..1445eac --- /dev/null +++ b/Assets/Editor Default Resources/FMOD/ArrowDown.png.meta @@ -0,0 +1,143 @@ +fileFormatVersion: 2 +guid: d5400a23002b107479debec613434ad6 +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 7 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: -1 + aniso: 1 + mipBias: -100 + wrapU: 1 + wrapV: 1 + wrapW: -1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 2 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - serializedVersion: 2 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: PS4 + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Windows Store Apps + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: WebGL + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: + vertices: [] + indices: + edges: [] + weights: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Editor Default Resources/FMOD/ArrowIcon.png b/Assets/Editor Default Resources/FMOD/ArrowIcon.png new file mode 100755 index 0000000..7dab8c3 Binary files /dev/null and b/Assets/Editor Default Resources/FMOD/ArrowIcon.png differ diff --git a/Assets/Editor Default Resources/FMOD/ArrowIcon.png.meta b/Assets/Editor Default Resources/FMOD/ArrowIcon.png.meta new file mode 100755 index 0000000..423fb26 --- /dev/null +++ b/Assets/Editor Default Resources/FMOD/ArrowIcon.png.meta @@ -0,0 +1,57 @@ +fileFormatVersion: 2 +guid: 01c0101f357b9da4ba78b8f58c290f86 +timeCreated: 1455161898 +licenseType: Free +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + linearTexture: 1 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 7 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -3 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: 1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + allowsAlphaSplitting: 0 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 1 + textureType: 2 + buildTargetSettings: [] + spriteSheet: + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Editor Default Resources/FMOD/ArrowUp.png b/Assets/Editor Default Resources/FMOD/ArrowUp.png new file mode 100755 index 0000000..e608cbe Binary files /dev/null and b/Assets/Editor Default Resources/FMOD/ArrowUp.png differ diff --git a/Assets/Editor Default Resources/FMOD/ArrowUp.png.meta b/Assets/Editor Default Resources/FMOD/ArrowUp.png.meta new file mode 100755 index 0000000..d60513b --- /dev/null +++ b/Assets/Editor Default Resources/FMOD/ArrowUp.png.meta @@ -0,0 +1,143 @@ +fileFormatVersion: 2 +guid: 82ff72577988cdb4a95bd92f1d0bc129 +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 7 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: -1 + aniso: 1 + mipBias: -100 + wrapU: 1 + wrapV: 1 + wrapW: -1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 2 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - serializedVersion: 2 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: PS4 + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Windows Store Apps + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: WebGL + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: + vertices: [] + indices: + edges: [] + weights: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Editor Default Resources/FMOD/BankIcon.png b/Assets/Editor Default Resources/FMOD/BankIcon.png new file mode 100755 index 0000000..b69fb3e Binary files /dev/null and b/Assets/Editor Default Resources/FMOD/BankIcon.png differ diff --git a/Assets/Editor Default Resources/FMOD/BankIcon.png.meta b/Assets/Editor Default Resources/FMOD/BankIcon.png.meta new file mode 100755 index 0000000..f53f3a7 --- /dev/null +++ b/Assets/Editor Default Resources/FMOD/BankIcon.png.meta @@ -0,0 +1,55 @@ +fileFormatVersion: 2 +guid: a7e06068a7215854a84bf5ed8280ed15 +timeCreated: 1433208188 +licenseType: Free +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + linearTexture: 1 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 8 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: 1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 1 + textureType: 2 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Editor Default Resources/FMOD/Border.png b/Assets/Editor Default Resources/FMOD/Border.png new file mode 100755 index 0000000..b0b1651 Binary files /dev/null and b/Assets/Editor Default Resources/FMOD/Border.png differ diff --git a/Assets/Editor Default Resources/FMOD/Border.png.meta b/Assets/Editor Default Resources/FMOD/Border.png.meta new file mode 100755 index 0000000..92ec907 --- /dev/null +++ b/Assets/Editor Default Resources/FMOD/Border.png.meta @@ -0,0 +1,57 @@ +fileFormatVersion: 2 +guid: 40848578d1961334d820821bec6175a4 +timeCreated: 1455150446 +licenseType: Free +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + linearTexture: 1 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 7 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -3 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: 1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + allowsAlphaSplitting: 0 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 1 + textureType: 2 + buildTargetSettings: [] + spriteSheet: + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Editor Default Resources/FMOD/BrowserIcon.png b/Assets/Editor Default Resources/FMOD/BrowserIcon.png new file mode 100755 index 0000000..1982527 Binary files /dev/null and b/Assets/Editor Default Resources/FMOD/BrowserIcon.png differ diff --git a/Assets/Editor Default Resources/FMOD/BrowserIcon.png.meta b/Assets/Editor Default Resources/FMOD/BrowserIcon.png.meta new file mode 100755 index 0000000..c8b4275 --- /dev/null +++ b/Assets/Editor Default Resources/FMOD/BrowserIcon.png.meta @@ -0,0 +1,57 @@ +fileFormatVersion: 2 +guid: c783b763d12874147876e070661b66ab +timeCreated: 1455688158 +licenseType: Free +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + linearTexture: 1 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 7 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -3 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: 1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + allowsAlphaSplitting: 0 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 1 + textureType: 2 + buildTargetSettings: [] + spriteSheet: + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Editor Default Resources/FMOD/CopyIcon.png b/Assets/Editor Default Resources/FMOD/CopyIcon.png new file mode 100755 index 0000000..fa6621b Binary files /dev/null and b/Assets/Editor Default Resources/FMOD/CopyIcon.png differ diff --git a/Assets/Editor Default Resources/FMOD/CopyIcon.png.meta b/Assets/Editor Default Resources/FMOD/CopyIcon.png.meta new file mode 100755 index 0000000..792ff4b --- /dev/null +++ b/Assets/Editor Default Resources/FMOD/CopyIcon.png.meta @@ -0,0 +1,57 @@ +fileFormatVersion: 2 +guid: 6e164dcb85fc8ad4b9ab2f1e883862d2 +timeCreated: 1455688729 +licenseType: Free +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 7 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapMode: -1 + nPOTScale: 1 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + allowsAlphaSplitting: 0 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + textureType: -1 + buildTargetSettings: [] + spriteSheet: + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Editor Default Resources/FMOD/Delete.png b/Assets/Editor Default Resources/FMOD/Delete.png new file mode 100755 index 0000000..52ed43b Binary files /dev/null and b/Assets/Editor Default Resources/FMOD/Delete.png differ diff --git a/Assets/Editor Default Resources/FMOD/Delete.png.meta b/Assets/Editor Default Resources/FMOD/Delete.png.meta new file mode 100755 index 0000000..40412c6 --- /dev/null +++ b/Assets/Editor Default Resources/FMOD/Delete.png.meta @@ -0,0 +1,55 @@ +fileFormatVersion: 2 +guid: 196080340db65c44883dd3f599556fb9 +timeCreated: 1434604329 +licenseType: Free +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + linearTexture: 1 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 8 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: 1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 1 + textureType: 2 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Editor Default Resources/FMOD/EventIcon.png b/Assets/Editor Default Resources/FMOD/EventIcon.png new file mode 100755 index 0000000..dc7c272 Binary files /dev/null and b/Assets/Editor Default Resources/FMOD/EventIcon.png differ diff --git a/Assets/Editor Default Resources/FMOD/EventIcon.png.meta b/Assets/Editor Default Resources/FMOD/EventIcon.png.meta new file mode 100755 index 0000000..f680acd --- /dev/null +++ b/Assets/Editor Default Resources/FMOD/EventIcon.png.meta @@ -0,0 +1,55 @@ +fileFormatVersion: 2 +guid: a602f206f9cb31f439c79a2fe23687c5 +timeCreated: 1432616010 +licenseType: Free +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + linearTexture: 1 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 8 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -3 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: 1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 1 + textureType: 2 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Editor Default Resources/FMOD/FolderIconClosed.png b/Assets/Editor Default Resources/FMOD/FolderIconClosed.png new file mode 100755 index 0000000..d0082ba Binary files /dev/null and b/Assets/Editor Default Resources/FMOD/FolderIconClosed.png differ diff --git a/Assets/Editor Default Resources/FMOD/FolderIconClosed.png.meta b/Assets/Editor Default Resources/FMOD/FolderIconClosed.png.meta new file mode 100755 index 0000000..4b3bdbe --- /dev/null +++ b/Assets/Editor Default Resources/FMOD/FolderIconClosed.png.meta @@ -0,0 +1,55 @@ +fileFormatVersion: 2 +guid: 70efeb6d97126f843b30b8ed62d18a4f +timeCreated: 1432621560 +licenseType: Free +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + linearTexture: 1 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 8 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -3 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: 1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 1 + textureType: 2 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Editor Default Resources/FMOD/FolderIconOpen.png b/Assets/Editor Default Resources/FMOD/FolderIconOpen.png new file mode 100755 index 0000000..d9df3e7 Binary files /dev/null and b/Assets/Editor Default Resources/FMOD/FolderIconOpen.png differ diff --git a/Assets/Editor Default Resources/FMOD/FolderIconOpen.png.meta b/Assets/Editor Default Resources/FMOD/FolderIconOpen.png.meta new file mode 100755 index 0000000..1be4086 --- /dev/null +++ b/Assets/Editor Default Resources/FMOD/FolderIconOpen.png.meta @@ -0,0 +1,55 @@ +fileFormatVersion: 2 +guid: d2b54e4f7f80b9448a41d3c5985f5672 +timeCreated: 1432621574 +licenseType: Free +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + linearTexture: 1 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 8 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -3 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: 1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 1 + textureType: 2 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Editor Default Resources/FMOD/LevelMeter.png b/Assets/Editor Default Resources/FMOD/LevelMeter.png new file mode 100755 index 0000000..7e427ef Binary files /dev/null and b/Assets/Editor Default Resources/FMOD/LevelMeter.png differ diff --git a/Assets/Editor Default Resources/FMOD/LevelMeter.png.meta b/Assets/Editor Default Resources/FMOD/LevelMeter.png.meta new file mode 100755 index 0000000..4c7a36b --- /dev/null +++ b/Assets/Editor Default Resources/FMOD/LevelMeter.png.meta @@ -0,0 +1,55 @@ +fileFormatVersion: 2 +guid: 21e7a3d41a926364a8b9a6704ebe80d8 +timeCreated: 1433917421 +licenseType: Free +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + linearTexture: 1 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 8 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: 1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 1 + textureType: 2 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Editor Default Resources/FMOD/LevelMeterOff.png b/Assets/Editor Default Resources/FMOD/LevelMeterOff.png new file mode 100755 index 0000000..6da84b2 Binary files /dev/null and b/Assets/Editor Default Resources/FMOD/LevelMeterOff.png differ diff --git a/Assets/Editor Default Resources/FMOD/LevelMeterOff.png.meta b/Assets/Editor Default Resources/FMOD/LevelMeterOff.png.meta new file mode 100755 index 0000000..473c6cb --- /dev/null +++ b/Assets/Editor Default Resources/FMOD/LevelMeterOff.png.meta @@ -0,0 +1,55 @@ +fileFormatVersion: 2 +guid: 48dc5470d93f669419f294fcd33f7b7c +timeCreated: 1434426551 +licenseType: Free +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + linearTexture: 1 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 8 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: 1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 1 + textureType: 2 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Editor Default Resources/FMOD/NotFound.png b/Assets/Editor Default Resources/FMOD/NotFound.png new file mode 100755 index 0000000..03a4ee0 Binary files /dev/null and b/Assets/Editor Default Resources/FMOD/NotFound.png differ diff --git a/Assets/Editor Default Resources/FMOD/NotFound.png.meta b/Assets/Editor Default Resources/FMOD/NotFound.png.meta new file mode 100755 index 0000000..bd16a94 --- /dev/null +++ b/Assets/Editor Default Resources/FMOD/NotFound.png.meta @@ -0,0 +1,55 @@ +fileFormatVersion: 2 +guid: 1138ab068176f29499337d7a73dfecd9 +timeCreated: 1432798099 +licenseType: Free +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + linearTexture: 1 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 8 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: 1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 1 + textureType: 2 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Editor Default Resources/FMOD/SearchIcon.png b/Assets/Editor Default Resources/FMOD/SearchIcon.png new file mode 100755 index 0000000..7cf8716 Binary files /dev/null and b/Assets/Editor Default Resources/FMOD/SearchIcon.png differ diff --git a/Assets/Editor Default Resources/FMOD/SearchIcon.png.meta b/Assets/Editor Default Resources/FMOD/SearchIcon.png.meta new file mode 100755 index 0000000..d6fbaf4 --- /dev/null +++ b/Assets/Editor Default Resources/FMOD/SearchIcon.png.meta @@ -0,0 +1,55 @@ +fileFormatVersion: 2 +guid: 1b785acb38b002542a02d6c4cbb1fa6f +timeCreated: 1432696384 +licenseType: Free +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + linearTexture: 1 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 8 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -3 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: 1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 1 + textureType: 2 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Editor Default Resources/FMOD/SearchIconBlack.png b/Assets/Editor Default Resources/FMOD/SearchIconBlack.png new file mode 100755 index 0000000..212ee28 Binary files /dev/null and b/Assets/Editor Default Resources/FMOD/SearchIconBlack.png differ diff --git a/Assets/Editor Default Resources/FMOD/SearchIconBlack.png.meta b/Assets/Editor Default Resources/FMOD/SearchIconBlack.png.meta new file mode 100755 index 0000000..aaa1c13 --- /dev/null +++ b/Assets/Editor Default Resources/FMOD/SearchIconBlack.png.meta @@ -0,0 +1,55 @@ +fileFormatVersion: 2 +guid: 99471facfde9fb84dbe4a81ad570ebce +timeCreated: 1434602090 +licenseType: Free +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + linearTexture: 1 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 8 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: 1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 1 + textureType: 2 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Editor Default Resources/FMOD/Selected.png b/Assets/Editor Default Resources/FMOD/Selected.png new file mode 100755 index 0000000..3b2e828 Binary files /dev/null and b/Assets/Editor Default Resources/FMOD/Selected.png differ diff --git a/Assets/Editor Default Resources/FMOD/Selected.png.meta b/Assets/Editor Default Resources/FMOD/Selected.png.meta new file mode 100755 index 0000000..2f2b520 --- /dev/null +++ b/Assets/Editor Default Resources/FMOD/Selected.png.meta @@ -0,0 +1,55 @@ +fileFormatVersion: 2 +guid: 38be8eaefa585de4aa1781acb0adc866 +timeCreated: 1432797507 +licenseType: Free +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + linearTexture: 1 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 8 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: 1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 1 + textureType: 2 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Editor Default Resources/FMOD/SelectedAlt.png b/Assets/Editor Default Resources/FMOD/SelectedAlt.png new file mode 100755 index 0000000..278fd13 Binary files /dev/null and b/Assets/Editor Default Resources/FMOD/SelectedAlt.png differ diff --git a/Assets/Editor Default Resources/FMOD/SelectedAlt.png.meta b/Assets/Editor Default Resources/FMOD/SelectedAlt.png.meta new file mode 100755 index 0000000..0ddcc1f --- /dev/null +++ b/Assets/Editor Default Resources/FMOD/SelectedAlt.png.meta @@ -0,0 +1,57 @@ +fileFormatVersion: 2 +guid: 8ce9b717b1bc7564cbe35664f2f178a7 +timeCreated: 1455161898 +licenseType: Free +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + linearTexture: 1 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 7 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -3 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: 1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + allowsAlphaSplitting: 0 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 1 + textureType: 2 + buildTargetSettings: [] + spriteSheet: + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Editor Default Resources/FMOD/SnapshotIcon.png b/Assets/Editor Default Resources/FMOD/SnapshotIcon.png new file mode 100755 index 0000000..6437178 Binary files /dev/null and b/Assets/Editor Default Resources/FMOD/SnapshotIcon.png differ diff --git a/Assets/Editor Default Resources/FMOD/SnapshotIcon.png.meta b/Assets/Editor Default Resources/FMOD/SnapshotIcon.png.meta new file mode 100755 index 0000000..4755690 --- /dev/null +++ b/Assets/Editor Default Resources/FMOD/SnapshotIcon.png.meta @@ -0,0 +1,55 @@ +fileFormatVersion: 2 +guid: cf2bba5fb8be7e64ca39979f18eb372a +timeCreated: 1434600422 +licenseType: Free +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + linearTexture: 1 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 8 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: 1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 1 + textureType: 2 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Editor Default Resources/FMOD/StudioIcon.png b/Assets/Editor Default Resources/FMOD/StudioIcon.png new file mode 100755 index 0000000..1e96c6a Binary files /dev/null and b/Assets/Editor Default Resources/FMOD/StudioIcon.png differ diff --git a/Assets/Editor Default Resources/FMOD/StudioIcon.png.meta b/Assets/Editor Default Resources/FMOD/StudioIcon.png.meta new file mode 100755 index 0000000..2f7dae7 --- /dev/null +++ b/Assets/Editor Default Resources/FMOD/StudioIcon.png.meta @@ -0,0 +1,55 @@ +fileFormatVersion: 2 +guid: a4edfa5854cdec34b98b1c55f0562bdd +timeCreated: 1434601223 +licenseType: Free +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + linearTexture: 1 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 8 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: 1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 1 + textureType: 2 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Editor Default Resources/FMOD/TransportOpen.png b/Assets/Editor Default Resources/FMOD/TransportOpen.png new file mode 100755 index 0000000..874ed76 Binary files /dev/null and b/Assets/Editor Default Resources/FMOD/TransportOpen.png differ diff --git a/Assets/Editor Default Resources/FMOD/TransportOpen.png.meta b/Assets/Editor Default Resources/FMOD/TransportOpen.png.meta new file mode 100755 index 0000000..c06cc4e --- /dev/null +++ b/Assets/Editor Default Resources/FMOD/TransportOpen.png.meta @@ -0,0 +1,57 @@ +fileFormatVersion: 2 +guid: b0fb832e401d1514a9611735d8d340b1 +timeCreated: 1453178387 +licenseType: Free +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + linearTexture: 1 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 7 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -3 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: 1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + allowsAlphaSplitting: 0 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 1 + textureType: 2 + buildTargetSettings: [] + spriteSheet: + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Editor Default Resources/FMOD/TransportPlayButtonOff.png b/Assets/Editor Default Resources/FMOD/TransportPlayButtonOff.png new file mode 100755 index 0000000..393ee3c Binary files /dev/null and b/Assets/Editor Default Resources/FMOD/TransportPlayButtonOff.png differ diff --git a/Assets/Editor Default Resources/FMOD/TransportPlayButtonOff.png.meta b/Assets/Editor Default Resources/FMOD/TransportPlayButtonOff.png.meta new file mode 100755 index 0000000..48014c5 --- /dev/null +++ b/Assets/Editor Default Resources/FMOD/TransportPlayButtonOff.png.meta @@ -0,0 +1,57 @@ +fileFormatVersion: 2 +guid: 29258b1336a580946bc144df00b74ac1 +timeCreated: 1453177025 +licenseType: Free +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + linearTexture: 1 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 7 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -3 + maxTextureSize: 2048 + textureSettings: + filterMode: 1 + aniso: 1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + allowsAlphaSplitting: 0 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 1 + textureType: 2 + buildTargetSettings: [] + spriteSheet: + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Editor Default Resources/FMOD/TransportPlayButtonOn.png b/Assets/Editor Default Resources/FMOD/TransportPlayButtonOn.png new file mode 100755 index 0000000..5f19c41 Binary files /dev/null and b/Assets/Editor Default Resources/FMOD/TransportPlayButtonOn.png differ diff --git a/Assets/Editor Default Resources/FMOD/TransportPlayButtonOn.png.meta b/Assets/Editor Default Resources/FMOD/TransportPlayButtonOn.png.meta new file mode 100755 index 0000000..7d4553f --- /dev/null +++ b/Assets/Editor Default Resources/FMOD/TransportPlayButtonOn.png.meta @@ -0,0 +1,57 @@ +fileFormatVersion: 2 +guid: 2d777c9a14189d241aea1afeeeff448c +timeCreated: 1453177025 +licenseType: Free +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + linearTexture: 1 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 7 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -3 + maxTextureSize: 2048 + textureSettings: + filterMode: 1 + aniso: 1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + allowsAlphaSplitting: 0 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 1 + textureType: 2 + buildTargetSettings: [] + spriteSheet: + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Editor Default Resources/FMOD/TransportStopButtonOff.png b/Assets/Editor Default Resources/FMOD/TransportStopButtonOff.png new file mode 100755 index 0000000..0a66e0a Binary files /dev/null and b/Assets/Editor Default Resources/FMOD/TransportStopButtonOff.png differ diff --git a/Assets/Editor Default Resources/FMOD/TransportStopButtonOff.png.meta b/Assets/Editor Default Resources/FMOD/TransportStopButtonOff.png.meta new file mode 100755 index 0000000..9f592a1 --- /dev/null +++ b/Assets/Editor Default Resources/FMOD/TransportStopButtonOff.png.meta @@ -0,0 +1,57 @@ +fileFormatVersion: 2 +guid: cafa069c15865d543a07375373f0a18e +timeCreated: 1453177025 +licenseType: Free +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + linearTexture: 1 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 7 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -3 + maxTextureSize: 2048 + textureSettings: + filterMode: 1 + aniso: 1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + allowsAlphaSplitting: 0 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 1 + textureType: 2 + buildTargetSettings: [] + spriteSheet: + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Editor Default Resources/FMOD/TransportStopButtonOn.png b/Assets/Editor Default Resources/FMOD/TransportStopButtonOn.png new file mode 100755 index 0000000..975e305 Binary files /dev/null and b/Assets/Editor Default Resources/FMOD/TransportStopButtonOn.png differ diff --git a/Assets/Editor Default Resources/FMOD/TransportStopButtonOn.png.meta b/Assets/Editor Default Resources/FMOD/TransportStopButtonOn.png.meta new file mode 100755 index 0000000..7ebdb4f --- /dev/null +++ b/Assets/Editor Default Resources/FMOD/TransportStopButtonOn.png.meta @@ -0,0 +1,57 @@ +fileFormatVersion: 2 +guid: eab53cb0959d1244aadeacf8b76c755c +timeCreated: 1453177025 +licenseType: Free +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + linearTexture: 1 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 7 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -3 + maxTextureSize: 2048 + textureSettings: + filterMode: 1 + aniso: 1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + allowsAlphaSplitting: 0 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 1 + textureType: 2 + buildTargetSettings: [] + spriteSheet: + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Editor Default Resources/FMOD/preview.png b/Assets/Editor Default Resources/FMOD/preview.png new file mode 100755 index 0000000..b91f101 Binary files /dev/null and b/Assets/Editor Default Resources/FMOD/preview.png differ diff --git a/Assets/Editor Default Resources/FMOD/preview.png.meta b/Assets/Editor Default Resources/FMOD/preview.png.meta new file mode 100755 index 0000000..b9fc668 --- /dev/null +++ b/Assets/Editor Default Resources/FMOD/preview.png.meta @@ -0,0 +1,56 @@ +fileFormatVersion: 2 +guid: 0793eda432fc5df4ab1291e6baacd771 +timeCreated: 1434430906 +licenseType: Free +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + linearTexture: 1 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 8 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -3 + maxTextureSize: 2048 + textureSettings: + filterMode: 1 + aniso: 1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + allowsAlphaSplitting: 0 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 1 + textureType: 2 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Editor Default Resources/FMOD/previewemitter.png b/Assets/Editor Default Resources/FMOD/previewemitter.png new file mode 100755 index 0000000..32ec8c6 Binary files /dev/null and b/Assets/Editor Default Resources/FMOD/previewemitter.png differ diff --git a/Assets/Editor Default Resources/FMOD/previewemitter.png.meta b/Assets/Editor Default Resources/FMOD/previewemitter.png.meta new file mode 100755 index 0000000..7e74c5d --- /dev/null +++ b/Assets/Editor Default Resources/FMOD/previewemitter.png.meta @@ -0,0 +1,55 @@ +fileFormatVersion: 2 +guid: 9519043db3741934fa01455c47683e8c +timeCreated: 1434431177 +licenseType: Free +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 8 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapMode: -1 + nPOTScale: 1 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + textureType: -1 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Gizmos.meta b/Assets/Gizmos.meta new file mode 100644 index 0000000..cf52957 --- /dev/null +++ b/Assets/Gizmos.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: eed3c0249cc802344a53fa081782eea7 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Gizmos/FMOD.meta b/Assets/Gizmos/FMOD.meta new file mode 100755 index 0000000..f81f4ef --- /dev/null +++ b/Assets/Gizmos/FMOD.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: c91c45cad0700604b9e81cdb2586d876 +folderAsset: yes +timeCreated: 1552564451 +licenseType: Free +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Gizmos/FMOD/FMODEmitter.tiff b/Assets/Gizmos/FMOD/FMODEmitter.tiff new file mode 100755 index 0000000..fe765e4 Binary files /dev/null and b/Assets/Gizmos/FMOD/FMODEmitter.tiff differ diff --git a/Assets/Gizmos/FMOD/FMODEmitter.tiff.meta b/Assets/Gizmos/FMOD/FMODEmitter.tiff.meta new file mode 100755 index 0000000..4d858e3 --- /dev/null +++ b/Assets/Gizmos/FMOD/FMODEmitter.tiff.meta @@ -0,0 +1,55 @@ +fileFormatVersion: 2 +guid: 392af304825cbe847bbf4e603852e4dd +timeCreated: 1433142042 +licenseType: Free +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 8 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapMode: -1 + nPOTScale: 1 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + textureType: -1 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins.meta b/Assets/Plugins.meta new file mode 100644 index 0000000..e791e16 --- /dev/null +++ b/Assets/Plugins.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 6d0521c8f15ef45de8cede25992f529f +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD.meta b/Assets/Plugins/FMOD.meta new file mode 100755 index 0000000..73f856b --- /dev/null +++ b/Assets/Plugins/FMOD.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 06ae579381df01a4a87bb149dec89954 +folderAsset: yes +timeCreated: 1429061260 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/LICENSE.TXT b/Assets/Plugins/FMOD/LICENSE.TXT new file mode 100755 index 0000000..59ad62d --- /dev/null +++ b/Assets/Plugins/FMOD/LICENSE.TXT @@ -0,0 +1,121 @@ + FMOD END USER LICENCE AGREEMENT + =============================== + +This FMOD End User Licence Agreement (EULA) is a legal agreement between you and +Firelight Technologies Pty Ltd (ACN 099 182 448) (us or we) and governs your use +of FMOD Studio and FMOD Engine software (FMOD). + +1. GRANT OF LICENCE + This EULA grants you the right to use FMOD, in a software application (Product), for + personal (hobbyist), educational (students and teachers) or Non-Commercial use only, + subject to the following: + i) Non-Commercial use does not involve any form of monetisation, sponsorship + or promotion. + ii) FMOD is distributed as integrated into a Product only; + iii) FMOD is not distributed as part of any Commercial Product or service; + iv) FMOD is not distributed as part of a game engine or tool set; + v) FMOD is not used in any Commercial enterprise or for any Commercial + production or subcontracting, except for the purposes of Evaluation or + Development of a Commercial Product; + vi) Product includes attribution in accordance with Clause 3; + +2. OTHER USE + For all Commercial use, and any Non Commercial use not permitted by this license, a + separate license is required. Refer to www.fmod.com/licensing for information. + +3. CREDITS + All Products require an in game credit line which must include the words "FMOD" or + "FMOD Studio" (if applicable) and "Firelight Technologies Pty Ltd". Refer to + www.fmod.com/licensing for examples + +4. INTELLECTUAL PROPERTY RIGHTS + a) We are and remain at all times the owner of FMOD (including all intellectual + property rights in or to the Software). For the avoidance of doubt, nothing in + this EULA may be deemed to grant or assign to you any proprietary or ownership + interest or intellectual property rights in or to FMOD other than the rights + licensed pursuant to clause 1. + b) You acknowledge and agree that you have no right, title or interest in and to the + intellectual property rights in FMOD. + +5. SECURITY AND RISK + You are responsible for protecting FMOD and any related materials at all times from + unauthorised access, use or damage. + +6. WARRANTY AND LIMITATION OF LIABILITY + a) FMOD is provided by us "as is" and, to the maximum extent permitted by law, + any express or implied warranties of any kind, including (but not limited to) all + implied warranties of merchantability and fitness for a particular purpose are + disclaimed. + b) In no event shall we (and our employees, contractors and subcontractors), + developers and contributors be liable for any direct, special, indirect or + consequential damages whatsoever resulting from loss of use of data or profits, + whether in an action of contract, negligence or other tortious conduct, arising + out of or in connection with the use or performance FMOD. + +7. OGG VORBIS CODEC + a) FMOD uses the Ogg Vorbis codec. + b) (c) 2002, Xiph.Org Foundation + c) Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + i) Redistributions of source code must retain the above copyright notice, the + list of conditions and the following disclaimer. + ii) Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other material provided with the distribution. + iii) Neither the name of the Xiph.org Foundation nor the names of its + contributors may be used to endorse or promote products derived from this + software without specific prior written permission. + d) THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND + CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +8. GOOGLE VR (GVR) + FMOD includes Google VR, licensed under the Apache Licence, Version 2.0 (the + Licence); you may not use this file except in compliance with the License. + You may obtain a copy of the License at: + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software distributed + under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. See the License for the + specific language governing permissions and limitations under the License. + +9. ANDROID PLATFORM CODE + Copyright (C) 2010 The Android Open Source Project All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, are + permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. + +10. AUDIOGAMING AUDIOMOTORS DEMO CONTENT + AudioGaming AudioMotors Demo Engine.agp is provided for evaluation purposes + only and is not to be redistributed. To create your own engine content, you + will need AudioMotors V2 Pro. A trial version be found at + http://store.audiogaming.net/content/audiomotors-v2-pro-trial. For access to + the full version, contact sales@fmod.com. diff --git a/Assets/Plugins/FMOD/LICENSE.TXT.meta b/Assets/Plugins/FMOD/LICENSE.TXT.meta new file mode 100755 index 0000000..d67400c --- /dev/null +++ b/Assets/Plugins/FMOD/LICENSE.TXT.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 4ce164ba4ab63814c81ffc0a4820e07c +timeCreated: 1552564471 +licenseType: Free +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/Resources.meta b/Assets/Plugins/FMOD/Resources.meta new file mode 100644 index 0000000..a8bd7f6 --- /dev/null +++ b/Assets/Plugins/FMOD/Resources.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: fa8df8c63e1ec478b8f48aac953782a1 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/Resources/FMODStudioCache.asset b/Assets/Plugins/FMOD/Resources/FMODStudioCache.asset new file mode 100644 index 0000000..55ec68f --- /dev/null +++ b/Assets/Plugins/FMOD/Resources/FMODStudioCache.asset @@ -0,0 +1,681 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &-9005644435477063976 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: c18180ecb35941f4682ae60107b85b7c, type: 3} + m_Name: + m_EditorClassIdentifier: + Path: /Users/darkness/FmodProjects/Ludum.Dare.44/Death.Hawaii/FMOD.Death.Hawaii/Build/Desktop/Master.strings.bank + lastModified: 636920836700000000 + LoadResult: 0 + FileSizes: + - Name: Desktop + Value: 1270 + Exists: 1 +--- !u!114 &-8700992224845500940 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ceb653cd98e289a4e8697a1af55201f2, type: 3} + m_Name: + m_EditorClassIdentifier: + Path: event:/ambience_gameplay + guid: 3f834ee7b11cf64cb03e45b092e86bdf + Banks: + - {fileID: -4314731109269342154} + IsStream: 1 + Is3D: 0 + IsOneShot: 0 + Parameters: [] + MinDistance: 0 + MaxDistance: 0 + Length: 51373 +--- !u!114 &-8203208471805641358 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ceb653cd98e289a4e8697a1af55201f2, type: 3} + m_Name: + m_EditorClassIdentifier: + Path: event:/sfx_hit_metal + guid: c942dc8c6eb8574fa7e0d77d691f83ec + Banks: + - {fileID: -4314731109269342154} + IsStream: 0 + Is3D: 0 + IsOneShot: 1 + Parameters: [] + MinDistance: 0 + MaxDistance: 0 + Length: 2240 +--- !u!114 &-7630244677751472250 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ceb653cd98e289a4e8697a1af55201f2, type: 3} + m_Name: + m_EditorClassIdentifier: + Path: event:/sfx_shouts_male + guid: 096df8d7dbd8504bb6459f59f51ebb3d + Banks: + - {fileID: 5038475025321297510} + IsStream: 0 + Is3D: 0 + IsOneShot: 1 + Parameters: [] + MinDistance: 0 + MaxDistance: 0 + Length: 1500 +--- !u!114 &-6917909706294029699 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ceb653cd98e289a4e8697a1af55201f2, type: 3} + m_Name: + m_EditorClassIdentifier: + Path: event:/music_menu + guid: 5f2e91eb701aa2409230863a070c9240 + Banks: + - {fileID: 5038475025321297510} + IsStream: 1 + Is3D: 0 + IsOneShot: 0 + Parameters: [] + MinDistance: 0 + MaxDistance: 0 + Length: 24774 +--- !u!114 &-6551421120203079660 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ceb653cd98e289a4e8697a1af55201f2, type: 3} + m_Name: + m_EditorClassIdentifier: + Path: event:/sfx_skate_roll + guid: 13c2c283b8853545a4c44b511ab9f8dc + Banks: + - {fileID: 5038475025321297510} + IsStream: 0 + Is3D: 0 + IsOneShot: 0 + Parameters: [] + MinDistance: 0 + MaxDistance: 0 + Length: 6773 +--- !u!114 &-6375368578962570124 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ceb653cd98e289a4e8697a1af55201f2, type: 3} + m_Name: + m_EditorClassIdentifier: + Path: event:/sfx_shouts_female + guid: 9c152038e9df114badfd107fd1ad5efc + Banks: + - {fileID: 5038475025321297510} + IsStream: 0 + Is3D: 0 + IsOneShot: 1 + Parameters: [] + MinDistance: 0 + MaxDistance: 0 + Length: 2000 +--- !u!114 &-6272511704519577286 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ceb653cd98e289a4e8697a1af55201f2, type: 3} + m_Name: + m_EditorClassIdentifier: + Path: event:/music_game_over + guid: 9c2a44335bc57844a4f5b505bc04eabe + Banks: + - {fileID: -4314731109269342154} + IsStream: 0 + Is3D: 0 + IsOneShot: 1 + Parameters: [] + MinDistance: 0 + MaxDistance: 0 + Length: 8127 +--- !u!114 &-4777722015740390916 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ceb653cd98e289a4e8697a1af55201f2, type: 3} + m_Name: + m_EditorClassIdentifier: + Path: event:/sfx_skate_roll + guid: 13c2c283b8853545a4c44b511ab9f8dc + Banks: + - {fileID: -4314731109269342154} + IsStream: 0 + Is3D: 0 + IsOneShot: 0 + Parameters: [] + MinDistance: 0 + MaxDistance: 0 + Length: 6773 +--- !u!114 &-4510499392113818473 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ceb653cd98e289a4e8697a1af55201f2, type: 3} + m_Name: + m_EditorClassIdentifier: + Path: event:/music_game_over + guid: 9c2a44335bc57844a4f5b505bc04eabe + Banks: + - {fileID: 5038475025321297510} + IsStream: 0 + Is3D: 0 + IsOneShot: 1 + Parameters: [] + MinDistance: 0 + MaxDistance: 0 + Length: 8127 +--- !u!114 &-4314731109269342154 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: c18180ecb35941f4682ae60107b85b7c, type: 3} + m_Name: + m_EditorClassIdentifier: + Path: /Users/darkness/FmodProjects/Ludum.Dare.44/Death.Hawaii/FMOD.Death.Hawaii/Build/Desktop/Master.bank + lastModified: 636920840320000000 + LoadResult: 0 + FileSizes: + - Name: Desktop + Value: 2270592 + Exists: 1 +--- !u!114 &-4054602727828430356 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ceb653cd98e289a4e8697a1af55201f2, type: 3} + m_Name: + m_EditorClassIdentifier: + Path: event:/sfx_cash_register + guid: 8ad31ce278e2614a8a1fca3d747345e7 + Banks: + - {fileID: 5038475025321297510} + IsStream: 0 + Is3D: 0 + IsOneShot: 1 + Parameters: [] + MinDistance: 0 + MaxDistance: 0 + Length: 1064 +--- !u!114 &-3551506775353787741 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ceb653cd98e289a4e8697a1af55201f2, type: 3} + m_Name: + m_EditorClassIdentifier: + Path: event:/sfx_colect coins + guid: 447bb809383c4e47a8bbccaf3ed1bc9b + Banks: + - {fileID: -4314731109269342154} + IsStream: 0 + Is3D: 0 + IsOneShot: 1 + Parameters: [] + MinDistance: 0 + MaxDistance: 0 + Length: 543 +--- !u!114 &-2449945591387876750 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ceb653cd98e289a4e8697a1af55201f2, type: 3} + m_Name: + m_EditorClassIdentifier: + Path: event:/music_victory + guid: c5fe10e93b7da944a8bf2f1c58ce4872 + Banks: + - {fileID: 5038475025321297510} + IsStream: 0 + Is3D: 0 + IsOneShot: 1 + Parameters: [] + MinDistance: 0 + MaxDistance: 0 + Length: 4486 +--- !u!114 &-1719491775567172822 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ceb653cd98e289a4e8697a1af55201f2, type: 3} + m_Name: + m_EditorClassIdentifier: + Path: event:/sfx_shouts_male + guid: 096df8d7dbd8504bb6459f59f51ebb3d + Banks: + - {fileID: -4314731109269342154} + IsStream: 0 + Is3D: 0 + IsOneShot: 1 + Parameters: [] + MinDistance: 0 + MaxDistance: 0 + Length: 1500 +--- !u!114 &-652652277495706193 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ceb653cd98e289a4e8697a1af55201f2, type: 3} + m_Name: + m_EditorClassIdentifier: + Path: event:/ambience_gameplay + guid: 3f834ee7b11cf64cb03e45b092e86bdf + Banks: + - {fileID: 5038475025321297510} + IsStream: 1 + Is3D: 0 + IsOneShot: 0 + Parameters: [] + MinDistance: 0 + MaxDistance: 0 + Length: 51373 +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d32cf7c32a3ed8347bac48ef5ed56d82, type: 3} + m_Name: FMODStudioCache + m_EditorClassIdentifier: + EditorBanks: + - {fileID: 6538330867862680022} + - {fileID: 5038475025321297510} + - {fileID: 8893018113691044415} + EditorEvents: + - {fileID: -7630244677751472250} + - {fileID: -6551421120203079660} + - {fileID: -652652277495706193} + - {fileID: 8273690441394894316} + - {fileID: 7818469860916841469} + - {fileID: -6917909706294029699} + - {fileID: 736112552278880865} + - {fileID: -4054602727828430356} + - {fileID: -6375368578962570124} + - {fileID: -4510499392113818473} + - {fileID: -2449945591387876750} + - {fileID: 799924552660108749} + EditorParameters: [] + MasterBanks: + - {fileID: 5038475025321297510} + StringsBanks: + - {fileID: 6538330867862680022} + stringsBankWriteTime: 636925979640000000 + cacheVersion: 3 +--- !u!114 &736112552278880865 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ceb653cd98e289a4e8697a1af55201f2, type: 3} + m_Name: + m_EditorClassIdentifier: + Path: event:/sfx_hit_people + guid: 763e8aafb0dbb24c9a8b6d026e7b754b + Banks: + - {fileID: 5038475025321297510} + IsStream: 0 + Is3D: 0 + IsOneShot: 1 + Parameters: [] + MinDistance: 0 + MaxDistance: 0 + Length: 645 +--- !u!114 &799924552660108749 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ceb653cd98e289a4e8697a1af55201f2, type: 3} + m_Name: + m_EditorClassIdentifier: + Path: event:/sfx_hit_metal + guid: c942dc8c6eb8574fa7e0d77d691f83ec + Banks: + - {fileID: 5038475025321297510} + IsStream: 0 + Is3D: 0 + IsOneShot: 1 + Parameters: [] + MinDistance: 0 + MaxDistance: 0 + Length: 2240 +--- !u!114 &1560815138797645397 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ceb653cd98e289a4e8697a1af55201f2, type: 3} + m_Name: + m_EditorClassIdentifier: + Path: event:/music_victory + guid: c5fe10e93b7da944a8bf2f1c58ce4872 + Banks: + - {fileID: -4314731109269342154} + IsStream: 0 + Is3D: 0 + IsOneShot: 1 + Parameters: [] + MinDistance: 0 + MaxDistance: 0 + Length: 4486 +--- !u!114 &2067574236406527477 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ceb653cd98e289a4e8697a1af55201f2, type: 3} + m_Name: + m_EditorClassIdentifier: + Path: event:/sfx_hit_people + guid: 763e8aafb0dbb24c9a8b6d026e7b754b + Banks: + - {fileID: -4314731109269342154} + IsStream: 0 + Is3D: 0 + IsOneShot: 1 + Parameters: [] + MinDistance: 0 + MaxDistance: 0 + Length: 645 +--- !u!114 &5038475025321297510 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: c18180ecb35941f4682ae60107b85b7c, type: 3} + m_Name: + m_EditorClassIdentifier: + Path: /Users/darkness/UnityProjects/InfiniteRunners/2DInfinityRunner/FMODProject/Build/Desktop/Master.bank + lastModified: 636925979640000000 + LoadResult: 0 + FileSizes: [] + Exists: 1 +--- !u!114 &5580497363468305816 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ceb653cd98e289a4e8697a1af55201f2, type: 3} + m_Name: + m_EditorClassIdentifier: + Path: event:/music_menu + guid: 5f2e91eb701aa2409230863a070c9240 + Banks: + - {fileID: -4314731109269342154} + IsStream: 1 + Is3D: 0 + IsOneShot: 0 + Parameters: [] + MinDistance: 0 + MaxDistance: 0 + Length: 24774 +--- !u!114 &6538330867862680022 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: c18180ecb35941f4682ae60107b85b7c, type: 3} + m_Name: + m_EditorClassIdentifier: + Path: FMODProject/Build/Desktop/Master.strings.bank + lastModified: 636925979640000000 + LoadResult: 0 + FileSizes: + - Name: Desktop + Value: 1270 + Exists: 1 +--- !u!114 &7681650897941995972 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ceb653cd98e289a4e8697a1af55201f2, type: 3} + m_Name: + m_EditorClassIdentifier: + Path: event:/sfx_cash_register + guid: 8ad31ce278e2614a8a1fca3d747345e7 + Banks: + - {fileID: -4314731109269342154} + IsStream: 0 + Is3D: 0 + IsOneShot: 1 + Parameters: [] + MinDistance: 0 + MaxDistance: 0 + Length: 1064 +--- !u!114 &7818469860916841469 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ceb653cd98e289a4e8697a1af55201f2, type: 3} + m_Name: + m_EditorClassIdentifier: + Path: event:/music_gameplay + guid: 4c9c8d406ee18349b16874496e92d3ff + Banks: + - {fileID: 5038475025321297510} + IsStream: 1 + Is3D: 0 + IsOneShot: 0 + Parameters: [] + MinDistance: 0 + MaxDistance: 0 + Length: 45039 +--- !u!114 &8273690441394894316 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ceb653cd98e289a4e8697a1af55201f2, type: 3} + m_Name: + m_EditorClassIdentifier: + Path: event:/sfx_colect coins + guid: 447bb809383c4e47a8bbccaf3ed1bc9b + Banks: + - {fileID: 5038475025321297510} + IsStream: 0 + Is3D: 0 + IsOneShot: 1 + Parameters: [] + MinDistance: 0 + MaxDistance: 0 + Length: 543 +--- !u!114 &8282829824166320026 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ceb653cd98e289a4e8697a1af55201f2, type: 3} + m_Name: + m_EditorClassIdentifier: + Path: event:/music_gameplay + guid: 4c9c8d406ee18349b16874496e92d3ff + Banks: + - {fileID: -4314731109269342154} + IsStream: 1 + Is3D: 0 + IsOneShot: 0 + Parameters: [] + MinDistance: 0 + MaxDistance: 0 + Length: 45039 +--- !u!114 &8703528732209089609 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ceb653cd98e289a4e8697a1af55201f2, type: 3} + m_Name: + m_EditorClassIdentifier: + Path: event:/sfx_shouts_female + guid: 9c152038e9df114badfd107fd1ad5efc + Banks: + - {fileID: -4314731109269342154} + IsStream: 0 + Is3D: 0 + IsOneShot: 1 + Parameters: [] + MinDistance: 0 + MaxDistance: 0 + Length: 2000 +--- !u!114 &8893018113691044415 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: c18180ecb35941f4682ae60107b85b7c, type: 3} + m_Name: + m_EditorClassIdentifier: + Path: /Users/darkness/UnityProjects/InfiniteRunners/2DInfinityRunner/FMODProject/Build/Desktop/Master.strings.bank + lastModified: 636925979640000000 + LoadResult: 70 + FileSizes: [] + Exists: 1 diff --git a/Assets/Plugins/FMOD/Resources/FMODStudioCache.asset.meta b/Assets/Plugins/FMOD/Resources/FMODStudioCache.asset.meta new file mode 100644 index 0000000..31b181e --- /dev/null +++ b/Assets/Plugins/FMOD/Resources/FMODStudioCache.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b58b1df9fec8045d0be923aac6baec37 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/Resources/FMODStudioSettings.asset b/Assets/Plugins/FMOD/Resources/FMODStudioSettings.asset new file mode 100644 index 0000000..461b344 --- /dev/null +++ b/Assets/Plugins/FMOD/Resources/FMODStudioSettings.asset @@ -0,0 +1,83 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: eef8d824ea7b63742966aaa0e94ac383, type: 3} + m_Name: FMODStudioSettings + m_EditorClassIdentifier: + SwitchSettingsMigration: 1 + HasSourceProject: 1 + HasPlatforms: 1 + sourceProjectPath: FMODProject/Death Hawaii.fspro + SourceProjectPathUnformatted: FMODProject/Death Hawaii.fspro + SourceBankPathUnformatted: FMODProject/Build + AutomaticEventLoading: 1 + BankLoadType: 0 + AutomaticSampleLoading: 0 + ImportType: 0 + TargetAssetPath: + LoggingLevel: 2 + SpeakerModeSettings: + - Platform: 2 + Value: 3 + - Platform: 20 + Value: 3 + SampleRateSettings: + - Platform: 1 + Value: 48000 + - Platform: 2 + Value: 0 + - Platform: 20 + Value: 0 + LiveUpdateSettings: + - Platform: 1 + Value: 1 + - Platform: 2 + Value: 0 + - Platform: 20 + Value: 0 + OverlaySettings: + - Platform: 1 + Value: 1 + - Platform: 2 + Value: 0 + - Platform: 20 + Value: 0 + LoggingSettings: + - Platform: 1 + Value: 1 + - Platform: 2 + Value: 0 + - Platform: 20 + Value: 0 + BankDirectorySettings: + - Platform: 2 + Value: Desktop + VirtualChannelSettings: + - Platform: 1 + Value: 1024 + - Platform: 2 + Value: 128 + - Platform: 20 + Value: 128 + RealChannelSettings: + - Platform: 1 + Value: 256 + - Platform: 2 + Value: 32 + - Platform: 20 + Value: 32 + Plugins: [] + MasterBanks: + - Master + Banks: + - Master.strings + BanksToLoad: [] + LiveUpdatePort: 9264 diff --git a/Assets/Plugins/FMOD/Resources/FMODStudioSettings.asset.meta b/Assets/Plugins/FMOD/Resources/FMODStudioSettings.asset.meta new file mode 100644 index 0000000..e617bff --- /dev/null +++ b/Assets/Plugins/FMOD/Resources/FMODStudioSettings.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 1ebeed83cdec04abc84fae5e9a3daff7 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/addons.meta b/Assets/Plugins/FMOD/addons.meta new file mode 100755 index 0000000..3057105 --- /dev/null +++ b/Assets/Plugins/FMOD/addons.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 213aa110a78c0e5458e08b4cb7d729a7 +folderAsset: yes +timeCreated: 1552564451 +licenseType: Free +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/addons/ResonanceAudio.meta b/Assets/Plugins/FMOD/addons/ResonanceAudio.meta new file mode 100755 index 0000000..115beb4 --- /dev/null +++ b/Assets/Plugins/FMOD/addons/ResonanceAudio.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 5d62fd6f3e33a8e4e95a3635297313a7 +folderAsset: yes +timeCreated: 1552564451 +licenseType: Free +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/addons/ResonanceAudio/Editor.meta b/Assets/Plugins/FMOD/addons/ResonanceAudio/Editor.meta new file mode 100755 index 0000000..868c83d --- /dev/null +++ b/Assets/Plugins/FMOD/addons/ResonanceAudio/Editor.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 29f46d64128196544afd19aaa0aa6f2c +folderAsset: yes +timeCreated: 1552564452 +licenseType: Free +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/addons/ResonanceAudio/Editor/FmodResonanceAudioRoomEditor.cs b/Assets/Plugins/FMOD/addons/ResonanceAudio/Editor/FmodResonanceAudioRoomEditor.cs new file mode 100755 index 0000000..8a8668d --- /dev/null +++ b/Assets/Plugins/FMOD/addons/ResonanceAudio/Editor/FmodResonanceAudioRoomEditor.cs @@ -0,0 +1,115 @@ +// Copyright 2017 Google Inc. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +using UnityEngine; +using UnityEditor; +using System.Collections; + +/// A custom editor for properties on the FmodResonanceAudioRoom script. This appears in the +/// Inspector window of a FmodResonanceAudioRoom object. +[CustomEditor(typeof(FmodResonanceAudioRoom))] +[CanEditMultipleObjects] +public class FmodResonanceAudioRoomEditor : Editor { + private SerializedProperty leftWall = null; + private SerializedProperty rightWall = null; + private SerializedProperty floor = null; + private SerializedProperty ceiling = null; + private SerializedProperty backWall = null; + private SerializedProperty frontWall = null; + private SerializedProperty reflectivity = null; + private SerializedProperty reverbGainDb = null; + private SerializedProperty reverbBrightness = null; + private SerializedProperty reverbTime = null; + private SerializedProperty size = null; + + private GUIContent surfaceMaterialsLabel = new GUIContent("Surface Materials", + "Room surface materials to calculate the acoustic properties of the room."); + private GUIContent surfaceMaterialLabel = new GUIContent("Surface Material", + "Surface material used to calculate the acoustic properties of the room."); + private GUIContent reflectivityLabel = new GUIContent("Reflectivity", + "Adjusts what proportion of the direct sound is reflected back by each surface, after an " + + "appropriate delay. Reverberation is unaffected by this setting."); + private GUIContent reverbGainLabel = new GUIContent("Gain (dB)", + "Applies a gain adjustment to the reverberation in the room. The default value will leave " + + "reverb unaffected."); + private GUIContent reverbPropertiesLabel = new GUIContent("Reverb Properties", + "Parameters to adjust the reverb properties of the room."); + private GUIContent reverbBrightnessLabel = new GUIContent("Brightness", + "Adjusts the balance between high and low frequencies in the reverb."); + private GUIContent reverbTimeLabel = new GUIContent("Time", + "Adjusts the overall duration of the reverb by a positive scaling factor."); + private GUIContent sizeLabel = new GUIContent("Size", "Sets the room dimensions."); + + void OnEnable () { + leftWall = serializedObject.FindProperty("leftWall"); + rightWall = serializedObject.FindProperty("rightWall"); + floor = serializedObject.FindProperty("floor"); + ceiling = serializedObject.FindProperty("ceiling"); + backWall = serializedObject.FindProperty("backWall"); + frontWall = serializedObject.FindProperty("frontWall"); + reflectivity = serializedObject.FindProperty("reflectivity"); + reverbGainDb = serializedObject.FindProperty("reverbGainDb"); + reverbBrightness = serializedObject.FindProperty("reverbBrightness"); + reverbTime = serializedObject.FindProperty("reverbTime"); + size = serializedObject.FindProperty("size"); + } + + /// @cond + public override void OnInspectorGUI () { + serializedObject.Update(); + + // Add clickable script field, as would have been provided by DrawDefaultInspector() + MonoScript script = MonoScript.FromMonoBehaviour (target as MonoBehaviour); + EditorGUI.BeginDisabledGroup (true); + EditorGUILayout.ObjectField ("Script", script, typeof(MonoScript), false); + EditorGUI.EndDisabledGroup (); + + EditorGUILayout.LabelField(surfaceMaterialsLabel); + ++EditorGUI.indentLevel; + DrawSurfaceMaterial(leftWall); + DrawSurfaceMaterial(rightWall); + DrawSurfaceMaterial(floor); + DrawSurfaceMaterial(ceiling); + DrawSurfaceMaterial(backWall); + DrawSurfaceMaterial(frontWall); + --EditorGUI.indentLevel; + + EditorGUILayout.Separator(); + + EditorGUILayout.Slider(reflectivity, 0.0f, FmodResonanceAudio.maxReflectivity, reflectivityLabel); + + EditorGUILayout.Separator(); + + EditorGUILayout.LabelField(reverbPropertiesLabel); + ++EditorGUI.indentLevel; + EditorGUILayout.Slider(reverbGainDb, FmodResonanceAudio.minGainDb, FmodResonanceAudio.maxGainDb, + reverbGainLabel); + EditorGUILayout.Slider(reverbBrightness, FmodResonanceAudio.minReverbBrightness, + FmodResonanceAudio.maxReverbBrightness, reverbBrightnessLabel); + EditorGUILayout.Slider(reverbTime, 0.0f, FmodResonanceAudio.maxReverbTime, reverbTimeLabel); + --EditorGUI.indentLevel; + + EditorGUILayout.Separator(); + + EditorGUILayout.PropertyField(size, sizeLabel); + + serializedObject.ApplyModifiedProperties(); + } + /// @endcond + + private void DrawSurfaceMaterial (SerializedProperty surfaceMaterial) { + surfaceMaterialLabel.text = surfaceMaterial.displayName; + EditorGUILayout.PropertyField(surfaceMaterial, surfaceMaterialLabel); + } +} diff --git a/Assets/Plugins/FMOD/addons/ResonanceAudio/Editor/FmodResonanceAudioRoomEditor.cs.meta b/Assets/Plugins/FMOD/addons/ResonanceAudio/Editor/FmodResonanceAudioRoomEditor.cs.meta new file mode 100755 index 0000000..b24704b --- /dev/null +++ b/Assets/Plugins/FMOD/addons/ResonanceAudio/Editor/FmodResonanceAudioRoomEditor.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 935c6716e27bd481e97897dd9e1de595 +timeCreated: 1511395157 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/addons/ResonanceAudio/Scripts.meta b/Assets/Plugins/FMOD/addons/ResonanceAudio/Scripts.meta new file mode 100755 index 0000000..bcadb75 --- /dev/null +++ b/Assets/Plugins/FMOD/addons/ResonanceAudio/Scripts.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 2e2f1935a9a6b3446bcd94217be4dd1a +folderAsset: yes +timeCreated: 1552015316 +licenseType: Free +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/addons/ResonanceAudio/Scripts/FmodResonanceAudio.cs b/Assets/Plugins/FMOD/addons/ResonanceAudio/Scripts/FmodResonanceAudio.cs new file mode 100755 index 0000000..0ff75eb --- /dev/null +++ b/Assets/Plugins/FMOD/addons/ResonanceAudio/Scripts/FmodResonanceAudio.cs @@ -0,0 +1,262 @@ +// Copyright 2017 Google Inc. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +using UnityEngine; +using System; +using System.Collections; +using System.Collections.Generic; +using System.Runtime.InteropServices; +using FMODUnity; + +/// This is the main Resonance Audio class that communicates with the FMOD Unity integration. Native +/// functions of the system can only be called through this class to preserve the internal system +/// functionality. +public static class FmodResonanceAudio { + /// Updates the room effects of the environment with given |room| properties. + /// @note This should only be called from the main Unity thread. + public static void UpdateAudioRoom(FmodResonanceAudioRoom room, bool roomEnabled) { + // Update the enabled rooms list. + if (roomEnabled) { + if (!enabledRooms.Contains(room)) { + enabledRooms.Add(room); + } + } else { + enabledRooms.Remove(room); + } + // Update the current room effects to be applied. + if (enabledRooms.Count > 0) { + FmodResonanceAudioRoom currentRoom = enabledRooms[enabledRooms.Count - 1]; + RoomProperties roomProperties = GetRoomProperties(currentRoom); + // Pass the room properties into a pointer. + IntPtr roomPropertiesPtr = Marshal.AllocHGlobal(roomPropertiesSize); + Marshal.StructureToPtr(roomProperties, roomPropertiesPtr, false); + ListenerPlugin.setParameterData (roomPropertiesIndex, GetBytes(roomPropertiesPtr, + roomPropertiesSize)); + Marshal.FreeHGlobal(roomPropertiesPtr); + } else { + // Set the room properties to a null room, which will effectively disable the room effects. + ListenerPlugin.setParameterData (roomPropertiesIndex, GetBytes(IntPtr.Zero, 0)); + } + } + + /// Returns whether the listener is currently inside the given |room| boundaries. + public static bool IsListenerInsideRoom(FmodResonanceAudioRoom room) { + // Compute the room position relative to the listener. + FMOD.VECTOR unused; + RuntimeManager.CoreSystem.get3DListenerAttributes(0, out listenerPositionFmod, out unused, + out unused, out unused); + Vector3 listenerPosition = new Vector3(listenerPositionFmod.x, listenerPositionFmod.y, + listenerPositionFmod.z); + Vector3 relativePosition = listenerPosition - room.transform.position; + Quaternion rotationInverse = Quaternion.Inverse(room.transform.rotation); + // Set the size of the room as the boundary and return whether the listener is inside. + bounds.size = Vector3.Scale(room.transform.lossyScale, room.size); + return bounds.Contains(rotationInverse * relativePosition); + } + + /// Maximum allowed gain value in decibels. + public const float maxGainDb = 24.0f; + + /// Minimum allowed gain value in decibels. + public const float minGainDb = -24.0f; + + /// Maximum allowed reverb brightness modifier value. + public const float maxReverbBrightness = 1.0f; + + /// Minimum allowed reverb brightness modifier value. + public const float minReverbBrightness = -1.0f; + + /// Maximum allowed reverb time modifier value. + public const float maxReverbTime = 3.0f; + + /// Maximum allowed reflectivity multiplier of a room surface material. + public const float maxReflectivity = 2.0f; + + [StructLayout(LayoutKind.Sequential)] + private struct RoomProperties { + // Center position of the room in world space. + public float positionX; + public float positionY; + public float positionZ; + + // Rotation (quaternion) of the room in world space. + public float rotationX; + public float rotationY; + public float rotationZ; + public float rotationW; + + // Size of the shoebox room in world space. + public float dimensionsX; + public float dimensionsY; + public float dimensionsZ; + + // Material name of each surface of the shoebox room. + public FmodResonanceAudioRoom.SurfaceMaterial materialLeft; + public FmodResonanceAudioRoom.SurfaceMaterial materialRight; + public FmodResonanceAudioRoom.SurfaceMaterial materialBottom; + public FmodResonanceAudioRoom.SurfaceMaterial materialTop; + public FmodResonanceAudioRoom.SurfaceMaterial materialFront; + public FmodResonanceAudioRoom.SurfaceMaterial materialBack; + + // User defined uniform scaling factor for reflectivity. This parameter has no effect when set + // to 1.0f. + public float reflectionScalar; + + // User defined reverb tail gain multiplier. This parameter has no effect when set to 0.0f. + public float reverbGain; + + // Adjusts the reverberation time across all frequency bands. RT60 values are multiplied by this + // factor. Has no effect when set to 1.0f. + public float reverbTime; + + // Controls the slope of a line from the lowest to the highest RT60 values (increases high + // frequency RT60s when positive, decreases when negative). Has no effect when set to 0.0f. + public float reverbBrightness; + }; + + // Returns the FMOD Resonance Audio Listener Plugin. + private static FMOD.DSP ListenerPlugin { + get { + if (!listenerPlugin.hasHandle()) { + listenerPlugin = Initialize(); + } + return listenerPlugin; + } + } + + // Converts given |db| value to its amplitude equivalent where 'dB = 20 * log10(amplitude)'. + private static float ConvertAmplitudeFromDb (float db) { + return Mathf.Pow(10.0f, 0.05f * db); + } + + // Converts given |position| and |rotation| from Unity space to audio space. + private static void ConvertAudioTransformFromUnity (ref Vector3 position, + ref Quaternion rotation) { + // Compose the transformation matrix. + Matrix4x4 transformMatrix = Matrix4x4.TRS(position, rotation, Vector3.one); + // Convert the transformation matrix from left-handed to right-handed. + transformMatrix = flipZ * transformMatrix * flipZ; + // Update |position| and |rotation| respectively. + position = transformMatrix.GetColumn(3); + rotation = Quaternion.LookRotation(transformMatrix.GetColumn(2), transformMatrix.GetColumn(1)); + } + + // Returns a byte array of |length| created from |ptr|. + private static byte[] GetBytes(IntPtr ptr, int length) { + if (ptr != IntPtr.Zero) { + byte[] byteArray = new byte[length]; + Marshal.Copy(ptr, byteArray, 0, length); + return byteArray; + } + // Return an empty array if the pointer is null. + return new byte[1]; + } + + // Returns room properties of the given |room|. + private static RoomProperties GetRoomProperties(FmodResonanceAudioRoom room) { + RoomProperties roomProperties; + Vector3 position = room.transform.position; + Quaternion rotation = room.transform.rotation; + Vector3 scale = Vector3.Scale(room.transform.lossyScale, room.size); + ConvertAudioTransformFromUnity(ref position, ref rotation); + roomProperties.positionX = position.x; + roomProperties.positionY = position.y; + roomProperties.positionZ = position.z; + roomProperties.rotationX = rotation.x; + roomProperties.rotationY = rotation.y; + roomProperties.rotationZ = rotation.z; + roomProperties.rotationW = rotation.w; + roomProperties.dimensionsX = scale.x; + roomProperties.dimensionsY = scale.y; + roomProperties.dimensionsZ = scale.z; + roomProperties.materialLeft = room.leftWall; + roomProperties.materialRight = room.rightWall; + roomProperties.materialBottom = room.floor; + roomProperties.materialTop = room.ceiling; + roomProperties.materialFront = room.frontWall; + roomProperties.materialBack = room.backWall; + roomProperties.reverbGain = ConvertAmplitudeFromDb(room.reverbGainDb); + roomProperties.reverbTime = room.reverbTime; + roomProperties.reverbBrightness = room.reverbBrightness; + roomProperties.reflectionScalar = room.reflectivity; + return roomProperties; + } + + // Initializes and returns the FMOD Resonance Audio Listener Plugin. + private static FMOD.DSP Initialize() { + // Search through all busses on in banks. + int numBanks = 0; + FMOD.DSP dsp = new FMOD.DSP(); + FMOD.Studio.Bank[] banks = null; + RuntimeManager.StudioSystem.getBankCount(out numBanks); + RuntimeManager.StudioSystem.getBankList(out banks); + for (int currentBank = 0; currentBank < numBanks; ++currentBank) { + int numBusses = 0; + FMOD.Studio.Bus[] busses = null; + banks[currentBank].getBusCount(out numBusses); + banks[currentBank].getBusList(out busses); + RuntimeManager.StudioSystem.flushCommands(); + for (int currentBus = 0; currentBus < numBusses; ++currentBus) { + // Make sure the channel group of the current bus is assigned properly. + string busPath = null; + busses[currentBus].getPath(out busPath); + RuntimeManager.StudioSystem.getBus(busPath, out busses[currentBus]); + RuntimeManager.StudioSystem.flushCommands(); + FMOD.ChannelGroup channelGroup; + busses[currentBus].getChannelGroup(out channelGroup); + RuntimeManager.StudioSystem.flushCommands(); + if (channelGroup.hasHandle()) { + int numDsps = 0; + channelGroup.getNumDSPs(out numDsps); + for (int currentDsp = 0; currentDsp < numDsps; ++currentDsp) { + channelGroup.getDSP(currentDsp, out dsp); + string dspNameSb; + int unusedInt = 0; + uint unusedUint = 0; + dsp.getInfo(out dspNameSb, out unusedUint, out unusedInt, out unusedInt, out unusedInt); + if (dspNameSb.ToString().Equals(listenerPluginName) && dsp.hasHandle()) { + return dsp; + } + } + } + } + } + Debug.LogError(listenerPluginName + " not found in the FMOD project."); + return dsp; + } + + // Right-handed to left-handed matrix converter (and vice versa). + private static readonly Matrix4x4 flipZ = Matrix4x4.Scale(new Vector3(1, 1, -1)); + + // Get a handle to the Resonance Audio Listener FMOD Plugin. + private static readonly string listenerPluginName = "Resonance Audio Listener"; + + // Size of |RoomProperties| struct in bytes. + private static readonly int roomPropertiesSize = Marshal.SizeOf(typeof(RoomProperties)); + + // Plugin data parameter index for the room properties. + private static readonly int roomPropertiesIndex = 1; + + // Boundaries instance to be used in room detection logic. + private static Bounds bounds = new Bounds(Vector3.zero, Vector3.zero); + + // Container to store the currently active rooms in the scene. + private static List enabledRooms = new List(); + + // Current listener position. + private static FMOD.VECTOR listenerPositionFmod = new FMOD.VECTOR(); + + // FMOD Resonance Audio Listener Plugin. + private static FMOD.DSP listenerPlugin; +} diff --git a/Assets/Plugins/FMOD/addons/ResonanceAudio/Scripts/FmodResonanceAudio.cs.meta b/Assets/Plugins/FMOD/addons/ResonanceAudio/Scripts/FmodResonanceAudio.cs.meta new file mode 100755 index 0000000..4c2e2f7 --- /dev/null +++ b/Assets/Plugins/FMOD/addons/ResonanceAudio/Scripts/FmodResonanceAudio.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 6794e6301575a445d8588930a0752568 +timeCreated: 1511395157 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/addons/ResonanceAudio/Scripts/FmodResonanceAudioRoom.cs b/Assets/Plugins/FMOD/addons/ResonanceAudio/Scripts/FmodResonanceAudioRoom.cs new file mode 100755 index 0000000..c8af53c --- /dev/null +++ b/Assets/Plugins/FMOD/addons/ResonanceAudio/Scripts/FmodResonanceAudioRoom.cs @@ -0,0 +1,100 @@ +// Copyright 2017 Google Inc. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +using UnityEngine; +using System.Collections; + +/// Resonance Audio room component that simulates environmental effects of a room with respect to +/// the properties of the attached game object. +[AddComponentMenu("ResonanceAudio/FmodResonanceAudioRoom")] +public class FmodResonanceAudioRoom : MonoBehaviour { + /// Material type that determines the acoustic properties of a room surface. + public enum SurfaceMaterial { + Transparent = 0, ///< Transparent + AcousticCeilingTiles = 1, ///< Acoustic ceiling tiles + BrickBare = 2, ///< Brick, bare + BrickPainted = 3, ///< Brick, painted + ConcreteBlockCoarse = 4, ///< Concrete block, coarse + ConcreteBlockPainted = 5, ///< Concrete block, painted + CurtainHeavy = 6, ///< Curtain, heavy + FiberglassInsulation = 7, ///< Fiberglass insulation + GlassThin = 8, ///< Glass, thin + GlassThick = 9, ///< Glass, thick + Grass = 10, ///< Grass + LinoleumOnConcrete = 11, ///< Linoleum on concrete + Marble = 12, ///< Marble + Metal = 13, ///< Galvanized sheet metal + ParquetOnConcrete = 14, ///< Parquet on concrete + PlasterRough = 15, ///< Plaster, rough + PlasterSmooth = 16, ///< Plaster, smooth + PlywoodPanel = 17, ///< Plywood panel + PolishedConcreteOrTile = 18, ///< Polished concrete or tile + Sheetrock = 19, ///< Sheetrock + WaterOrIceSurface = 20, ///< Water or ice surface + WoodCeiling = 21, ///< Wood ceiling + WoodPanel = 22 ///< Wood panel + } + + /// Room surface material in negative x direction. + public SurfaceMaterial leftWall = SurfaceMaterial.ConcreteBlockCoarse; + + /// Room surface material in positive x direction. + public SurfaceMaterial rightWall = SurfaceMaterial.ConcreteBlockCoarse; + + /// Room surface material in negative y direction. + public SurfaceMaterial floor = SurfaceMaterial.ParquetOnConcrete; + + /// Room surface material in positive y direction. + public SurfaceMaterial ceiling = SurfaceMaterial.PlasterRough; + + /// Room surface material in negative z direction. + public SurfaceMaterial backWall = SurfaceMaterial.ConcreteBlockCoarse; + + /// Room surface material in positive z direction. + public SurfaceMaterial frontWall = SurfaceMaterial.ConcreteBlockCoarse; + + /// Reflectivity scalar for each surface of the room. + public float reflectivity = 1.0f; + + /// Reverb gain modifier in decibels. + public float reverbGainDb = 0.0f; + + /// Reverb brightness modifier. + public float reverbBrightness = 0.0f; + + /// Reverb time modifier. + public float reverbTime = 1.0f; + + /// Size of the room (normalized with respect to scale of the game object). + public Vector3 size = Vector3.one; + + void OnEnable () { + FmodResonanceAudio.UpdateAudioRoom(this, FmodResonanceAudio.IsListenerInsideRoom(this)); + } + + void OnDisable () { + FmodResonanceAudio.UpdateAudioRoom(this, false); + } + + void Update () { + FmodResonanceAudio.UpdateAudioRoom(this, FmodResonanceAudio.IsListenerInsideRoom(this)); + } + + void OnDrawGizmosSelected () { + // Draw shoebox model wireframe of the room. + Gizmos.color = Color.yellow; + Gizmos.matrix = transform.localToWorldMatrix; + Gizmos.DrawWireCube(Vector3.zero, size); + } +} diff --git a/Assets/Plugins/FMOD/addons/ResonanceAudio/Scripts/FmodResonanceAudioRoom.cs.meta b/Assets/Plugins/FMOD/addons/ResonanceAudio/Scripts/FmodResonanceAudioRoom.cs.meta new file mode 100755 index 0000000..3ee062d --- /dev/null +++ b/Assets/Plugins/FMOD/addons/ResonanceAudio/Scripts/FmodResonanceAudioRoom.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 6b0c5e63920ee4f55b7ec5248525af4b +timeCreated: 1511395157 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/lib.meta b/Assets/Plugins/FMOD/lib.meta new file mode 100755 index 0000000..446ce72 --- /dev/null +++ b/Assets/Plugins/FMOD/lib.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: dd7df6a0d364b7048a4bd0b5a3aba60e +folderAsset: yes +timeCreated: 1552564451 +licenseType: Free +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/lib/html5.meta b/Assets/Plugins/FMOD/lib/html5.meta new file mode 100755 index 0000000..1913520 --- /dev/null +++ b/Assets/Plugins/FMOD/lib/html5.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 2197fbd8fe97d334796721324e4e9b37 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/lib/html5/libfmodstudiounityplugin.bc b/Assets/Plugins/FMOD/lib/html5/libfmodstudiounityplugin.bc new file mode 100755 index 0000000..2110ca9 Binary files /dev/null and b/Assets/Plugins/FMOD/lib/html5/libfmodstudiounityplugin.bc differ diff --git a/Assets/Plugins/FMOD/lib/html5/libfmodstudiounityplugin.bc.meta b/Assets/Plugins/FMOD/lib/html5/libfmodstudiounityplugin.bc.meta new file mode 100755 index 0000000..31e24de --- /dev/null +++ b/Assets/Plugins/FMOD/lib/html5/libfmodstudiounityplugin.bc.meta @@ -0,0 +1,23 @@ +fileFormatVersion: 2 +guid: 254f6ee9df4d3024d9c550104ea5feaf +timeCreated: 1518408468 +licenseType: Free +PluginImporter: + serializedVersion: 1 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + platformData: + Any: + enabled: 0 + settings: {} + Editor: + enabled: 0 + settings: + DefaultValueInitialized: true + WebGL: + enabled: 1 + settings: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/lib/html5/libfmodstudiounitypluginL.bc b/Assets/Plugins/FMOD/lib/html5/libfmodstudiounitypluginL.bc new file mode 100755 index 0000000..9e7b42c Binary files /dev/null and b/Assets/Plugins/FMOD/lib/html5/libfmodstudiounitypluginL.bc differ diff --git a/Assets/Plugins/FMOD/lib/html5/libfmodstudiounitypluginL.bc.meta b/Assets/Plugins/FMOD/lib/html5/libfmodstudiounitypluginL.bc.meta new file mode 100755 index 0000000..71bad11 --- /dev/null +++ b/Assets/Plugins/FMOD/lib/html5/libfmodstudiounitypluginL.bc.meta @@ -0,0 +1,23 @@ +fileFormatVersion: 2 +guid: 2dab3dda051681d4a9ea3ed67cb9877f +timeCreated: 1518408468 +licenseType: Free +PluginImporter: + serializedVersion: 1 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + platformData: + Any: + enabled: 0 + settings: {} + Editor: + enabled: 0 + settings: + DefaultValueInitialized: true + WebGL: + enabled: 0 + settings: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/lib/ios.meta b/Assets/Plugins/FMOD/lib/ios.meta new file mode 100755 index 0000000..7da8917 --- /dev/null +++ b/Assets/Plugins/FMOD/lib/ios.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 17c2d7a6bf1d69b40babc6a644e721d3 +folderAsset: yes +timeCreated: 1432606678 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/lib/ios/libfmodstudiounityplugin.a b/Assets/Plugins/FMOD/lib/ios/libfmodstudiounityplugin.a new file mode 100755 index 0000000..e97d0f7 Binary files /dev/null and b/Assets/Plugins/FMOD/lib/ios/libfmodstudiounityplugin.a differ diff --git a/Assets/Plugins/FMOD/lib/ios/libfmodstudiounityplugin.a.meta b/Assets/Plugins/FMOD/lib/ios/libfmodstudiounityplugin.a.meta new file mode 100755 index 0000000..3873ef3 --- /dev/null +++ b/Assets/Plugins/FMOD/lib/ios/libfmodstudiounityplugin.a.meta @@ -0,0 +1,21 @@ +fileFormatVersion: 2 +guid: 79c89db1833831740aee981c0d90d2d4 +PluginImporter: + serializedVersion: 1 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + platformData: + Any: + enabled: 0 + settings: {} + Editor: + enabled: 0 + settings: + DefaultValueInitialized: true + iOS: + enabled: 1 + settings: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/lib/ios/libfmodstudiounitypluginL.a b/Assets/Plugins/FMOD/lib/ios/libfmodstudiounitypluginL.a new file mode 100755 index 0000000..ec54eab Binary files /dev/null and b/Assets/Plugins/FMOD/lib/ios/libfmodstudiounitypluginL.a differ diff --git a/Assets/Plugins/FMOD/lib/ios/libfmodstudiounitypluginL.a.meta b/Assets/Plugins/FMOD/lib/ios/libfmodstudiounitypluginL.a.meta new file mode 100755 index 0000000..1b10142 --- /dev/null +++ b/Assets/Plugins/FMOD/lib/ios/libfmodstudiounitypluginL.a.meta @@ -0,0 +1,21 @@ +fileFormatVersion: 2 +guid: 5aa4057a8deee1c45a69677125e2c241 +PluginImporter: + serializedVersion: 1 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + platformData: + Any: + enabled: 0 + settings: {} + Editor: + enabled: 0 + settings: + DefaultValueInitialized: true + iOS: + enabled: 0 + settings: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/lib/ios/libresonanceaudio.a b/Assets/Plugins/FMOD/lib/ios/libresonanceaudio.a new file mode 100755 index 0000000..ea694e3 Binary files /dev/null and b/Assets/Plugins/FMOD/lib/ios/libresonanceaudio.a differ diff --git a/Assets/Plugins/FMOD/lib/ios/libresonanceaudio.a.meta b/Assets/Plugins/FMOD/lib/ios/libresonanceaudio.a.meta new file mode 100755 index 0000000..f589998 --- /dev/null +++ b/Assets/Plugins/FMOD/lib/ios/libresonanceaudio.a.meta @@ -0,0 +1,61 @@ +fileFormatVersion: 2 +guid: bc5d15d8f7607af478126b815040cbd2 +timeCreated: 1511469552 +licenseType: Free +PluginImporter: + serializedVersion: 1 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + platformData: + Android: + enabled: 0 + settings: + CPU: AnyCPU + Any: + enabled: 0 + settings: {} + Editor: + enabled: 0 + settings: + CPU: AnyCPU + DefaultValueInitialized: true + OS: AnyOS + Linux: + enabled: 0 + settings: + CPU: x86 + Linux64: + enabled: 0 + settings: + CPU: x86_64 + LinuxUniversal: + enabled: 0 + settings: + CPU: None + OSXIntel: + enabled: 0 + settings: + CPU: AnyCPU + OSXIntel64: + enabled: 0 + settings: + CPU: AnyCPU + OSXUniversal: + enabled: 0 + settings: + CPU: None + Win: + enabled: 0 + settings: + CPU: AnyCPU + Win64: + enabled: 0 + settings: + CPU: AnyCPU + iOS: + enabled: 1 + settings: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/lib/linux.meta b/Assets/Plugins/FMOD/lib/linux.meta new file mode 100755 index 0000000..60f2222 --- /dev/null +++ b/Assets/Plugins/FMOD/lib/linux.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 7ee0ba258cf439f4295d5019ffb2db16 +folderAsset: yes +timeCreated: 1552564451 +licenseType: Free +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/lib/linux/x86.meta b/Assets/Plugins/FMOD/lib/linux/x86.meta new file mode 100755 index 0000000..4f64af3 --- /dev/null +++ b/Assets/Plugins/FMOD/lib/linux/x86.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 2f3bf21cd17c5ea4683f4b3d443065f4 +folderAsset: yes +timeCreated: 1552564452 +licenseType: Free +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/lib/linux/x86/libfmod.so b/Assets/Plugins/FMOD/lib/linux/x86/libfmod.so new file mode 100755 index 0000000..df4fa02 Binary files /dev/null and b/Assets/Plugins/FMOD/lib/linux/x86/libfmod.so differ diff --git a/Assets/Plugins/FMOD/lib/linux/x86/libfmod.so.meta b/Assets/Plugins/FMOD/lib/linux/x86/libfmod.so.meta new file mode 100755 index 0000000..ffa805a --- /dev/null +++ b/Assets/Plugins/FMOD/lib/linux/x86/libfmod.so.meta @@ -0,0 +1,78 @@ +fileFormatVersion: 2 +guid: 36f717655f4546d49be99d6500b37235 +PluginImporter: + serializedVersion: 1 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + platformData: + Android: + enabled: 0 + settings: + CPU: AnyCPU + Any: + enabled: 0 + settings: {} + Editor: + enabled: 1 + settings: + CPU: x86 + DefaultValueInitialized: true + OS: AnyOS + Linux: + enabled: 1 + settings: + CPU: x86 + Linux64: + enabled: 0 + settings: + CPU: None + LinuxUniversal: + enabled: 1 + settings: + CPU: x86 + OSXIntel: + enabled: 0 + settings: + CPU: None + OSXIntel64: + enabled: 0 + settings: + CPU: None + OSXUniversal: + enabled: 0 + settings: + CPU: None + SamsungTV: + enabled: 0 + settings: + STV_MODEL: STANDARD_13 + WP8: + enabled: 0 + settings: + CPU: AnyCPU + DontProcess: False + PlaceholderPath: + Win: + enabled: 1 + settings: + CPU: AnyCPU + Win64: + enabled: 0 + settings: + CPU: None + WindowsStoreApps: + enabled: 0 + settings: + CPU: AnyCPU + DontProcess: False + PlaceholderPath: + SDK: AnySDK + iOS: + enabled: 0 + settings: + CompileFlags: + FrameworkDependencies: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/lib/linux/x86/libfmodL.so b/Assets/Plugins/FMOD/lib/linux/x86/libfmodL.so new file mode 100755 index 0000000..e76f1ee Binary files /dev/null and b/Assets/Plugins/FMOD/lib/linux/x86/libfmodL.so differ diff --git a/Assets/Plugins/FMOD/lib/linux/x86/libfmodL.so.meta b/Assets/Plugins/FMOD/lib/linux/x86/libfmodL.so.meta new file mode 100755 index 0000000..f325f50 --- /dev/null +++ b/Assets/Plugins/FMOD/lib/linux/x86/libfmodL.so.meta @@ -0,0 +1,82 @@ +fileFormatVersion: 2 +guid: c9b2333e7c587429b95411dc500b8b6f +timeCreated: 1481780142 +licenseType: Free +PluginImporter: + serializedVersion: 1 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + isOverridable: 0 + platformData: + Android: + enabled: 0 + settings: + CPU: ARMv7 + Any: + enabled: 0 + settings: + Exclude Android: 1 + Exclude Editor: 0 + Exclude Linux: 0 + Exclude Linux64: 1 + Exclude LinuxUniversal: 0 + Exclude OSXIntel: 1 + Exclude OSXIntel64: 1 + Exclude OSXUniversal: 1 + Exclude SamsungTV: 1 + Exclude Tizen: 1 + Exclude WebGL: 1 + Exclude Win: 0 + Exclude Win64: 0 + Exclude iOS: 1 + Editor: + enabled: 1 + settings: + CPU: x86 + DefaultValueInitialized: true + OS: AnyOS + Linux: + enabled: 1 + settings: + CPU: x86 + Linux64: + enabled: 0 + settings: + CPU: None + LinuxUniversal: + enabled: 1 + settings: + CPU: x86 + OSXIntel: + enabled: 0 + settings: + CPU: None + OSXIntel64: + enabled: 0 + settings: + CPU: None + OSXUniversal: + enabled: 0 + settings: + CPU: None + SamsungTV: + enabled: 0 + settings: + STV_MODEL: STANDARD_15 + Win: + enabled: 1 + settings: + CPU: AnyCPU + Win64: + enabled: 1 + settings: + CPU: None + iOS: + enabled: 0 + settings: + CompileFlags: + FrameworkDependencies: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/lib/linux/x86/libfmodstudio.so b/Assets/Plugins/FMOD/lib/linux/x86/libfmodstudio.so new file mode 100755 index 0000000..fa8b8a0 Binary files /dev/null and b/Assets/Plugins/FMOD/lib/linux/x86/libfmodstudio.so differ diff --git a/Assets/Plugins/FMOD/lib/linux/x86/libfmodstudio.so.meta b/Assets/Plugins/FMOD/lib/linux/x86/libfmodstudio.so.meta new file mode 100755 index 0000000..cb556be --- /dev/null +++ b/Assets/Plugins/FMOD/lib/linux/x86/libfmodstudio.so.meta @@ -0,0 +1,78 @@ +fileFormatVersion: 2 +guid: 4495168029c64a340a80fbfa8e0f1209 +PluginImporter: + serializedVersion: 1 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + platformData: + Android: + enabled: 0 + settings: + CPU: AnyCPU + Any: + enabled: 0 + settings: {} + Editor: + enabled: 1 + settings: + CPU: x86 + DefaultValueInitialized: true + OS: AnyOS + Linux: + enabled: 1 + settings: + CPU: x86 + Linux64: + enabled: 0 + settings: + CPU: None + LinuxUniversal: + enabled: 1 + settings: + CPU: x86 + OSXIntel: + enabled: 0 + settings: + CPU: None + OSXIntel64: + enabled: 0 + settings: + CPU: None + OSXUniversal: + enabled: 0 + settings: + CPU: None + SamsungTV: + enabled: 0 + settings: + STV_MODEL: STANDARD_13 + WP8: + enabled: 0 + settings: + CPU: AnyCPU + DontProcess: False + PlaceholderPath: + Win: + enabled: 1 + settings: + CPU: AnyCPU + Win64: + enabled: 0 + settings: + CPU: None + WindowsStoreApps: + enabled: 0 + settings: + CPU: AnyCPU + DontProcess: False + PlaceholderPath: + SDK: AnySDK + iOS: + enabled: 0 + settings: + CompileFlags: + FrameworkDependencies: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/lib/linux/x86/libfmodstudioL.so b/Assets/Plugins/FMOD/lib/linux/x86/libfmodstudioL.so new file mode 100755 index 0000000..b9a4dba Binary files /dev/null and b/Assets/Plugins/FMOD/lib/linux/x86/libfmodstudioL.so differ diff --git a/Assets/Plugins/FMOD/lib/linux/x86/libfmodstudioL.so.meta b/Assets/Plugins/FMOD/lib/linux/x86/libfmodstudioL.so.meta new file mode 100755 index 0000000..2f799b8 --- /dev/null +++ b/Assets/Plugins/FMOD/lib/linux/x86/libfmodstudioL.so.meta @@ -0,0 +1,82 @@ +fileFormatVersion: 2 +guid: f97044b07bd9b4555b0669530d6ca6f2 +timeCreated: 1481780142 +licenseType: Free +PluginImporter: + serializedVersion: 1 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + isOverridable: 0 + platformData: + Android: + enabled: 0 + settings: + CPU: ARMv7 + Any: + enabled: 0 + settings: + Exclude Android: 1 + Exclude Editor: 0 + Exclude Linux: 0 + Exclude Linux64: 1 + Exclude LinuxUniversal: 0 + Exclude OSXIntel: 1 + Exclude OSXIntel64: 1 + Exclude OSXUniversal: 1 + Exclude SamsungTV: 1 + Exclude Tizen: 1 + Exclude WebGL: 1 + Exclude Win: 0 + Exclude Win64: 0 + Exclude iOS: 1 + Editor: + enabled: 1 + settings: + CPU: x86 + DefaultValueInitialized: true + OS: AnyOS + Linux: + enabled: 1 + settings: + CPU: x86 + Linux64: + enabled: 0 + settings: + CPU: None + LinuxUniversal: + enabled: 1 + settings: + CPU: x86 + OSXIntel: + enabled: 0 + settings: + CPU: None + OSXIntel64: + enabled: 0 + settings: + CPU: None + OSXUniversal: + enabled: 0 + settings: + CPU: None + SamsungTV: + enabled: 0 + settings: + STV_MODEL: STANDARD_15 + Win: + enabled: 1 + settings: + CPU: AnyCPU + Win64: + enabled: 1 + settings: + CPU: None + iOS: + enabled: 0 + settings: + CompileFlags: + FrameworkDependencies: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/lib/linux/x86_64.meta b/Assets/Plugins/FMOD/lib/linux/x86_64.meta new file mode 100755 index 0000000..bc47c14 --- /dev/null +++ b/Assets/Plugins/FMOD/lib/linux/x86_64.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: fe71464de859a7548956c9df1d047c4d +folderAsset: yes +timeCreated: 1552564452 +licenseType: Free +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/lib/linux/x86_64/libfmod.so b/Assets/Plugins/FMOD/lib/linux/x86_64/libfmod.so new file mode 100755 index 0000000..7cbcebf Binary files /dev/null and b/Assets/Plugins/FMOD/lib/linux/x86_64/libfmod.so differ diff --git a/Assets/Plugins/FMOD/lib/linux/x86_64/libfmod.so.meta b/Assets/Plugins/FMOD/lib/linux/x86_64/libfmod.so.meta new file mode 100755 index 0000000..fdb25f2 --- /dev/null +++ b/Assets/Plugins/FMOD/lib/linux/x86_64/libfmod.so.meta @@ -0,0 +1,65 @@ +fileFormatVersion: 2 +guid: 9bd728ed7fbc89141a4885c569d1bd7f +PluginImporter: + serializedVersion: 1 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + platformData: + Android: + enabled: 0 + settings: + CPU: AnyCPU + Any: + enabled: 0 + settings: {} + Editor: + enabled: 1 + settings: + CPU: x86_64 + DefaultValueInitialized: true + OS: AnyOS + Linux: + enabled: 0 + settings: + CPU: None + Linux64: + enabled: 1 + settings: + CPU: x86_64 + LinuxUniversal: + enabled: 1 + settings: + CPU: AnyCPU + OSXIntel: + enabled: 0 + settings: + CPU: None + OSXIntel64: + enabled: 0 + settings: + CPU: None + OSXUniversal: + enabled: 0 + settings: + CPU: None + SamsungTV: + enabled: 0 + settings: + STV_MODEL: STANDARD_15 + Win: + enabled: 0 + settings: + CPU: None + Win64: + enabled: 0 + settings: + CPU: None + iOS: + enabled: 0 + settings: + CompileFlags: + FrameworkDependencies: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/lib/linux/x86_64/libfmodL.so b/Assets/Plugins/FMOD/lib/linux/x86_64/libfmodL.so new file mode 100755 index 0000000..0c3dde6 Binary files /dev/null and b/Assets/Plugins/FMOD/lib/linux/x86_64/libfmodL.so differ diff --git a/Assets/Plugins/FMOD/lib/linux/x86_64/libfmodL.so.meta b/Assets/Plugins/FMOD/lib/linux/x86_64/libfmodL.so.meta new file mode 100755 index 0000000..a01254e --- /dev/null +++ b/Assets/Plugins/FMOD/lib/linux/x86_64/libfmodL.so.meta @@ -0,0 +1,65 @@ +fileFormatVersion: 2 +guid: 31af1dcfb5b345945916c9c4ea794255 +PluginImporter: + serializedVersion: 1 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + platformData: + Android: + enabled: 0 + settings: + CPU: AnyCPU + Any: + enabled: 0 + settings: {} + Editor: + enabled: 1 + settings: + CPU: x86_64 + DefaultValueInitialized: true + OS: AnyOS + Linux: + enabled: 0 + settings: + CPU: None + Linux64: + enabled: 1 + settings: + CPU: x86_64 + LinuxUniversal: + enabled: 1 + settings: + CPU: AnyCPU + OSXIntel: + enabled: 0 + settings: + CPU: None + OSXIntel64: + enabled: 0 + settings: + CPU: None + OSXUniversal: + enabled: 0 + settings: + CPU: None + SamsungTV: + enabled: 0 + settings: + STV_MODEL: STANDARD_15 + Win: + enabled: 0 + settings: + CPU: None + Win64: + enabled: 0 + settings: + CPU: None + iOS: + enabled: 0 + settings: + CompileFlags: + FrameworkDependencies: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/lib/linux/x86_64/libfmodstudio.so b/Assets/Plugins/FMOD/lib/linux/x86_64/libfmodstudio.so new file mode 100755 index 0000000..144ec87 Binary files /dev/null and b/Assets/Plugins/FMOD/lib/linux/x86_64/libfmodstudio.so differ diff --git a/Assets/Plugins/FMOD/lib/linux/x86_64/libfmodstudio.so.meta b/Assets/Plugins/FMOD/lib/linux/x86_64/libfmodstudio.so.meta new file mode 100755 index 0000000..67f8f9a --- /dev/null +++ b/Assets/Plugins/FMOD/lib/linux/x86_64/libfmodstudio.so.meta @@ -0,0 +1,65 @@ +fileFormatVersion: 2 +guid: 9063aa11b1fcfcf4cb6030a076d14a30 +PluginImporter: + serializedVersion: 1 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + platformData: + Android: + enabled: 0 + settings: + CPU: AnyCPU + Any: + enabled: 0 + settings: {} + Editor: + enabled: 1 + settings: + CPU: x86_64 + DefaultValueInitialized: true + OS: AnyOS + Linux: + enabled: 0 + settings: + CPU: None + Linux64: + enabled: 1 + settings: + CPU: x86_64 + LinuxUniversal: + enabled: 1 + settings: + CPU: AnyCPU + OSXIntel: + enabled: 0 + settings: + CPU: None + OSXIntel64: + enabled: 0 + settings: + CPU: None + OSXUniversal: + enabled: 0 + settings: + CPU: None + SamsungTV: + enabled: 0 + settings: + STV_MODEL: STANDARD_15 + Win: + enabled: 0 + settings: + CPU: None + Win64: + enabled: 0 + settings: + CPU: None + iOS: + enabled: 0 + settings: + CompileFlags: + FrameworkDependencies: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/lib/linux/x86_64/libfmodstudioL.so b/Assets/Plugins/FMOD/lib/linux/x86_64/libfmodstudioL.so new file mode 100755 index 0000000..68cc128 Binary files /dev/null and b/Assets/Plugins/FMOD/lib/linux/x86_64/libfmodstudioL.so differ diff --git a/Assets/Plugins/FMOD/lib/linux/x86_64/libfmodstudioL.so.meta b/Assets/Plugins/FMOD/lib/linux/x86_64/libfmodstudioL.so.meta new file mode 100755 index 0000000..7844dad --- /dev/null +++ b/Assets/Plugins/FMOD/lib/linux/x86_64/libfmodstudioL.so.meta @@ -0,0 +1,65 @@ +fileFormatVersion: 2 +guid: ab75dd6bc4ee544bca23421ff8bff0f9 +PluginImporter: + serializedVersion: 1 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + platformData: + Android: + enabled: 0 + settings: + CPU: AnyCPU + Any: + enabled: 0 + settings: {} + Editor: + enabled: 1 + settings: + CPU: x86_64 + DefaultValueInitialized: true + OS: AnyOS + Linux: + enabled: 0 + settings: + CPU: None + Linux64: + enabled: 1 + settings: + CPU: x86_64 + LinuxUniversal: + enabled: 1 + settings: + CPU: AnyCPU + OSXIntel: + enabled: 0 + settings: + CPU: None + OSXIntel64: + enabled: 0 + settings: + CPU: None + OSXUniversal: + enabled: 0 + settings: + CPU: None + SamsungTV: + enabled: 0 + settings: + STV_MODEL: STANDARD_15 + Win: + enabled: 0 + settings: + CPU: None + Win64: + enabled: 0 + settings: + CPU: None + iOS: + enabled: 0 + settings: + CompileFlags: + FrameworkDependencies: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/lib/linux/x86_64/libresonanceaudio.so b/Assets/Plugins/FMOD/lib/linux/x86_64/libresonanceaudio.so new file mode 100755 index 0000000..0671f56 Binary files /dev/null and b/Assets/Plugins/FMOD/lib/linux/x86_64/libresonanceaudio.so differ diff --git a/Assets/Plugins/FMOD/lib/linux/x86_64/libresonanceaudio.so.meta b/Assets/Plugins/FMOD/lib/linux/x86_64/libresonanceaudio.so.meta new file mode 100755 index 0000000..6f3803c --- /dev/null +++ b/Assets/Plugins/FMOD/lib/linux/x86_64/libresonanceaudio.so.meta @@ -0,0 +1,69 @@ +fileFormatVersion: 2 +guid: bca6f630c310b4945b52486d2ed1da0a +timeCreated: 1511469552 +licenseType: Free +PluginImporter: + serializedVersion: 1 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + isOverridable: 0 + platformData: + Android: + enabled: 0 + settings: + CPU: ARMv7 + Any: + enabled: 0 + settings: + CPU: AnyCPU + Editor: + enabled: 1 + settings: + CPU: x86_64 + DefaultValueInitialized: true + OS: Linux + Linux: + enabled: 0 + settings: + CPU: None + Linux64: + enabled: 1 + settings: + CPU: x86_64 + LinuxUniversal: + enabled: 1 + settings: + CPU: x86_64 + OSXIntel: + enabled: 0 + settings: + CPU: None + OSXIntel64: + enabled: 0 + settings: + CPU: None + OSXUniversal: + enabled: 0 + settings: + CPU: None + SamsungTV: + enabled: 0 + settings: + STV_MODEL: STANDARD_15 + Win: + enabled: 0 + settings: + CPU: None + Win64: + enabled: 0 + settings: + CPU: AnyCPU + iOS: + enabled: 0 + settings: + CompileFlags: + FrameworkDependencies: + userData: + assetBundleName: + assetBundleVariant: \ No newline at end of file diff --git a/Assets/Plugins/FMOD/lib/mac.meta b/Assets/Plugins/FMOD/lib/mac.meta new file mode 100755 index 0000000..8405186 --- /dev/null +++ b/Assets/Plugins/FMOD/lib/mac.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 213874730a5d3834c903c8f919bb9884 +folderAsset: yes +timeCreated: 1552564451 +licenseType: Free +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/lib/mac/fmodstudio.bundle.meta b/Assets/Plugins/FMOD/lib/mac/fmodstudio.bundle.meta new file mode 100755 index 0000000..5ab94eb --- /dev/null +++ b/Assets/Plugins/FMOD/lib/mac/fmodstudio.bundle.meta @@ -0,0 +1,68 @@ +fileFormatVersion: 2 +guid: 4f94b6752a0d5ad489274786cbfbc6e5 +folderAsset: yes +timeCreated: 1442816865 +licenseType: Free +PluginImporter: + serializedVersion: 1 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + platformData: + Android: + enabled: 0 + settings: + CPU: AnyCPU + Any: + enabled: 0 + settings: {} + Editor: + enabled: 1 + settings: + CPU: AnyCPU + DefaultValueInitialized: true + OS: OSX + Linux: + enabled: 1 + settings: + CPU: x86 + Linux64: + enabled: 1 + settings: + CPU: x86_64 + LinuxUniversal: + enabled: 1 + settings: + CPU: AnyCPU + OSXIntel: + enabled: 1 + settings: + CPU: AnyCPU + OSXIntel64: + enabled: 1 + settings: + CPU: AnyCPU + OSXUniversal: + enabled: 1 + settings: + CPU: AnyCPU + SamsungTV: + enabled: 0 + settings: + STV_MODEL: STANDARD_13 + Win: + enabled: 1 + settings: + CPU: AnyCPU + Win64: + enabled: 1 + settings: + CPU: AnyCPU + iOS: + enabled: 0 + settings: + CompileFlags: + FrameworkDependencies: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/lib/mac/fmodstudio.bundle/Contents.meta b/Assets/Plugins/FMOD/lib/mac/fmodstudio.bundle/Contents.meta new file mode 100755 index 0000000..22a6353 --- /dev/null +++ b/Assets/Plugins/FMOD/lib/mac/fmodstudio.bundle/Contents.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 2879b055c8551c44caa264ce7208ea17 +folderAsset: yes +timeCreated: 1432606678 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/lib/mac/fmodstudio.bundle/Contents/MacOS.meta b/Assets/Plugins/FMOD/lib/mac/fmodstudio.bundle/Contents/MacOS.meta new file mode 100755 index 0000000..c0faa7b --- /dev/null +++ b/Assets/Plugins/FMOD/lib/mac/fmodstudio.bundle/Contents/MacOS.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 4c7ef954631945d4981884adcc603e81 +folderAsset: yes +timeCreated: 1432606678 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/lib/mac/fmodstudio.bundle/Contents/MacOS/fmodstudio b/Assets/Plugins/FMOD/lib/mac/fmodstudio.bundle/Contents/MacOS/fmodstudio new file mode 100755 index 0000000..d64427c Binary files /dev/null and b/Assets/Plugins/FMOD/lib/mac/fmodstudio.bundle/Contents/MacOS/fmodstudio differ diff --git a/Assets/Plugins/FMOD/lib/mac/fmodstudio.bundle/Contents/MacOS/fmodstudio.meta b/Assets/Plugins/FMOD/lib/mac/fmodstudio.bundle/Contents/MacOS/fmodstudio.meta new file mode 100755 index 0000000..c9f7db9 --- /dev/null +++ b/Assets/Plugins/FMOD/lib/mac/fmodstudio.bundle/Contents/MacOS/fmodstudio.meta @@ -0,0 +1,6 @@ +fileFormatVersion: 2 +guid: c5e926e235023354fb6b94bc154a8d2c +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/lib/mac/fmodstudioL.bundle.meta b/Assets/Plugins/FMOD/lib/mac/fmodstudioL.bundle.meta new file mode 100755 index 0000000..ff146f8 --- /dev/null +++ b/Assets/Plugins/FMOD/lib/mac/fmodstudioL.bundle.meta @@ -0,0 +1,68 @@ +fileFormatVersion: 2 +guid: 17156b5dbba3da94e9d70a06add50376 +folderAsset: yes +timeCreated: 1442816865 +licenseType: Free +PluginImporter: + serializedVersion: 1 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + platformData: + Android: + enabled: 0 + settings: + CPU: AnyCPU + Any: + enabled: 0 + settings: {} + Editor: + enabled: 1 + settings: + CPU: AnyCPU + DefaultValueInitialized: true + OS: OSX + Linux: + enabled: 1 + settings: + CPU: x86 + Linux64: + enabled: 1 + settings: + CPU: x86_64 + LinuxUniversal: + enabled: 1 + settings: + CPU: AnyCPU + OSXIntel: + enabled: 1 + settings: + CPU: AnyCPU + OSXIntel64: + enabled: 1 + settings: + CPU: AnyCPU + OSXUniversal: + enabled: 1 + settings: + CPU: AnyCPU + SamsungTV: + enabled: 0 + settings: + STV_MODEL: STANDARD_13 + Win: + enabled: 1 + settings: + CPU: AnyCPU + Win64: + enabled: 1 + settings: + CPU: AnyCPU + iOS: + enabled: 0 + settings: + CompileFlags: + FrameworkDependencies: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/lib/mac/fmodstudioL.bundle/Contents.meta b/Assets/Plugins/FMOD/lib/mac/fmodstudioL.bundle/Contents.meta new file mode 100755 index 0000000..e09a0e6 --- /dev/null +++ b/Assets/Plugins/FMOD/lib/mac/fmodstudioL.bundle/Contents.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 3ee033c1fbe25354097a9e4f56806fd5 +folderAsset: yes +timeCreated: 1432606678 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/lib/mac/fmodstudioL.bundle/Contents/MacOS.meta b/Assets/Plugins/FMOD/lib/mac/fmodstudioL.bundle/Contents/MacOS.meta new file mode 100755 index 0000000..2b2089e --- /dev/null +++ b/Assets/Plugins/FMOD/lib/mac/fmodstudioL.bundle/Contents/MacOS.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: d31dcfc39fb2ce943a0f3b1a5fe3d574 +folderAsset: yes +timeCreated: 1432606678 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/lib/mac/fmodstudioL.bundle/Contents/MacOS/fmodstudioL b/Assets/Plugins/FMOD/lib/mac/fmodstudioL.bundle/Contents/MacOS/fmodstudioL new file mode 100755 index 0000000..0c6f2ef Binary files /dev/null and b/Assets/Plugins/FMOD/lib/mac/fmodstudioL.bundle/Contents/MacOS/fmodstudioL differ diff --git a/Assets/Plugins/FMOD/lib/mac/fmodstudioL.bundle/Contents/MacOS/fmodstudioL.meta b/Assets/Plugins/FMOD/lib/mac/fmodstudioL.bundle/Contents/MacOS/fmodstudioL.meta new file mode 100755 index 0000000..003ce02 --- /dev/null +++ b/Assets/Plugins/FMOD/lib/mac/fmodstudioL.bundle/Contents/MacOS/fmodstudioL.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: ccbd5fd69ea0cd145a1b6ab7543f3b8d +timeCreated: 1429825705 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/lib/mac/resonanceaudio.bundle.meta b/Assets/Plugins/FMOD/lib/mac/resonanceaudio.bundle.meta new file mode 100755 index 0000000..2a46a15 --- /dev/null +++ b/Assets/Plugins/FMOD/lib/mac/resonanceaudio.bundle.meta @@ -0,0 +1,59 @@ +fileFormatVersion: 2 +guid: 04e20ff877bea8747ae257229c720dcc +folderAsset: yes +timeCreated: 1511469544 +licenseType: Free +PluginImporter: + serializedVersion: 1 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + platformData: + Android: + enabled: 0 + settings: + CPU: AnyCPU + Any: + enabled: 0 + settings: {} + Editor: + enabled: 0 + settings: + CPU: AnyCPU + DefaultValueInitialized: true + OS: AnyOS + Linux: + enabled: 0 + settings: + CPU: x86 + Linux64: + enabled: 0 + settings: + CPU: x86_64 + LinuxUniversal: + enabled: 0 + settings: + CPU: None + OSXIntel: + enabled: 1 + settings: + CPU: AnyCPU + OSXIntel64: + enabled: 1 + settings: + CPU: AnyCPU + OSXUniversal: + enabled: 1 + settings: + CPU: AnyCPU + Win: + enabled: 0 + settings: + CPU: AnyCPU + Win64: + enabled: 0 + settings: + CPU: AnyCPU + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/lib/mac/resonanceaudio.bundle/Contents.meta b/Assets/Plugins/FMOD/lib/mac/resonanceaudio.bundle/Contents.meta new file mode 100755 index 0000000..e8297a7 --- /dev/null +++ b/Assets/Plugins/FMOD/lib/mac/resonanceaudio.bundle/Contents.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: a5e43a852000e2443a14695f63ceffd7 +folderAsset: yes +timeCreated: 1511469545 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/lib/mac/resonanceaudio.bundle/Contents/MacOS.meta b/Assets/Plugins/FMOD/lib/mac/resonanceaudio.bundle/Contents/MacOS.meta new file mode 100755 index 0000000..70f53e6 --- /dev/null +++ b/Assets/Plugins/FMOD/lib/mac/resonanceaudio.bundle/Contents/MacOS.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 242a6e2e6d91dcf45a7ef7bdd7bfe227 +folderAsset: yes +timeCreated: 1511469545 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/lib/mac/resonanceaudio.bundle/Contents/MacOS/resonanceaudio b/Assets/Plugins/FMOD/lib/mac/resonanceaudio.bundle/Contents/MacOS/resonanceaudio new file mode 100755 index 0000000..49f9385 Binary files /dev/null and b/Assets/Plugins/FMOD/lib/mac/resonanceaudio.bundle/Contents/MacOS/resonanceaudio differ diff --git a/Assets/Plugins/FMOD/lib/mac/resonanceaudio.bundle/Contents/MacOS/resonanceaudio.meta b/Assets/Plugins/FMOD/lib/mac/resonanceaudio.bundle/Contents/MacOS/resonanceaudio.meta new file mode 100755 index 0000000..bdd9748 --- /dev/null +++ b/Assets/Plugins/FMOD/lib/mac/resonanceaudio.bundle/Contents/MacOS/resonanceaudio.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 2e2968e9faea7be4ea2b24d5bd144749 +timeCreated: 1511469545 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/lib/tvos.meta b/Assets/Plugins/FMOD/lib/tvos.meta new file mode 100755 index 0000000..70e656a --- /dev/null +++ b/Assets/Plugins/FMOD/lib/tvos.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 857bc61def44e6344ba0fa6ab2fb8e9b +folderAsset: yes +timeCreated: 1477604800 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/lib/tvos/libfmodstudiounityplugin.a b/Assets/Plugins/FMOD/lib/tvos/libfmodstudiounityplugin.a new file mode 100755 index 0000000..0a178c3 Binary files /dev/null and b/Assets/Plugins/FMOD/lib/tvos/libfmodstudiounityplugin.a differ diff --git a/Assets/Plugins/FMOD/lib/tvos/libfmodstudiounityplugin.a.meta b/Assets/Plugins/FMOD/lib/tvos/libfmodstudiounityplugin.a.meta new file mode 100755 index 0000000..856dcf3 --- /dev/null +++ b/Assets/Plugins/FMOD/lib/tvos/libfmodstudiounityplugin.a.meta @@ -0,0 +1,18 @@ +fileFormatVersion: 2 +guid: 4abc247d0f34143ec95396c7b6bec6a8 +PluginImporter: + serializedVersion: 1 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + platformData: + tvOS: + enabled: 1 + settings: {} + Editor: + enabled: 0 + settings: + DefaultValueInitialized: true + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/lib/tvos/libfmodstudiounitypluginL.a b/Assets/Plugins/FMOD/lib/tvos/libfmodstudiounitypluginL.a new file mode 100755 index 0000000..bd72a46 Binary files /dev/null and b/Assets/Plugins/FMOD/lib/tvos/libfmodstudiounitypluginL.a differ diff --git a/Assets/Plugins/FMOD/lib/tvos/libfmodstudiounitypluginL.a.meta b/Assets/Plugins/FMOD/lib/tvos/libfmodstudiounitypluginL.a.meta new file mode 100755 index 0000000..ba7ba80 --- /dev/null +++ b/Assets/Plugins/FMOD/lib/tvos/libfmodstudiounitypluginL.a.meta @@ -0,0 +1,20 @@ +fileFormatVersion: 2 +guid: 982978af662f9ea43b7979c7f61bbad3 +timeCreated: 1507179416 +licenseType: Free +PluginImporter: + serializedVersion: 1 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + platformData: + Any: + enabled: 0 + settings: {} + Editor: + enabled: 0 + settings: + DefaultValueInitialized: true + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/lib/uwp.meta b/Assets/Plugins/FMOD/lib/uwp.meta new file mode 100755 index 0000000..c9a2258 --- /dev/null +++ b/Assets/Plugins/FMOD/lib/uwp.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: be8af5ff3d289a14ba8508f34a77d6bb +folderAsset: yes +timeCreated: 1457062767 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/lib/uwp/arm.meta b/Assets/Plugins/FMOD/lib/uwp/arm.meta new file mode 100755 index 0000000..7e0ebdb --- /dev/null +++ b/Assets/Plugins/FMOD/lib/uwp/arm.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 0cddbb9418c24f44d87fc49581769340 +folderAsset: yes +timeCreated: 1457408139 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/lib/uwp/arm/fmod.dll b/Assets/Plugins/FMOD/lib/uwp/arm/fmod.dll new file mode 100755 index 0000000..a32b166 Binary files /dev/null and b/Assets/Plugins/FMOD/lib/uwp/arm/fmod.dll differ diff --git a/Assets/Plugins/FMOD/lib/uwp/arm/fmod.dll.meta b/Assets/Plugins/FMOD/lib/uwp/arm/fmod.dll.meta new file mode 100755 index 0000000..1d7a3db --- /dev/null +++ b/Assets/Plugins/FMOD/lib/uwp/arm/fmod.dll.meta @@ -0,0 +1,58 @@ +fileFormatVersion: 2 +guid: 907f4331811d73442b58d50627a775d4 +timeCreated: 1457408139 +licenseType: Free +PluginImporter: + serializedVersion: 1 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + platformData: + Android: + enabled: 0 + settings: + CPU: AnyCPU + Any: + enabled: 0 + settings: {} + Editor: + enabled: 0 + settings: + CPU: AnyCPU + DefaultValueInitialized: true + OS: AnyOS + Linux: + enabled: 0 + settings: + CPU: x86 + Linux64: + enabled: 0 + settings: + CPU: x86_64 + OSXIntel: + enabled: 0 + settings: + CPU: AnyCPU + OSXIntel64: + enabled: 0 + settings: + CPU: AnyCPU + Win: + enabled: 0 + settings: + CPU: AnyCPU + Win64: + enabled: 0 + settings: + CPU: AnyCPU + WindowsStoreApps: + enabled: 1 + settings: + CPU: ARM + DontProcess: False + PlaceholderPath: + SDK: UWP + ScriptingBackend: AnyScriptingBackend + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/lib/uwp/arm/fmodL.dll b/Assets/Plugins/FMOD/lib/uwp/arm/fmodL.dll new file mode 100755 index 0000000..fe000a9 Binary files /dev/null and b/Assets/Plugins/FMOD/lib/uwp/arm/fmodL.dll differ diff --git a/Assets/Plugins/FMOD/lib/uwp/arm/fmodL.dll.meta b/Assets/Plugins/FMOD/lib/uwp/arm/fmodL.dll.meta new file mode 100755 index 0000000..3c490d8 --- /dev/null +++ b/Assets/Plugins/FMOD/lib/uwp/arm/fmodL.dll.meta @@ -0,0 +1,58 @@ +fileFormatVersion: 2 +guid: 82bacb4b0f3cc85418d2a1aa2ca57df6 +timeCreated: 1457408139 +licenseType: Free +PluginImporter: + serializedVersion: 1 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + platformData: + Android: + enabled: 0 + settings: + CPU: AnyCPU + Any: + enabled: 0 + settings: {} + Editor: + enabled: 0 + settings: + CPU: AnyCPU + DefaultValueInitialized: true + OS: AnyOS + Linux: + enabled: 0 + settings: + CPU: x86 + Linux64: + enabled: 0 + settings: + CPU: x86_64 + OSXIntel: + enabled: 0 + settings: + CPU: AnyCPU + OSXIntel64: + enabled: 0 + settings: + CPU: AnyCPU + Win: + enabled: 0 + settings: + CPU: AnyCPU + Win64: + enabled: 0 + settings: + CPU: AnyCPU + WindowsStoreApps: + enabled: 1 + settings: + CPU: ARM + DontProcess: False + PlaceholderPath: + SDK: UWP + ScriptingBackend: AnyScriptingBackend + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/lib/uwp/arm/fmodstudio.dll b/Assets/Plugins/FMOD/lib/uwp/arm/fmodstudio.dll new file mode 100755 index 0000000..55628e0 Binary files /dev/null and b/Assets/Plugins/FMOD/lib/uwp/arm/fmodstudio.dll differ diff --git a/Assets/Plugins/FMOD/lib/uwp/arm/fmodstudio.dll.meta b/Assets/Plugins/FMOD/lib/uwp/arm/fmodstudio.dll.meta new file mode 100755 index 0000000..0a1de25 --- /dev/null +++ b/Assets/Plugins/FMOD/lib/uwp/arm/fmodstudio.dll.meta @@ -0,0 +1,58 @@ +fileFormatVersion: 2 +guid: a7c1eb40b6cc0b8468c161b5ba9a6df6 +timeCreated: 1457408139 +licenseType: Free +PluginImporter: + serializedVersion: 1 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + platformData: + Android: + enabled: 0 + settings: + CPU: AnyCPU + Any: + enabled: 0 + settings: {} + Editor: + enabled: 0 + settings: + CPU: AnyCPU + DefaultValueInitialized: true + OS: AnyOS + Linux: + enabled: 0 + settings: + CPU: x86 + Linux64: + enabled: 0 + settings: + CPU: x86_64 + OSXIntel: + enabled: 0 + settings: + CPU: AnyCPU + OSXIntel64: + enabled: 0 + settings: + CPU: AnyCPU + Win: + enabled: 0 + settings: + CPU: AnyCPU + Win64: + enabled: 0 + settings: + CPU: AnyCPU + WindowsStoreApps: + enabled: 1 + settings: + CPU: ARM + DontProcess: False + PlaceholderPath: + SDK: UWP + ScriptingBackend: AnyScriptingBackend + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/lib/uwp/arm/fmodstudioL.dll b/Assets/Plugins/FMOD/lib/uwp/arm/fmodstudioL.dll new file mode 100755 index 0000000..4a19135 Binary files /dev/null and b/Assets/Plugins/FMOD/lib/uwp/arm/fmodstudioL.dll differ diff --git a/Assets/Plugins/FMOD/lib/uwp/arm/fmodstudioL.dll.meta b/Assets/Plugins/FMOD/lib/uwp/arm/fmodstudioL.dll.meta new file mode 100755 index 0000000..af4f20b --- /dev/null +++ b/Assets/Plugins/FMOD/lib/uwp/arm/fmodstudioL.dll.meta @@ -0,0 +1,58 @@ +fileFormatVersion: 2 +guid: 5476dd86ee3260f4bb2283aef1d9a883 +timeCreated: 1457408139 +licenseType: Free +PluginImporter: + serializedVersion: 1 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + platformData: + Android: + enabled: 0 + settings: + CPU: AnyCPU + Any: + enabled: 0 + settings: {} + Editor: + enabled: 0 + settings: + CPU: AnyCPU + DefaultValueInitialized: true + OS: AnyOS + Linux: + enabled: 0 + settings: + CPU: x86 + Linux64: + enabled: 0 + settings: + CPU: x86_64 + OSXIntel: + enabled: 0 + settings: + CPU: AnyCPU + OSXIntel64: + enabled: 0 + settings: + CPU: AnyCPU + Win: + enabled: 0 + settings: + CPU: AnyCPU + Win64: + enabled: 0 + settings: + CPU: AnyCPU + WindowsStoreApps: + enabled: 1 + settings: + CPU: ARM + DontProcess: False + PlaceholderPath: + SDK: UWP + ScriptingBackend: AnyScriptingBackend + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/lib/uwp/x64.meta b/Assets/Plugins/FMOD/lib/uwp/x64.meta new file mode 100755 index 0000000..3a6641e --- /dev/null +++ b/Assets/Plugins/FMOD/lib/uwp/x64.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 81189b2e21a815647a28e3437c86beb2 +folderAsset: yes +timeCreated: 1457064777 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/lib/uwp/x64/fmod.dll b/Assets/Plugins/FMOD/lib/uwp/x64/fmod.dll new file mode 100755 index 0000000..1007dc1 Binary files /dev/null and b/Assets/Plugins/FMOD/lib/uwp/x64/fmod.dll differ diff --git a/Assets/Plugins/FMOD/lib/uwp/x64/fmod.dll.meta b/Assets/Plugins/FMOD/lib/uwp/x64/fmod.dll.meta new file mode 100755 index 0000000..0822901 --- /dev/null +++ b/Assets/Plugins/FMOD/lib/uwp/x64/fmod.dll.meta @@ -0,0 +1,58 @@ +fileFormatVersion: 2 +guid: 68f9a982a926833498d438319388a455 +timeCreated: 1457408139 +licenseType: Free +PluginImporter: + serializedVersion: 1 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + platformData: + Android: + enabled: 0 + settings: + CPU: AnyCPU + Any: + enabled: 0 + settings: {} + Editor: + enabled: 0 + settings: + CPU: AnyCPU + DefaultValueInitialized: true + OS: AnyOS + Linux: + enabled: 0 + settings: + CPU: x86 + Linux64: + enabled: 0 + settings: + CPU: x86_64 + OSXIntel: + enabled: 0 + settings: + CPU: AnyCPU + OSXIntel64: + enabled: 0 + settings: + CPU: AnyCPU + Win: + enabled: 0 + settings: + CPU: AnyCPU + Win64: + enabled: 0 + settings: + CPU: AnyCPU + WindowsStoreApps: + enabled: 1 + settings: + CPU: X64 + DontProcess: False + PlaceholderPath: + SDK: UWP + ScriptingBackend: AnyScriptingBackend + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/lib/uwp/x64/fmodL.dll b/Assets/Plugins/FMOD/lib/uwp/x64/fmodL.dll new file mode 100755 index 0000000..46a64cd Binary files /dev/null and b/Assets/Plugins/FMOD/lib/uwp/x64/fmodL.dll differ diff --git a/Assets/Plugins/FMOD/lib/uwp/x64/fmodL.dll.meta b/Assets/Plugins/FMOD/lib/uwp/x64/fmodL.dll.meta new file mode 100755 index 0000000..233512d --- /dev/null +++ b/Assets/Plugins/FMOD/lib/uwp/x64/fmodL.dll.meta @@ -0,0 +1,58 @@ +fileFormatVersion: 2 +guid: d15f9d3e1089b114a8f625e994fea839 +timeCreated: 1457408139 +licenseType: Free +PluginImporter: + serializedVersion: 1 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + platformData: + Android: + enabled: 0 + settings: + CPU: AnyCPU + Any: + enabled: 0 + settings: {} + Editor: + enabled: 0 + settings: + CPU: AnyCPU + DefaultValueInitialized: true + OS: AnyOS + Linux: + enabled: 0 + settings: + CPU: x86 + Linux64: + enabled: 0 + settings: + CPU: x86_64 + OSXIntel: + enabled: 0 + settings: + CPU: AnyCPU + OSXIntel64: + enabled: 0 + settings: + CPU: AnyCPU + Win: + enabled: 0 + settings: + CPU: AnyCPU + Win64: + enabled: 0 + settings: + CPU: AnyCPU + WindowsStoreApps: + enabled: 1 + settings: + CPU: X64 + DontProcess: False + PlaceholderPath: + SDK: UWP + ScriptingBackend: AnyScriptingBackend + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/lib/uwp/x64/fmodstudio.dll b/Assets/Plugins/FMOD/lib/uwp/x64/fmodstudio.dll new file mode 100755 index 0000000..bfb776b Binary files /dev/null and b/Assets/Plugins/FMOD/lib/uwp/x64/fmodstudio.dll differ diff --git a/Assets/Plugins/FMOD/lib/uwp/x64/fmodstudio.dll.meta b/Assets/Plugins/FMOD/lib/uwp/x64/fmodstudio.dll.meta new file mode 100755 index 0000000..3412da5 --- /dev/null +++ b/Assets/Plugins/FMOD/lib/uwp/x64/fmodstudio.dll.meta @@ -0,0 +1,58 @@ +fileFormatVersion: 2 +guid: 29800d7cce1a5fc46ae163c8a68d8346 +timeCreated: 1457408139 +licenseType: Free +PluginImporter: + serializedVersion: 1 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + platformData: + Android: + enabled: 0 + settings: + CPU: AnyCPU + Any: + enabled: 0 + settings: {} + Editor: + enabled: 0 + settings: + CPU: AnyCPU + DefaultValueInitialized: true + OS: AnyOS + Linux: + enabled: 0 + settings: + CPU: x86 + Linux64: + enabled: 0 + settings: + CPU: x86_64 + OSXIntel: + enabled: 0 + settings: + CPU: AnyCPU + OSXIntel64: + enabled: 0 + settings: + CPU: AnyCPU + Win: + enabled: 0 + settings: + CPU: AnyCPU + Win64: + enabled: 0 + settings: + CPU: AnyCPU + WindowsStoreApps: + enabled: 1 + settings: + CPU: X64 + DontProcess: False + PlaceholderPath: + SDK: UWP + ScriptingBackend: AnyScriptingBackend + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/lib/uwp/x64/fmodstudioL.dll b/Assets/Plugins/FMOD/lib/uwp/x64/fmodstudioL.dll new file mode 100755 index 0000000..33be7d1 Binary files /dev/null and b/Assets/Plugins/FMOD/lib/uwp/x64/fmodstudioL.dll differ diff --git a/Assets/Plugins/FMOD/lib/uwp/x64/fmodstudioL.dll.meta b/Assets/Plugins/FMOD/lib/uwp/x64/fmodstudioL.dll.meta new file mode 100755 index 0000000..0bbdb23 --- /dev/null +++ b/Assets/Plugins/FMOD/lib/uwp/x64/fmodstudioL.dll.meta @@ -0,0 +1,58 @@ +fileFormatVersion: 2 +guid: 813ca429588de5d40b5c8a184a15bcd9 +timeCreated: 1457408139 +licenseType: Free +PluginImporter: + serializedVersion: 1 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + platformData: + Android: + enabled: 0 + settings: + CPU: AnyCPU + Any: + enabled: 0 + settings: {} + Editor: + enabled: 0 + settings: + CPU: AnyCPU + DefaultValueInitialized: true + OS: AnyOS + Linux: + enabled: 0 + settings: + CPU: x86 + Linux64: + enabled: 0 + settings: + CPU: x86_64 + OSXIntel: + enabled: 0 + settings: + CPU: AnyCPU + OSXIntel64: + enabled: 0 + settings: + CPU: AnyCPU + Win: + enabled: 0 + settings: + CPU: AnyCPU + Win64: + enabled: 0 + settings: + CPU: AnyCPU + WindowsStoreApps: + enabled: 1 + settings: + CPU: X64 + DontProcess: False + PlaceholderPath: + SDK: UWP + ScriptingBackend: AnyScriptingBackend + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/lib/uwp/x86.meta b/Assets/Plugins/FMOD/lib/uwp/x86.meta new file mode 100755 index 0000000..d4dbed4 --- /dev/null +++ b/Assets/Plugins/FMOD/lib/uwp/x86.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: fa5c1a42d40246b4a83af1e8192b6bdf +folderAsset: yes +timeCreated: 1457063023 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/lib/uwp/x86/fmod.dll b/Assets/Plugins/FMOD/lib/uwp/x86/fmod.dll new file mode 100755 index 0000000..8565c27 Binary files /dev/null and b/Assets/Plugins/FMOD/lib/uwp/x86/fmod.dll differ diff --git a/Assets/Plugins/FMOD/lib/uwp/x86/fmod.dll.meta b/Assets/Plugins/FMOD/lib/uwp/x86/fmod.dll.meta new file mode 100755 index 0000000..38df19e --- /dev/null +++ b/Assets/Plugins/FMOD/lib/uwp/x86/fmod.dll.meta @@ -0,0 +1,58 @@ +fileFormatVersion: 2 +guid: 39f9a761a2a032045a853a069db31081 +timeCreated: 1457408139 +licenseType: Free +PluginImporter: + serializedVersion: 1 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + platformData: + Android: + enabled: 0 + settings: + CPU: AnyCPU + Any: + enabled: 0 + settings: {} + Editor: + enabled: 0 + settings: + CPU: AnyCPU + DefaultValueInitialized: true + OS: AnyOS + Linux: + enabled: 0 + settings: + CPU: x86 + Linux64: + enabled: 0 + settings: + CPU: x86_64 + OSXIntel: + enabled: 0 + settings: + CPU: AnyCPU + OSXIntel64: + enabled: 0 + settings: + CPU: AnyCPU + Win: + enabled: 0 + settings: + CPU: AnyCPU + Win64: + enabled: 0 + settings: + CPU: AnyCPU + WindowsStoreApps: + enabled: 1 + settings: + CPU: X86 + DontProcess: False + PlaceholderPath: + SDK: UWP + ScriptingBackend: AnyScriptingBackend + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/lib/uwp/x86/fmodL.dll b/Assets/Plugins/FMOD/lib/uwp/x86/fmodL.dll new file mode 100755 index 0000000..2c3c36f Binary files /dev/null and b/Assets/Plugins/FMOD/lib/uwp/x86/fmodL.dll differ diff --git a/Assets/Plugins/FMOD/lib/uwp/x86/fmodL.dll.meta b/Assets/Plugins/FMOD/lib/uwp/x86/fmodL.dll.meta new file mode 100755 index 0000000..9dfb750 --- /dev/null +++ b/Assets/Plugins/FMOD/lib/uwp/x86/fmodL.dll.meta @@ -0,0 +1,58 @@ +fileFormatVersion: 2 +guid: 243e8fba07980f74b8d49ef345dadd64 +timeCreated: 1457408139 +licenseType: Free +PluginImporter: + serializedVersion: 1 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + platformData: + Android: + enabled: 0 + settings: + CPU: AnyCPU + Any: + enabled: 0 + settings: {} + Editor: + enabled: 0 + settings: + CPU: AnyCPU + DefaultValueInitialized: true + OS: AnyOS + Linux: + enabled: 0 + settings: + CPU: x86 + Linux64: + enabled: 0 + settings: + CPU: x86_64 + OSXIntel: + enabled: 0 + settings: + CPU: AnyCPU + OSXIntel64: + enabled: 0 + settings: + CPU: AnyCPU + Win: + enabled: 0 + settings: + CPU: AnyCPU + Win64: + enabled: 0 + settings: + CPU: AnyCPU + WindowsStoreApps: + enabled: 1 + settings: + CPU: X86 + DontProcess: False + PlaceholderPath: + SDK: UWP + ScriptingBackend: AnyScriptingBackend + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/lib/uwp/x86/fmodstudio.dll b/Assets/Plugins/FMOD/lib/uwp/x86/fmodstudio.dll new file mode 100755 index 0000000..eec2011 Binary files /dev/null and b/Assets/Plugins/FMOD/lib/uwp/x86/fmodstudio.dll differ diff --git a/Assets/Plugins/FMOD/lib/uwp/x86/fmodstudio.dll.meta b/Assets/Plugins/FMOD/lib/uwp/x86/fmodstudio.dll.meta new file mode 100755 index 0000000..74c73fc --- /dev/null +++ b/Assets/Plugins/FMOD/lib/uwp/x86/fmodstudio.dll.meta @@ -0,0 +1,58 @@ +fileFormatVersion: 2 +guid: ecb0cc0019197154b9baeef623b6ec0a +timeCreated: 1457408139 +licenseType: Free +PluginImporter: + serializedVersion: 1 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + platformData: + Android: + enabled: 0 + settings: + CPU: AnyCPU + Any: + enabled: 0 + settings: {} + Editor: + enabled: 0 + settings: + CPU: AnyCPU + DefaultValueInitialized: true + OS: AnyOS + Linux: + enabled: 0 + settings: + CPU: x86 + Linux64: + enabled: 0 + settings: + CPU: x86_64 + OSXIntel: + enabled: 0 + settings: + CPU: AnyCPU + OSXIntel64: + enabled: 0 + settings: + CPU: AnyCPU + Win: + enabled: 0 + settings: + CPU: AnyCPU + Win64: + enabled: 0 + settings: + CPU: AnyCPU + WindowsStoreApps: + enabled: 1 + settings: + CPU: X86 + DontProcess: False + PlaceholderPath: + SDK: UWP + ScriptingBackend: AnyScriptingBackend + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/lib/uwp/x86/fmodstudioL.dll b/Assets/Plugins/FMOD/lib/uwp/x86/fmodstudioL.dll new file mode 100755 index 0000000..97a8cd1 Binary files /dev/null and b/Assets/Plugins/FMOD/lib/uwp/x86/fmodstudioL.dll differ diff --git a/Assets/Plugins/FMOD/lib/uwp/x86/fmodstudioL.dll.meta b/Assets/Plugins/FMOD/lib/uwp/x86/fmodstudioL.dll.meta new file mode 100755 index 0000000..0569202 --- /dev/null +++ b/Assets/Plugins/FMOD/lib/uwp/x86/fmodstudioL.dll.meta @@ -0,0 +1,58 @@ +fileFormatVersion: 2 +guid: 43ab9a198caf2d841b813eb81e02486d +timeCreated: 1457408139 +licenseType: Free +PluginImporter: + serializedVersion: 1 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + platformData: + Android: + enabled: 0 + settings: + CPU: AnyCPU + Any: + enabled: 0 + settings: {} + Editor: + enabled: 0 + settings: + CPU: AnyCPU + DefaultValueInitialized: true + OS: AnyOS + Linux: + enabled: 0 + settings: + CPU: x86 + Linux64: + enabled: 0 + settings: + CPU: x86_64 + OSXIntel: + enabled: 0 + settings: + CPU: AnyCPU + OSXIntel64: + enabled: 0 + settings: + CPU: AnyCPU + Win: + enabled: 0 + settings: + CPU: AnyCPU + Win64: + enabled: 0 + settings: + CPU: AnyCPU + WindowsStoreApps: + enabled: 1 + settings: + CPU: X86 + DontProcess: False + PlaceholderPath: + SDK: UWP + ScriptingBackend: AnyScriptingBackend + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/lib/win.meta b/Assets/Plugins/FMOD/lib/win.meta new file mode 100755 index 0000000..ad92187 --- /dev/null +++ b/Assets/Plugins/FMOD/lib/win.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 931b64b4742e82246a7e9e3ba4a6753c +folderAsset: yes +timeCreated: 1552564451 +licenseType: Free +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/lib/win/x86.meta b/Assets/Plugins/FMOD/lib/win/x86.meta new file mode 100755 index 0000000..e23ad28 --- /dev/null +++ b/Assets/Plugins/FMOD/lib/win/x86.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 03f590b69e4afe14fa1c73f89a98a203 +folderAsset: yes +timeCreated: 1432606678 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/lib/win/x86/fmodstudio.dll b/Assets/Plugins/FMOD/lib/win/x86/fmodstudio.dll new file mode 100755 index 0000000..1cb51cb Binary files /dev/null and b/Assets/Plugins/FMOD/lib/win/x86/fmodstudio.dll differ diff --git a/Assets/Plugins/FMOD/lib/win/x86/fmodstudio.dll.meta b/Assets/Plugins/FMOD/lib/win/x86/fmodstudio.dll.meta new file mode 100755 index 0000000..a32046a --- /dev/null +++ b/Assets/Plugins/FMOD/lib/win/x86/fmodstudio.dll.meta @@ -0,0 +1,78 @@ +fileFormatVersion: 2 +guid: 1550e5c882b8c2445a1f14f8b1b23d41 +PluginImporter: + serializedVersion: 1 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + platformData: + Android: + enabled: 0 + settings: + CPU: AnyCPU + Any: + enabled: 0 + settings: {} + Editor: + enabled: 1 + settings: + CPU: x86 + DefaultValueInitialized: true + OS: Windows + Linux: + enabled: 1 + settings: + CPU: x86 + Linux64: + enabled: 1 + settings: + CPU: None + LinuxUniversal: + enabled: 1 + settings: + CPU: AnyCPU + OSXIntel: + enabled: 1 + settings: + CPU: AnyCPU + OSXIntel64: + enabled: 1 + settings: + CPU: None + OSXUniversal: + enabled: 1 + settings: + CPU: AnyCPU + SamsungTV: + enabled: 0 + settings: + STV_MODEL: STANDARD_13 + WP8: + enabled: 0 + settings: + CPU: AnyCPU + DontProcess: False + PlaceholderPath: + Win: + enabled: 1 + settings: + CPU: AnyCPU + Win64: + enabled: 0 + settings: + CPU: None + WindowsStoreApps: + enabled: 0 + settings: + CPU: AnyCPU + DontProcess: False + PlaceholderPath: + SDK: AnySDK + iOS: + enabled: 0 + settings: + CompileFlags: + FrameworkDependencies: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/lib/win/x86/fmodstudiol.dll b/Assets/Plugins/FMOD/lib/win/x86/fmodstudiol.dll new file mode 100755 index 0000000..d5351c3 Binary files /dev/null and b/Assets/Plugins/FMOD/lib/win/x86/fmodstudiol.dll differ diff --git a/Assets/Plugins/FMOD/lib/win/x86/fmodstudiol.dll.meta b/Assets/Plugins/FMOD/lib/win/x86/fmodstudiol.dll.meta new file mode 100755 index 0000000..8576b2e --- /dev/null +++ b/Assets/Plugins/FMOD/lib/win/x86/fmodstudiol.dll.meta @@ -0,0 +1,80 @@ +fileFormatVersion: 2 +guid: 6e48bf6e640baa24f9e87619d1a61e8d +timeCreated: 1429083373 +licenseType: Pro +PluginImporter: + serializedVersion: 1 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + platformData: + Android: + enabled: 0 + settings: + CPU: AnyCPU + Any: + enabled: 0 + settings: {} + Editor: + enabled: 1 + settings: + CPU: x86 + DefaultValueInitialized: true + OS: Windows + Linux: + enabled: 1 + settings: + CPU: x86 + Linux64: + enabled: 1 + settings: + CPU: None + LinuxUniversal: + enabled: 1 + settings: + CPU: AnyCPU + OSXIntel: + enabled: 1 + settings: + CPU: AnyCPU + OSXIntel64: + enabled: 1 + settings: + CPU: None + OSXUniversal: + enabled: 1 + settings: + CPU: AnyCPU + SamsungTV: + enabled: 0 + settings: + STV_MODEL: STANDARD_13 + WP8: + enabled: 0 + settings: + CPU: AnyCPU + DontProcess: False + PlaceholderPath: + Win: + enabled: 1 + settings: + CPU: AnyCPU + Win64: + enabled: 0 + settings: + CPU: None + WindowsStoreApps: + enabled: 0 + settings: + CPU: AnyCPU + DontProcess: False + PlaceholderPath: + SDK: AnySDK + iOS: + enabled: 0 + settings: + CompileFlags: + FrameworkDependencies: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/lib/win/x86/resonanceaudio.dll b/Assets/Plugins/FMOD/lib/win/x86/resonanceaudio.dll new file mode 100755 index 0000000..da506ae Binary files /dev/null and b/Assets/Plugins/FMOD/lib/win/x86/resonanceaudio.dll differ diff --git a/Assets/Plugins/FMOD/lib/win/x86/resonanceaudio.dll.meta b/Assets/Plugins/FMOD/lib/win/x86/resonanceaudio.dll.meta new file mode 100755 index 0000000..b3274db --- /dev/null +++ b/Assets/Plugins/FMOD/lib/win/x86/resonanceaudio.dll.meta @@ -0,0 +1,55 @@ +fileFormatVersion: 2 +guid: b2c11f1e03736f748bd861d7bf4f8952 +timeCreated: 1511469552 +licenseType: Free +PluginImporter: + serializedVersion: 1 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + platformData: + Android: + enabled: 0 + settings: + CPU: AnyCPU + Editor: + enabled: 0 + settings: + CPU: x86 + DefaultValueInitialized: true + OS: AnyOS + Linux: + enabled: 0 + settings: + CPU: x86 + Linux64: + enabled: 0 + settings: + CPU: x86_64 + LinuxUniversal: + enabled: 0 + settings: + CPU: AnyCPU + OSXIntel: + enabled: 0 + settings: + CPU: AnyCPU + OSXIntel64: + enabled: 0 + settings: + CPU: AnyCPU + OSXUniversal: + enabled: 0 + settings: + CPU: AnyCPU + Win: + enabled: 1 + settings: + CPU: AnyCPU + Win64: + enabled: 0 + settings: + CPU: None + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/lib/win/x86_64.meta b/Assets/Plugins/FMOD/lib/win/x86_64.meta new file mode 100755 index 0000000..d574d01 --- /dev/null +++ b/Assets/Plugins/FMOD/lib/win/x86_64.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 8105cca2fc4eb2e488e010278c3ea1bf +folderAsset: yes +timeCreated: 1432606678 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/lib/win/x86_64/fmodstudio.dll b/Assets/Plugins/FMOD/lib/win/x86_64/fmodstudio.dll new file mode 100755 index 0000000..2b5398f Binary files /dev/null and b/Assets/Plugins/FMOD/lib/win/x86_64/fmodstudio.dll differ diff --git a/Assets/Plugins/FMOD/lib/win/x86_64/fmodstudio.dll.meta b/Assets/Plugins/FMOD/lib/win/x86_64/fmodstudio.dll.meta new file mode 100755 index 0000000..2059acb --- /dev/null +++ b/Assets/Plugins/FMOD/lib/win/x86_64/fmodstudio.dll.meta @@ -0,0 +1,78 @@ +fileFormatVersion: 2 +guid: 684d4d47a018ed14080e15f4c99b8e86 +PluginImporter: + serializedVersion: 1 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + platformData: + Android: + enabled: 0 + settings: + CPU: AnyCPU + Any: + enabled: 0 + settings: {} + Editor: + enabled: 1 + settings: + CPU: x86_64 + DefaultValueInitialized: true + OS: Windows + Linux: + enabled: 1 + settings: + CPU: None + Linux64: + enabled: 1 + settings: + CPU: x86_64 + LinuxUniversal: + enabled: 1 + settings: + CPU: AnyCPU + OSXIntel: + enabled: 1 + settings: + CPU: None + OSXIntel64: + enabled: 1 + settings: + CPU: AnyCPU + OSXUniversal: + enabled: 1 + settings: + CPU: AnyCPU + SamsungTV: + enabled: 0 + settings: + STV_MODEL: STANDARD_13 + WP8: + enabled: 0 + settings: + CPU: AnyCPU + DontProcess: False + PlaceholderPath: + Win: + enabled: 0 + settings: + CPU: None + Win64: + enabled: 1 + settings: + CPU: AnyCPU + WindowsStoreApps: + enabled: 0 + settings: + CPU: AnyCPU + DontProcess: False + PlaceholderPath: + SDK: AnySDK + iOS: + enabled: 0 + settings: + CompileFlags: + FrameworkDependencies: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/lib/win/x86_64/fmodstudiol.dll b/Assets/Plugins/FMOD/lib/win/x86_64/fmodstudiol.dll new file mode 100755 index 0000000..ecd2b97 Binary files /dev/null and b/Assets/Plugins/FMOD/lib/win/x86_64/fmodstudiol.dll differ diff --git a/Assets/Plugins/FMOD/lib/win/x86_64/fmodstudiol.dll.meta b/Assets/Plugins/FMOD/lib/win/x86_64/fmodstudiol.dll.meta new file mode 100755 index 0000000..bb5a313 --- /dev/null +++ b/Assets/Plugins/FMOD/lib/win/x86_64/fmodstudiol.dll.meta @@ -0,0 +1,80 @@ +fileFormatVersion: 2 +guid: 8514ea8d6deab804895ec1cab6902681 +timeCreated: 1429083373 +licenseType: Pro +PluginImporter: + serializedVersion: 1 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + platformData: + Android: + enabled: 0 + settings: + CPU: AnyCPU + Any: + enabled: 0 + settings: {} + Editor: + enabled: 1 + settings: + CPU: x86_64 + DefaultValueInitialized: true + OS: Windows + Linux: + enabled: 1 + settings: + CPU: None + Linux64: + enabled: 1 + settings: + CPU: x86_64 + LinuxUniversal: + enabled: 1 + settings: + CPU: AnyCPU + OSXIntel: + enabled: 1 + settings: + CPU: None + OSXIntel64: + enabled: 1 + settings: + CPU: AnyCPU + OSXUniversal: + enabled: 1 + settings: + CPU: AnyCPU + SamsungTV: + enabled: 0 + settings: + STV_MODEL: STANDARD_13 + WP8: + enabled: 0 + settings: + CPU: AnyCPU + DontProcess: False + PlaceholderPath: + Win: + enabled: 0 + settings: + CPU: None + Win64: + enabled: 1 + settings: + CPU: AnyCPU + WindowsStoreApps: + enabled: 0 + settings: + CPU: AnyCPU + DontProcess: False + PlaceholderPath: + SDK: AnySDK + iOS: + enabled: 0 + settings: + CompileFlags: + FrameworkDependencies: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/lib/win/x86_64/resonanceaudio.dll b/Assets/Plugins/FMOD/lib/win/x86_64/resonanceaudio.dll new file mode 100755 index 0000000..06104dd Binary files /dev/null and b/Assets/Plugins/FMOD/lib/win/x86_64/resonanceaudio.dll differ diff --git a/Assets/Plugins/FMOD/lib/win/x86_64/resonanceaudio.dll.meta b/Assets/Plugins/FMOD/lib/win/x86_64/resonanceaudio.dll.meta new file mode 100755 index 0000000..611e72f --- /dev/null +++ b/Assets/Plugins/FMOD/lib/win/x86_64/resonanceaudio.dll.meta @@ -0,0 +1,50 @@ +fileFormatVersion: 2 +guid: 4c8fb9b92ea2eae4f9112a3941c4f128 +timeCreated: 1511469552 +licenseType: Free +PluginImporter: + serializedVersion: 1 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + platformData: + Android: + enabled: 0 + settings: + CPU: AnyCPU + Any: + enabled: 0 + settings: {} + Editor: + enabled: 0 + settings: + CPU: x86_64 + DefaultValueInitialized: true + OS: AnyOS + Linux: + enabled: 0 + settings: + CPU: x86 + Linux64: + enabled: 0 + settings: + CPU: x86_64 + OSXIntel: + enabled: 0 + settings: + CPU: AnyCPU + OSXIntel64: + enabled: 0 + settings: + CPU: AnyCPU + Win: + enabled: 0 + settings: + CPU: None + Win64: + enabled: 1 + settings: + CPU: AnyCPU + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/src.meta b/Assets/Plugins/FMOD/src.meta new file mode 100755 index 0000000..6be7001 --- /dev/null +++ b/Assets/Plugins/FMOD/src.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 6a3cba29e2465d342a800c13844b8033 +folderAsset: yes +timeCreated: 1552564451 +licenseType: Free +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/src/Editor.meta b/Assets/Plugins/FMOD/src/Editor.meta new file mode 100755 index 0000000..ac30ffa --- /dev/null +++ b/Assets/Plugins/FMOD/src/Editor.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 5f0547c89d574424bb5f839c55fbc893 +folderAsset: yes +timeCreated: 1552564451 +licenseType: Free +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/src/Editor/BankRefDrawer.cs b/Assets/Plugins/FMOD/src/Editor/BankRefDrawer.cs new file mode 100755 index 0000000..eda7758 --- /dev/null +++ b/Assets/Plugins/FMOD/src/Editor/BankRefDrawer.cs @@ -0,0 +1,66 @@ +using UnityEditor; +using UnityEngine; + +namespace FMODUnity +{ + [CustomPropertyDrawer(typeof(BankRefAttribute))] + class BankRefDrawer : PropertyDrawer + { + public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) + { + Texture browseIcon = EditorGUIUtility.Load("FMOD/SearchIconBlack.png") as Texture; + + SerializedProperty pathProperty = property; + + EditorGUI.BeginProperty(position, label, property); + + Event e = Event.current; + if (e.type == EventType.DragPerform && position.Contains(e.mousePosition)) + { + if (DragAndDrop.objectReferences.Length > 0 && + DragAndDrop.objectReferences[0] != null && + DragAndDrop.objectReferences[0].GetType() == typeof(EditorBankRef)) + { + pathProperty.stringValue = ((EditorBankRef)DragAndDrop.objectReferences[0]).Name; + + e.Use(); + } + } + if (e.type == EventType.DragUpdated && position.Contains(e.mousePosition)) + { + if (DragAndDrop.objectReferences.Length > 0 && + DragAndDrop.objectReferences[0] != null && + DragAndDrop.objectReferences[0].GetType() == typeof(EditorBankRef)) + { + DragAndDrop.visualMode = DragAndDropVisualMode.Move; + DragAndDrop.AcceptDrag(); + e.Use(); + } + } + + float baseHeight = GUI.skin.textField.CalcSize(new GUIContent()).y; + + position = EditorGUI.PrefixLabel(position, GUIUtility.GetControlID(FocusType.Passive), label); + + var buttonStyle = new GUIStyle(GUI.skin.button); + buttonStyle.padding.top = buttonStyle.padding.bottom = 1; + + Rect searchRect = new Rect(position.x + position.width - browseIcon.width - 15, position.y, browseIcon.width + 10, baseHeight); + Rect pathRect = new Rect(position.x, position.y, searchRect.x - position.x - 5, baseHeight); + + EditorGUI.PropertyField(pathRect, pathProperty, GUIContent.none); + if (GUI.Button(searchRect, new GUIContent(browseIcon, "Select FMOD Bank"), buttonStyle)) + { + var eventBrowser = EventBrowser.CreateInstance(); + + eventBrowser.SelectBank(property); + var windowRect = position; + windowRect.position = GUIUtility.GUIToScreenPoint(windowRect.position); + windowRect.height = searchRect.height + 1; + eventBrowser.ShowAsDropDown(windowRect, new Vector2(windowRect.width, 400)); + } + + EditorGUI.EndProperty(); + } + } +} diff --git a/Assets/Plugins/FMOD/src/Editor/BankRefDrawer.cs.meta b/Assets/Plugins/FMOD/src/Editor/BankRefDrawer.cs.meta new file mode 100755 index 0000000..9b8463c --- /dev/null +++ b/Assets/Plugins/FMOD/src/Editor/BankRefDrawer.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 49ebe6fea5e4bfc4bb492bba062b2afe +timeCreated: 1433209573 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/src/Editor/CreateEventPopup.cs b/Assets/Plugins/FMOD/src/Editor/CreateEventPopup.cs new file mode 100755 index 0000000..556a1da --- /dev/null +++ b/Assets/Plugins/FMOD/src/Editor/CreateEventPopup.cs @@ -0,0 +1,386 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using UnityEngine; +using UnityEditor; + +namespace FMODUnity +{ + class CreateEventPopup : EditorWindow + { + class FolderEntry + { + public FolderEntry parent; + public string name; + public string guid; + public List entries = new List(); + public Rect rect; + } + + SerializedProperty outputProperty; + internal void SelectEvent(SerializedProperty property) + { + outputProperty = property; + } + + class BankEntry + { + public string name; + public string guid; + } + + FolderEntry rootFolder; + FolderEntry currentFolder; + List banks; + + public CreateEventPopup() + { + } + + private void BuildTree() + { + var rootGuid = EditorUtils.GetScriptOutput("studio.project.workspace.masterEventFolder.id"); + rootFolder = new FolderEntry(); + rootFolder.guid = rootGuid; + BuildTreeItem(rootFolder); + wantsMouseMove = true; + banks = new List(); + + EditorUtils.GetScriptOutput("children = \"\";"); + EditorUtils.GetScriptOutput("func = function(val) {{ children += \",\" + val.id + val.name; }};"); + EditorUtils.GetScriptOutput("studio.project.workspace.masterBankFolder.items.forEach(func, this); "); + string bankList = EditorUtils.GetScriptOutput("children;"); + string[] bankListSplit = bankList.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); + foreach(var bank in bankListSplit) + { + var entry = new BankEntry(); + entry.guid = bank.Substring(0, 38); + entry.name = bank.Substring(38); + banks.Add(entry); + } + + banks.Sort((a, b) => a.name.CompareTo(b.name)); + } + + private void BuildTreeItem(FolderEntry entry) + { + // lookup the entry + EditorUtils.GetScriptOutput(string.Format("cur = studio.project.lookup(\"{0}\");", entry.guid)); + + // get child count + string itemCountString = EditorUtils.GetScriptOutput("cur.items.length;"); + int itemCount; + Int32.TryParse(itemCountString, out itemCount); + + // iterate children looking for folder + for (int item = 0; item < itemCount; item++) + { + EditorUtils.GetScriptOutput(String.Format("child = cur.items[{0}]", item)); + + // check if it's a folder + string isFolder = EditorUtils.GetScriptOutput("child.isOfExactType(\"EventFolder\")"); + if (isFolder == "false") + { + continue; + } + + // Get guid and name + string info = EditorUtils.GetScriptOutput("child.id + child.name"); + + var childEntry = new FolderEntry(); + childEntry.guid = info.Substring(0, 38); + childEntry.name = info.Substring(38); + childEntry.parent = entry; + entry.entries.Add(childEntry); + } + + // Recurse for child entries + foreach(var childEntry in entry.entries) + { + BuildTreeItem(childEntry); + } + } + + int lastHover = 0; + string eventFolder = "/"; + string eventName = ""; + string currentFilter = ""; + int selectedBank = 0; + bool resetCursor = true; + Vector2 scrollPos = new Vector2(); + Rect scrollRect = new Rect(); + bool isConnected = false; + + public void OnGUI() + { + var borderIcon = EditorGUIUtility.Load("FMOD/Border.png") as Texture2D; + var border = new GUIStyle(GUI.skin.box); + border.normal.background = borderIcon; + GUI.Box(new Rect(1, 1, position.width - 1, position.height - 1), GUIContent.none, border); + + if (Event.current.type == EventType.Layout) + { + isConnected = EditorUtils.IsConnectedToStudio(); + } + + if (!isConnected) + { + this.ShowNotification(new GUIContent("FMOD Studio not running")); + return; + } + + this.RemoveNotification(); + + if (rootFolder == null) + { + BuildTree(); + currentFolder = rootFolder; + } + + var arrowIcon = EditorGUIUtility.Load("FMOD/ArrowIcon.png") as Texture; + var hoverIcon = EditorGUIUtility.Load("FMOD/SelectedAlt.png") as Texture2D; + var titleIcon = EditorGUIUtility.Load("IN BigTitle") as Texture2D; + + var nextEntry = currentFolder; + + var filteredEntries = currentFolder.entries.FindAll((x) => x.name.StartsWith(currentFilter, StringComparison.CurrentCultureIgnoreCase)); + + // Process key strokes for the folder list + { + if (Event.current.keyCode == KeyCode.UpArrow) + { + if (Event.current.type == EventType.KeyDown) + { + lastHover = Math.Max(lastHover - 1, 0); + if (filteredEntries[lastHover].rect.y < scrollPos.y) + { + scrollPos.y = filteredEntries[lastHover].rect.y; + } + } + Event.current.Use(); + } + if (Event.current.keyCode == KeyCode.DownArrow) + { + if (Event.current.type == EventType.KeyDown) + { + lastHover = Math.Min(lastHover + 1, filteredEntries.Count - 1); + if (filteredEntries[lastHover].rect.y + filteredEntries[lastHover].rect.height > scrollPos.y + scrollRect.height) + { + scrollPos.y = filteredEntries[lastHover].rect.y - scrollRect.height + filteredEntries[lastHover].rect.height * 2; + } + } + Event.current.Use(); + } + if (Event.current.keyCode == KeyCode.RightArrow) + { + if (Event.current.type == EventType.KeyDown) + nextEntry = filteredEntries[lastHover]; + Event.current.Use(); + } + if (Event.current.keyCode == KeyCode.LeftArrow) + { + if (Event.current.type == EventType.KeyDown) + if (currentFolder.parent != null) + { + nextEntry = currentFolder.parent; + } + Event.current.Use(); + } + } + + bool disabled = eventName.Length == 0; + EditorGUI.BeginDisabledGroup(disabled); + if (GUILayout.Button("Create Event")) + { + CreateEventInStudio(); + this.Close(); + } + EditorGUI.EndDisabledGroup(); + + { + GUI.SetNextControlName("name"); + + EditorGUILayout.LabelField("Name"); + eventName = EditorGUILayout.TextField(eventName); + } + + { + EditorGUILayout.LabelField("Bank"); + selectedBank = EditorGUILayout.Popup(selectedBank, banks.Select(x => x.name).ToArray()); + } + + bool updateEventPath = false; + { + GUI.SetNextControlName("folder"); + EditorGUI.BeginChangeCheck(); + EditorGUILayout.LabelField("Path"); + eventFolder = GUILayout.TextField(eventFolder); + if (EditorGUI.EndChangeCheck()) + { + updateEventPath = true; + } + } + + if (resetCursor) + { + resetCursor = false; + + var textEditor = (TextEditor)GUIUtility.GetStateObject(typeof(TextEditor), GUIUtility.keyboardControl); + if (textEditor != null) + { + textEditor.MoveCursorToPosition(new Vector2(9999, 9999)); + } + } + + // Draw the current folder as a title bar, click to go back one level + { + Rect currentRect = EditorGUILayout.GetControlRect(); + + var bg = new GUIStyle(GUI.skin.box); + bg.normal.background = titleIcon; + Rect bgRect = new Rect(currentRect); + bgRect.x = 2; + bgRect.width = position.width-4; + GUI.Box(bgRect, GUIContent.none, bg); + + Rect textureRect = currentRect; + textureRect.width = arrowIcon.width; + if (currentFolder.name != null) + { + GUI.DrawTextureWithTexCoords(textureRect, arrowIcon, new Rect(1, 1, -1, -1)); + } + + Rect labelRect = currentRect; + labelRect.x += arrowIcon.width + 50; + labelRect.width -= arrowIcon.width + 50; + GUI.Label(labelRect, currentFolder.name != null ? currentFolder.name : "Folders", EditorStyles.boldLabel); + + if (Event.current.type == EventType.MouseDown && currentRect.Contains(Event.current.mousePosition) && + currentFolder.parent != null) + { + nextEntry = currentFolder.parent; + Event.current.Use(); + } + } + + var normal = new GUIStyle(GUI.skin.label); + normal.padding.left = 14; + var hover = new GUIStyle(normal); + hover.normal.background = hoverIcon; + + scrollPos = EditorGUILayout.BeginScrollView(scrollPos, false, false); + + for (int i = 0; i < filteredEntries.Count; i++) + { + var entry = filteredEntries[i]; + var content = new GUIContent(entry.name); + var rect = EditorGUILayout.GetControlRect(); + if ((rect.Contains(Event.current.mousePosition) && Event.current.type == EventType.MouseMove) || i == lastHover) + { + lastHover = i; + + GUI.Label(rect, content, hover); + if (rect.Contains(Event.current.mousePosition) && Event.current.type == EventType.MouseDown) + { + nextEntry = entry; + } + } + else + { + GUI.Label(rect, content, normal); + } + + Rect textureRect = rect; + textureRect.x = textureRect.width - arrowIcon.width; + textureRect.width = arrowIcon.width; + GUI.DrawTexture(textureRect, arrowIcon); + + if (Event.current.type == EventType.Repaint) + { + entry.rect = rect; + } + } + EditorGUILayout.EndScrollView(); + + if (Event.current.type == EventType.Repaint) + { + scrollRect = GUILayoutUtility.GetLastRect(); + } + + if (currentFolder != nextEntry) + { + lastHover = 0; + currentFolder = nextEntry; + UpdateTextFromList(); + Repaint(); + } + + if (updateEventPath) + { + UpdateListFromText(); + } + + if (Event.current.type == EventType.MouseMove) + { + Repaint(); + } + } + + private void CreateEventInStudio() + { + string eventGuid = EditorUtils.CreateStudioEvent(eventFolder, eventName); + + if (!string.IsNullOrEmpty(eventGuid)) + { + EditorUtils.GetScriptOutput(String.Format("studio.project.lookup(\"{0}\").relationships.banks.add(studio.project.lookup(\"{1}\"));", eventGuid, banks[selectedBank].guid)); + EditorUtils.GetScriptOutput("studio.project.build();"); + + string fullPath = "event:" + eventFolder + eventName; + outputProperty.stringValue = fullPath; + EditorUtils.UpdateParamsOnEmitter(outputProperty.serializedObject, fullPath); + outputProperty.serializedObject.ApplyModifiedProperties(); + } + } + + private void UpdateListFromText() + { + int endFolders = eventFolder.LastIndexOf("/"); + currentFilter = eventFolder.Substring(endFolders + 1); + + var folders = eventFolder.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries); + FolderEntry entry = rootFolder; + int i; + for (i = 0; i < folders.Length; i++) + { + var newEntry = entry.entries.Find((x) => x.name.Equals(folders[i], StringComparison.CurrentCultureIgnoreCase)); + if (newEntry == null) + { + break; + } + entry = newEntry; + } + currentFolder = entry; + + // Treat an exact filter match as being in that folder and clear the filter + if (entry.name != null && entry.name.Equals(currentFilter, StringComparison.CurrentCultureIgnoreCase)) + { + currentFilter = ""; + } + } + + private void UpdateTextFromList() + { + string path = ""; + var entry = currentFolder; + while (entry.parent != null) + { + path = entry.name + "/" + path; + entry = entry.parent; + } + + eventFolder = "/" + path; + resetCursor = true; + currentFilter = ""; + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/FMOD/src/Editor/CreateEventPopup.cs.meta b/Assets/Plugins/FMOD/src/Editor/CreateEventPopup.cs.meta new file mode 100755 index 0000000..10b1009 --- /dev/null +++ b/Assets/Plugins/FMOD/src/Editor/CreateEventPopup.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 9c9773a32ed4a2b429fd42645175c32b +timeCreated: 1455063674 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/src/Editor/EditorBankRef.cs b/Assets/Plugins/FMOD/src/Editor/EditorBankRef.cs new file mode 100755 index 0000000..f9270db --- /dev/null +++ b/Assets/Plugins/FMOD/src/Editor/EditorBankRef.cs @@ -0,0 +1,44 @@ +using System; +using System.Collections.Generic; +using UnityEngine; +namespace FMODUnity +{ + public class EditorBankRef : ScriptableObject + { + [Serializable] + public class NameValuePair + { + public string Name; + public long Value; + + public NameValuePair(string name, long value) + { + Name = name; + Value = value; + } + } + + [SerializeField] + public string Path; + public string Name + { + get { return global::System.IO.Path.GetFileNameWithoutExtension(Path); } + } + + [SerializeField] + Int64 lastModified; + public DateTime LastModified + { + get { return new DateTime(lastModified); } + set { lastModified = value.Ticks; } + } + + [SerializeField] + public FMOD.RESULT LoadResult; + + [SerializeField] + public List FileSizes; + + public bool Exists; + } +} diff --git a/Assets/Plugins/FMOD/src/Editor/EditorBankRef.cs.meta b/Assets/Plugins/FMOD/src/Editor/EditorBankRef.cs.meta new file mode 100755 index 0000000..6773b8b --- /dev/null +++ b/Assets/Plugins/FMOD/src/Editor/EditorBankRef.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: c18180ecb35941f4682ae60107b85b7c +timeCreated: 1432775088 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/src/Editor/EditorEventRef.cs b/Assets/Plugins/FMOD/src/Editor/EditorEventRef.cs new file mode 100755 index 0000000..6666e6d --- /dev/null +++ b/Assets/Plugins/FMOD/src/Editor/EditorEventRef.cs @@ -0,0 +1,38 @@ +using System; +using System.Collections.Generic; +using UnityEngine; +using UnityEditor; + +namespace FMODUnity +{ + public class EditorEventRef : ScriptableObject + { + [SerializeField] + public string Path; + + [SerializeField] + byte[] guid = new byte[16]; + public Guid Guid + { + get { return new Guid(guid); } + set { Array.Copy(value.ToByteArray(), guid, 16); } + } + + [SerializeField] + public List Banks; + [SerializeField] + public bool IsStream; + [SerializeField] + public bool Is3D; + [SerializeField] + public bool IsOneShot; + [SerializeField] + public List Parameters; + [SerializeField] + public float MinDistance; + [SerializeField] + public float MaxDistance; + [SerializeField] + public int Length; + } +} diff --git a/Assets/Plugins/FMOD/src/Editor/EditorEventRef.cs.meta b/Assets/Plugins/FMOD/src/Editor/EditorEventRef.cs.meta new file mode 100755 index 0000000..81521cc --- /dev/null +++ b/Assets/Plugins/FMOD/src/Editor/EditorEventRef.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: ceb653cd98e289a4e8697a1af55201f2 +timeCreated: 1432775088 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/src/Editor/EditorParamRef.cs b/Assets/Plugins/FMOD/src/Editor/EditorParamRef.cs new file mode 100755 index 0000000..bc1cc17 --- /dev/null +++ b/Assets/Plugins/FMOD/src/Editor/EditorParamRef.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using UnityEditor; +using UnityEngine; + +namespace FMODUnity +{ + public class EditorParamRef : ScriptableObject + { + [SerializeField] + public string Name; + [SerializeField] + public float Min; + [SerializeField] + public float Max; + [SerializeField] + public float Default; + [SerializeField] + public FMOD.Studio.PARAMETER_ID ID; + + public bool Exists; + } +} diff --git a/Assets/Plugins/FMOD/src/Editor/EditorParamRef.cs.meta b/Assets/Plugins/FMOD/src/Editor/EditorParamRef.cs.meta new file mode 100755 index 0000000..aa123d2 --- /dev/null +++ b/Assets/Plugins/FMOD/src/Editor/EditorParamRef.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: fecb8ef7f94ca804a8ab72049b86782e +timeCreated: 1432775088 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/src/Editor/EditorUtils.cs b/Assets/Plugins/FMOD/src/Editor/EditorUtils.cs new file mode 100755 index 0000000..bbbf693 --- /dev/null +++ b/Assets/Plugins/FMOD/src/Editor/EditorUtils.cs @@ -0,0 +1,847 @@ +using System; +using System.Collections.Generic; +using UnityEngine; +using UnityEditor; +using System.IO; +using System.Text; +using System.Net.Sockets; + +namespace FMODUnity +{ + public enum PreviewState + { + Stopped, + Playing, + Paused, + } + + [InitializeOnLoad] + class EditorUtils : MonoBehaviour + { + public static void CheckResult(FMOD.RESULT result) + { + if (result != FMOD.RESULT.OK) + { + UnityEngine.Debug.LogError(string.Format("FMOD Studio: Encounterd Error: {0} {1}", result, FMOD.Error.String(result))); + } + } + + const string BuildFolder = "Build"; + + public static string GetBankDirectory() + { + if (Settings.Instance.HasSourceProject && !String.IsNullOrEmpty(Settings.Instance.SourceProjectPath)) + { + string projectPath = Settings.Instance.SourceProjectPath; + string projectFolder = Path.GetDirectoryName(projectPath); + return Path.Combine(projectFolder, BuildFolder); + } + else if (!String.IsNullOrEmpty(Settings.Instance.SourceBankPath)) + { + return Settings.Instance.SourceBankPath; + } + return null; + } + + public static string GetBankDirectoryUnformatted() + { + if (Settings.Instance.HasSourceProject && !String.IsNullOrEmpty(Settings.Instance.SourceProjectPathUnformatted)) + { + string projectPath = Settings.Instance.SourceProjectPathUnformatted; + char directorySeparator = '\\'; + var folderIndex = projectPath.LastIndexOf(directorySeparator); + if (folderIndex < 0) + { + directorySeparator = '/'; + folderIndex = projectPath.LastIndexOf(directorySeparator); + } + string projectFolder = ""; + if (folderIndex > 0) + { + projectFolder = projectPath.Substring(0, folderIndex); + } + return projectFolder + directorySeparator + BuildFolder; + } + else if (!String.IsNullOrEmpty(Settings.Instance.SourceBankPathUnformatted)) + { + return Settings.Instance.SourceBankPathUnformatted; + } + return null; + } + + public static void ValidateSource(out bool valid, out string reason) + { + valid = true; + reason = ""; + var settings = Settings.Instance; + if (settings.HasSourceProject) + { + if (string.IsNullOrEmpty(settings.SourceProjectPath)) + { + valid = false; + reason = "FMOD Studio Project path not set"; + return; + } + if (!File.Exists(settings.SourceProjectPath)) + { + valid = false; + reason = "FMOD Studio Project not found"; + return; + } + + string projectPath = settings.SourceProjectPath; + string projectFolder = Path.GetDirectoryName(projectPath); + string buildFolder = Path.Combine(projectFolder, BuildFolder); + if (!Directory.Exists(buildFolder) || + Directory.GetDirectories(buildFolder).Length == 0 || + Directory.GetFiles(Directory.GetDirectories(buildFolder)[0], "*.bank").Length == 0 + ) + { + valid = false; + reason = "FMOD Studio Project does not contain any built data. Please build your project in FMOD Studio."; + return; + } + } + else + { + if (String.IsNullOrEmpty(settings.SourceBankPath)) + { + valid = false; + reason = "Build path not set"; + return; + } + if (!Directory.Exists(settings.SourceBankPath)) + { + valid = false; + reason = "Build path doesn't exist"; + return; + } + + if (settings.HasPlatforms) + { + if (Directory.GetDirectories(settings.SourceBankPath).Length == 0) + { + valid = false; + reason = "Build path doesn't contain any platform folders"; + return; + } + } + else + { + if (Directory.GetFiles(settings.SourceBankPath, "*.strings.bank").Length == 0) + { + valid = false; + reason = "Build path doesn't contain the contents of an FMOD Studio Build"; + return; + } + } + } + } + + public static string[] GetBankPlatforms() + { + string buildFolder = GetBankDirectory(); + try + { + if (Directory.GetFiles(buildFolder, "*.bank").Length == 0) + { + string[] buildDirectories = Directory.GetDirectories(buildFolder); + string[] buildNames = new string[buildDirectories.Length]; + for (int i = 0; i < buildDirectories.Length; i++) + { + buildNames[i] = Path.GetFileNameWithoutExtension(buildDirectories[i]); + } + return buildNames; + } + } + catch + { + } + return new string[0]; + } + + static string VerionNumberToString(uint version) + { + uint major = (version & 0x00FF0000) >> 16; + uint minor = (version & 0x0000FF00) >> 8; + uint patch = (version & 0x000000FF); + + return major.ToString("X1") + "." + minor.ToString("X2") + "." + patch.ToString("X2"); + } + + static EditorUtils() + { + EditorApplication.update += Update; + + EditorApplication.playModeStateChanged += HandleOnPlayModeChanged; + EditorApplication.pauseStateChanged += HandleOnPausedModeChanged; + } + + static void HandleOnPausedModeChanged(PauseState state) + { + if (RuntimeManager.IsInitialized && RuntimeManager.HasBanksLoaded) + { + RuntimeManager.GetBus("bus:/").setPaused(EditorApplication.isPaused); + RuntimeManager.StudioSystem.update(); + } + } + + static void HandleOnPlayModeChanged(PlayModeStateChange state) + { + // Entering Play Mode will cause scripts to reload, losing all state + // This is the last chance to clean up FMOD and avoid a leak. + if (state == PlayModeStateChange.ExitingEditMode) + { + DestroySystem(); + } + } + + static void Update() + { + // Compilation will cause scripts to reload, losing all state + // This is the last chance to clean up FMOD and avoid a leak. + if (EditorApplication.isCompiling) + { + DestroySystem(); + RuntimeManager.Destroy(); + } + + // Update the editor system + if (system.isValid()) + { + CheckResult(system.update()); + } + + if (previewEventInstance.isValid()) + { + FMOD.Studio.PLAYBACK_STATE state; + previewEventInstance.getPlaybackState(out state); + if (previewState == PreviewState.Playing && state == FMOD.Studio.PLAYBACK_STATE.STOPPED) + { + PreviewStop(); + } + } + } + + static FMOD.Studio.System system; + + static void DestroySystem() + { + if (system.isValid()) + { + UnityEngine.Debug.Log("FMOD Studio: Destroying editor system instance"); + system.release(); + system.clearHandle(); + } + } + + static void CreateSystem() + { + UnityEngine.Debug.Log("FMOD Studio: Creating editor system instance"); + RuntimeUtils.EnforceLibraryOrder(); + + FMOD.RESULT result = FMOD.Debug.Initialize(FMOD.DEBUG_FLAGS.LOG, FMOD.DEBUG_MODE.FILE, null, "fmod_editor.log"); + if (result != FMOD.RESULT.OK) + { + UnityEngine.Debug.LogWarning("FMOD Studio: Cannot open fmod_editor.log. Logging will be disabled for importing and previewing"); + } + + CheckResult(FMOD.Studio.System.create(out system)); + + FMOD.System lowlevel; + CheckResult(system.getCoreSystem(out lowlevel)); + + // Use play-in-editor speaker mode for event browser preview and metering + lowlevel.setSoftwareFormat(0, (FMOD.SPEAKERMODE)Settings.Instance.GetSpeakerMode(FMODPlatform.Default),0 ); + + CheckResult(system.initialize(256, FMOD.Studio.INITFLAGS.ALLOW_MISSING_PLUGINS | FMOD.Studio.INITFLAGS.SYNCHRONOUS_UPDATE, FMOD.INITFLAGS.NORMAL, IntPtr.Zero)); + + FMOD.ChannelGroup master; + CheckResult(lowlevel.getMasterChannelGroup(out master)); + FMOD.DSP masterHead; + CheckResult(master.getDSP(FMOD.CHANNELCONTROL_DSP_INDEX.HEAD, out masterHead)); + CheckResult(masterHead.setMeteringEnabled(false, true)); + } + + public static void UpdateParamsOnEmitter(SerializedObject serializedObject, string path) + { + if (string.IsNullOrEmpty(path) || EventManager.EventFromPath(path) == null) + { + return; + } + + var eventRef = EventManager.EventFromPath(path); + serializedObject.ApplyModifiedProperties(); + if (serializedObject.isEditingMultipleObjects) + { + foreach (var obj in serializedObject.targetObjects) + { + UpdateParamsOnEmitter(obj, eventRef); + } + } + else + { + UpdateParamsOnEmitter(serializedObject.targetObject, eventRef); + } + serializedObject.Update(); + } + + private static void UpdateParamsOnEmitter(UnityEngine.Object obj, EditorEventRef eventRef) + { + var emitter = obj as StudioEventEmitter; + if (emitter == null) + { + // Custom game object + return; + } + + for (int i = 0; i < emitter.Params.Length; i++) + { + if (!eventRef.Parameters.Exists((x) => x.Name == emitter.Params[i].Name)) + { + int end = emitter.Params.Length - 1; + emitter.Params[i] = emitter.Params[end]; + Array.Resize(ref emitter.Params, end); + i--; + } + } + } + + public static FMOD.Studio.System System + { + get + { + if (!system.isValid()) + { + CreateSystem(); + } + return system; + } + } + + [MenuItem("FMOD/Help/Integration Manual", priority = 3)] + static void OnlineManual() + { + Application.OpenURL("https://fmod.com/resources/documentation-unity"); + } + + [MenuItem("FMOD/Help/API Documentation", priority = 4)] + static void OnlineAPIDocs() + { + Application.OpenURL("https://fmod.com/resources/documentation-api"); + } + + [MenuItem("FMOD/Help/Support Forum", priority = 5)] + static void OnlineQA() + { + Application.OpenURL("https://qa.fmod.com/"); + } + + [MenuItem("FMOD/Help/Revision History", priority = 6)] + static void OnlineRevisions() + { + Application.OpenURL("https://fmod.com/resources/documentation-api?version=2.0&page=welcome-revision-history.html"); + } + + [MenuItem("FMOD/About Integration", priority = 7)] + public static void About() + { + FMOD.System lowlevel; + CheckResult(System.getCoreSystem(out lowlevel)); + + uint version; + CheckResult(lowlevel.getVersion(out version)); + + EditorUtility.DisplayDialog("FMOD Studio Unity Integration", "Version: " + VerionNumberToString(version) + "\n\nCopyright \u00A9 Firelight Technologies Pty, Ltd. 2014-2019 \n\nSee LICENSE.TXT for additional license information.", "OK"); + } + + [MenuItem("FMOD/Consolidate Plugin Files")] + public static void FolderMerge() + { + string root = "Assets/Plugins/FMOD"; + string lib = root + "/lib"; + string src = root + "/src"; + string runtime = src + "/Runtime"; + string editor = src + "/Editor"; + string addons = root + "/addons"; + + bool merge = EditorUtility.DisplayDialog("FMOD Plugin Consolidator", "This will consolidate most of the FMOD files into a single directory (Assets/Plugins/FMOD), only if the files have not been moved from their original location.\n\nThis should only need to be done if upgrading from before 2.0.", "OK", "Cancel"); + if (merge) + { + if (!Directory.Exists(addons)) + AssetDatabase.CreateFolder(root, "addons"); + if (!Directory.Exists(src)) + AssetDatabase.CreateFolder(root, "src"); + if (!Directory.Exists(runtime)) + AssetDatabase.CreateFolder(src, "Runtime"); + if (!Directory.Exists(lib)) + AssetDatabase.CreateFolder(root, "lib"); + if (!Directory.Exists(lib + "/mac")) + AssetDatabase.CreateFolder(lib, "mac"); + if (!Directory.Exists(lib + "/win")) + AssetDatabase.CreateFolder(lib, "win"); + if (!Directory.Exists(lib + "/linux")) + AssetDatabase.CreateFolder(lib, "linux"); + if (!Directory.Exists(lib + "/linux/x86")) + AssetDatabase.CreateFolder(lib + "/linux", "x86"); + if (!Directory.Exists(lib + "/linux/x86_64")) + AssetDatabase.CreateFolder(lib + "/linux", "x86_64"); + if (!Directory.Exists(lib + "/android")) + AssetDatabase.CreateFolder(lib, "android"); + + // Scripts + var files = Directory.GetFiles(root, "*.cs", SearchOption.TopDirectoryOnly); + foreach (var filePath in files) + { + MoveAsset(filePath, runtime + "/" + Path.GetFileName(filePath)); + } + MoveAsset(root + "/fmodplugins.cpp", runtime + "/fmodplugins.cpp"); + MoveAsset(root + "/Timeline", runtime + "/Timeline"); + MoveAsset("Assets/Plugins/FMOD/Wrapper", runtime + "/wrapper"); + MoveAsset("Assets/Plugins/Editor/FMOD", editor); + if (AssetDatabase.IsValidFolder("Assets/Plugins/FMOD/Runtime") && AssetDatabase.FindAssets("Assets/Plugins/FMOD/Runtime").Length == 0) + Directory.Delete("Assets/Plugins/FMOD/Runtime"); + if (AssetDatabase.IsValidFolder("Assets/Plugins/Editor") && AssetDatabase.FindAssets("Assets/Plugins/Editor").Length == 0) + Directory.Delete("Assets/Plugins/Editor"); + // GoogleVR + if (AssetDatabase.IsValidFolder("Assets/GoogleVR")) + MoveAsset("Assets/GoogleVR", addons + "/GoogleVR"); + // ResonanceAudio + MoveAsset("Assets/ResonanceAudio", addons + "/ResonanceAudio"); + // Cache files + MoveAsset("Assets/Resources", root + "/Resources"); + MoveAsset("Assets/FMODStudioCache.asset", root + "/Resources/FMODStudioCache.asset"); + if (AssetDatabase.IsValidFolder("Assets/Resources") && AssetDatabase.FindAssets("Assets/Resources").Length == 0) + Directory.Delete("Assets/Resources"); + // Android libs + MoveAsset("Assets/Plugins/Android/libs/armeabi-v7a", lib + "/android/armeabi-v7a"); + MoveAsset("Assets/Plugins/Android/libs/x86", lib + "/android/x86"); + if (AssetDatabase.IsValidFolder("Assets/Plugins/Android/libs/arm68-v8a")) + MoveAsset("Assets/Plugins/Android/libs/arm68-v8a", lib + "/android/arm64-v8a"); + MoveAsset("Assets/Plugins/Android/fmod.jar", lib + "/android/fmod.jar"); + if (AssetDatabase.IsValidFolder("Assets/Plugins/Android") && AssetDatabase.FindAssets("Assets/Plugins/Android").Length == 0) + Directory.Delete("Assets/Plugins/Android", true); + AssetDatabase. + // Mac libs + MoveAsset("Assets/Plugins/fmodstudio.bundle", lib + "/mac/fmodstudio.bundle"); + MoveAsset("Assets/Plugins/fmodstudioL.bundle", lib + "/mac/fmodstudioL.bundle"); + MoveAsset("Assets/Plugins/resonanceaudio.bundle", lib + "/mac/resonanceaudio.bundle"); + if (AssetDatabase.IsValidFolder("Assets/Plugins/gvraudio.bundle")) + MoveAsset("Assets/Plugins/gvraudio.bundle", lib + "/mac/gvraudio.bundle"); + // iOS libs + MoveAsset("Assets/Plugins/iOS", lib + "/ios"); + // tvOS libs + MoveAsset("Assets/Plugins/tvOS", lib + "/tvos"); + // UWP libs + MoveAsset("Assets/Plugins/UWP", lib + "/uwp"); + // HTML5 libs + MoveAsset("Assets/Plugins/WebGL", lib + "/html5"); + // PS4 libs (optional) + if (AssetDatabase.IsValidFolder("Assets/Plugins/PS4")) + MoveAsset("Assets/Plugins/PS4", lib + "/ps4"); + // Switch libs (optional) + if (AssetDatabase.IsValidFolder("Assets/Plugins/Switch")) + MoveAsset("Assets/Plugins/Switch", lib + "/switch"); + // Xbox One libs (optional) + if (AssetDatabase.IsValidFolder("Assets/Plugins/XboxOne")) + MoveAsset("Assets/Plugins/XboxOne", lib + "/xboxone"); + // Linux libs + MoveAsset("Assets/Plugins/x86/libfmod.so", lib + "/linux/x86/libfmod.so"); + MoveAsset("Assets/Plugins/x86/libfmodL.so", lib + "/linux/x86/libfmodL.so"); + MoveAsset("Assets/Plugins/x86/libfmodstudio.so", lib + "/linux/x86/libfmodstudio.so"); + MoveAsset("Assets/Plugins/x86/libfmodstudioL.so", lib + "/linux/x86/libfmodstudioL.so"); + MoveAsset("Assets/Plugins/x86_64/libfmod.so", lib + "/linux/x86_64/libfmod.so"); + MoveAsset("Assets/Plugins/x86_64/libfmodL.so", lib + "/linux/x86_64/libfmodL.so"); + MoveAsset("Assets/Plugins/x86_64/libfmodstudio.so", lib + "/linux/x86_64/libfmodstudio.so"); + MoveAsset("Assets/Plugins/x86_64/libfmodstudioL.so", lib + "/linux/x86_64/libfmodstudioL.so"); + MoveAsset("Assets/Plugins/x86_64/libresonanceaudio.so", lib + "/linux/x86_64/libresonanceaudio.so"); + // Windows libs + MoveAsset("Assets/Plugins/x86", lib + "/win/x86"); + MoveAsset("Assets/Plugins/x86_64", lib + "/win/x86_64"); + + Debug.Log("Folder merge finished!"); + } + } + + static void MoveAsset(string from, string to) + { + string result = AssetDatabase.MoveAsset(from, to); + if (!string.IsNullOrEmpty(result)) + { + Debug.LogWarning("[FMOD] Failed to move " + from + " : " + result); + } + } + + static List masterBanks = new List(); + static FMOD.Studio.Bank previewBank; + static FMOD.Studio.EventDescription previewEventDesc; + static FMOD.Studio.EventInstance previewEventInstance; + + static PreviewState previewState; + public static PreviewState PreviewState + { + get { return previewState; } + } + + public static void PreviewEvent(EditorEventRef eventRef, Dictionary previewParamValues) + { + bool load = true; + if (previewEventDesc.isValid()) + { + Guid guid; + previewEventDesc.getID(out guid); + if (guid == eventRef.Guid) + { + load = false; + } + else + { + PreviewStop(); + } + } + + if (load) + { + masterBanks.Clear(); + + foreach (EditorBankRef masterBankRef in EventManager.MasterBanks) + { + FMOD.Studio.Bank masterBank; + CheckResult(System.loadBankFile(masterBankRef.Path, FMOD.Studio.LOAD_BANK_FLAGS.NORMAL, out masterBank)); + masterBanks.Add(masterBank); + } + + if (!EventManager.MasterBanks.Exists(x => eventRef.Banks.Contains(x))) + { + CheckResult(System.loadBankFile(eventRef.Banks[0].Path, FMOD.Studio.LOAD_BANK_FLAGS.NORMAL, out previewBank)); + } + else + { + previewBank.clearHandle(); + } + + CheckResult(System.getEventByID(eventRef.Guid, out previewEventDesc)); + CheckResult(previewEventDesc.createInstance(out previewEventInstance)); + } + + foreach (EditorParamRef param in eventRef.Parameters) + { + FMOD.Studio.PARAMETER_DESCRIPTION paramDesc; + CheckResult(previewEventDesc.getParameterDescriptionByName(param.Name, out paramDesc)); + param.ID = paramDesc.id; + PreviewUpdateParameter(param.ID, previewParamValues[param.Name]); + } + + CheckResult(previewEventInstance.start()); + previewState = PreviewState.Playing; + } + + public static void PreviewUpdateParameter(FMOD.Studio.PARAMETER_ID id, float paramValue) + { + if (previewEventInstance.isValid()) + { + CheckResult(previewEventInstance.setParameterByID(id, paramValue)); + } + } + + public static void PreviewUpdatePosition(float distance, float orientation) + { + if (previewEventInstance.isValid()) + { + // Listener at origin + FMOD.ATTRIBUTES_3D pos = new FMOD.ATTRIBUTES_3D(); + pos.position.x = (float)Math.Sin(orientation) * distance; + pos.position.y = (float)Math.Cos(orientation) * distance; + pos.forward.x = 1.0f; + pos.up.z = 1.0f; + CheckResult(previewEventInstance.set3DAttributes(pos)); + } + } + + public static void PreviewPause() + { + if (previewEventInstance.isValid()) + { + bool paused; + CheckResult(previewEventInstance.getPaused(out paused)); + CheckResult(previewEventInstance.setPaused(!paused)); + previewState = paused ? PreviewState.Playing : PreviewState.Paused; + } + } + + public static void PreviewStop() + { + if (previewEventInstance.isValid()) + { + previewEventInstance.stop(FMOD.Studio.STOP_MODE.IMMEDIATE); + previewEventInstance.release(); + previewEventInstance.clearHandle(); + previewEventDesc.clearHandle(); + if (previewBank.isValid()) + { + previewBank.unload(); + } + masterBanks.ForEach(x => { x.unload(); x.clearHandle(); }); + previewBank.clearHandle(); + previewState = PreviewState.Stopped; + } + } + + public static float[] GetMetering() + { + FMOD.System lowlevel; + CheckResult(System.getCoreSystem(out lowlevel)); + FMOD.ChannelGroup master; + CheckResult(lowlevel.getMasterChannelGroup(out master)); + FMOD.DSP masterHead; + CheckResult(master.getDSP(FMOD.CHANNELCONTROL_DSP_INDEX.HEAD, out masterHead)); + + FMOD.DSP_METERING_INFO outputMetering; + CheckResult(masterHead.getMeteringInfo(IntPtr.Zero, out outputMetering)); + + FMOD.SPEAKERMODE mode; + int rate, raw; + lowlevel.getSoftwareFormat(out rate, out mode, out raw); + int channels; + lowlevel.getSpeakerModeChannels(mode, out channels); + + float[] data = new float[outputMetering.numchannels > 0 ? outputMetering.numchannels : channels]; + if (outputMetering.numchannels > 0) + { + Array.Copy(outputMetering.rmslevel, data, outputMetering.numchannels); + } + return data; + } + + + const int StudioScriptPort = 3663; + static NetworkStream networkStream = null; + static Socket socket = null; + static IAsyncResult socketConnection = null; + + static NetworkStream ScriptStream + { + get + { + if (networkStream == null) + { + try + { + if (socket == null) + { + socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); + } + + if (!socket.Connected) + { + socketConnection = socket.BeginConnect("127.0.0.1", StudioScriptPort, null, null); + socketConnection.AsyncWaitHandle.WaitOne(); + socket.EndConnect(socketConnection); + socketConnection = null; + } + + networkStream = new NetworkStream(socket); + + byte[] headerBytes = new byte[128]; + int read = ScriptStream.Read(headerBytes, 0, 128); + string header = Encoding.UTF8.GetString(headerBytes, 0, read - 1); + if (header.StartsWith("log():")) + { + UnityEngine.Debug.Log("FMOD Studio: Script Client returned " + header.Substring(6)); + } + } + catch (Exception e) + { + UnityEngine.Debug.Log("FMOD Studio: Script Client failed to connect - Check FMOD Studio is running"); + + socketConnection = null; + socket = null; + networkStream = null; + + throw e; + } + } + return networkStream; + } + } + + private static void AsyncConnectCallback(IAsyncResult result) + { + try + { + socket.EndConnect(result); + } + catch (Exception) + { + } + finally + { + socketConnection = null; + } + } + + public static bool IsConnectedToStudio() + { + try + { + if (socket != null && socket.Connected) + { + if (SendScriptCommand("true")) + { + return true; + } + } + + if (socketConnection == null) + { + socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); + socketConnection = socket.BeginConnect("127.0.0.1", StudioScriptPort, AsyncConnectCallback, null); + } + + return false; + + } + catch(Exception e) + { + Debug.LogException(e); + return false; + } + } + + public static bool SendScriptCommand(string command) + { + byte[] commandBytes = Encoding.UTF8.GetBytes(command); + try + { + ScriptStream.Write(commandBytes, 0, commandBytes.Length); + byte[] commandReturnBytes = new byte[128]; + int read = ScriptStream.Read(commandReturnBytes, 0, 128); + string result = Encoding.UTF8.GetString(commandReturnBytes, 0, read - 1); + return (result.Contains("true")); + } + catch (Exception) + { + if (networkStream != null) + { + networkStream.Close(); + networkStream = null; + } + return false; + } + } + + + public static string GetScriptOutput(string command) + { + byte[] commandBytes = Encoding.UTF8.GetBytes(command); + try + { + ScriptStream.Write(commandBytes, 0, commandBytes.Length); + byte[] commandReturnBytes = new byte[2048]; + int read = ScriptStream.Read(commandReturnBytes, 0, commandReturnBytes.Length); + string result = Encoding.UTF8.GetString(commandReturnBytes, 0, read - 1); + if (result.StartsWith("out():")) + { + return result.Substring(6).Trim(); + } + return null; + } + catch (Exception) + { + networkStream.Close(); + networkStream = null; + return null; + } + } + + public static bool IsFileOpenByStudio(string path) + { + bool open = true; + try + { + using (var file = File.Open(path, FileMode.Open, FileAccess.Read, FileShare.None)) + { + open = false; + } + } + catch (Exception) + { + } + return open; + } + + private static string GetMasterBank() + { + GetScriptOutput(string.Format("masterBankFolder = studio.project.workspace.masterBankFolder;")); + string bankCountString = GetScriptOutput(string.Format("masterBankFolder.items.length;")); + int bankCount = int.Parse(bankCountString); + for (int i = 0; i < bankCount; i++) + { + string isMaster = GetScriptOutput(string.Format("masterBankFolder.items[{1}].isOfExactType(\"MasterBank\");", i)); + if (isMaster == "true") + { + string guid = GetScriptOutput(string.Format("masterBankFolder.items[{1}].id;", i)); + return guid; + } + } + return ""; + } + + private static bool CheckForNameConflict(string folderGuid, string eventName) + { + GetScriptOutput(string.Format("nameConflict = false;")); + GetScriptOutput(string.Format("checkFunction = function(val) {{ nameConflict |= val.name == \"{0}\"; }};", eventName)); + GetScriptOutput(string.Format("studio.project.lookup(\"{0}\").items.forEach(checkFunction, this); ", folderGuid)); + string conflictBool = GetScriptOutput(string.Format("nameConflict;")); + return conflictBool == "1"; + } + + public static string CreateStudioEvent(string eventPath, string eventName) + { + var folders = eventPath.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries); + + string folderGuid = EditorUtils.GetScriptOutput("studio.project.workspace.masterEventFolder.id;"); + for (int i = 0; i < folders.Length; i++) + { + string parentGuid = folderGuid; + GetScriptOutput(string.Format("guid = \"\";")); + GetScriptOutput(string.Format("findFunc = function(val) {{ guid = val.isOfType(\"EventFolder\") && val.name == \"{0}\" ? val.id : guid; }};", folders[i])); + GetScriptOutput(string.Format("studio.project.lookup(\"{0}\").items.forEach(findFunc, this);", folderGuid)); + folderGuid = GetScriptOutput(string.Format("guid;")); + if (folderGuid == "") + { + GetScriptOutput(string.Format("folder = studio.project.create(\"EventFolder\");")); + GetScriptOutput(string.Format("folder.name = \"{0}\"", folders[i])); + GetScriptOutput(string.Format("folder.folder = studio.project.lookup(\"{0}\");", parentGuid)); + folderGuid = GetScriptOutput(string.Format("folder.id;")); + } + } + + if (CheckForNameConflict(folderGuid, eventName)) + { + EditorUtility.DisplayDialog("Name Conflict", string.Format("The event {0} already exists under {1}", eventName, eventPath), "OK"); + return null; + } + + GetScriptOutput("event = studio.project.create(\"Event\");"); + GetScriptOutput("event.note = \"Placeholder created via Unity\";"); + GetScriptOutput(string.Format("event.name = \"{0}\"", eventName)); + GetScriptOutput(string.Format("event.folder = studio.project.lookup(\"{0}\");", folderGuid)); + + // Add a group track + GetScriptOutput("track = studio.project.create(\"GroupTrack\");"); + GetScriptOutput("track.mixerGroup.output = event.mixer.masterBus;"); + GetScriptOutput("track.mixerGroup.name = \"Audio 1\";"); + GetScriptOutput("event.relationships.groupTracks.add(track);"); + + // Add tags + GetScriptOutput("tag = studio.project.create(\"Tag\");"); + GetScriptOutput("tag.name = \"placeholder\";"); + GetScriptOutput("tag.folder = studio.project.workspace.masterTagFolder;"); + GetScriptOutput("event.relationships.tags.add(tag);"); + + string eventGuid = GetScriptOutput(string.Format("event.id;")); + return eventGuid; + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/FMOD/src/Editor/EditorUtils.cs.meta b/Assets/Plugins/FMOD/src/Editor/EditorUtils.cs.meta new file mode 100755 index 0000000..7a44a90 --- /dev/null +++ b/Assets/Plugins/FMOD/src/Editor/EditorUtils.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 2bb4068641d1f71478f95a9b73533f51 +timeCreated: 1432608272 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/src/Editor/EventBrowser.cs b/Assets/Plugins/FMOD/src/Editor/EventBrowser.cs new file mode 100755 index 0000000..b057f21 --- /dev/null +++ b/Assets/Plugins/FMOD/src/Editor/EventBrowser.cs @@ -0,0 +1,1181 @@ +using System; +using System.Collections.Generic; +using System.Text; +using UnityEditor; +using UnityEngine; +using System.IO; + +namespace FMODUnity +{ + class EventBrowser : EditorWindow, ISerializationCallbackReceiver + { + public enum TreeType : int + { + Events, + Snapshots, + Banks, + GlobalParameters, + } + + [MenuItem("FMOD/Event Browser", priority = 1)] + public static void ShowEventBrowser() + { + EventBrowser eventBrowser = GetWindow("FMOD Events"); + eventBrowser.minSize = new Vector2(280, 600); + eventBrowser.Show(); + } + + void OnDestroy() + { + EditorUtils.PreviewStop(); + } + + List expandedState; + int selectedIndex = -1; + public void OnBeforeSerialize() + { + expandedState = new List(); + Action isExpanded = null; + isExpanded = (x) => { selectedIndex = (x == selectedItem) ? expandedState.Count : selectedIndex; expandedState.Add(x.Expanded); x.Children.ForEach(isExpanded); }; + treeItems.ForEach(isExpanded); + } + + public void OnAfterDeserialize() + { + } + + class TreeItem + { + public string Name; + public bool Expanded = false; + public EditorEventRef EventRef = null; + public EditorBankRef BankRef = null; + public EditorParamRef ParamRef = null; + public List Children = new List(); + public TreeItem Next = null; + public TreeItem Prev = null; + public Rect Rect; + public bool Exists; + } + + [NonSerialized] + List treeItems; + + Texture searchIcon; + Texture eventIcon; + Texture folderOpenIcon; + Texture folderClosedIcon; + Texture bankIcon; + Texture snapshotIcon; + Texture2D borderIcon; + GUIStyle eventStyle; + + [NonSerialized] + TreeItem selectedItem = null; + + Dictionary previewParamValues = new Dictionary(); + float previewDistance = 0; + float previewOrientation = 0; + + string searchString = ""; + + private SerializedProperty outputProperty; + + bool fromInspector = false; + bool showEvents = true; + bool showBanks = true; + bool showParameters = true; + + Vector2 treeScroll; + Vector2 paramScroll; + + [NonSerialized] + TreeItem lastDrawnItem; + [NonSerialized] + int itemCount; + [NonSerialized] + bool forceRepaint; + [NonSerialized] + float lastRepaintTime; + + void Update() + { + if (forceRepaint && lastRepaintTime < Time.time + (1/30.0f)) + { + Repaint(); + lastRepaintTime = Time.time; + } + } + + void SetPreviewEvent(EditorEventRef eventRef) + { + forceRepaint = false; + EditorUtils.PreviewStop(); + previewParamValues.Clear(); + + previewDistance = 0; + previewOrientation = 0; + + if (eventRef != null) + { + foreach (var paramRef in eventRef.Parameters) + { + previewParamValues.Add(paramRef.Name, paramRef.Default); + } + } + eventPosition = new Vector2(0, 0); + } + + void SetSelectedItem(TreeItem item) + { + //if (item != selectedItem) + { + selectedItem = item; + + if (item != null) + { + SetPreviewEvent(item.EventRef); + } + else + { + SetPreviewEvent(null); + } + } + } + + void ShowEventFolder(TreeItem item, Predicate filter) + { + eventStyle.padding.left += 17; + { + // Highlight first found item + if (item.EventRef != null || item.BankRef != null) + { + if (!String.IsNullOrEmpty(searchString) && + itemCount == 0 && + selectedItem == null + ) + { + SetSelectedItem(item); + } + + itemCount++; + } + + item.Next = null; + item.Prev = lastDrawnItem; + if (lastDrawnItem != null) + { + lastDrawnItem.Next = item; + } + lastDrawnItem = item; + } + + if (item.EventRef != null) + { + // Rendering and GUI event handling to show an event + GUIContent content = new GUIContent(item.Name, item.EventRef.Path.StartsWith("snapshot") ? snapshotIcon : eventIcon); + + eventStyle.normal.background = selectedItem == item ? EditorGUIUtility.Load("FMOD/Selected.png") as Texture2D : null; + GUILayout.Label(content, eventStyle, GUILayout.ExpandWidth(true)); + + Event e = Event.current; + + Rect rect = GUILayoutUtility.GetLastRect(); + if (e.type == EventType.MouseDown && + e.button == 0 && + rect.Contains(e.mousePosition)) + { + e.Use(); + + if (fromInspector && e.clickCount >= 2) + { + outputProperty.stringValue = ""; + outputProperty.stringValue = item.EventRef.Path; + EditorUtils.UpdateParamsOnEmitter(outputProperty.serializedObject, item.EventRef.Path); + outputProperty.serializedObject.ApplyModifiedProperties(); + Close(); + } + + SetSelectedItem(item); + } + if (e.type == EventType.MouseDrag && rect.Contains(e.mousePosition) && !fromInspector) + { + DragAndDrop.PrepareStartDrag(); + DragAndDrop.objectReferences = new UnityEngine.Object[] { Instantiate(item.EventRef) }; + DragAndDrop.StartDrag("New FMOD Studio Emitter"); + e.Use(); + } + if (Event.current.type == EventType.Repaint) + { + item.Rect = rect; + } + } + else if (item.BankRef != null) + { + // Rendering and event handling for a bank + GUIContent content = new GUIContent(item.Name, bankIcon); + + eventStyle.normal.background = selectedItem == item ? EditorGUIUtility.Load("FMOD/Selected.png") as Texture2D : null; + GUILayout.Label(content, eventStyle, GUILayout.ExpandWidth(true)); + + Event e = Event.current; + + Rect rect = GUILayoutUtility.GetLastRect(); + if (e.type == EventType.MouseDown && + e.button == 0 && + rect.Contains(e.mousePosition)) + { + e.Use(); + + if (fromInspector && e.clickCount >= 2) + { + outputProperty.stringValue = item.BankRef.Name; + outputProperty.serializedObject.ApplyModifiedProperties(); + Close(); + } + + SetSelectedItem(item); + } + if (e.type == EventType.MouseDrag && rect.Contains(e.mousePosition) && !fromInspector) + { + DragAndDrop.PrepareStartDrag(); + DragAndDrop.objectReferences = new UnityEngine.Object[] { Instantiate(item.BankRef) }; + DragAndDrop.StartDrag("New FMOD Studio Bank Loader"); + e.Use(); + } + if (Event.current.type == EventType.Repaint) + { + item.Rect = rect; + } + } + else if (item.ParamRef != null) + { + // Rendering and event handling for a bank + GUIContent content = new GUIContent(item.Name, eventIcon); + + eventStyle.normal.background = selectedItem == item ? EditorGUIUtility.Load("FMOD/Selected.png") as Texture2D : null; + GUILayout.Label(content, eventStyle, GUILayout.ExpandWidth(true)); + + Event e = Event.current; + + Rect rect = GUILayoutUtility.GetLastRect(); + if (e.type == EventType.MouseDown && + e.button == 0 && + rect.Contains(e.mousePosition)) + { + e.Use(); + + if (fromInspector && e.clickCount >= 2) + { + outputProperty.stringValue = item.ParamRef.Name; + outputProperty.serializedObject.ApplyModifiedProperties(); + Close(); + } + + SetSelectedItem(item); + } + if (e.type == EventType.MouseDrag && rect.Contains(e.mousePosition) && !fromInspector) + { + DragAndDrop.PrepareStartDrag(); + DragAndDrop.objectReferences = new UnityEngine.Object[] { Instantiate(item.ParamRef) }; + DragAndDrop.StartDrag("New FMOD Studio Global Parameter Trigger"); + e.Use(); + } + if (Event.current.type == EventType.Repaint) + { + item.Rect = rect; + } + } + else + { + eventStyle.normal.background = selectedItem == item ? EditorGUIUtility.Load("FMOD/Selected.png") as Texture2D : null; + + bool expanded = item.Expanded || !string.IsNullOrEmpty(searchString); + GUIContent content = new GUIContent(item.Name, expanded ? folderOpenIcon : folderClosedIcon); + GUILayout.Label(content, eventStyle, GUILayout.ExpandWidth(true)); + + Rect rect = GUILayoutUtility.GetLastRect(); + if (Event.current.type == EventType.MouseDown && + Event.current.button == 0 && + rect.Contains(Event.current.mousePosition)) + { + Event.current.Use(); + item.Expanded = !item.Expanded; + SetSelectedItem(item); + } + + if (item.Expanded || !string.IsNullOrEmpty(searchString)) + { + item.Children.Sort((a, b) => a.Name.CompareTo(b.Name)); + if (item.Name.ToLower().Contains(searchString.ToLower())) + { + foreach(var childFolder in item.Children) + { + ShowEventFolder(childFolder, (x) => true); + } + } + else + { + foreach (var childFolder in item.Children.FindAll(filter)) + { + ShowEventFolder(childFolder, filter); + } + } + } + + if (Event.current.type == EventType.Repaint) + { + item.Rect = rect; + } + } + eventStyle.padding.left -= 17; + } + + Vector2 eventPosition; + + void OnGUI() + { + if (EditorApplication.isPlayingOrWillChangePlaymode && !EditorApplication.isPlaying) + { + // Brute force hack to stop us calling DLL functions while Unity is starting up + // playing in editor mode and will cause us to leak system objects + ShowNotification(new GUIContent("Playing In Editor Starting")); + return; + } + + if (!EventManager.IsValid) + { + ShowNotification(new GUIContent("No FMOD Studio banks loaded. Please check your settings.")); + return; + } + + if (Event.current.type == EventType.Layout) + { + RebuildDisplayFromCache(); + } + + //if (eventStyle == null) + { + eventStyle = new GUIStyle(GUI.skin.button); + eventStyle.normal.background = null; + eventStyle.focused.background = null; + eventStyle.active.background = null; + eventStyle.onFocused.background = null; + eventStyle.onNormal.background = null; + eventStyle.onHover.background = null; + eventStyle.onActive.background = null; + eventStyle.stretchWidth = false; + eventStyle.padding.left = 0; + eventStyle.stretchHeight = false; + eventStyle.fixedHeight = eventStyle.lineHeight + eventStyle.margin.top + eventStyle.margin.bottom; + eventStyle.alignment = TextAnchor.MiddleLeft; + + eventIcon = EditorGUIUtility.Load("FMOD/EventIcon.png") as Texture; + folderOpenIcon = EditorGUIUtility.Load("FMOD/FolderIconOpen.png") as Texture; + folderClosedIcon = EditorGUIUtility.Load("FMOD/FolderIconClosed.png") as Texture; + searchIcon = EditorGUIUtility.Load("FMOD/SearchIcon.png") as Texture; + bankIcon = EditorGUIUtility.Load("FMOD/BankIcon.png") as Texture; + snapshotIcon = EditorGUIUtility.Load("FMOD/SnapshotIcon.png") as Texture; + borderIcon = EditorGUIUtility.Load("FMOD/Border.png") as Texture2D; + } + + if (fromInspector) + { + var border = new GUIStyle(GUI.skin.box); + border.normal.background = borderIcon; + GUI.Box(new Rect(1, 1, position.width - 1, position.height - 1), GUIContent.none, border); + } + + // Split the window int search box, tree view, preview pane (only if full browser) + Rect searchRect, listRect, previewRect; + SplitWindow(out searchRect, out listRect, out previewRect); + + // Scroll the selected item in the tree view - put above the search box otherwise it will take + // our key presses + if (selectedItem != null && Event.current.type == EventType.KeyDown) + { + if (Event.current.keyCode == KeyCode.UpArrow) + { + if (selectedItem.Prev != null) + { + SetSelectedItem(selectedItem.Prev); + + // make sure it's visible + if (selectedItem.Rect.y < treeScroll.y) + { + treeScroll.y = selectedItem.Rect.y; + } + } + Event.current.Use(); + } + if (Event.current.keyCode == KeyCode.DownArrow) + { + if (selectedItem.Next != null) + { + SetSelectedItem(selectedItem.Next); + // make sure it's visible + if (selectedItem.Rect.y + selectedItem.Rect.height > treeScroll.y + listRect.height) + { + treeScroll.y += (selectedItem.Rect.y + selectedItem.Rect.height) - listRect.height; + } + } + Event.current.Use(); + } + if (Event.current.keyCode == KeyCode.RightArrow) + { + selectedItem.Expanded = true; + Event.current.Use(); + } + if (Event.current.keyCode == KeyCode.LeftArrow) + { + selectedItem.Expanded = false; + Event.current.Use(); + } + } + + // Show the search box at the top + GUILayout.BeginArea(searchRect); + GUILayout.BeginHorizontal(); + GUILayout.Label(new GUIContent(searchIcon), GUILayout.ExpandWidth(false)); + GUI.SetNextControlName("SearchBox"); + searchString = EditorGUILayout.TextField(searchString); + GUILayout.EndHorizontal(); + GUILayout.EndArea(); + + if (fromInspector) + { + EditorGUI.FocusTextInControl("SearchBox"); + + if (selectedItem != null && Event.current.isKey && Event.current.keyCode == KeyCode.Return + && !(selectedItem.EventRef == null && selectedItem.BankRef == null)) + { + Event.current.Use(); + + if (selectedItem.EventRef != null) + { + outputProperty.stringValue = ""; + outputProperty.stringValue = selectedItem.EventRef.Path; + EditorUtils.UpdateParamsOnEmitter(outputProperty.serializedObject, selectedItem.EventRef.Path); + } + else + { + outputProperty.stringValue = selectedItem.BankRef.Name; + } + outputProperty.serializedObject.ApplyModifiedProperties(); + Close(); + } + if (Event.current.isKey && Event.current.keyCode == KeyCode.Escape) + { + Close(); + } + } + + // Show the tree view + Predicate searchFilter = null; + searchFilter = (x) => (x.Name.ToLower().Contains(searchString.ToLower()) || x.Children.Exists(searchFilter)); + + // Check if our selected item still matches the search string + if (selectedItem != null && !String.IsNullOrEmpty(searchString) && selectedItem.Children.Count == 0) + { + Predicate containsSelected = null; + containsSelected = (x) => (x == selectedItem || x.Children.Exists(containsSelected)); + Predicate matchForSelected = null; + matchForSelected = (x) => (x.Name.ToLower().Contains(searchString.ToLower()) && (x == selectedItem || x.Children.Exists(containsSelected))) || x.Children.Exists(matchForSelected); + if (!treeItems.Exists(matchForSelected)) + { + SetSelectedItem(null); + } + } + + GUILayout.BeginArea(listRect); + treeScroll = GUILayout.BeginScrollView(treeScroll, GUILayout.ExpandHeight(true)); + + lastDrawnItem = null; + itemCount = 0; + + if (showEvents) + { + treeItems[(int)TreeType.Events].Expanded = fromInspector ? true : treeItems[(int)TreeType.Events].Expanded; + ShowEventFolder(treeItems[(int)TreeType.Events], searchFilter); + ShowEventFolder(treeItems[(int)TreeType.Snapshots], searchFilter); + } + if (showBanks) + { + treeItems[(int)TreeType.Banks].Expanded = fromInspector ? true : treeItems[(int)TreeType.Banks].Expanded; + ShowEventFolder(treeItems[(int)TreeType.Banks], searchFilter); + } + if (showParameters) + { + treeItems[(int)TreeType.GlobalParameters].Expanded = fromInspector ? true : treeItems[(int)TreeType.GlobalParameters].Expanded; + ShowEventFolder(treeItems[(int)TreeType.GlobalParameters], searchFilter); + } + + GUILayout.EndScrollView(); + GUILayout.EndArea(); + + // If the standalone event browser show a preview of the selected item + if (!fromInspector) + { + GUI.Box(previewRect, GUIContent.none); + + if (selectedItem != null && selectedItem.EventRef != null && selectedItem.EventRef.Path.StartsWith("event:")) + { + PreviewEvent(previewRect, selectedItem.EventRef); + } + + if (selectedItem != null && selectedItem.EventRef != null && selectedItem.EventRef.Path.StartsWith("snapshot:")) + { + PreviewSnapshot(previewRect, selectedItem.EventRef); + } + + if (selectedItem != null && selectedItem.BankRef != null) + { + PreviewBank(previewRect, selectedItem.BankRef); + } + + if (selectedItem != null && selectedItem.ParamRef != null) + { + PreviewParameter(previewRect, selectedItem.ParamRef); + } + } + } + + private void SplitWindow(out Rect searchRect, out Rect listRect, out Rect previewRect) + { + searchRect = new Rect(4, 4, position.width - 8, 16); + float previewBoxHeight = fromInspector ? 0 : 300; + listRect = new Rect(0, searchRect.height + 6, position.width, position.height - previewBoxHeight - searchRect.height - 15); + previewRect = new Rect(0, position.height - previewBoxHeight, position.width, previewBoxHeight); + } + + Rect previewCustomRect; + Rect previewPathRect; + + private void PreviewEvent(Rect previewRect, EditorEventRef selectedEvent) + { + GUILayout.BeginArea(previewRect); + + bool isNarrow = previewRect.width < 400; + + var style = new GUIStyle(EditorStyles.label); + EditorStyles.label.fontStyle = FontStyle.Bold; + EditorGUIUtility.labelWidth = 75; + + var copyIcon = EditorGUIUtility.Load("FMOD/CopyIcon.png") as Texture; + EditorGUILayout.BeginHorizontal(); + EditorGUILayout.LabelField("Full Path", selectedEvent.Path, style, GUILayout.ExpandWidth(true)); + if (GUILayout.Button(copyIcon, GUILayout.ExpandWidth(false))) + { + EditorGUIUtility.systemCopyBuffer = selectedEvent.Path; + } + EditorGUILayout.EndHorizontal(); + + StringBuilder builder = new StringBuilder(); + selectedEvent.Banks.ForEach((x) => { builder.Append(Path.GetFileNameWithoutExtension(x.Path)); builder.Append(", "); }); + EditorGUILayout.LabelField("Banks", builder.ToString(0, Math.Max(0, builder.Length - 2)), style); + + EditorGUILayout.BeginHorizontal(); + EditorGUILayout.LabelField("Panning", selectedEvent.Is3D ? "3D" : "2D", style); + EditorGUILayout.LabelField("Oneshot", selectedEvent.IsOneShot.ToString(), style); + + TimeSpan t = TimeSpan.FromMilliseconds(selectedEvent.Length); + EditorGUILayout.LabelField("Length", selectedEvent.Length > 0 ? string.Format("{0:D2}:{1:D2}:{2:D3}", t.Minutes, t.Seconds, t.Milliseconds) : "N/A", style); + + if (!isNarrow) EditorGUILayout.LabelField("Streaming", selectedEvent.IsStream.ToString(), style); + EditorGUILayout.EndHorizontal(); + if (isNarrow) EditorGUILayout.LabelField("Streaming", selectedEvent.IsStream.ToString(), style); + + EditorGUIUtility.labelWidth = 0; + EditorStyles.label.fontStyle = FontStyle.Normal; + + if (Event.current.type == EventType.Repaint) + { + var lastRect = GUILayoutUtility.GetLastRect(); + if (!isNarrow) + { + previewCustomRect = new Rect(lastRect.width / 2 - 200, lastRect.yMax + 10, 400, 150); + } + else + { + previewCustomRect = new Rect(lastRect.width / 2 - 130, lastRect.yMax + 10, 260, 150); + } + } + + GUI.Box(new Rect(0, previewCustomRect.yMin, previewRect.width, 1), GUIContent.none); + GUI.Box(new Rect(0, previewCustomRect.yMax, previewRect.width, 1), GUIContent.none); + + GUILayout.BeginArea(previewCustomRect); + + Texture playOff = EditorGUIUtility.Load("FMOD/TransportPlayButtonOff.png") as Texture; + Texture playOn = EditorGUIUtility.Load("FMOD/TransportPlayButtonOn.png") as Texture; + Texture stopOff = EditorGUIUtility.Load("FMOD/TransportStopButtonOff.png") as Texture; + Texture stopOn = EditorGUIUtility.Load("FMOD/TransportStopButtonOn.png") as Texture; + Texture openIcon = EditorGUIUtility.Load("FMOD/transportOpen.png") as Texture; + + var transportButtonStyle = new GUIStyle(); + transportButtonStyle.padding.left = 4; + transportButtonStyle.padding.top = 10; + + var previewState = EditorUtils.PreviewState; + bool playing = previewState == PreviewState.Playing; + bool paused = previewState == PreviewState.Paused; + bool stopped = previewState == PreviewState.Stopped; + EditorGUILayout.BeginVertical(); + if (!isNarrow) GUILayout.FlexibleSpace(); + EditorGUILayout.BeginHorizontal(); + + if (GUILayout.Button(stopped || paused ? stopOn : stopOff, transportButtonStyle, GUILayout.ExpandWidth(false))) + { + forceRepaint = false; + if (paused) + { + EditorUtils.PreviewStop(); + } + if (playing) + { + EditorUtils.PreviewPause(); + } + } + if (GUILayout.Button(playing ? playOn : playOff, transportButtonStyle, GUILayout.ExpandWidth(false))) + { + if (playing || stopped) + { + EditorUtils.PreviewEvent(selectedEvent, previewParamValues); + } + else + { + EditorUtils.PreviewPause(); + } + forceRepaint = true; + } + if (GUILayout.Button(new GUIContent(openIcon, "Show Event in FMOD Studio"), transportButtonStyle, GUILayout.ExpandWidth(false))) + { + string cmd = string.Format("studio.window.navigateTo(studio.project.lookup(\"{0}\"))", selectedEvent.Guid.ToString("b")); + EditorUtils.SendScriptCommand(cmd); + } + + EditorGUILayout.EndHorizontal(); + if (!isNarrow) GUILayout.FlexibleSpace(); + EditorGUILayout.EndVertical(); + + { + Texture circle = EditorGUIUtility.Load("FMOD/preview.png") as Texture; + Texture circle2 = EditorGUIUtility.Load("FMOD/previewemitter.png") as Texture; + + var originalColour = GUI.color; + if (!selectedEvent.Is3D) + { + GUI.color = new Color(1.0f, 1.0f, 1.0f, 0.1f); + } + + Rect rect = new Rect(isNarrow ? 120 : 150, 10, 128, 128); + GUI.DrawTexture(rect, circle); + + Vector2 centre = rect.center; + Rect rect2 = new Rect(rect.center.x + eventPosition.x - 6, rect.center.y + eventPosition.y - 6, 12, 12); + GUI.DrawTexture(rect2, circle2); + + GUI.color = originalColour; + + if (selectedEvent.Is3D && (Event.current.type == EventType.MouseDown || Event.current.type == EventType.MouseDrag) && rect.Contains(Event.current.mousePosition)) + { + var newPosition = Event.current.mousePosition; + Vector2 delta = (newPosition - centre); + float distance = delta.magnitude; + if (distance < 60) + { + eventPosition = newPosition - rect.center; + previewDistance = distance / 60.0f * selectedEvent.MaxDistance; + delta.Normalize(); + float angle = Mathf.Atan2(delta.y, delta.x); + previewOrientation = angle + Mathf.PI * 0.5f; + } + Event.current.Use(); + } + + EditorUtils.PreviewUpdatePosition(previewDistance, previewOrientation); + } + + float hoffset = isNarrow ? 15 : 300; + float voffset = isNarrow ? 50 : 10; + Texture meterOn = EditorGUIUtility.Load("FMOD/LevelMeter.png") as Texture; + Texture meterOff = EditorGUIUtility.Load("FMOD/LevelMeterOff.png") as Texture; + float[] metering = EditorUtils.GetMetering(); + int meterHeight = isNarrow ? 86 : 128; + int meterWidth = (int)((128 / (float)meterOff.height) * meterOff.width); + foreach (float rms in metering) + { + GUI.DrawTexture(new Rect(hoffset, voffset, meterWidth, meterHeight), meterOff); + + float db = 20.0f * Mathf.Log10(rms * Mathf.Sqrt(2.0f)); + db = Mathf.Clamp(db, -80.0f, 10.0f); + float visible = 0; + int[] segmentPixels = new int[] { 0, 18, 38, 60, 89, 130, 187, 244, 300 }; + float[] segmentDB = new float[] { -80.0f, -60.0f, -50.0f, -40.0f, -30.0f, -20.0f, -10.0f, 0, 10.0f }; + int segment = 1; + while (segmentDB[segment] < db) + { + segment++; + } + visible = segmentPixels[segment - 1] + ((db - segmentDB[segment - 1]) / (segmentDB[segment] - segmentDB[segment - 1])) * (segmentPixels[segment] - segmentPixels[segment - 1]); + + visible *= meterHeight / (float)meterOff.height; + + Rect levelPosRect = new Rect(hoffset, meterHeight - visible + voffset, meterWidth, visible); + Rect levelUVRect = new Rect(0, 0, 1.0f, visible / meterHeight); + GUI.DrawTextureWithTexCoords(levelPosRect, meterOn, levelUVRect); + hoffset += meterWidth + 5.0f; + } + + GUILayout.EndArea(); + + Rect paramRect = new Rect(0, previewCustomRect.yMax + 10, previewRect.width, previewRect.height - (previewCustomRect.yMax + 10)); + GUILayout.BeginArea(paramRect); + + paramScroll = GUILayout.BeginScrollView(paramScroll, false, false); + foreach (var paramRef in selectedEvent.Parameters) + { + if (!previewParamValues.ContainsKey(paramRef.Name)) + { + previewParamValues[paramRef.Name] = paramRef.Default; + } + previewParamValues[paramRef.Name] = EditorGUILayout.Slider(paramRef.Name, previewParamValues[paramRef.Name], paramRef.Min, paramRef.Max); + EditorUtils.PreviewUpdateParameter(paramRef.ID, previewParamValues[paramRef.Name]); + } + GUILayout.EndScrollView(); + + GUILayout.EndArea(); + GUILayout.EndArea(); + } + + private void PreviewBank(Rect previewRect, EditorBankRef selectedBank) + { + GUILayout.BeginArea(previewRect); + EditorGUIUtility.labelWidth = 75; + string[] SizeSuffix = { "B", "KB", "MB", "GB" }; + EditorStyles.label.fontStyle = FontStyle.Bold; + EditorGUILayout.LabelField("Platform Bank Sizes"); + EditorStyles.label.fontStyle = FontStyle.Normal; + EditorGUI.indentLevel++; + foreach (var sizeInfo in selectedBank.FileSizes) + { + int order = 0; + long len = sizeInfo.Value; + while (len >= 1024 && order + 1 < SizeSuffix.Length) + { + order++; + len /= 1024; + } + EditorGUILayout.LabelField(sizeInfo.Name, string.Format("{0} {1}", len, SizeSuffix[order])); + } + EditorGUI.indentLevel--; + EditorGUIUtility.labelWidth = 0; + GUILayout.EndArea(); + } + + private void PreviewParameter(Rect previewRect, EditorParamRef selectedParam) + { + GUILayout.BeginArea(previewRect); + var style = new GUIStyle(EditorStyles.label); + EditorStyles.label.fontStyle = FontStyle.Bold; + EditorGUIUtility.labelWidth = 75; + + EditorGUILayout.BeginHorizontal(); + EditorGUILayout.LabelField("Name", selectedParam.Name, style, GUILayout.ExpandWidth(true)); + EditorGUILayout.EndHorizontal(); + + EditorGUILayout.LabelField("Min", selectedParam.Min.ToString(), style, GUILayout.ExpandWidth(true)); + EditorGUILayout.LabelField("Max", selectedParam.Max.ToString(), style, GUILayout.ExpandWidth(true)); + + EditorGUI.indentLevel--; + EditorGUIUtility.labelWidth = 0; + GUILayout.EndArea(); + } + + private void PreviewSnapshot(Rect previewRect, EditorEventRef selectedEvent) + { + GUILayout.BeginArea(previewRect); + var style = new GUIStyle(EditorStyles.label); + EditorStyles.label.fontStyle = FontStyle.Bold; + EditorGUIUtility.labelWidth = 75; + + EditorGUILayout.LabelField("Full Path", selectedEvent.Path, style); + + EditorGUIUtility.labelWidth = 0; + EditorStyles.label.fontStyle = FontStyle.Normal; + GUILayout.EndArea(); + } + + private void RebuildDisplayFromCache() + { + Action nullEvents = null; + nullEvents = (x) => { x.Exists = false; x.Children.ForEach(nullEvents); }; + Predicate isStale = (x) => !x.Exists; + Action removeStaleChildren = null; + removeStaleChildren = (x) => { x.Children.RemoveAll(isStale); x.Children.ForEach(removeStaleChildren); }; + + if (showEvents) + { + var editorEvents = EventManager.Events; + + treeItems[(int)TreeType.Events].Children.ForEach(nullEvents); + treeItems[(int)TreeType.Snapshots].Children.ForEach(nullEvents); + + foreach (var editorEvent in editorEvents) + { + string[] split = editorEvent.Path.Split('/'); + var level = split[0] == "snapshot:" ? treeItems[(int)TreeType.Snapshots].Children : treeItems[(int)TreeType.Events].Children; + for (int i = 1; i < split.Length; i++) + { + TreeItem item = level.Find((x) => x.Name == split[i]); + if (item != null) + { + if (i == (split.Length - 1)) + { + item.EventRef = editorEvent; + } + else + { + level = item.Children; + } + } + else + { + item = new TreeItem(); + if (i == (split.Length - 1)) + { + item.EventRef = editorEvent; + } + item.Name = split[i]; + level.Add(item); + level.Sort((a, b) => a.EventRef != b.EventRef ? (a.EventRef != null ? 1 : -1) : a.Name.CompareTo(b.Name)); + level = item.Children; + } + item.Exists = true; + } + } + + removeStaleChildren(treeItems[(int)TreeType.Events]); + removeStaleChildren(treeItems[(int)TreeType.Snapshots]); + } + + if (showBanks) + { + var editorBanks = EventManager.Banks; + var children = treeItems[(int)TreeType.Banks].Children; + + children.ForEach(nullEvents); + + foreach (var editorBank in editorBanks) + { + var name = Path.GetFileNameWithoutExtension(editorBank.Path); + TreeItem item = children.Find((x) => x.Name == name); + if (item == null) + { + item = new TreeItem(); + item.Name = name; + item.BankRef = editorBank; + children.Add(item); + } + item.Exists = true; + } + children.Sort((a, b) => a.Name.CompareTo(b.Name)); + + removeStaleChildren(treeItems[(int)TreeType.Banks]); + } + + if (showParameters) + { + var editorParams = EventManager.Parameters; + var children = treeItems[(int)TreeType.GlobalParameters].Children; + + children.ForEach(nullEvents); + + foreach (var editorParam in editorParams) + { + var name = editorParam.Name; + TreeItem item = children.Find((x) => x.Name == name); + if (item == null) + { + item = new TreeItem(); + item.Name = name; + item.ParamRef = editorParam; + children.Add(item); + } + item.Exists = true; + } + children.Sort((a, b) => a.Name.CompareTo(b.Name)); + + removeStaleChildren(treeItems[(int)TreeType.GlobalParameters]); + } + + if (expandedState != null && EventManager.IsLoaded) + { + int i = 0; + Action setExpanded = null; + setExpanded = (x) => { selectedItem = (i == selectedIndex) ? x : selectedItem; x.Expanded = expandedState[i++]; x.Children.ForEach(setExpanded); }; + try + { + treeItems.ForEach(setExpanded); + } + catch + { + } + + expandedState = null; + + if (selectedItem != null) + { + SetPreviewEvent(selectedItem.EventRef); + } + else + { + SetPreviewEvent(null); + } + } + } + + internal void SelectEvent(SerializedProperty property) + { + fromInspector = true; + showBanks = false; + showParameters = false; + outputProperty = property; + JumpToEvent(outputProperty.stringValue); + } + + internal void SelectBank(SerializedProperty property) + { + fromInspector = true; + showEvents = false; + showParameters = false; + outputProperty = property; + JumpToBank(outputProperty.stringValue); + } + + internal void SelectParameter(SerializedProperty property) + { + fromInspector = true; + showBanks = false; + showEvents = false; + outputProperty = property; + JumpToParameter(outputProperty.stringValue); + } + + public void JumpToEvent(string eventPath) + { + if (!string.IsNullOrEmpty(eventPath)) + { + searchString = ""; + RebuildDisplayFromCache(); + TreeItem currentItem = null; + if (eventPath.StartsWith("event:/")) + { + currentItem = treeItems[(int)TreeType.Events]; + eventPath = eventPath.Replace("event:/", ""); + } + else if (eventPath.StartsWith("snapshot:/")) + { + currentItem = treeItems[(int)TreeType.Snapshots]; + eventPath = eventPath.Replace("snapshot:/", ""); + } + else + { + return; + } + + currentItem.Expanded = true; + var pathElements = eventPath.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries); + foreach (var pathElement in pathElements) + { + var nextItem = currentItem.Children.Find(x => x.Name.Equals(pathElement, StringComparison.CurrentCultureIgnoreCase)); + if (nextItem == null) + { + return; + } + nextItem.Expanded = true; + if (nextItem.EventRef) + { + SetSelectedItem(nextItem); + + Rect searchRect, listRect, previewRect; + SplitWindow(out searchRect, out listRect, out previewRect); + if (selectedItem.Rect.y < treeScroll.y) + { + treeScroll.y = selectedItem.Rect.y; + } + else if (selectedItem.Rect.y + selectedItem.Rect.height > treeScroll.y + listRect.height) + { + treeScroll.y += (selectedItem.Rect.y + selectedItem.Rect.height) - listRect.height; + } + return; + } + currentItem = nextItem; + } + } + } + + void JumpToBank(string bankName) + { + if (!string.IsNullOrEmpty(bankName)) + { + RebuildDisplayFromCache(); + TreeItem currentItem = treeItems[(int)TreeType.Banks]; + + currentItem.Expanded = true; + var nextItem = currentItem.Children.Find(x => x.Name.Equals(bankName, StringComparison.CurrentCultureIgnoreCase)); + if (nextItem == null) + { + return; + } + if (nextItem.BankRef) + { + SetSelectedItem(nextItem); + return; + } + } + } + + public void JumpToParameter(string parameterName) + { + if (!string.IsNullOrEmpty(parameterName)) + { + RebuildDisplayFromCache(); + TreeItem currentItem = treeItems[(int)TreeType.Banks]; + + currentItem.Expanded = true; + var nextItem = currentItem.Children.Find(x => x.Name.Equals(parameterName, StringComparison.CurrentCultureIgnoreCase)); + if (nextItem == null) + { + return; + } + if (nextItem.ParamRef) + { + SetSelectedItem(nextItem); + return; + } + } + } + + public EventBrowser() + { + treeItems = new List(); + treeItems.Add(new TreeItem()); + treeItems.Add(new TreeItem()); + treeItems.Add(new TreeItem()); + treeItems.Add(new TreeItem()); + treeItems[(int)TreeType.Events].Name = "Events"; + treeItems[(int)TreeType.Snapshots].Name = "Snapshots"; + treeItems[(int)TreeType.Banks].Name = "Banks"; + treeItems[(int)TreeType.GlobalParameters].Name = "Global Parameters"; + } + + public static void RepaintEventBrowser() + { + if (instance) + { + instance.Repaint(); + } + } + + static EventBrowser instance; + + public void OnEnable() + { + SceneView.onSceneGUIDelegate += SceneUpdate; + EditorApplication.hierarchyWindowItemOnGUI += HierachachyUpdate; + instance = this; + } + + // This is an event handler on the hierachy view to handle dragging our objects from the browser + void HierachachyUpdate(int instance, Rect rect) + { + Event e = Event.current; + if (e.type == EventType.DragPerform && rect.Contains(e.mousePosition)) + { + if (DragAndDrop.objectReferences.Length > 0 && + DragAndDrop.objectReferences[0] != null && + (DragAndDrop.objectReferences[0].GetType() == typeof(EditorEventRef) || + DragAndDrop.objectReferences[0].GetType() == typeof(EditorBankRef))) + { + GameObject target = (GameObject)EditorUtility.InstanceIDToObject(instance); + if (DragAndDrop.objectReferences[0].GetType() == typeof(EditorEventRef)) + { + var emitter = Undo.AddComponent(target); + emitter.Event = ((EditorEventRef)DragAndDrop.objectReferences[0]).Path; + var so = new SerializedObject(emitter); + so.ApplyModifiedProperties(); + } + else + { + var loader = Undo.AddComponent(target); + loader.Banks = new List(); + loader.Banks.Add(((EditorBankRef)DragAndDrop.objectReferences[0]).Name); + } + Selection.activeObject = target; + e.Use(); + } + } + } + + // This is an event handler on the scene view to handle dragging our objects from the browser + // and creating new gameobjects + void SceneUpdate(SceneView sceneView) + { + Event e = Event.current; + if (e.type == EventType.DragPerform) + { + if (DragAndDrop.objectReferences.Length > 0 && + DragAndDrop.objectReferences[0] != null && + (DragAndDrop.objectReferences[0].GetType() == typeof(EditorEventRef) || + DragAndDrop.objectReferences[0].GetType() == typeof(EditorBankRef))) + { + GameObject newObject = null; + if (DragAndDrop.objectReferences[0].GetType() == typeof(EditorEventRef)) + { + string path = ((EditorEventRef)DragAndDrop.objectReferences[0]).Path; + string name = path.Substring(path.LastIndexOf("/") + 1); + newObject = new GameObject(name + " Emitter"); + var emitter = newObject.AddComponent(); + emitter.Event = path; + var so = new SerializedObject(emitter); + so.ApplyModifiedProperties(); + Undo.RegisterCreatedObjectUndo(newObject, "Create FMOD Studio Emitter"); + } + else + { + newObject = new GameObject("FMOD Studio Loader"); + var loader = newObject.AddComponent(); + loader.Banks = new List(); + loader.Banks.Add(((EditorBankRef)DragAndDrop.objectReferences[0]).Name); + Undo.RegisterCreatedObjectUndo(newObject, "Create FMOD Studio Loader"); + } + Ray ray = HandleUtility.GUIPointToWorldRay(e.mousePosition); + var hit = HandleUtility.RaySnap(ray); + if (hit != null) + { + newObject.transform.position = ((RaycastHit)hit).point; + } + else + { + newObject.transform.position = ray.origin + ray.direction * 10.0f; + } + Selection.activeObject = newObject; + e.Use(); + } + } + if (e.type == EventType.DragUpdated) + { + if (DragAndDrop.objectReferences.Length > 0 && + DragAndDrop.objectReferences[0] != null && + (DragAndDrop.objectReferences[0].GetType() == typeof(EditorEventRef) || + DragAndDrop.objectReferences[0].GetType() == typeof(EditorBankRef))) + { + DragAndDrop.visualMode = DragAndDropVisualMode.Move; + DragAndDrop.AcceptDrag(); + e.Use(); + } + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/FMOD/src/Editor/EventBrowser.cs.meta b/Assets/Plugins/FMOD/src/Editor/EventBrowser.cs.meta new file mode 100755 index 0000000..c5714f4 --- /dev/null +++ b/Assets/Plugins/FMOD/src/Editor/EventBrowser.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 5332ad2baabb58844975479e906001c8 +timeCreated: 1432613753 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/src/Editor/EventCache.cs b/Assets/Plugins/FMOD/src/Editor/EventCache.cs new file mode 100755 index 0000000..fcbd185 --- /dev/null +++ b/Assets/Plugins/FMOD/src/Editor/EventCache.cs @@ -0,0 +1,42 @@ +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace FMODUnity +{ + class EventCache : ScriptableObject + { + public static int CurrentCacheVersion = 3; + + [SerializeField] + public List EditorBanks; + [SerializeField] + public List EditorEvents; + [SerializeField] + public List EditorParameters; + [SerializeField] + public List MasterBanks; + [SerializeField] + public List StringsBanks; + [SerializeField] + Int64 stringsBankWriteTime; + [SerializeField] + public int cacheVersion; + + public DateTime StringsBankWriteTime + { + get { return new DateTime(stringsBankWriteTime); } + set { stringsBankWriteTime = value.Ticks; } + } + + public EventCache() + { + EditorBanks = new List(); + EditorEvents = new List(); + EditorParameters = new List(); + MasterBanks = new List(); + StringsBanks = new List(); + stringsBankWriteTime = 0; + } + } +} diff --git a/Assets/Plugins/FMOD/src/Editor/EventCache.cs.meta b/Assets/Plugins/FMOD/src/Editor/EventCache.cs.meta new file mode 100755 index 0000000..13509d0 --- /dev/null +++ b/Assets/Plugins/FMOD/src/Editor/EventCache.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: d32cf7c32a3ed8347bac48ef5ed56d82 +timeCreated: 1432775088 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/src/Editor/EventManager.cs b/Assets/Plugins/FMOD/src/Editor/EventManager.cs new file mode 100755 index 0000000..baed6c8 --- /dev/null +++ b/Assets/Plugins/FMOD/src/Editor/EventManager.cs @@ -0,0 +1,728 @@ +using UnityEngine; +using UnityEditor; +using System; +using System.Collections.Generic; +using System.IO; +using UnityEditor.Build; +#if UNITY_2018_1_OR_NEWER +using UnityEditor.Build.Reporting; +#endif + +namespace FMODUnity +{ + [InitializeOnLoad] + public class EventManager : MonoBehaviour + { + const string CacheAssetName = "FMODStudioCache"; + const string CacheAssetFullName = "Assets/Plugins/FMOD/Resources/" + CacheAssetName + ".asset"; + static EventCache eventCache; + + const string StringBankExtension = "strings.bank"; + const string BankExtension = "bank"; + + const int FilePollTimeSeconds = 5; + + // How many seconds to wait since last file activity to start the import + const int CountdownTimerReset = 15 / FilePollTimeSeconds; + + static int countdownTimer; + +#if UNITY_EDITOR + [MenuItem("FMOD/Refresh Banks", priority = 1)] + public static void RefreshBanks() + { + UpdateCache(); + countdownTimer = 0; + UpdateCache(); + } +#endif + + static void ClearCache() + { + countdownTimer = CountdownTimerReset; + eventCache.StringsBankWriteTime = DateTime.MinValue; + eventCache.EditorBanks.Clear(); + eventCache.EditorEvents.Clear(); + eventCache.EditorParameters.Clear(); + eventCache.StringsBanks.Clear(); + eventCache.MasterBanks.Clear(); + if (Settings.Instance) + Settings.Instance.BanksToLoad.Clear(); + OnCacheChange(); + } + + static public void UpdateCache() + { + // Deserialize the cache from the unity resources + if (eventCache == null) + { + eventCache = AssetDatabase.LoadAssetAtPath(CacheAssetFullName, typeof(EventCache)) as EventCache; + if (eventCache == null || eventCache.cacheVersion != EventCache.CurrentCacheVersion) + { + UnityEngine.Debug.Log("FMOD Studio: Cannot find serialized event cache or cache in old format, creating new instance"); + eventCache = ScriptableObject.CreateInstance(); + eventCache.cacheVersion = EventCache.CurrentCacheVersion; + if (!Directory.Exists("Assets/Plugins/FMOD/Resources")) + { + AssetDatabase.CreateFolder("Assets/Plugins/FMOD", "Resources"); + } + AssetDatabase.CreateAsset(eventCache, CacheAssetFullName); + } + } + + if (EditorUtils.GetBankDirectory() == null) + { + ClearCache(); + return; + } + + string defaultBankFolder = null; + + if (!Settings.Instance.HasPlatforms) + { + defaultBankFolder = EditorUtils.GetBankDirectory(); + } + else + { + FMODPlatform platform = RuntimeUtils.GetEditorFMODPlatform(); + if (platform == FMODPlatform.None) + { + platform = FMODPlatform.PlayInEditor; + } + + defaultBankFolder = Path.Combine(EditorUtils.GetBankDirectory(), Settings.Instance.GetBankPlatform(platform)); + } + + string[] bankPlatforms = EditorUtils.GetBankPlatforms(); + string[] bankFolders = new string[bankPlatforms.Length]; + for (int i = 0; i < bankPlatforms.Length; i++) + { + bankFolders[i] = Path.Combine(EditorUtils.GetBankDirectory(), bankPlatforms[i]); + } + + List stringBanks = new List(0); + try + { + var files = Directory.GetFiles(defaultBankFolder, "*." + StringBankExtension); + stringBanks = new List(files); + } + catch + { + } + + // Strip out OSX resource-fork files that appear on FAT32 + stringBanks.RemoveAll((x) => Path.GetFileName(x).StartsWith("._")); + + if (stringBanks.Count == 0) + { + bool wasValid = eventCache.StringsBankWriteTime != DateTime.MinValue; + ClearCache(); + if (wasValid) + { + UnityEngine.Debug.LogError(string.Format("FMOD Studio: Directory {0} doesn't contain any banks. Build from the tool or check the path in the settings", defaultBankFolder)); + } + return; + } + + // If we have multiple .strings.bank files find the most recent + stringBanks.Sort((a, b) => File.GetLastWriteTime(b).CompareTo(File.GetLastWriteTime(a))); + + // Use the most recent string bank timestamp as a marker for the most recent build of any bank because it gets exported every time + DateTime lastWriteTime = File.GetLastWriteTime(stringBanks[0]); + + if (lastWriteTime == eventCache.StringsBankWriteTime) + { + countdownTimer = CountdownTimerReset; + return; + } + + if (EditorUtils.IsFileOpenByStudio(stringBanks[0])) + { + countdownTimer = CountdownTimerReset; + return; + } + + // Most recent strings bank is newer than last cache update time, recache. + + // Get a list of all banks + List bankFileNames = new List(); + List reducedStringBanksList = new List(); + HashSet stringBankGuids = new HashSet(); + + foreach (string stringBankPath in stringBanks) + { + FMOD.Studio.Bank stringBank; + EditorUtils.CheckResult(EditorUtils.System.loadBankFile(stringBankPath, FMOD.Studio.LOAD_BANK_FLAGS.NORMAL, out stringBank)); + + if (!stringBank.isValid()) + { + countdownTimer = CountdownTimerReset; + return; + } + else + { + // Unload the strings bank + stringBank.unload(); + } + Guid stringBankGuid; + EditorUtils.CheckResult(stringBank.getID(out stringBankGuid)); + + if (!stringBankGuids.Add(stringBankGuid)) + { + // If we encounter multiple string banks with the same GUID then only use the first. This handles the scenario where + // a Studio project is cloned and extended for DLC with a new master bank name. + continue; + } + + reducedStringBanksList.Add(stringBankPath); + } + + bankFileNames = new List(Directory.GetFiles(defaultBankFolder, "*.bank", SearchOption.AllDirectories)); + + stringBanks = reducedStringBanksList; + + if (!UnityEditorInternal.InternalEditorUtility.inBatchMode) + { + // Check if any of the files are still being written by studio + foreach (string bankFileName in bankFileNames) + { + EditorBankRef bankRef = eventCache.EditorBanks.Find((x) => bankFileName == x.Path); + if (bankRef == null) + { + if (EditorUtils.IsFileOpenByStudio(bankFileName)) + { + countdownTimer = CountdownTimerReset; + return; + } + continue; + } + + if (bankRef.LastModified != File.GetLastWriteTime(bankFileName)) + { + if (EditorUtils.IsFileOpenByStudio(bankFileName)) + { + countdownTimer = CountdownTimerReset; + return; + } + } + } + + // Count down the timer in case we catch studio in-between updating two files. + if (countdownTimer-- > 0) + { + return; + } + } + + eventCache.StringsBankWriteTime = lastWriteTime; + + // All files are finished being modified by studio so update the cache + + // Stop editor preview so no stale data being held + EditorUtils.PreviewStop(); + + // Reload the strings banks + List loadedStringsBanks = new List(); + + try + { + AssetDatabase.StartAssetEditing(); + + eventCache.EditorBanks.ForEach((x) => x.Exists = false); + HashSet masterBankFileNames = new HashSet(); + + foreach (string stringBankPath in stringBanks) + { + FMOD.Studio.Bank stringBank; + EditorUtils.CheckResult(EditorUtils.System.loadBankFile(stringBankPath, FMOD.Studio.LOAD_BANK_FLAGS.NORMAL, out stringBank)); + + if (!stringBank.isValid()) + { + ClearCache(); + return; + } + + loadedStringsBanks.Add(stringBank); + + FileInfo stringBankFileInfo = new FileInfo(stringBankPath); + + string masterBankFileName = Path.GetFileName(stringBankPath).Replace(StringBankExtension, BankExtension); + masterBankFileNames.Add(masterBankFileName); + + EditorBankRef stringsBankRef = eventCache.StringsBanks.Find(x => stringBankPath == x.Path); + + if (stringsBankRef == null) + { + stringsBankRef = ScriptableObject.CreateInstance(); + stringsBankRef.FileSizes = new List(); + eventCache.EditorBanks.Add(stringsBankRef); + AssetDatabase.AddObjectToAsset(stringsBankRef, eventCache); + AssetDatabase.ImportAsset(AssetDatabase.GetAssetPath(stringsBankRef)); + eventCache.StringsBanks.Add(stringsBankRef); + } + + stringsBankRef.Path = stringBankPath; + stringsBankRef.LastModified = stringBankFileInfo.LastWriteTime; + stringsBankRef.Exists = true; + stringsBankRef.FileSizes.Clear(); + + if (Settings.Instance.HasPlatforms) + { + for (int i = 0; i < bankPlatforms.Length; i++) + { + stringsBankRef.FileSizes.Add(new EditorBankRef.NameValuePair(bankPlatforms[i], stringBankFileInfo.Length)); + } + } + else + { + stringsBankRef.FileSizes.Add(new EditorBankRef.NameValuePair("", stringBankFileInfo.Length)); + } + } + + eventCache.EditorParameters.ForEach((x) => x.Exists = false); + foreach (string bankFileName in bankFileNames) + { + FileInfo bankFileInfo = new FileInfo(bankFileName); + EditorBankRef bankRef = eventCache.EditorBanks.Find((x) => bankFileInfo.FullName == x.Path); + + // New bank we've never seen before + if (bankRef == null) + { + bankRef = ScriptableObject.CreateInstance(); + AssetDatabase.AddObjectToAsset(bankRef, eventCache); + AssetDatabase.ImportAsset(AssetDatabase.GetAssetPath(bankRef)); + bankRef.Path = bankFileInfo.FullName; + bankRef.LastModified = DateTime.MinValue; + bankRef.FileSizes = new List(); + eventCache.EditorBanks.Add(bankRef); + } + + bankRef.Exists = true; + + // Timestamp check - if it doesn't match update events from that bank + if (bankRef.LastModified != bankFileInfo.LastWriteTime) + { + bankRef.LastModified = bankFileInfo.LastWriteTime; + UpdateCacheBank(bankRef); + } + + // Update file sizes + bankRef.FileSizes.Clear(); + if (Settings.Instance.HasPlatforms) + { + for (int i = 0; i < bankPlatforms.Length; i++) + { + string platformBankPath = Path.Combine(bankFolders[i], bankFileName); + var fileInfo = new FileInfo(platformBankPath); + if (fileInfo.Exists) + { + bankRef.FileSizes.Add(new EditorBankRef.NameValuePair(bankPlatforms[i], fileInfo.Length)); + } + } + } + else + { + string platformBankPath = Path.Combine(EditorUtils.GetBankDirectory(), bankFileName); + var fileInfo = new FileInfo(platformBankPath); + if (fileInfo.Exists) + { + bankRef.FileSizes.Add(new EditorBankRef.NameValuePair("", fileInfo.Length)); + } + } + + if (masterBankFileNames.Contains(bankFileInfo.Name)) + { + if (!eventCache.MasterBanks.Exists(x => bankFileInfo.FullName == x.Path)) + { + eventCache.MasterBanks.Add(bankRef); + } + } + } + + // Remove any stale entries from bank, event and parameter lists + eventCache.EditorBanks.FindAll((x) => !x.Exists).ForEach(RemoveCacheBank); + eventCache.EditorBanks.RemoveAll((x) => !x.Exists); + eventCache.EditorEvents.RemoveAll((x) => x.Banks.Count == 0); + eventCache.EditorParameters.RemoveAll((x) => !x.Exists); + eventCache.MasterBanks.RemoveAll((x) => !x.Exists); + eventCache.StringsBanks.RemoveAll((x) => !x.Exists); + + OnCacheChange(); + } + finally + { + // Unload the strings banks + loadedStringsBanks.ForEach(x => x.unload()); + AssetDatabase.StopAssetEditing(); + } + } + + static void UpdateCacheBank(EditorBankRef bankRef) + { + // Clear out any cached events from this bank + eventCache.EditorEvents.ForEach((x) => x.Banks.Remove(bankRef)); + + FMOD.Studio.Bank bank; + bankRef.LoadResult = EditorUtils.System.loadBankFile(bankRef.Path, FMOD.Studio.LOAD_BANK_FLAGS.NORMAL, out bank); + + if (bankRef.LoadResult == FMOD.RESULT.ERR_EVENT_ALREADY_LOADED) + { + EditorUtils.System.getBank(bankRef.Name, out bank); + bank.unload(); + bankRef.LoadResult = EditorUtils.System.loadBankFile(bankRef.Path, FMOD.Studio.LOAD_BANK_FLAGS.NORMAL, out bank); + } + + if (bankRef.LoadResult == FMOD.RESULT.OK) + { + // Iterate all events in the bank and cache them + FMOD.Studio.EventDescription[] eventList; + var result = bank.getEventList(out eventList); + if (result == FMOD.RESULT.OK) + { + foreach (var eventDesc in eventList) + { + string path; + result = eventDesc.getPath(out path); + EditorEventRef eventRef = eventCache.EditorEvents.Find((x) => x.Path == path); + if (eventRef == null) + { + eventRef = ScriptableObject.CreateInstance(); + AssetDatabase.AddObjectToAsset(eventRef, eventCache); + AssetDatabase.ImportAsset(AssetDatabase.GetAssetPath(eventRef)); + eventRef.Banks = new List(); + eventCache.EditorEvents.Add(eventRef); + } + + eventRef.Banks.Add(bankRef); + Guid guid; + eventDesc.getID(out guid); + eventRef.Guid = guid; + eventRef.Path = path; + eventDesc.is3D(out eventRef.Is3D); + eventDesc.isOneshot(out eventRef.IsOneShot); + eventDesc.isStream(out eventRef.IsStream); + eventDesc.getMaximumDistance(out eventRef.MaxDistance); + eventDesc.getMinimumDistance(out eventRef.MinDistance); + eventDesc.getLength(out eventRef.Length); + int paramCount = 0; + eventDesc.getParameterDescriptionCount(out paramCount); + eventRef.Parameters = new List(paramCount); + for (int paramIndex = 0; paramIndex < paramCount; paramIndex++) + { + FMOD.Studio.PARAMETER_DESCRIPTION param; + eventDesc.getParameterDescriptionByIndex(paramIndex, out param); + if ((param.flags & FMOD.Studio.PARAMETER_FLAGS.READONLY) != 0) + { + continue; + } + EditorParamRef paramRef = ScriptableObject.CreateInstance(); + AssetDatabase.AddObjectToAsset(paramRef, eventCache); + AssetDatabase.ImportAsset(AssetDatabase.GetAssetPath(paramRef)); + paramRef.Name = param.name; + paramRef.Min = param.minimum; + paramRef.Max = param.maximum; + paramRef.Default = param.defaultvalue; + eventRef.Parameters.Add(paramRef); + } + } + } + + // Update global parameter list for each bank + FMOD.Studio.PARAMETER_DESCRIPTION[] parameterDescriptions; + result = EditorUtils.System.getParameterDescriptionList(out parameterDescriptions); + if (result == FMOD.RESULT.OK) + { + for (int i = 0; i < parameterDescriptions.Length; i++) + { + FMOD.Studio.PARAMETER_DESCRIPTION param = parameterDescriptions[i]; + if (param.flags == FMOD.Studio.PARAMETER_FLAGS.GLOBAL) + { + EditorParamRef paramRef = eventCache.EditorParameters.Find((x) => + (parameterDescriptions[i].id.data1 == x.ID.data1 && param.id.data2 == x.ID.data2)); + if (paramRef == null) + { + paramRef = ScriptableObject.CreateInstance(); + AssetDatabase.AddObjectToAsset(paramRef, eventCache); + AssetDatabase.ImportAsset(AssetDatabase.GetAssetPath(paramRef)); + eventCache.EditorParameters.Add(paramRef); + paramRef.ID = param.id; + } + paramRef.Name = paramRef.name = param.name; + paramRef.Min = param.minimum; + paramRef.Max = param.maximum; + paramRef.Default = param.defaultvalue; + paramRef.Exists = true; + } + } + } + bank.unload(); + } + else + { + Debug.LogError(string.Format("FMOD Studio: Unable to load {0}: {1}", bankRef.Name, FMOD.Error.String(bankRef.LoadResult))); + eventCache.StringsBankWriteTime = DateTime.MinValue; + } + } + + static void RemoveCacheBank(EditorBankRef bankRef) + { + eventCache.EditorEvents.ForEach((x) => x.Banks.Remove(bankRef)); + } + + static EventManager() + { + countdownTimer = CountdownTimerReset; + EditorApplication.update += Update; + } + + public static void CopyToStreamingAssets() + { + FMODPlatform platform = RuntimeUtils.GetEditorFMODPlatform(); + if (platform == FMODPlatform.None) + { + UnityEngine.Debug.LogWarning(string.Format("FMOD Studio: copy banks for platform {0} : Unsupported platform", EditorUserBuildSettings.activeBuildTarget.ToString())); + return; + } + + string bankTargetFolder = + Settings.Instance.ImportType == ImportType.StreamingAssets + ? Application.dataPath + "/StreamingAssets" + : Application.dataPath + Path.DirectorySeparatorChar + Settings.Instance.TargetAssetPath; + Directory.CreateDirectory(bankTargetFolder); + + string bankTargetExension = + Settings.Instance.ImportType == ImportType.StreamingAssets + ? "bank" + : "bytes"; + + string bankSourceFolder = EditorUtils.GetBankDirectory() + Path.DirectorySeparatorChar + Settings.Instance.GetBankPlatform(platform); + + if (Path.GetFullPath(bankTargetFolder).TrimEnd(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar).ToUpperInvariant() == + Path.GetFullPath(bankSourceFolder).TrimEnd(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar).ToUpperInvariant()) + { + return; + } + + bool madeChanges = false; + + try + { + // Clean out any stale .bank files + string[] currentBankFiles = Directory.GetFiles(bankTargetFolder, "*." + bankTargetExension, SearchOption.AllDirectories); + foreach (var bankFileName in currentBankFiles) + { + string bankName = Path.GetFileNameWithoutExtension(bankFileName); + if (!eventCache.EditorBanks.Exists((x) => bankName == x.Name)) + { + File.Delete(bankFileName); + madeChanges = true; + } + } + + // Copy over any files that don't match timestamp or size or don't exist + foreach (var bankRef in eventCache.EditorBanks) + { + var subDir = Path.GetDirectoryName(bankRef.Path).Replace(bankSourceFolder, ""); + string sourcePath = bankSourceFolder + subDir + Path.DirectorySeparatorChar + bankRef.Name + ".bank"; + string targetPath = bankTargetFolder + subDir + Path.DirectorySeparatorChar + bankRef.Name + "." + bankTargetExension; + + FileInfo sourceInfo = new FileInfo(sourcePath); + FileInfo targetInfo = new FileInfo(targetPath); + + if (!targetInfo.Exists || + sourceInfo.Length != targetInfo.Length || + sourceInfo.LastWriteTime != targetInfo.LastWriteTime) + { + if (!targetInfo.Directory.Exists) + { + targetInfo.Directory.Create(); + } + else if (targetInfo.Exists) + { + targetInfo.IsReadOnly = false; + } + File.Copy(sourcePath, targetPath, true); + targetInfo = new FileInfo(targetPath); + targetInfo.IsReadOnly = false; + targetInfo.LastWriteTime = sourceInfo.LastWriteTime; + + madeChanges = true; + } + } + } + catch(Exception exception) + { + UnityEngine.Debug.LogError(string.Format("FMOD Studio: copy banks for platform {0} : copying banks from {1} to {2}", platform.ToString(), bankSourceFolder, bankTargetFolder)); + UnityEngine.Debug.LogException(exception); + return; + } + + if (madeChanges) + { + AssetDatabase.Refresh(); + UnityEngine.Debug.Log(string.Format("FMOD Studio: copy banks for platform {0} : copying banks from {1} to {2} succeeded", platform.ToString(), bankSourceFolder, bankTargetFolder)); + } + } + + private static void BuildTargetChanged() + { + UpdateCache(); + + // Copy over assets for the new platform + CopyToStreamingAssets(); + } + + static void OnCacheChange() + { + var settings = Settings.Instance; + settings.MasterBanks.Clear(); + + foreach (EditorBankRef bankRef in eventCache.MasterBanks) + { + settings.MasterBanks.Add(bankRef.Name); + } + + settings.Banks.Clear(); + + foreach (var bankRef in eventCache.EditorBanks) + { + if (!eventCache.MasterBanks.Contains(bankRef) && + !eventCache.StringsBanks.Contains(bankRef)) + { + settings.Banks.Add(bankRef.Name); + } + } + EditorUtility.SetDirty(settings); + + CopyToStreamingAssets(); + + EventBrowser.RepaintEventBrowser(); + } + + static bool firstUpdate = true; + static float lastCheckTime; + static void Update() + { + if (firstUpdate) + { + UpdateCache(); + OnCacheChange(); + CopyToStreamingAssets(); + bool isValid; + string validateMessage; + EditorUtils.ValidateSource(out isValid, out validateMessage); + if (!isValid) + { + Debug.LogError("FMOD Studio: " + validateMessage); + } + firstUpdate = false; + lastCheckTime = Time.realtimeSinceStartup; + } + + if (lastCheckTime + FilePollTimeSeconds < Time.realtimeSinceStartup) + { + UpdateCache(); + lastCheckTime = Time.realtimeSinceStartup; + } + } + + public static List Events + { + get + { + UpdateCache(); + return eventCache.EditorEvents; + } + } + + public static List Banks + { + get + { + UpdateCache(); + return eventCache.EditorBanks; + } + } + + public static List Parameters + { + get + { + UpdateCache(); + return eventCache.EditorParameters; + } + } + + public static List MasterBanks + { + get + { + UpdateCache(); + return eventCache.MasterBanks; + } + } + + public static bool IsLoaded + { + get + { + return EditorUtils.GetBankDirectory() != null; + } + } + + public static bool IsValid + { + get + { + UpdateCache(); + return eventCache.StringsBankWriteTime != DateTime.MinValue; + } + } + + public static EditorEventRef EventFromPath(string path) + { + UpdateCache(); + return eventCache.EditorEvents.Find((x) => x.Path.Equals(path, StringComparison.CurrentCultureIgnoreCase)); + } + + public static EditorEventRef EventFromGUID(Guid guid) + { + UpdateCache(); + return eventCache.EditorEvents.Find((x) => x.Guid == guid); + } + + public static EditorParamRef ParamFromPath(string name) + { + UpdateCache(); + return eventCache.EditorParameters.Find((x) => x.Name.Equals(name, StringComparison.CurrentCultureIgnoreCase)); + } + + public class ActiveBuildTargetListener : IActiveBuildTargetChanged + { + public int callbackOrder{ get { return 0; } } + public void OnActiveBuildTargetChanged(BuildTarget previousTarget, BuildTarget newTarget) + { + BuildTargetChanged(); + } + } + #if UNITY_2018_1_OR_NEWER + public class PreprocessBuild : IPreprocessBuildWithReport + { + public int callbackOrder { get { return 0; } } + public void OnPreprocessBuild(BuildReport report) + { + BuildTargetChanged(); + } + } + #else + public class PreprocessBuild : IPreprocessBuild + { + public int callbackOrder { get { return 0; } } + public void OnPreprocessBuild(BuildTarget target, string path) + { + BuildTargetChanged(); + } + } + #endif + } +} diff --git a/Assets/Plugins/FMOD/src/Editor/EventManager.cs.meta b/Assets/Plugins/FMOD/src/Editor/EventManager.cs.meta new file mode 100755 index 0000000..965dcb3 --- /dev/null +++ b/Assets/Plugins/FMOD/src/Editor/EventManager.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 1fc38201a5edb994c874a4a61e96053b +timeCreated: 1432600216 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/src/Editor/EventRefDrawer.cs b/Assets/Plugins/FMOD/src/Editor/EventRefDrawer.cs new file mode 100755 index 0000000..6e69afc --- /dev/null +++ b/Assets/Plugins/FMOD/src/Editor/EventRefDrawer.cs @@ -0,0 +1,149 @@ +using System; +using System.Text; +using UnityEngine; +using UnityEditor; +using System.IO; + +namespace FMODUnity +{ + [CustomPropertyDrawer(typeof(EventRefAttribute))] + class EventRefDrawer : PropertyDrawer + { + public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) + { + Texture browseIcon = EditorGUIUtility.Load("FMOD/SearchIconBlack.png") as Texture; + Texture openIcon = EditorGUIUtility.Load("FMOD/BrowserIcon.png") as Texture; + Texture addIcon = EditorGUIUtility.Load("FMOD/AddIcon.png") as Texture; + + EditorGUI.BeginProperty(position, label, property); + SerializedProperty pathProperty = property; + + Event e = Event.current; + if (e.type == EventType.DragPerform && position.Contains(e.mousePosition)) + { + if (DragAndDrop.objectReferences.Length > 0 && + DragAndDrop.objectReferences[0] != null && + DragAndDrop.objectReferences[0].GetType() == typeof(EditorEventRef)) + { + pathProperty.stringValue = ((EditorEventRef)DragAndDrop.objectReferences[0]).Path; + GUI.changed = true; + e.Use(); + } + } + if (e.type == EventType.DragUpdated && position.Contains(e.mousePosition)) + { + if (DragAndDrop.objectReferences.Length > 0 && + DragAndDrop.objectReferences[0] != null && + DragAndDrop.objectReferences[0].GetType() == typeof(EditorEventRef)) + { + DragAndDrop.visualMode = DragAndDropVisualMode.Move; + DragAndDrop.AcceptDrag(); + e.Use(); + } + } + + float baseHeight = GUI.skin.textField.CalcSize(new GUIContent()).y; + + position = EditorGUI.PrefixLabel(position, GUIUtility.GetControlID(FocusType.Passive), label); + + GUIStyle buttonStyle = new GUIStyle(GUI.skin.button); + buttonStyle.padding.top = 1; + buttonStyle.padding.bottom = 1; + + Rect addRect = new Rect(position.x + position.width - addIcon.width - 7, position.y, addIcon.width + 7, baseHeight); + Rect openRect = new Rect(addRect.x - openIcon.width - 7, position.y, openIcon.width + 6, baseHeight); + Rect searchRect = new Rect(openRect.x - browseIcon.width - 9, position.y, browseIcon.width + 8, baseHeight); + Rect pathRect = new Rect(position.x, position.y, searchRect.x - position.x - 3, baseHeight); + + EditorGUI.PropertyField(pathRect, pathProperty, GUIContent.none); + + if (GUI.Button(searchRect, new GUIContent(browseIcon, "Search"), buttonStyle)) + { + var eventBrowser = EventBrowser.CreateInstance(); + + eventBrowser.SelectEvent(property); + var windowRect = position; + windowRect.position = GUIUtility.GUIToScreenPoint(windowRect.position); + windowRect.height = openRect.height + 1; + eventBrowser.ShowAsDropDown(windowRect, new Vector2(windowRect.width, 400)); + + } + if (GUI.Button(addRect, new GUIContent(addIcon, "Create New Event in Studio"), buttonStyle)) + { + var addDropdown= EditorWindow.CreateInstance(); + + addDropdown.SelectEvent(property); + var windowRect = position; + windowRect.position = GUIUtility.GUIToScreenPoint(windowRect.position); + windowRect.height = openRect.height + 1; + addDropdown.ShowAsDropDown(windowRect, new Vector2(windowRect.width, 500)); + + } + if (GUI.Button(openRect, new GUIContent(openIcon, "Open In Browser"), buttonStyle) && + !string.IsNullOrEmpty(pathProperty.stringValue) && + EventManager.EventFromPath(pathProperty.stringValue) != null + ) + { + EventBrowser.ShowEventBrowser(); + var eventBrowser = EditorWindow.GetWindow(); + eventBrowser.JumpToEvent(pathProperty.stringValue); + } + + if (!string.IsNullOrEmpty(pathProperty.stringValue) && EventManager.EventFromPath(pathProperty.stringValue) != null) + { + Rect foldoutRect = new Rect(position.x + 10, position.y + baseHeight, position.width, baseHeight); + property.isExpanded = EditorGUI.Foldout(foldoutRect, property.isExpanded, "Event Properties"); + if (property.isExpanded) + { + var style = new GUIStyle(GUI.skin.label); + style.richText = true; + EditorEventRef eventRef = EventManager.EventFromPath(pathProperty.stringValue); + float width = style.CalcSize(new GUIContent("Oneshot")).x; + Rect labelRect = new Rect(position.x, position.y + baseHeight * 2, width, baseHeight); + Rect valueRect = new Rect(position.x + width + 10, position.y + baseHeight * 2, pathRect.width, baseHeight); + + GUI.Label(labelRect, new GUIContent("GUID"), style); + EditorGUI.SelectableLabel(valueRect, eventRef.Guid.ToString("b")); + labelRect.y += baseHeight; + valueRect.y += baseHeight; + + GUI.Label(labelRect, new GUIContent("Banks"), style); + StringBuilder builder = new StringBuilder(); + eventRef.Banks.ForEach((x) => { builder.Append(Path.GetFileNameWithoutExtension(x.Path)); builder.Append(", "); }); + GUI.Label(valueRect, builder.ToString(0, builder.Length - 2)); + labelRect.y += baseHeight; + valueRect.y += baseHeight; + + GUI.Label(labelRect, new GUIContent("Panning"), style); + GUI.Label(valueRect, eventRef.Is3D ? "3D" : "2D"); + labelRect.y += baseHeight; + valueRect.y += baseHeight; + + GUI.Label(labelRect, new GUIContent("Stream"), style); + GUI.Label(valueRect, eventRef.IsStream.ToString()); + labelRect.y += baseHeight; + valueRect.y += baseHeight; + + GUI.Label(labelRect, new GUIContent("Oneshot"), style); + GUI.Label(valueRect, eventRef.IsOneShot.ToString()); + labelRect.y += baseHeight; + valueRect.y += baseHeight; + } + } + else + { + Rect labelRect = new Rect(position.x, position.y + baseHeight, position.width, baseHeight); + GUI.Label(labelRect, new GUIContent("Event Not Found", EditorGUIUtility.Load("FMOD/NotFound.png") as Texture2D)); + } + + EditorGUI.EndProperty(); + } + + public override float GetPropertyHeight(SerializedProperty property, GUIContent label) + { + bool expanded = property.isExpanded && !string.IsNullOrEmpty(property.stringValue) && EventManager.EventFromPath(property.stringValue) != null; + float baseHeight = GUI.skin.textField.CalcSize(new GUIContent()).y; + return baseHeight * (expanded ? 7 : 2); // 6 lines of info + } + } +} diff --git a/Assets/Plugins/FMOD/src/Editor/EventRefDrawer.cs.meta b/Assets/Plugins/FMOD/src/Editor/EventRefDrawer.cs.meta new file mode 100755 index 0000000..7799839 --- /dev/null +++ b/Assets/Plugins/FMOD/src/Editor/EventRefDrawer.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 29a86a77bf7568e499243d9b47b7e88e +timeCreated: 1432696197 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/src/Editor/FindAndReplace.cs b/Assets/Plugins/FMOD/src/Editor/FindAndReplace.cs new file mode 100755 index 0000000..1bc366d --- /dev/null +++ b/Assets/Plugins/FMOD/src/Editor/FindAndReplace.cs @@ -0,0 +1,199 @@ +using System; +using UnityEngine; +using UnityEditor; +using System.Collections.Generic; + +namespace FMODUnity +{ + class FindAndReplace : EditorWindow + { + [MenuItem("FMOD/Find and Replace", priority = 2)] + static void ShowFindAndReplace() + { + var window = CreateInstance(); + window.titleContent = new GUIContent("FMOD Find and Replace"); + window.OnHierarchyChange(); + var position = window.position; + window.maxSize = window.minSize = position.size = new Vector2(400, 170); + window.position = position; + window.ShowUtility(); + } + + bool levelScope = true; + bool prefabScope; + string findText; + string replaceText; + string message = ""; + MessageType messageType = MessageType.None; + int lastMatch = -1; + List emitters; + + void OnHierarchyChange() + { + emitters = new List(Resources.FindObjectsOfTypeAll()); + + if (!levelScope) + { + #if UNITY_2018_3_OR_NEWER + emitters.RemoveAll(x => PrefabUtility.GetPrefabAssetType(x) == PrefabAssetType.NotAPrefab); + #else + emitters.RemoveAll(x => PrefabUtility.GetPrefabType(x) != PrefabType.Prefab); + #endif + } + + if (!prefabScope) + { + #if UNITY_2018_3_OR_NEWER + emitters.RemoveAll(x => PrefabUtility.GetPrefabAssetType(x) == PrefabAssetType.NotAPrefab); + #else + emitters.RemoveAll(x => PrefabUtility.GetPrefabType(x) != PrefabType.Prefab); + #endif + } + } + + bool first = true; + + void OnGUI() + { + bool doFind = false; + if ((Event.current.type == EventType.KeyDown && Event.current.keyCode == KeyCode.Return)) + { + Event.current.Use(); + doFind = true; + } + + GUI.SetNextControlName("find"); + EditorGUILayout.PrefixLabel("Find:"); + EditorGUI.BeginChangeCheck(); + findText = EditorGUILayout.TextField(findText); + if (EditorGUI.EndChangeCheck()) + { + lastMatch = -1; + message = null; + } + EditorGUILayout.PrefixLabel("Replace:"); + replaceText = EditorGUILayout.TextField(replaceText); + + EditorGUILayout.BeginHorizontal(); + EditorGUI.BeginChangeCheck(); + levelScope = EditorGUILayout.ToggleLeft("Current Level", levelScope, GUILayout.ExpandWidth(false)); + prefabScope = EditorGUILayout.ToggleLeft("Prefabs", prefabScope, GUILayout.ExpandWidth(false)); + if (EditorGUI.EndChangeCheck()) + { + OnHierarchyChange(); + } + EditorGUILayout.EndHorizontal(); + + GUILayout.BeginHorizontal(); + if (GUILayout.Button("Find") || doFind) + { + message = ""; + { + FindNext(); + } + if (lastMatch == -1) + { + message = "Finished Search"; + messageType = MessageType.Warning; + } + } + if (GUILayout.Button("Replace")) + { + message = ""; + if (lastMatch == -1) + { + FindNext(); + } + else + { + Replace(); + } + if (lastMatch == -1) + { + message = "Finished Search"; + messageType = MessageType.Warning; + } + } + if (GUILayout.Button("Replace All")) + { + if (EditorUtility.DisplayDialog("Replace All", "Are you sure you wish to replace all in the current hierachy?", "yes", "no")) + { + ReplaceAll(); + } + } + GUILayout.EndHorizontal(); + if (!string.IsNullOrEmpty(message)) + { + EditorGUILayout.HelpBox(message, messageType); + } + else + { + EditorGUILayout.HelpBox("\n\n", MessageType.None); + } + + if (first) + { + first = false; + EditorGUI.FocusTextInControl("find"); + } + } + + void FindNext() + { + for (int i = lastMatch + 1; i < emitters.Count; i++) + { + if (emitters[i].Event.IndexOf(findText, 0, StringComparison.CurrentCultureIgnoreCase) >= 0) + { + lastMatch = i; + EditorGUIUtility.PingObject(emitters[i]); + Selection.activeGameObject = emitters[i].gameObject; + message = "Found object"; + messageType = MessageType.Info; + return; + } + } + lastMatch = -1; + } + + void ReplaceAll() + { + int replaced = 0; + for (int i = 0; i < emitters.Count; i++) + { + if (ReplaceText(emitters[i])) + { + replaced++; + } + } + + message = string.Format("{0} replaced", replaced); + messageType = MessageType.Info; + } + + bool ReplaceText(StudioEventEmitter emitter) + { + int findLength = findText.Length; + int replaceLength = replaceText.Length; + int position = 0; + var serializedObject = new SerializedObject(emitter); + var pathProperty = serializedObject.FindProperty("Event"); + string path = pathProperty.stringValue; + position = path.IndexOf(findText, position, StringComparison.CurrentCultureIgnoreCase); + while (position >= 0) + { + path = path.Remove(position, findLength).Insert(position, replaceText); + position += replaceLength; + position = path.IndexOf(findText, position, StringComparison.CurrentCultureIgnoreCase); + } + pathProperty.stringValue = path; + return serializedObject.ApplyModifiedProperties(); + } + + void Replace() + { + ReplaceText(emitters[lastMatch]); + FindNext(); + } + + } +} diff --git a/Assets/Plugins/FMOD/src/Editor/FindAndReplace.cs.meta b/Assets/Plugins/FMOD/src/Editor/FindAndReplace.cs.meta new file mode 100755 index 0000000..5070d34 --- /dev/null +++ b/Assets/Plugins/FMOD/src/Editor/FindAndReplace.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: a3d0ed60438564241a4e62b152836893 +timeCreated: 1453876443 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/src/Editor/LogViewer.cs b/Assets/Plugins/FMOD/src/Editor/LogViewer.cs new file mode 100755 index 0000000..afb6c60 --- /dev/null +++ b/Assets/Plugins/FMOD/src/Editor/LogViewer.cs @@ -0,0 +1,6 @@ +/* This class is now legacy. Keep the definition here for the migration to work */ +using UnityEditor; + +public class LogViewer : EditorWindow +{ +} \ No newline at end of file diff --git a/Assets/Plugins/FMOD/src/Editor/LogViewer.cs.meta b/Assets/Plugins/FMOD/src/Editor/LogViewer.cs.meta new file mode 100755 index 0000000..17a20b4 --- /dev/null +++ b/Assets/Plugins/FMOD/src/Editor/LogViewer.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 255133e2dd4fbd9449ba729ddbb2f77f +timeCreated: 1433383105 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/src/Editor/ParamRefDrawer.cs b/Assets/Plugins/FMOD/src/Editor/ParamRefDrawer.cs new file mode 100755 index 0000000..bff2088 --- /dev/null +++ b/Assets/Plugins/FMOD/src/Editor/ParamRefDrawer.cs @@ -0,0 +1,81 @@ +using UnityEditor; +using UnityEngine; + +namespace FMODUnity +{ + [CustomPropertyDrawer(typeof(ParamRefAttribute))] + class ParamRefDrawer : PropertyDrawer + { + public bool MouseDrag(Event e) + { + bool isDragging = false; + + if (e.type == EventType.DragPerform) + { + isDragging = true; + } + + return isDragging; + } + + public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) + { + Texture browseIcon = EditorGUIUtility.Load("FMOD/SearchIconBlack.png") as Texture; + Texture openIcon = EditorGUIUtility.Load("FMOD/BrowserIcon.png") as Texture; + Texture addIcon = EditorGUIUtility.Load("FMOD/AddIcon.png") as Texture; + + EditorGUI.BeginProperty(position, label, property); + SerializedProperty pathProperty = property; + + Event e = Event.current; + if (MouseDrag(e) && position.Contains(e.mousePosition)) + { + if (DragAndDrop.objectReferences.Length > 0 && + DragAndDrop.objectReferences[0] != null && + DragAndDrop.objectReferences[0].GetType() == typeof(EditorParamRef)) + { + pathProperty.stringValue = ((EditorParamRef)DragAndDrop.objectReferences[0]).Name; + GUI.changed = true; + e.Use(); + } + } + if (e.type == EventType.DragUpdated && position.Contains(e.mousePosition)) + { + if (DragAndDrop.objectReferences.Length > 0 && + DragAndDrop.objectReferences[0] != null && + DragAndDrop.objectReferences[0].GetType() == typeof(EditorParamRef)) + { + DragAndDrop.visualMode = DragAndDropVisualMode.Move; + DragAndDrop.AcceptDrag(); + e.Use(); + } + } + + float baseHeight = GUI.skin.textField.CalcSize(new GUIContent()).y; + + position = EditorGUI.PrefixLabel(position, GUIUtility.GetControlID(FocusType.Passive), label); + + GUIStyle buttonStyle = new GUIStyle(GUI.skin.button); + buttonStyle.padding.top = 1; + buttonStyle.padding.bottom = 1; + + Rect addRect = new Rect(position.x + position.width - addIcon.width - 7, position.y, addIcon.width + 7, baseHeight); + Rect openRect = new Rect(addRect.x - openIcon.width - 7, position.y, openIcon.width + 6, baseHeight); + Rect searchRect = new Rect(openRect.x - browseIcon.width - 9, position.y, browseIcon.width + 8, baseHeight); + Rect pathRect = new Rect(position.x, position.y, searchRect.x - position.x - 3, baseHeight); + + EditorGUI.PropertyField(pathRect, pathProperty, GUIContent.none); + + if (GUI.Button(searchRect, new GUIContent(browseIcon, "Search"), buttonStyle)) + { + var eventBrowser = EventBrowser.CreateInstance(); + + eventBrowser.SelectParameter(property); + var windowRect = position; + windowRect.position = GUIUtility.GUIToScreenPoint(windowRect.position); + windowRect.height = openRect.height + 1; + eventBrowser.ShowAsDropDown(windowRect, new Vector2(windowRect.width, 400)); + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/FMOD/src/Editor/ParamRefDrawer.cs.meta b/Assets/Plugins/FMOD/src/Editor/ParamRefDrawer.cs.meta new file mode 100755 index 0000000..fa3237d --- /dev/null +++ b/Assets/Plugins/FMOD/src/Editor/ParamRefDrawer.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: ea88808aa26cd614db1c5c1dcbb14d4e +timeCreated: 1444197074 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/src/Editor/SettingsEditor.cs b/Assets/Plugins/FMOD/src/Editor/SettingsEditor.cs new file mode 100755 index 0000000..b22769f --- /dev/null +++ b/Assets/Plugins/FMOD/src/Editor/SettingsEditor.cs @@ -0,0 +1,781 @@ +using UnityEngine; +using System.Collections.Generic; +using UnityEditor; +using System.IO; +using System; + +namespace FMODUnity +{ + [CustomEditor(typeof(Settings))] + public class SettingsEditor : Editor + { + string[] ToggleParent = new string[] { "Disabled", "Enabled", "Development Build Only", }; + + string[] ToggleEditor = new string[] { "Enabled", "Disabled", }; + + string[] FrequencyDisplay = new string[] { "Platform Default", "22050", "24000", "32000", "44100", "48000"}; + int[] FrequencyValues = new int[] { 0, 22050, 24000, 32000, 44100, 48000 }; + + string[] SpeakerModeDisplay = new string[] { + "Stereo", + "5.1", + "7.1" }; + + int[] SpeakerModeValues = new int[] { + (int)FMOD.SPEAKERMODE.STEREO, + (int)FMOD.SPEAKERMODE._5POINT1, + (int)FMOD.SPEAKERMODE._7POINT1}; + + bool[] foldoutState = new bool[(int)FMODPlatform.Count]; + + bool hasBankSourceChanged = false; + string targetAssetPath; + bool focused = false; + bool bankFoldOutState = true; + + string PlatformLabel(FMODPlatform platform) + { + switch(platform) + { + case FMODPlatform.Linux: + return "Linux"; + case FMODPlatform.Desktop: + return "Desktop"; + case FMODPlatform.Console: + return "Console"; + case FMODPlatform.iOS: + return "iOS"; + case FMODPlatform.Mac: + return "OSX"; + case FMODPlatform.Mobile: + return "Mobile"; + case FMODPlatform.PS4: + return "PS4"; + case FMODPlatform.Windows: + return "Windows"; + case FMODPlatform.UWP: + return "UWP"; + case FMODPlatform.XboxOne: + return "XBox One"; + case FMODPlatform.Android: + return "Android"; + case FMODPlatform.AppleTV: + return "Apple TV"; + case FMODPlatform.MobileHigh: + return "High-End Mobile"; + case FMODPlatform.MobileLow: + return "Low-End Mobile"; + case FMODPlatform.Switch: + return "Switch"; + } + return "Unknown"; + } + + void DisplayEditorBool(string label, List settings, FMODPlatform platform) + { + int current = Settings.GetSetting(settings, platform, TriStateBool.Disabled) != TriStateBool.Disabled ? 0 : 1; + int next = EditorGUILayout.Popup(label, (int)current, ToggleEditor); + Settings.SetSetting(settings, platform, next == 0 ? TriStateBool.Enabled : TriStateBool.Disabled); + } + + void DisplayParentBool(string label, List settings, FMODPlatform platform) + { + TriStateBool current = Settings.GetSetting(settings, platform, TriStateBool.Disabled); + int next = EditorGUILayout.Popup(label, (int)current, ToggleParent); + Settings.SetSetting(settings, platform, (TriStateBool)next); + } + + void DisplayChildBool(string label, List settings, FMODPlatform platform) + { + bool overriden = Settings.HasSetting(settings, platform); + TriStateBool parent = Settings.GetSetting(settings, Settings.GetParent(platform), TriStateBool.Disabled); + TriStateBool current = Settings.GetSetting(settings, platform, TriStateBool.Disabled); + + string[] toggleChild = new string[ToggleParent.Length + 1]; + Array.Copy(ToggleParent, 0, toggleChild, 1, ToggleParent.Length); + toggleChild[0] = string.Format("Inherit ({0})", ToggleParent[(int)parent]); + + int next = EditorGUILayout.Popup(label, overriden ? (int)current + 1: 0, toggleChild); + if (next == 0) + { + if (overriden) + { + Settings.RemoveSetting(settings, platform); + } + } + else + { + Settings.SetSetting(settings, platform, (TriStateBool)(next-1)); + } + } + + void DisplayParentInt(string label, List settings, FMODPlatform platform, int min, int max) + { + int current = Settings.GetSetting(settings, platform, 0); + int next = EditorGUILayout.IntSlider(label, current, min, max); + Settings.SetSetting(settings, platform, next); + } + + void DisplayChildInt(string label, List settings, FMODPlatform platform, int min, int max) + { + bool overriden = Settings.HasSetting(settings, platform); + int current = Settings.GetSetting(settings, platform, 0); + + EditorGUILayout.BeginHorizontal(); + EditorGUILayout.PrefixLabel(label); + overriden = !GUILayout.Toggle(!overriden, "Inherit"); + EditorGUI.BeginDisabledGroup(!overriden); + int next = EditorGUILayout.IntSlider(current, min, max); + EditorGUI.EndDisabledGroup(); + EditorGUILayout.EndHorizontal(); + + if (overriden) + { + Settings.SetSetting(settings, platform, next); + } + else + { + Settings.RemoveSetting(settings, platform); + } + } + + void DisplayParentFreq(string label, List settings, FMODPlatform platform) + { + int current = Settings.GetSetting(settings, platform, 0); + int index = Array.IndexOf(FrequencyValues, current); + int next = EditorGUILayout.Popup(label, index, FrequencyDisplay); + Settings.SetSetting(settings, platform, FrequencyValues[next]); + } + + void DisplayChildFreq(string label, List settings, FMODPlatform platform) + { + bool overriden = Settings.HasSetting(settings, platform); + int current = Settings.GetSetting(settings, platform, 0); + int inherit = Settings.GetSetting(settings, Settings.GetParent(platform), 0); + int currentIndex = Array.IndexOf(FrequencyValues, current); + int inheritIndex = Array.IndexOf(FrequencyValues, inherit); + + string[] valuesChild = new string[FrequencyDisplay.Length + 1]; + Array.Copy(FrequencyDisplay, 0, valuesChild, 1, FrequencyDisplay.Length); + valuesChild[0] = string.Format("Inherit ({0})", FrequencyDisplay[inheritIndex]); + + int next = EditorGUILayout.Popup(label, overriden ? currentIndex + 1 : 0, valuesChild); + if (next == 0) + { + Settings.RemoveSetting(settings, platform); + } + else + { + Settings.SetSetting(settings, platform, FrequencyValues[next-1]); + } + } + + void DisplayParentSpeakerMode(string label, List settings, FMODPlatform platform) + { + int current = Settings.GetSetting(settings, platform, (int)FMOD.SPEAKERMODE.STEREO); + int index = Array.IndexOf(SpeakerModeValues, current); + int next = EditorGUILayout.Popup(label, index, SpeakerModeDisplay); + Settings.SetSetting(settings, platform, SpeakerModeValues[next]); + } + + void DisplayPIESpeakerMode(string label, List settings, FMODPlatform platform) + { + int buildTargetSetting = Settings.GetSetting(settings, RuntimeUtils.GetEditorFMODPlatform(), (int)FMOD.SPEAKERMODE.STEREO); + int buildTargetIndex = Array.IndexOf(SpeakerModeValues, buildTargetSetting); + string[] speakerModes = new string[SpeakerModeDisplay.Length + 1]; + Array.Copy(SpeakerModeDisplay, 0, speakerModes, 1, SpeakerModeDisplay.Length); + speakerModes[0] = string.Format("Current Unity Platform ({0})", SpeakerModeDisplay[buildTargetIndex]); + + bool useCurrentUnity = !Settings.HasSetting(settings, platform); + + int current = Settings.GetSetting(settings, platform, (int)FMOD.SPEAKERMODE.STEREO); + int index = Array.IndexOf(SpeakerModeValues, current) + 1; + if (useCurrentUnity || index < 0) index = 0; + int next = EditorGUILayout.Popup(label, index, speakerModes); + if (next != 0) + { + Settings.SetSetting(settings, platform, SpeakerModeValues[next - 1]); + } + else + { + Settings.RemoveSetting(settings, platform); + } + } + + void DisplayChildSpeakerMode(string label, List settings, FMODPlatform platform) + { + bool overriden = Settings.HasSetting(settings, platform); + int current = Settings.GetSetting(settings, platform, 0); + int inherit = Settings.GetSetting(settings, Settings.GetParent(platform), 0); + int currentIndex = Array.IndexOf(SpeakerModeValues, current); + int inheritIndex = Array.IndexOf(SpeakerModeValues, inherit); + + string[] valuesChild = new string[SpeakerModeDisplay.Length + 1]; + Array.Copy(SpeakerModeDisplay, 0, valuesChild, 1, SpeakerModeDisplay.Length); + valuesChild[0] = string.Format("Inherit ({0})", SpeakerModeDisplay[inheritIndex]); + + int next = EditorGUILayout.Popup(label, overriden ? currentIndex + 1 : 0, valuesChild); + if (next == 0) + { + Settings.RemoveSetting(settings, platform); + } + else + { + Settings.SetSetting(settings, platform, SpeakerModeValues[next - 1]); + } + } + + void DisplayParentBuildDirectory(string label, List settings, FMODPlatform platform) + { + string[] buildDirectories = EditorUtils.GetBankPlatforms(); + + string current = Settings.GetSetting(settings, platform, "Desktop"); + int index = Array.IndexOf(buildDirectories, current); + if (index < 0) index = 0; + + int next = EditorGUILayout.Popup(label, index, buildDirectories); + Settings.SetSetting(settings, platform, buildDirectories[next]); + } + + + void DisplayPIEBuildDirectory(string label, List settings, FMODPlatform platform) + { + string buildTargetSetting = Settings.GetSetting(settings, RuntimeUtils.GetEditorFMODPlatform(), "Desktop"); + string[] buildDirectories = new string[EditorUtils.GetBankPlatforms().Length + 1]; + Array.Copy(EditorUtils.GetBankPlatforms(), 0, buildDirectories, 1, EditorUtils.GetBankPlatforms().Length); + buildDirectories[0] = String.Format("Current Unity Platform ({0})", buildTargetSetting); + + bool useCurrentUnity = !Settings.HasSetting(settings, platform); + string current = Settings.GetSetting(settings, platform, "Desktop"); + int index = Array.IndexOf(buildDirectories, current); + if (useCurrentUnity || index < 0) index = 0; + + int next = EditorGUILayout.Popup(label, index, buildDirectories); + if (next != 0) + { + Settings.SetSetting(settings, platform, buildDirectories[next]); + } + else + { + Settings.RemoveSetting(settings, platform); + } + } + + void DisplayChildBuildDirectories(string label, List settings, FMODPlatform platform) + { + string[] buildDirectories = EditorUtils.GetBankPlatforms(); + + bool overriden = Settings.HasSetting(settings, platform); + string current = Settings.GetSetting(settings, platform, "Desktop"); + string inherit = Settings.GetSetting(settings, Settings.GetParent(platform), "Desktop"); + int index = Array.IndexOf(buildDirectories, current); + if (index < 0) index = 0; + + string[] valuesChild = new string[buildDirectories.Length + 1]; + Array.Copy(buildDirectories, 0, valuesChild, 1, buildDirectories.Length); + valuesChild[0] = string.Format("Inherit ({0})", inherit); + + int next = EditorGUILayout.Popup(label, overriden ? index + 1 : 0, valuesChild); + if (next == 0) + { + Settings.RemoveSetting(settings, platform); + Settings.RemoveSetting(((Settings)target).SpeakerModeSettings, platform); + } + else + { + Settings.SetSetting(settings, platform, buildDirectories[next - 1]); + } + } + + void DisplayPlatform(FMODPlatform platform, FMODPlatform[] children = null) + { + Settings settings = target as Settings; + + var label = new System.Text.StringBuilder(); + label.AppendFormat("{0}", (PlatformLabel(platform))); + if (children != null) + { + label.Append(" ("); + foreach (var child in children) + { + label.Append(PlatformLabel(child)); + label.Append(", "); + } + label.Remove(label.Length - 2, 2); + label.Append(")"); + } + + GUIStyle style = new GUIStyle(GUI.skin.FindStyle("Foldout")); + style.richText = true; + + foldoutState[(int)platform] = EditorGUILayout.Foldout(foldoutState[(int)platform], new GUIContent(label.ToString()), style); + if (foldoutState[(int)platform]) + { + EditorGUI.indentLevel++; + DisplayChildBool("Live Update", settings.LiveUpdateSettings, platform); + if (settings.IsLiveUpdateEnabled(platform)) + { + GUIStyle style2 = new GUIStyle(GUI.skin.label); + style2.richText = true; + EditorGUILayout.BeginHorizontal(); + EditorGUILayout.PrefixLabel(" "); + GUILayout.Label("Live update will listen on port 9264", style2); + EditorGUILayout.EndHorizontal(); + } + DisplayChildBool("Debug Overlay", settings.OverlaySettings, platform); + DisplayChildFreq("Sample Rate", settings.SampleRateSettings, platform); + if (settings.HasPlatforms && AllowBankChange(platform)) + { + bool prevChanged = GUI.changed; + DisplayChildBuildDirectories("Bank Platform", settings.BankDirectorySettings, platform); + hasBankSourceChanged |= !prevChanged && GUI.changed; + + if (Settings.HasSetting(settings.BankDirectorySettings, platform)) + { + DisplayChildSpeakerMode("Speaker Mode", settings.SpeakerModeSettings, platform); + EditorGUILayout.HelpBox(string.Format("Match the speaker mode to the setting of the platform {0} inside FMOD Studio", settings.GetBankPlatform(platform)), MessageType.Info, false); + } + else + { + EditorGUI.BeginDisabledGroup(true); + DisplayChildSpeakerMode("Speaker Mode", settings.SpeakerModeSettings, platform); + EditorGUI.EndDisabledGroup(); + } + } + + DisplayChildInt("Virtual Channel Count", settings.VirtualChannelSettings, platform, 1, 2048); + DisplayChildInt("Real Channel Count", settings.RealChannelSettings, platform, 1, 256); + + if (children != null) + { + foreach (var child in children) + { + DisplayPlatform(child); + } + } + + EditorGUI.indentLevel--; + } + } + + private bool AllowBankChange(FMODPlatform platform) + { + // Can't do these settings on pseudo-platforms + if (platform == FMODPlatform.MobileLow || platform == FMODPlatform.MobileHigh) + { + return false; + } + + return true; + } + + public override void OnInspectorGUI() + { + Settings settings = target as Settings; + + EditorGUI.BeginChangeCheck(); + + hasBankSourceChanged = false; + bool hasBankTargetChanged = false; + + GUIStyle style = new GUIStyle(GUI.skin.label); + style.richText = true; + + GUI.skin.FindStyle("HelpBox").richText = true; + + int sourceType = settings.HasSourceProject ? 0 : (settings.HasPlatforms ? 2 : 1); + + EditorGUILayout.BeginHorizontal(); + EditorGUILayout.BeginVertical(); + sourceType = GUILayout.Toggle(sourceType == 0, "Project", "Button") ? 0 : sourceType; + sourceType = GUILayout.Toggle(sourceType == 1, "Single Platform Build", "Button") ? 1 : sourceType; + sourceType = GUILayout.Toggle(sourceType == 2, "Multiple Platform Build", "Button") ? 2 : sourceType; + EditorGUILayout.EndVertical(); + EditorGUILayout.BeginVertical(); + + EditorGUILayout.HelpBox( + "Select the way you wish to connect Unity to the FMOD Studio content:\n" + + "• Project\t\tIf you have the complete FMOD Studio project avaliable\n" + + "• Single Platform\tIf you have only the contents of the Build folder for a single platform\n" + + "• Multiple Platforms\tIf you have only the contents of the Build folder for multiple platforms, each platform in it's own sub directory\n" + + "" + , MessageType.Info, true); + EditorGUILayout.EndVertical(); + EditorGUILayout.EndHorizontal(); + EditorGUILayout.Space(); + + if (sourceType == 0) + { + EditorGUILayout.BeginHorizontal(); + string oldPath = settings.SourceProjectPathUnformatted; + EditorGUILayout.PrefixLabel("Studio Project Path", GUI.skin.textField, style); + + EditorGUI.BeginChangeCheck(); + settings.SourceProjectPathUnformatted = EditorGUILayout.TextField(GUIContent.none, settings.SourceProjectPathUnformatted); + if (EditorGUI.EndChangeCheck()) + { + settings.SourceProjectPath = settings.SourceProjectPathUnformatted; + } + + if (GUILayout.Button("Browse", GUILayout.ExpandWidth(false))) + { + GUI.FocusControl(null); + string path = EditorUtility.OpenFilePanel("Locate Studio Project", oldPath, "fspro"); + if (!string.IsNullOrEmpty(path)) + { + path = MakePathRelativeToProject(path); + settings.SourceProjectPathUnformatted = path; + settings.SourceProjectPath = path; + Repaint(); + } + } + EditorGUILayout.EndHorizontal(); + + // Cache in settings for runtime access in play-in-editor mode + string bankPath = EditorUtils.GetBankDirectoryUnformatted(); + settings.SourceBankPathUnformatted = bankPath; + settings.SourceBankPath = bankPath; + settings.HasPlatforms = true; + settings.HasSourceProject = true; + + // First time project path is set or changes, copy to streaming assets + if (settings.SourceProjectPathUnformatted != oldPath) + { + hasBankSourceChanged = true; + } + } + + if (sourceType == 1 || sourceType == 2) + { + EditorGUILayout.BeginHorizontal(); + string oldPath = settings.SourceBankPathUnformatted; + EditorGUILayout.PrefixLabel("Build Path", GUI.skin.textField, style); + + EditorGUI.BeginChangeCheck(); + settings.SourceBankPathUnformatted = EditorGUILayout.TextField(GUIContent.none, settings.SourceBankPathUnformatted); + if (EditorGUI.EndChangeCheck()) + { + settings.SourceBankPath = settings.SourceBankPathUnformatted; + } + + if (GUILayout.Button("Browse", GUILayout.ExpandWidth(false))) + { + GUI.FocusControl(null); + var path = EditorUtility.OpenFolderPanel("Locate Build Folder", oldPath, null); + if (!string.IsNullOrEmpty(path)) + { + path = MakePathRelativeToProject(path); + settings.SourceBankPathUnformatted = path; + settings.SourceBankPath = path; + } + } + EditorGUILayout.EndHorizontal(); + + settings.HasPlatforms = (sourceType == 2); + settings.HasSourceProject = false; + + // First time project path is set or changes, copy to streaming assets + if (settings.SourceBankPathUnformatted != oldPath) + { + hasBankSourceChanged = true; + } + } + + if ((settings.HasSourceProject && !settings.SourceProjectPathUnformatted.Equals(settings.SourceProjectPath)) || + (sourceType >= 1 && !settings.SourceBankPathUnformatted.Equals(settings.SourceBankPath))) + { + EditorGUI.BeginDisabledGroup(true); + EditorGUILayout.TextField("Platform specific path", sourceType >= 1 ? settings.SourceBankPath : settings.SourceProjectPath); + EditorGUI.EndDisabledGroup(); + } + + bool validBanks; + string failReason; + EditorUtils.ValidateSource(out validBanks, out failReason); + if (!validBanks) + { + EditorGUILayout.HelpBox(failReason, MessageType.Error, true); + if (EditorGUI.EndChangeCheck()) + { + EditorUtility.SetDirty(settings); + } + return; + } + + ImportType importType = (ImportType)EditorGUILayout.EnumPopup("Import Type", settings.ImportType); + if (importType != settings.ImportType) + { + hasBankTargetChanged = true; + settings.ImportType = importType; + } + + // ----- Text Assets ------------- + EditorGUI.BeginDisabledGroup(settings.ImportType != ImportType.AssetBundle); + GUI.SetNextControlName("targetAssetPath"); + targetAssetPath = EditorGUILayout.TextField("FMOD Asset Folder", string.IsNullOrEmpty(targetAssetPath) ? settings.TargetAssetPath : targetAssetPath); + if (GUI.GetNameOfFocusedControl() == "targetAssetPath") + { + focused = true; + if (Event.current.isKey) + { + switch (Event.current.keyCode) + { + case KeyCode.Return: + case KeyCode.KeypadEnter: + settings.TargetAssetPath = targetAssetPath; + hasBankTargetChanged = true; + break; + } + } + } + else if (focused) + { + settings.TargetAssetPath = targetAssetPath; + hasBankTargetChanged = true; + focused = false; + } + EditorGUI.EndDisabledGroup(); + + // ----- Logging ----------------- + EditorGUILayout.Separator(); + EditorGUILayout.LabelField("Logging", style); + EditorGUI.indentLevel++; + settings.LoggingLevel = (FMOD.DEBUG_FLAGS)EditorGUILayout.EnumPopup("Logging Level", settings.LoggingLevel); + EditorGUI.indentLevel--; + + // ----- Loading ----------------- + EditorGUI.BeginDisabledGroup(settings.ImportType == ImportType.AssetBundle); + EditorGUILayout.Separator(); + EditorGUILayout.LabelField("Initialization", style); + EditorGUI.indentLevel++; + + settings.BankLoadType = (BankLoadType)EditorGUILayout.EnumPopup("Load Banks", settings.BankLoadType); + switch (settings.BankLoadType) + { + case BankLoadType.All: + break; + case BankLoadType.Specified: + settings.AutomaticEventLoading = false; + Texture upArrowTexture = EditorGUIUtility.Load("FMOD/ArrowUp.png") as Texture; + Texture downArrowTexture = EditorGUIUtility.Load("FMOD/ArrowDown.png") as Texture; + bankFoldOutState = EditorGUILayout.Foldout(bankFoldOutState, "Specified Banks", true); + if (bankFoldOutState) + { + for (int i = 0; i < settings.BanksToLoad.Count; i++) + { + EditorGUILayout.BeginHorizontal(); + EditorGUI.indentLevel++; + + var bankName = settings.BanksToLoad[i]; + EditorGUILayout.TextField(bankName.Replace(".bank", "")); + + if (GUILayout.Button(upArrowTexture, GUILayout.ExpandWidth(false))) + { + if (i > 0) + { + var temp = settings.BanksToLoad[i]; + settings.BanksToLoad[i] = settings.BanksToLoad[i - 1]; + settings.BanksToLoad[i - 1] = temp; + } + continue; + } + if (GUILayout.Button(downArrowTexture, GUILayout.ExpandWidth(false))) + { + if (i < settings.BanksToLoad.Count - 1) + { + var temp = settings.BanksToLoad[i]; + settings.BanksToLoad[i] = settings.BanksToLoad[i + 1]; + settings.BanksToLoad[i + 1] = temp; + } + continue; + } + + if (GUILayout.Button("Browse", GUILayout.ExpandWidth(false))) + { + GUI.FocusControl(null); + string path = EditorUtility.OpenFilePanel("Locate Bank", Application.streamingAssetsPath, "bank"); + if (!string.IsNullOrEmpty(path)) + { + settings.BanksToLoad[i] = path.Replace(Application.streamingAssetsPath + Path.AltDirectorySeparatorChar, ""); + Repaint(); + } + } + if (GUILayout.Button("Remove", GUILayout.ExpandWidth(false))) + { + Settings.Instance.BanksToLoad.RemoveAt(i); + continue; + } + EditorGUILayout.EndHorizontal(); + EditorGUI.indentLevel--; + } + + GUILayout.BeginHorizontal(); + GUILayout.Space(30); + if (GUILayout.Button("Add Bank", GUILayout.ExpandWidth(false))) + { + settings.BanksToLoad.Add(""); + } + if (GUILayout.Button("Add All Banks", GUILayout.ExpandWidth(false))) + { + FMODPlatform platform = RuntimeUtils.GetEditorFMODPlatform(); + if (platform == FMODPlatform.None) + { + platform = FMODPlatform.PlayInEditor; + } + var banksFound = new List(Directory.GetFiles(EditorUtils.GetBankDirectory(), "*.bank", SearchOption.AllDirectories)); + for (int i = 0; i < banksFound.Count; i++) + { + string path = Path.GetFullPath(banksFound[i]); + string bankShortName = Path.GetFullPath(path).Replace(EditorUtils.GetBankDirectory() + Path.DirectorySeparatorChar + settings.GetBankPlatform(platform) + Path.DirectorySeparatorChar, ""); + if (!settings.BanksToLoad.Contains(bankShortName)) + { + settings.BanksToLoad.Add(bankShortName); + } + } + Repaint(); + } + if (GUILayout.Button("Clear", GUILayout.ExpandWidth(false))) + { + settings.BanksToLoad.Clear(); + } + GUILayout.EndHorizontal(); + } + break; + case BankLoadType.None: + settings.AutomaticEventLoading = false; + break; + default: + break; + } + + EditorGUI.BeginDisabledGroup(settings.BankLoadType == BankLoadType.None); + settings.AutomaticSampleLoading = EditorGUILayout.Toggle("Load Bank Sample Data", settings.AutomaticSampleLoading); + EditorGUI.EndDisabledGroup(); + + EditorGUI.indentLevel--; + EditorGUI.EndDisabledGroup(); + + // ----- PIE ---------------------------------------------- + EditorGUILayout.Separator(); + EditorGUILayout.LabelField("Play In Editor Settings", style); + EditorGUI.indentLevel++; + DisplayEditorBool("Live Update", settings.LiveUpdateSettings, FMODPlatform.PlayInEditor); + if (settings.IsLiveUpdateEnabled(FMODPlatform.PlayInEditor)) + { + EditorGUILayout.BeginHorizontal(); + settings.LiveUpdatePort = ushort.Parse(EditorGUILayout.TextField("Live Update Port:", settings.LiveUpdatePort.ToString())); + if (GUILayout.Button("Reset", GUILayout.ExpandWidth(false))) + { + #if UNITY_5_0 || UNITY_5_1 + settings.LiveUpdatePort = 9265; + #else + settings.LiveUpdatePort = 9264; + #endif + } + EditorGUILayout.EndHorizontal(); + #if UNITY_5_0 || UNITY_5_1 + EditorGUILayout.HelpBox("Unity 5.0 or 5.1 detected: Live update will not be able to use port 9264", MessageType.Warning, false); + #endif + } + DisplayEditorBool("Debug Overlay", settings.OverlaySettings, FMODPlatform.PlayInEditor); + DisplayChildFreq("Sample Rate", settings.SampleRateSettings, FMODPlatform.PlayInEditor); + if (settings.HasPlatforms) + { + DisplayPIEBuildDirectory("Bank Platform", settings.BankDirectorySettings, FMODPlatform.PlayInEditor); + } + + DisplayPIESpeakerMode("Speaker Mode", settings.SpeakerModeSettings, FMODPlatform.PlayInEditor); + if (settings.HasPlatforms) + { + EditorGUILayout.HelpBox(string.Format("Match the speaker mode to the setting of the platform {0} inside FMOD Studio", settings.GetBankPlatform(FMODPlatform.PlayInEditor)), MessageType.Info, false); + } + else + { + EditorGUILayout.HelpBox("Match the speaker mode to the setting inside FMOD Studio", MessageType.Info, false); + } + + EditorGUI.indentLevel--; + + // ----- Default ---------------------------------------------- + EditorGUILayout.Separator(); + EditorGUILayout.LabelField("Default Settings", style); + EditorGUI.indentLevel++; + DisplayParentBool("Live Update", settings.LiveUpdateSettings, FMODPlatform.Default); + if (settings.IsLiveUpdateEnabled(FMODPlatform.Default)) + { + EditorGUILayout.HelpBox("Live update will listen on port 9264", MessageType.Info, false); + } + DisplayParentBool("Debug Overlay", settings.OverlaySettings, FMODPlatform.Default); + DisplayParentFreq("Sample Rate", settings.SampleRateSettings, FMODPlatform.Default); + if (settings.HasPlatforms) + { + bool prevChanged = GUI.changed; + DisplayParentBuildDirectory("Bank Platform", settings.BankDirectorySettings, FMODPlatform.Default); + hasBankSourceChanged |= !prevChanged && GUI.changed; + } + + DisplayParentSpeakerMode("Speaker Mode", settings.SpeakerModeSettings, FMODPlatform.Default); + if (settings.HasPlatforms) + { + EditorGUILayout.HelpBox(string.Format("Match the speaker mode to the setting of the platform {0} inside FMOD Studio", settings.GetBankPlatform(FMODPlatform.Default)), MessageType.Info, false); + } + else + { + EditorGUILayout.HelpBox("Match the speaker mode to the setting inside FMOD Studio", MessageType.Info, false); + } + DisplayParentInt("Virtual Channel Count", settings.VirtualChannelSettings, FMODPlatform.Default, 1, 2048); + DisplayParentInt("Real Channel Count", settings.RealChannelSettings, FMODPlatform.Default, 1, 256); + EditorGUI.indentLevel--; + + // ----- Plugins ---------------------------------------------- + EditorGUILayout.Separator(); + EditorGUILayout.BeginHorizontal(); + EditorGUILayout.PrefixLabel("Plugins", GUI.skin.button, style); + if (GUILayout.Button("Add Plugin", GUILayout.ExpandWidth(false))) + { + settings.Plugins.Add(""); + } + EditorGUILayout.EndHorizontal(); + + EditorGUI.indentLevel++; + for (int count = 0; count < settings.Plugins.Count; count++) + { + EditorGUILayout.BeginHorizontal(); + settings.Plugins[count] = EditorGUILayout.TextField("Plugin " + (count + 1).ToString() + ":", settings.Plugins[count]); + + if (GUILayout.Button("Delete Plugin", GUILayout.ExpandWidth(false))) + { + settings.Plugins.RemoveAt(count); + } + EditorGUILayout.EndHorizontal(); + } + EditorGUI.indentLevel--; + + // ----- Windows ---------------------------------------------- + DisplayPlatform(FMODPlatform.Desktop, null); + DisplayPlatform(FMODPlatform.Mobile, new FMODPlatform[] { FMODPlatform.MobileHigh, FMODPlatform.MobileLow, FMODPlatform.AppleTV }); + DisplayPlatform(FMODPlatform.Console, new FMODPlatform[] { FMODPlatform.XboxOne, FMODPlatform.PS4, FMODPlatform.Switch }); + + if (EditorGUI.EndChangeCheck()) + { + EditorUtility.SetDirty(settings); + } + + if (hasBankSourceChanged) + { + EventManager.UpdateCache(); + } + if (hasBankTargetChanged) + { + EventManager.CopyToStreamingAssets(); + } + } + + private string MakePathRelativeToProject(string path) + { + string fullPath = Path.GetFullPath(path); + string fullProjectPath = Path.GetFullPath(Environment.CurrentDirectory + Path.DirectorySeparatorChar); + return fullPath.Replace(fullProjectPath, ""); + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/FMOD/src/Editor/SettingsEditor.cs.meta b/Assets/Plugins/FMOD/src/Editor/SettingsEditor.cs.meta new file mode 100755 index 0000000..ec90526 --- /dev/null +++ b/Assets/Plugins/FMOD/src/Editor/SettingsEditor.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 353a9c870c318f74fa5fdcd475129bae +timeCreated: 1432530253 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/src/Editor/StudioBankLoaderEditor.cs b/Assets/Plugins/FMOD/src/Editor/StudioBankLoaderEditor.cs new file mode 100755 index 0000000..b14f34f --- /dev/null +++ b/Assets/Plugins/FMOD/src/Editor/StudioBankLoaderEditor.cs @@ -0,0 +1,101 @@ +using UnityEditor; +using UnityEngine; + +namespace FMODUnity +{ + [CustomEditor(typeof(StudioBankLoader))] + [CanEditMultipleObjects] + public class StudioBankLoaderEditor : Editor + { + public override void OnInspectorGUI() + { + var load = serializedObject.FindProperty("LoadEvent"); + var unload = serializedObject.FindProperty("UnloadEvent"); + var tag = serializedObject.FindProperty("CollisionTag"); + var banks = serializedObject.FindProperty("Banks"); + var preload = serializedObject.FindProperty("PreloadSamples"); + + EditorGUILayout.PropertyField(load, new GUIContent("Load")); + EditorGUILayout.PropertyField(unload, new GUIContent("Unload")); + + if ((load.enumValueIndex >= 3 && load.enumValueIndex <= 6) || + (unload.enumValueIndex >= 3 && unload.enumValueIndex <= 6)) + { + tag.stringValue = EditorGUILayout.TagField("Collision Tag", tag.stringValue); + } + + EditorGUILayout.PropertyField(preload, new GUIContent("Preload Sample Data")); + + EditorGUILayout.BeginHorizontal(); + EditorGUILayout.PrefixLabel("Banks"); + EditorGUILayout.BeginVertical(); + if (GUILayout.Button("Add Bank", GUILayout.ExpandWidth(false))) + { + banks.InsertArrayElementAtIndex(banks.arraySize); + SerializedProperty newBank = banks.GetArrayElementAtIndex(banks.arraySize - 1); + newBank.stringValue = ""; + + var browser = EventBrowser.CreateInstance(); + + browser.titleContent = new GUIContent("Select FMOD Bank"); + + browser.SelectBank(newBank); + browser.ShowUtility(); + } + + Texture deleteTexture = EditorGUIUtility.Load("FMOD/Delete.png") as Texture; + GUIContent deleteContent = new GUIContent(deleteTexture, "Delete Bank"); + + var buttonStyle = new GUIStyle(GUI.skin.button); + buttonStyle.padding.top = buttonStyle.padding.bottom = 1; + buttonStyle.margin.top = 2; + buttonStyle.padding.left = buttonStyle.padding.right = 4; + buttonStyle.fixedHeight = GUI.skin.textField.CalcSize(new GUIContent()).y; + + for (int i = 0; i < banks.arraySize; i++) + { + EditorGUILayout.BeginHorizontal(); + EditorGUILayout.PropertyField(banks.GetArrayElementAtIndex(i), GUIContent.none); + + if (GUILayout.Button(deleteContent, buttonStyle, GUILayout.ExpandWidth(false))) + { + banks.DeleteArrayElementAtIndex(i); + } + EditorGUILayout.EndHorizontal(); + } + EditorGUILayout.EndVertical(); + + EditorGUILayout.EndHorizontal(); + + Event e = Event.current; + if (e.type == EventType.DragPerform) + { + if (DragAndDrop.objectReferences.Length > 0 && + DragAndDrop.objectReferences[0] != null && + DragAndDrop.objectReferences[0].GetType() == typeof(EditorBankRef)) + { + int pos = banks.arraySize; + banks.InsertArrayElementAtIndex(pos); + var pathProperty = banks.GetArrayElementAtIndex(pos); + + pathProperty.stringValue = ((EditorBankRef)DragAndDrop.objectReferences[0]).Name; + + e.Use(); + } + } + if (e.type == EventType.DragUpdated) + { + if (DragAndDrop.objectReferences.Length > 0 && + DragAndDrop.objectReferences[0] != null && + DragAndDrop.objectReferences[0].GetType() == typeof(EditorBankRef)) + { + DragAndDrop.visualMode = DragAndDropVisualMode.Move; + DragAndDrop.AcceptDrag(); + e.Use(); + } + } + + serializedObject.ApplyModifiedProperties(); + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/FMOD/src/Editor/StudioBankLoaderEditor.cs.meta b/Assets/Plugins/FMOD/src/Editor/StudioBankLoaderEditor.cs.meta new file mode 100755 index 0000000..6c10c5d --- /dev/null +++ b/Assets/Plugins/FMOD/src/Editor/StudioBankLoaderEditor.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: f7f61e03a350e1e428dba6c562f3d64a +timeCreated: 1434691856 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/src/Editor/StudioEventEmitterEditor.cs b/Assets/Plugins/FMOD/src/Editor/StudioEventEmitterEditor.cs new file mode 100755 index 0000000..0336baa --- /dev/null +++ b/Assets/Plugins/FMOD/src/Editor/StudioEventEmitterEditor.cs @@ -0,0 +1,328 @@ +using System; +using System.Linq; +using UnityEditor; +using UnityEngine; + +namespace FMODUnity +{ + [CustomEditor(typeof(StudioEventEmitter))] + [CanEditMultipleObjects] + public class StudioEventEmitterEditor : Editor + { + public void OnSceneGUI() + { + var emitter = target as StudioEventEmitter; + + EditorEventRef editorEvent = EventManager.EventFromPath(emitter.Event); + if (editorEvent != null && editorEvent.Is3D) + { + EditorGUI.BeginChangeCheck(); + float minDistance = emitter.OverrideAttenuation ? emitter.OverrideMinDistance : editorEvent.MinDistance; + float maxDistance = emitter.OverrideAttenuation ? emitter.OverrideMaxDistance : editorEvent.MaxDistance; + minDistance = Handles.RadiusHandle(Quaternion.identity, emitter.transform.position, minDistance); + maxDistance = Handles.RadiusHandle(Quaternion.identity, emitter.transform.position, maxDistance); + if (EditorGUI.EndChangeCheck() && emitter.OverrideAttenuation) + { + Undo.RecordObject(emitter, "Change Emitter Bounds"); + emitter.OverrideMinDistance = Mathf.Clamp(minDistance, 0, emitter.OverrideMaxDistance); + emitter.OverrideMaxDistance = Mathf.Max(emitter.OverrideMinDistance, maxDistance); + } + } + } + + public override void OnInspectorGUI() + { + var begin = serializedObject.FindProperty("PlayEvent"); + var end = serializedObject.FindProperty("StopEvent"); + var tag = serializedObject.FindProperty("CollisionTag"); + var ev = serializedObject.FindProperty("Event"); + var param = serializedObject.FindProperty("Params"); + var fadeout = serializedObject.FindProperty("AllowFadeout"); + var once = serializedObject.FindProperty("TriggerOnce"); + var preload = serializedObject.FindProperty("Preload"); + var overrideAtt = serializedObject.FindProperty("OverrideAttenuation"); + var minDistance = serializedObject.FindProperty("OverrideMinDistance"); + var maxDistance = serializedObject.FindProperty("OverrideMaxDistance"); + + EditorGUILayout.PropertyField(begin, new GUIContent("Play Event")); + EditorGUILayout.PropertyField(end, new GUIContent("Stop Event")); + + if ((begin.enumValueIndex >= (int)EmitterGameEvent.TriggerEnter && begin.enumValueIndex <= (int)EmitterGameEvent.TriggerExit2D) || + (end.enumValueIndex >= (int)EmitterGameEvent.TriggerEnter && end.enumValueIndex <= (int)EmitterGameEvent.TriggerExit2D)) + { + tag.stringValue = EditorGUILayout.TagField("Collision Tag", tag.stringValue); + } + + EditorGUI.BeginChangeCheck(); + + EditorGUILayout.PropertyField(ev, new GUIContent("Event")); + + EditorEventRef editorEvent = EventManager.EventFromPath(ev.stringValue); + + if (EditorGUI.EndChangeCheck()) + { + EditorUtils.UpdateParamsOnEmitter(serializedObject, ev.stringValue); + if (editorEvent != null) + { + overrideAtt.boolValue = false; + minDistance.floatValue = editorEvent.MinDistance; + maxDistance.floatValue = editorEvent.MaxDistance; + } + } + + // Attenuation + if (editorEvent != null) + { + { + EditorGUI.BeginDisabledGroup(editorEvent == null || !editorEvent.Is3D); + EditorGUILayout.BeginHorizontal(); + EditorGUILayout.PrefixLabel("Override Attenuation"); + EditorGUI.BeginChangeCheck(); + overrideAtt.boolValue = EditorGUILayout.Toggle(overrideAtt.boolValue, GUILayout.Width(20)); + if (EditorGUI.EndChangeCheck() || + (minDistance.floatValue == -1 && maxDistance.floatValue == -1) // never been initialiased + ) + { + minDistance.floatValue = editorEvent.MinDistance; + maxDistance.floatValue = editorEvent.MaxDistance; + } + EditorGUI.BeginDisabledGroup(!overrideAtt.boolValue); + EditorGUIUtility.labelWidth = 30; + minDistance.floatValue = EditorGUILayout.FloatField("Min", minDistance.floatValue); + minDistance.floatValue = Mathf.Clamp(minDistance.floatValue, 0, maxDistance.floatValue); + maxDistance.floatValue = EditorGUILayout.FloatField("Max", maxDistance.floatValue); + maxDistance.floatValue = Mathf.Max(minDistance.floatValue, maxDistance.floatValue); + EditorGUIUtility.labelWidth = 0; + EditorGUI.EndDisabledGroup(); + EditorGUILayout.EndHorizontal(); + EditorGUI.EndDisabledGroup(); + } + + param.isExpanded = EditorGUILayout.Foldout(param.isExpanded, "Initial Parameter Values"); + if (ev.hasMultipleDifferentValues) + { + if (param.isExpanded) + { + GUILayout.Box("Cannot change parameters when different events are selected", GUILayout.ExpandWidth(true)); + } + } + else + { + var eventRef = EventManager.EventFromPath(ev.stringValue); + if (param.isExpanded && eventRef != null) + { + foreach (var paramRef in eventRef.Parameters) + { + bool set; + float value; + bool matchingSet, matchingValue; + CheckParameter(paramRef.Name, out set, out matchingSet, out value, out matchingValue); + + EditorGUILayout.BeginHorizontal(); + EditorGUILayout.PrefixLabel(paramRef.Name); + EditorGUI.showMixedValue = !matchingSet; + EditorGUI.BeginChangeCheck(); + bool newSet = EditorGUILayout.Toggle(set, GUILayout.Width(20)); + EditorGUI.showMixedValue = false; + + if (EditorGUI.EndChangeCheck()) + { + Undo.RecordObjects(serializedObject.isEditingMultipleObjects ? serializedObject.targetObjects : new UnityEngine.Object[] { serializedObject.targetObject }, "Inspector"); + if (newSet) + { + AddParameterValue(paramRef.Name, paramRef.Default); + } + else + { + DeleteParameterValue(paramRef.Name); + } + set = newSet; + } + + EditorGUI.BeginDisabledGroup(!newSet); + if (set) + { + EditorGUI.showMixedValue = !matchingValue; + EditorGUI.BeginChangeCheck(); + value = EditorGUILayout.Slider(value, paramRef.Min, paramRef.Max); + if (EditorGUI.EndChangeCheck()) + { + Undo.RecordObjects(serializedObject.isEditingMultipleObjects ? serializedObject.targetObjects : new UnityEngine.Object[] { serializedObject.targetObject }, "Inspector"); + SetParameterValue(paramRef.Name, value); + } + EditorGUI.showMixedValue = false; + } + else + { + EditorGUI.showMixedValue = !matchingValue; + EditorGUILayout.Slider(paramRef.Default, paramRef.Min, paramRef.Max); + EditorGUI.showMixedValue = false; + } + EditorGUI.EndDisabledGroup(); + EditorGUILayout.EndHorizontal(); + } + } + } + + fadeout.isExpanded = EditorGUILayout.Foldout(fadeout.isExpanded, "Advanced Controls"); + if (fadeout.isExpanded) + { + EditorGUILayout.PropertyField(preload, new GUIContent("Preload Sample Data")); + EditorGUILayout.PropertyField(fadeout, new GUIContent("Allow Fadeout When Stopping")); + EditorGUILayout.PropertyField(once, new GUIContent("Trigger Once")); + } + } + + serializedObject.ApplyModifiedProperties(); + } + + void CheckParameter(string name, out bool set, out bool matchingSet, out float value, out bool matchingValue) + { + value = 0; + set = false; + if (serializedObject.isEditingMultipleObjects) + { + bool first = true; + matchingValue = true; + matchingSet = true; + foreach (var obj in serializedObject.targetObjects) + { + var emitter = obj as StudioEventEmitter; + var param = emitter.Params != null ? emitter.Params.FirstOrDefault((x) => x.Name == name) : null; + if (first) + { + set = param != null; + value = set ? param.Value : 0; + first = false; + } + else + { + if (set) + { + if (param == null) + { + matchingSet = false; + matchingValue = false; + return; + } + else + { + if (param.Value != value) + { + matchingValue = false; + } + } + } + else + { + if (param != null) + { + matchingSet = false; + } + } + } + } + } + else + { + matchingSet = matchingValue = true; + + var emitter = serializedObject.targetObject as StudioEventEmitter; + var param = emitter.Params != null ? emitter.Params.FirstOrDefault((x) => x.Name == name) : null; + if (param != null) + { + set = true; + value = param.Value; + } + } + } + + void SetParameterValue(string name, float value) + { + if (serializedObject.isEditingMultipleObjects) + { + foreach (var obj in serializedObject.targetObjects) + { + SetParameterValue(obj, name, value); + } + } + else + { + SetParameterValue(serializedObject.targetObject, name, value); + } + } + + void SetParameterValue(UnityEngine.Object obj, string name, float value) + { + var emitter = obj as StudioEventEmitter; + var param = emitter.Params != null ? emitter.Params.FirstOrDefault((x) => x.Name == name) : null; + if (param != null) + { + param.Value = value; + } + } + + void AddParameterValue(string name, float value) + { + if (serializedObject.isEditingMultipleObjects) + { + foreach (var obj in serializedObject.targetObjects) + { + AddParameterValue(obj, name, value); + } + } + else + { + AddParameterValue(serializedObject.targetObject, name, value); + } + } + + void AddParameterValue(UnityEngine.Object obj, string name, float value) + { + var emitter = obj as StudioEventEmitter; + var param = emitter.Params != null ? emitter.Params.FirstOrDefault((x) => x.Name == name) : null; + if (param == null) + { + int end = emitter.Params.Length; + Array.Resize(ref emitter.Params, end + 1); + emitter.Params[end] = new ParamRef(); + emitter.Params[end].Name = name; + emitter.Params[end].Value = value; + } + } + + void DeleteParameterValue(string name) + { + if (serializedObject.isEditingMultipleObjects) + { + foreach (var obj in serializedObject.targetObjects) + { + DeleteParameterValue(obj, name); + } + } + else + { + DeleteParameterValue(serializedObject.targetObject, name); + } + } + + void DeleteParameterValue(UnityEngine.Object obj, string name) + { + var emitter = obj as StudioEventEmitter; + int found = -1; + for (int i = 0; i < emitter.Params.Length; i++) + { + if (emitter.Params[i].Name == name) + { + found = i; + } + } + if (found >= 0) + { + int end = emitter.Params.Length - 1; + emitter.Params[found] = emitter.Params[end]; + Array.Resize(ref emitter.Params, end); + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/FMOD/src/Editor/StudioEventEmitterEditor.cs.meta b/Assets/Plugins/FMOD/src/Editor/StudioEventEmitterEditor.cs.meta new file mode 100755 index 0000000..043c1ca --- /dev/null +++ b/Assets/Plugins/FMOD/src/Editor/StudioEventEmitterEditor.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 2b044fd4ebf2c42468e1f41d5e2b879c +timeCreated: 1434696182 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/src/Editor/StudioEventEmitterGizmoDrawer.cs b/Assets/Plugins/FMOD/src/Editor/StudioEventEmitterGizmoDrawer.cs new file mode 100755 index 0000000..bd24f8d --- /dev/null +++ b/Assets/Plugins/FMOD/src/Editor/StudioEventEmitterGizmoDrawer.cs @@ -0,0 +1,14 @@ +using UnityEngine; +using UnityEditor; + +namespace FMODUnity +{ + public class StudioEventEmitterGizoDrawer + { + [DrawGizmo(GizmoType.Selected | GizmoType.Active | GizmoType.NotInSelectionHierarchy | GizmoType.Pickable)] + static void DrawGizmo(StudioEventEmitter studioEmitter, GizmoType gizmoType) + { + Gizmos.DrawIcon(studioEmitter.transform.position, "FMOD/FMODEmitter.tiff", true); + } + } +} diff --git a/Assets/Plugins/FMOD/src/Editor/StudioEventEmitterGizmoDrawer.cs.meta b/Assets/Plugins/FMOD/src/Editor/StudioEventEmitterGizmoDrawer.cs.meta new file mode 100755 index 0000000..0296f94 --- /dev/null +++ b/Assets/Plugins/FMOD/src/Editor/StudioEventEmitterGizmoDrawer.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: f09ba26caab55e048a2e596ff75b3eab +timeCreated: 1433142677 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/src/Editor/StudioGlobalParameterTriggerEditor.cs b/Assets/Plugins/FMOD/src/Editor/StudioGlobalParameterTriggerEditor.cs new file mode 100755 index 0000000..fa94f40 --- /dev/null +++ b/Assets/Plugins/FMOD/src/Editor/StudioGlobalParameterTriggerEditor.cs @@ -0,0 +1,60 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using UnityEditor; +using UnityEngine; + +namespace FMODUnity +{ + [CustomEditor(typeof(StudioGlobalParameterTrigger))] + public class StudioGlobalParameterTriggerEditor : Editor + { + SerializedProperty param; + SerializedProperty trigger; + SerializedProperty tag; + SerializedProperty value; + + SerializedProperty data1, data2; + + [SerializeField] + EditorParamRef editorParamRef; + + void OnEnable() + { + param = serializedObject.FindProperty("parameter"); + trigger = serializedObject.FindProperty("TriggerEvent"); + tag = serializedObject.FindProperty("CollisionTag"); + value = serializedObject.FindProperty("value"); + } + + public override void OnInspectorGUI() + { + EditorGUILayout.PropertyField(trigger, new GUIContent("Trigger")); + if (trigger.enumValueIndex >= (int)EmitterGameEvent.TriggerEnter && trigger.enumValueIndex <= (int)EmitterGameEvent.TriggerExit2D) + { + tag.stringValue = EditorGUILayout.TagField("Collision Tag", tag.stringValue); + } + + EditorGUI.BeginChangeCheck(); + + var oldParam = param.stringValue; + EditorGUILayout.PropertyField(param, new GUIContent("Parameter")); + + if (!String.IsNullOrEmpty(param.stringValue)) + { + if (!editorParamRef || param.stringValue != oldParam) + { + editorParamRef = EventManager.ParamFromPath(param.stringValue); + } + + EditorGUILayout.BeginHorizontal(); + EditorGUILayout.PrefixLabel("Override Value"); + value.floatValue = EditorGUILayout.Slider(value.floatValue, editorParamRef.Min, editorParamRef.Max); + EditorGUILayout.EndHorizontal(); + } + + serializedObject.ApplyModifiedProperties(); + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/FMOD/src/Editor/StudioGlobalParameterTriggerEditor.cs.meta b/Assets/Plugins/FMOD/src/Editor/StudioGlobalParameterTriggerEditor.cs.meta new file mode 100755 index 0000000..7728f87 --- /dev/null +++ b/Assets/Plugins/FMOD/src/Editor/StudioGlobalParameterTriggerEditor.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 0a901681b5558f247b4c227fb425c010 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/src/Editor/StudioListenerEditor.cs b/Assets/Plugins/FMOD/src/Editor/StudioListenerEditor.cs new file mode 100755 index 0000000..961122c --- /dev/null +++ b/Assets/Plugins/FMOD/src/Editor/StudioListenerEditor.cs @@ -0,0 +1,16 @@ +using UnityEditor; + +namespace FMODUnity +{ + [CustomEditor(typeof(StudioListener))] + [CanEditMultipleObjects] + public class StudioListenerEditor : Editor + { + public override void OnInspectorGUI() + { + var index = serializedObject.FindProperty("ListenerNumber"); + EditorGUILayout.IntSlider(index, 0, FMOD.CONSTANTS.MAX_LISTENERS, "Listener Index"); + serializedObject.ApplyModifiedProperties(); + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/FMOD/src/Editor/StudioListenerEditor.cs.meta b/Assets/Plugins/FMOD/src/Editor/StudioListenerEditor.cs.meta new file mode 100755 index 0000000..27ef28e --- /dev/null +++ b/Assets/Plugins/FMOD/src/Editor/StudioListenerEditor.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 847f8505c25f5cf42adba68a26f2cda6 +timeCreated: 1445576758 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/src/Editor/StudioParameterTriggerEditor.cs b/Assets/Plugins/FMOD/src/Editor/StudioParameterTriggerEditor.cs new file mode 100755 index 0000000..04d9ef2 --- /dev/null +++ b/Assets/Plugins/FMOD/src/Editor/StudioParameterTriggerEditor.cs @@ -0,0 +1,148 @@ +using System.Collections.Generic; +using UnityEditor; +using UnityEngine; + +namespace FMODUnity +{ + [CustomEditor(typeof(StudioParameterTrigger))] + public class StudioParameterTriggerEditor : Editor + { + StudioEventEmitter targetEmitter; + SerializedProperty emitters; + SerializedProperty trigger; + SerializedProperty tag; + + bool[] expanded; + + void OnEnable() + { + emitters = serializedObject.FindProperty("Emitters"); + trigger = serializedObject.FindProperty("TriggerEvent"); + tag = serializedObject.FindProperty("CollisionTag"); + targetEmitter = null; + for (int i = 0; i < emitters.arraySize; i++) + { + targetEmitter = emitters.GetArrayElementAtIndex(i).FindPropertyRelative("Target").objectReferenceValue as StudioEventEmitter; + if (targetEmitter != null) + { + expanded = new bool[targetEmitter.GetComponents().Length]; + break; + } + } + } + + public override void OnInspectorGUI() + { + var newTargetEmitter = EditorGUILayout.ObjectField("Target", targetEmitter, typeof(StudioEventEmitter), true) as StudioEventEmitter; + if (newTargetEmitter != targetEmitter) + { + emitters.ClearArray(); + targetEmitter = newTargetEmitter; + + if (targetEmitter == null) + { + serializedObject.ApplyModifiedProperties(); + return; + } + + List newEmitters = new List(); + targetEmitter.GetComponents(newEmitters); + expanded = new bool[newEmitters.Count]; + foreach (var emitter in newEmitters) + { + emitters.InsertArrayElementAtIndex(0); + emitters.GetArrayElementAtIndex(0).FindPropertyRelative("Target").objectReferenceValue = emitter; + } + } + + if (targetEmitter == null) + { + return; + } + + EditorGUILayout.PropertyField(trigger, new GUIContent("Trigger")); + + if (trigger.enumValueIndex >= (int)EmitterGameEvent.TriggerEnter && trigger.enumValueIndex <= (int)EmitterGameEvent.TriggerExit2D) + { + tag.stringValue = EditorGUILayout.TagField("Collision Tag", tag.stringValue); + } + + var localEmitters = new List(); + targetEmitter.GetComponents(localEmitters); + + int emitterIndex = 0; + foreach (var emitter in localEmitters) + { + SerializedProperty emitterProperty = null; + for(int i = 0; i < emitters.arraySize; i++) + { + if (emitters.GetArrayElementAtIndex(i).FindPropertyRelative("Target").objectReferenceValue == emitter) + { + emitterProperty = emitters.GetArrayElementAtIndex(i); + break; + } + } + + // New emitter component added to game object since we last looked + if (emitterProperty == null) + { + emitters.InsertArrayElementAtIndex(0); + emitterProperty = emitters.GetArrayElementAtIndex(0); + emitterProperty.FindPropertyRelative("Target").objectReferenceValue = emitter; + } + + if (!string.IsNullOrEmpty(emitter.Event)) + { + expanded[emitterIndex] = EditorGUILayout.Foldout(expanded[emitterIndex], emitter.Event); + if (expanded[emitterIndex]) + { + var eventRef = EventManager.EventFromPath(emitter.Event); + foreach (var paramRef in eventRef.Parameters) + { + bool set = false; + int index = -1; + for (int i = 0; i < emitterProperty.FindPropertyRelative("Params").arraySize; i++) + { + if (emitterProperty.FindPropertyRelative("Params").GetArrayElementAtIndex(i).FindPropertyRelative("Name").stringValue == paramRef.Name) + { + index = i; + set = true; + break; + } + } + EditorGUILayout.BeginHorizontal(); + EditorGUILayout.PrefixLabel(paramRef.Name); + bool newSet = GUILayout.Toggle(set, ""); + if (!set && newSet) + { + index = 0; + emitterProperty.FindPropertyRelative("Params").InsertArrayElementAtIndex(0); + emitterProperty.FindPropertyRelative("Params").GetArrayElementAtIndex(0).FindPropertyRelative("Name").stringValue = paramRef.Name; + emitterProperty.FindPropertyRelative("Params").GetArrayElementAtIndex(0).FindPropertyRelative("Value").floatValue = 0; + } + if (set && !newSet) + { + emitterProperty.FindPropertyRelative("Params").DeleteArrayElementAtIndex(index); + } + set = newSet; + EditorGUI.BeginDisabledGroup(!set); + if (set) + { + var valueProperty = emitterProperty.FindPropertyRelative("Params").GetArrayElementAtIndex(index).FindPropertyRelative("Value"); + valueProperty.floatValue = EditorGUILayout.Slider(valueProperty.floatValue, paramRef.Min, paramRef.Max); + } + else + { + EditorGUILayout.Slider(0, paramRef.Min, paramRef.Max); + } + EditorGUI.EndDisabledGroup(); + EditorGUILayout.EndHorizontal(); + } + } + } + emitterIndex++; + } + serializedObject.ApplyModifiedProperties(); + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/FMOD/src/Editor/StudioParameterTriggerEditor.cs.meta b/Assets/Plugins/FMOD/src/Editor/StudioParameterTriggerEditor.cs.meta new file mode 100755 index 0000000..fc4e483 --- /dev/null +++ b/Assets/Plugins/FMOD/src/Editor/StudioParameterTriggerEditor.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: dc94d213814ef1a42b0ca8ee00dd4728 +timeCreated: 1451968823 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/src/Editor/Timeline.meta b/Assets/Plugins/FMOD/src/Editor/Timeline.meta new file mode 100755 index 0000000..3bdbbb0 --- /dev/null +++ b/Assets/Plugins/FMOD/src/Editor/Timeline.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 4e03eecb9c762874b9bdb393ee5d8db4 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/src/Editor/Timeline/FMODEventPlayableEditor.cs b/Assets/Plugins/FMOD/src/Editor/Timeline/FMODEventPlayableEditor.cs new file mode 100755 index 0000000..6284607 --- /dev/null +++ b/Assets/Plugins/FMOD/src/Editor/Timeline/FMODEventPlayableEditor.cs @@ -0,0 +1,144 @@ +using UnityEditor; +using UnityEngine; +using FMODUnity; +using System; +using System.Linq; + +[CustomEditor(typeof(FMODEventPlayable))] +public class FMODEventPlayableEditor : Editor +{ + private FMODEventPlayable eventPlayable; + private EditorEventRef editorEventRef; + + public void OnEnable() + { + eventPlayable = target as FMODEventPlayable; + if (eventPlayable && !string.IsNullOrEmpty(eventPlayable.eventName)) + { + editorEventRef = EventManager.EventFromPath(eventPlayable.eventName); + eventPlayable.UpdateEventDuration(editorEventRef.IsOneShot ? editorEventRef.Length : float.PositiveInfinity); + } + } + + public override void OnInspectorGUI() + { + serializedObject.Update(); + + var ev = serializedObject.FindProperty("eventName"); + var stopType = serializedObject.FindProperty("stopType"); + + EditorGUILayout.PropertyField(ev, new GUIContent("Event")); + + var eventRef = EventManager.EventFromPath(ev.stringValue); + + if (eventRef != null && eventRef.Parameters.Count > 0) + { + foreach (var paramRef in eventRef.Parameters) + { + bool set; + float value; + CheckParameter(paramRef.Name, out set, out value); + + EditorGUILayout.BeginHorizontal(); + EditorGUILayout.PrefixLabel(paramRef.Name); + EditorGUI.BeginChangeCheck(); + bool newSet = EditorGUILayout.Toggle(set, GUILayout.Width(20)); + + if (EditorGUI.EndChangeCheck()) + { + Undo.RecordObjects(new UnityEngine.Object[] { serializedObject.targetObject }, "Inspector"); + if (newSet) + { + AddParameterValue(serializedObject.targetObject, paramRef.Name, paramRef.Default); + } + else + { + DeleteParameterValue(serializedObject.targetObject, paramRef.Name); + } + set = newSet; + } + + if (set) + { + EditorGUI.BeginChangeCheck(); + value = EditorGUILayout.Slider(value, paramRef.Min, paramRef.Max); + if (EditorGUI.EndChangeCheck()) + { + Undo.RecordObjects(new UnityEngine.Object[] { serializedObject.targetObject }, "Inspector"); + SetParameterValue(serializedObject.targetObject, paramRef.Name, value); + } + } + else + { + EditorGUILayout.Slider(paramRef.Default, paramRef.Min, paramRef.Max); + } + EditorGUILayout.EndHorizontal(); + } + } + + EditorGUILayout.PropertyField(stopType, new GUIContent("Stop Mode")); + + if (eventPlayable) + { + eventPlayable.OnValidate(); + } + serializedObject.ApplyModifiedProperties(); + } + + void CheckParameter(string name, out bool set, out float value) + { + value = 0; + set = false; + + var playable = serializedObject.targetObject as FMODEventPlayable; + var param = playable.parameters != null ? playable.parameters.FirstOrDefault((x) => x.Name == name) : null; + if (param != null) + { + set = true; + value = param.Value; + } + } + + void SetParameterValue(UnityEngine.Object obj, string name, float value) + { + var playable = obj as FMODEventPlayable; + var param = playable.parameters != null ? playable.parameters.FirstOrDefault((x) => x.Name == name) : null; + if (param != null) + { + param.Value = value; + } + } + + void AddParameterValue(UnityEngine.Object obj, string name, float value) + { + var playable = obj as FMODEventPlayable; + var param = playable.parameters != null ? playable.parameters.FirstOrDefault((x) => x.Name == name) : null; + if (param == null) + { + int end = playable.parameters.Length; + Array.Resize(ref playable.parameters, end + 1); + playable.parameters[end] = new ParamRef(); + playable.parameters[end].Name = name; + playable.parameters[end].Value = value; + } + } + + void DeleteParameterValue(UnityEngine.Object obj, string name) + { + var emitter = obj as FMODEventPlayable; + int found = -1; + for (int i = 0; i < emitter.parameters.Length; i++) + { + if (emitter.parameters[i].Name == name) + { + found = i; + } + } + if (found >= 0) + { + int end = emitter.parameters.Length - 1; + emitter.parameters[found] = emitter.parameters[end]; + Array.Resize(ref emitter.parameters, end); + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/FMOD/src/Editor/Timeline/FMODEventPlayableEditor.cs.meta b/Assets/Plugins/FMOD/src/Editor/Timeline/FMODEventPlayableEditor.cs.meta new file mode 100755 index 0000000..ecbaeb4 --- /dev/null +++ b/Assets/Plugins/FMOD/src/Editor/Timeline/FMODEventPlayableEditor.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: fa325be8441506c4bb1462c8333ccce9 +timeCreated: 1523230773 +licenseType: Free +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/src/Runtime.meta b/Assets/Plugins/FMOD/src/Runtime.meta new file mode 100755 index 0000000..b1fea48 --- /dev/null +++ b/Assets/Plugins/FMOD/src/Runtime.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 5403e1e7e2b4ebb4ea8affc8a5ca84d8 +folderAsset: yes +timeCreated: 1552564451 +licenseType: Free +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/src/Runtime/BankRefAttribute.cs b/Assets/Plugins/FMOD/src/Runtime/BankRefAttribute.cs new file mode 100755 index 0000000..d1329b2 --- /dev/null +++ b/Assets/Plugins/FMOD/src/Runtime/BankRefAttribute.cs @@ -0,0 +1,8 @@ +using UnityEngine; + +namespace FMODUnity +{ + public class BankRefAttribute : PropertyAttribute + { + } +} diff --git a/Assets/Plugins/FMOD/src/Runtime/BankRefAttribute.cs.meta b/Assets/Plugins/FMOD/src/Runtime/BankRefAttribute.cs.meta new file mode 100755 index 0000000..06ddbb1 --- /dev/null +++ b/Assets/Plugins/FMOD/src/Runtime/BankRefAttribute.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: a8ab5f38e7776644297d8b3687c39b49 +timeCreated: 1445488716 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/src/Runtime/EventRefAttribute.cs b/Assets/Plugins/FMOD/src/Runtime/EventRefAttribute.cs new file mode 100755 index 0000000..78d188c --- /dev/null +++ b/Assets/Plugins/FMOD/src/Runtime/EventRefAttribute.cs @@ -0,0 +1,8 @@ +using UnityEngine; + +namespace FMODUnity +{ + public class EventRefAttribute : PropertyAttribute + { + } +} diff --git a/Assets/Plugins/FMOD/src/Runtime/EventRefAttribute.cs.meta b/Assets/Plugins/FMOD/src/Runtime/EventRefAttribute.cs.meta new file mode 100755 index 0000000..96cb1d9 --- /dev/null +++ b/Assets/Plugins/FMOD/src/Runtime/EventRefAttribute.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 1b29a1189268c3b47aa2ec4b96a9e7ef +timeCreated: 1445311748 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/src/Runtime/ParamRef.cs b/Assets/Plugins/FMOD/src/Runtime/ParamRef.cs new file mode 100755 index 0000000..9cc13c7 --- /dev/null +++ b/Assets/Plugins/FMOD/src/Runtime/ParamRef.cs @@ -0,0 +1,12 @@ +using System; + +namespace FMODUnity +{ + [Serializable] + public class ParamRef + { + public string Name; + public float Value; + public FMOD.Studio.PARAMETER_ID ID; + } +} diff --git a/Assets/Plugins/FMOD/src/Runtime/ParamRef.cs.meta b/Assets/Plugins/FMOD/src/Runtime/ParamRef.cs.meta new file mode 100755 index 0000000..43c1ef3 --- /dev/null +++ b/Assets/Plugins/FMOD/src/Runtime/ParamRef.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 00e1a9817a5d9844796d7c313b1ab197 +timeCreated: 1444192631 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/src/Runtime/ParamRefAttribute.cs b/Assets/Plugins/FMOD/src/Runtime/ParamRefAttribute.cs new file mode 100755 index 0000000..2c61397 --- /dev/null +++ b/Assets/Plugins/FMOD/src/Runtime/ParamRefAttribute.cs @@ -0,0 +1,8 @@ +using UnityEngine; + +namespace FMODUnity +{ + public class ParamRefAttribute : PropertyAttribute + { + } +} diff --git a/Assets/Plugins/FMOD/src/Runtime/ParamRefAttribute.cs.meta b/Assets/Plugins/FMOD/src/Runtime/ParamRefAttribute.cs.meta new file mode 100755 index 0000000..1704608 --- /dev/null +++ b/Assets/Plugins/FMOD/src/Runtime/ParamRefAttribute.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 7ae6224668d1647429723f89e10d593f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/src/Runtime/RuntimeManager.cs b/Assets/Plugins/FMOD/src/Runtime/RuntimeManager.cs new file mode 100755 index 0000000..48bfbe5 --- /dev/null +++ b/Assets/Plugins/FMOD/src/Runtime/RuntimeManager.cs @@ -0,0 +1,1075 @@ +using System; +using System.Collections.Generic; +using System.Text; +using UnityEngine; + +#if UNITY_EDITOR +using UnityEditor; +#endif + +namespace FMODUnity +{ + [AddComponentMenu("")] + public class RuntimeManager : MonoBehaviour + { + static SystemNotInitializedException initException = null; + static RuntimeManager instance; + + [SerializeField] + FMODPlatform fmodPlatform; + + [AOT.MonoPInvokeCallback(typeof(FMOD.DEBUG_CALLBACK))] + static FMOD.RESULT DEBUG_CALLBACK(FMOD.DEBUG_FLAGS flags, FMOD.StringWrapper file, int line, FMOD.StringWrapper func, FMOD.StringWrapper message) + { + if (flags == FMOD.DEBUG_FLAGS.ERROR) + { + Debug.LogError(string.Format(("[FMOD] {0} : {1}"), (string)func, (string)message)); + } + else if (flags == FMOD.DEBUG_FLAGS.WARNING) + { + Debug.LogWarning(string.Format(("[FMOD] {0} : {1}"), (string)func, (string)message)); + } + else if (flags == FMOD.DEBUG_FLAGS.LOG) + { + Debug.Log(string.Format(("[FMOD] {0} : {1}"), (string)func, (string)message)); + } + return FMOD.RESULT.OK; + } + + static RuntimeManager Instance + { + get + { + if (initException != null) + { + throw initException; + } + + if (instance == null) + { + FMOD.RESULT initResult = FMOD.RESULT.OK; // Initialize can return an error code if it falls back to NO_SOUND, throw it as a non-cached exception + + var existing = FindObjectsOfType(typeof(RuntimeManager)) as RuntimeManager[]; + foreach (var iter in existing) + { + if (existing != null) + { + // Older versions of the integration may have leaked the runtime manager game object into the scene, + // which was then serialized. It won't have valid pointers so don't use it. + if (iter.cachedPointers[0] != 0) + { + instance = iter; + instance.studioSystem.handle = ((IntPtr)instance.cachedPointers[0]); + instance.coreSystem.handle = ((IntPtr)instance.cachedPointers[1]); + } + DestroyImmediate(iter); + } + } + + var gameObject = new GameObject("FMOD.UnityIntegration.RuntimeManager"); + instance = gameObject.AddComponent(); + + if (Application.isPlaying) // This class is used in edit mode by the Timeline auditioning system + { + DontDestroyOnLoad(gameObject); + } + gameObject.hideFlags = HideFlags.HideAndDontSave; + + try + { + #if UNITY_ANDROID && !UNITY_EDITOR + // First, obtain the current activity context + AndroidJavaObject activity = null; + using (var activityClass = new AndroidJavaClass("com.unity3d.player.UnityPlayer")) + { + activity = activityClass.GetStatic("currentActivity"); + } + + using (var fmodJava = new AndroidJavaClass("org.fmod.FMOD")) + { + if (fmodJava != null) + { + fmodJava.CallStatic("init", activity); + } + else + { + UnityEngine.Debug.LogWarning("[FMOD] Cannot initialize Java wrapper"); + } + } + #endif + + RuntimeUtils.EnforceLibraryOrder(); + initResult = instance.Initialize(); + } + catch (Exception e) + { + initException = e as SystemNotInitializedException; + if (initException == null) + { + initException = new SystemNotInitializedException(e); + } + throw initException; + } + + if (initResult != FMOD.RESULT.OK) + { + throw new SystemNotInitializedException(initResult, "Output forced to NO SOUND mode"); + } + } + return instance; + } + } + + public static FMOD.Studio.System StudioSystem + { + get { return Instance.studioSystem; } + } + + public static FMOD.System CoreSystem + { + get { return Instance.coreSystem; } + } + + FMOD.Studio.System studioSystem; + FMOD.System coreSystem; + FMOD.DSP mixerHead; + + [SerializeField] + private long[] cachedPointers = new long[2]; + + struct LoadedBank + { + public FMOD.Studio.Bank Bank; + public int RefCount; + } + + Dictionary loadedBanks = new Dictionary(); + Dictionary loadedPlugins = new Dictionary(); + + // Explicit comparer to avoid issues on platforms that don't support JIT compilation + class GuidComparer : IEqualityComparer + { + bool IEqualityComparer.Equals(Guid x, Guid y) + { + return x.Equals(y); + } + + int IEqualityComparer.GetHashCode(Guid obj) + { + return obj.GetHashCode(); + } + } + Dictionary cachedDescriptions = new Dictionary(new GuidComparer()); + + void CheckInitResult(FMOD.RESULT result, string cause) + { + if (result != FMOD.RESULT.OK) + { + if (studioSystem.isValid()) + { + studioSystem.release(); + studioSystem.clearHandle(); + } + throw new SystemNotInitializedException(result, cause); + } + } + + FMOD.RESULT Initialize() + { + #if UNITY_EDITOR + EditorApplication.playModeStateChanged += HandlePlayModeStateChange; + #endif // UNITY_EDITOR + + FMOD.RESULT result = FMOD.RESULT.OK; + FMOD.RESULT initResult = FMOD.RESULT.OK; + Settings fmodSettings = Settings.Instance; + fmodPlatform = RuntimeUtils.GetCurrentPlatform(); + + int sampleRate = fmodSettings.GetSampleRate(fmodPlatform); + int realChannels = Math.Min(fmodSettings.GetRealChannels(fmodPlatform), 256); + int virtualChannels = fmodSettings.GetVirtualChannels(fmodPlatform); + FMOD.SPEAKERMODE speakerMode = (FMOD.SPEAKERMODE)fmodSettings.GetSpeakerMode(fmodPlatform); + FMOD.OUTPUTTYPE outputType = FMOD.OUTPUTTYPE.AUTODETECT; + + FMOD.ADVANCEDSETTINGS advancedSettings = new FMOD.ADVANCEDSETTINGS(); + advancedSettings.randomSeed = (uint)DateTime.Now.Ticks; + #if UNITY_EDITOR || UNITY_STANDALONE + advancedSettings.maxVorbisCodecs = realChannels; + #elif UNITY_XBOXONE + advancedSettings.maxXMACodecs = realChannels; + #elif UNITY_PS4 + advancedSettings.maxAT9Codecs = realChannels; + #else + advancedSettings.maxFADPCMCodecs = realChannels; + #endif + + SetThreadAffinity(); + + #if UNITY_EDITOR || DEVELOPMENT_BUILD + result = FMOD.Debug.Initialize(fmodSettings.LoggingLevel, FMOD.DEBUG_MODE.CALLBACK, DEBUG_CALLBACK, null); + CheckInitResult(result, "FMOD.Debug.Initialize"); + #endif + + FMOD.Studio.INITFLAGS studioInitFlags = FMOD.Studio.INITFLAGS.NORMAL | FMOD.Studio.INITFLAGS.DEFERRED_CALLBACKS; + if (fmodSettings.IsLiveUpdateEnabled(fmodPlatform)) + { + studioInitFlags |= FMOD.Studio.INITFLAGS.LIVEUPDATE; + advancedSettings.profilePort = fmodSettings.LiveUpdatePort; + } + +retry: + result = FMOD.Studio.System.create(out studioSystem); + CheckInitResult(result, "FMOD.Studio.System.create"); + + result = studioSystem.getCoreSystem(out coreSystem); + CheckInitResult(result, "FMOD.Studio.System.getCoreSystem"); + + result = coreSystem.setOutput(outputType); + CheckInitResult(result, "FMOD.System.setOutput"); + + result = coreSystem.setSoftwareChannels(realChannels); + CheckInitResult(result, "FMOD.System.setSoftwareChannels"); + + result = coreSystem.setSoftwareFormat(sampleRate, speakerMode, 0); + CheckInitResult(result, "FMOD.System.setSoftwareFormat"); + + result = coreSystem.setAdvancedSettings(ref advancedSettings); + CheckInitResult(result, "FMOD.System.setAdvancedSettings"); + + result = studioSystem.initialize(virtualChannels, studioInitFlags, FMOD.INITFLAGS.NORMAL, IntPtr.Zero); + if (result != FMOD.RESULT.OK && initResult == FMOD.RESULT.OK) + { + initResult = result; // Save this to throw at the end (we'll attempt NO SOUND to shield ourselves from unexpected device failures) + outputType = FMOD.OUTPUTTYPE.NOSOUND; + UnityEngine.Debug.LogErrorFormat("[FMOD] Studio::System::initialize returned {0}, defaulting to no-sound mode.", result.ToString()); + + goto retry; + } + CheckInitResult(result, "Studio::System::initialize"); + + // Test network functionality triggered during System::update + if ((studioInitFlags & FMOD.Studio.INITFLAGS.LIVEUPDATE) != 0) + { + studioSystem.flushCommands(); // Any error will be returned through Studio.System.update + + result = studioSystem.update(); + if (result == FMOD.RESULT.ERR_NET_SOCKET_ERROR) + { + studioInitFlags &= ~FMOD.Studio.INITFLAGS.LIVEUPDATE; + UnityEngine.Debug.LogWarning("[FMOD] Cannot open network port for Live Update (in-use), restarting with Live Update disabled."); + + result = studioSystem.release(); + CheckInitResult(result, "FMOD.Studio.System.Release"); + + goto retry; + } + } + + LoadPlugins(fmodSettings); + LoadBanks(fmodSettings); + + return initResult; + } + + class AttachedInstance + { + public FMOD.Studio.EventInstance instance; + public Transform transform; + public Rigidbody rigidBody; + public Rigidbody2D rigidBody2D; + } + + List attachedInstances = new List(128); + + #if UNITY_EDITOR + List eventPositionWarnings = new List(); + #endif + + bool listenerWarningIssued = false; + void Update() + { + if (studioSystem.isValid()) + { + bool foundListener = false; + bool hasAllListeners = false; + int numListeners = 0; + for (int i = FMOD.CONSTANTS.MAX_LISTENERS - 1; i >= 0; i--) + { + if (!foundListener && HasListener[i]) + { + numListeners = i + 1; + foundListener = true; + hasAllListeners = true; + } + + if (!HasListener[i] && foundListener) + { + hasAllListeners = false; + } + } + + if (foundListener) + { + studioSystem.setNumListeners(numListeners); + } + + if (!hasAllListeners && !listenerWarningIssued) + { + listenerWarningIssued = true; + UnityEngine.Debug.LogWarning("[FMOD] Please add an 'FMOD Studio Listener' component to your a camera in the scene for correct 3D positioning of sounds"); + } + + for (int i = 0; i < attachedInstances.Count; i++) + { + FMOD.Studio.PLAYBACK_STATE playbackState = FMOD.Studio.PLAYBACK_STATE.STOPPED; + attachedInstances[i].instance.getPlaybackState(out playbackState); + if (!attachedInstances[i].instance.isValid() || + playbackState == FMOD.Studio.PLAYBACK_STATE.STOPPED || + attachedInstances[i].transform == null // destroyed game object + ) + { + attachedInstances.RemoveAt(i); + i--; + continue; + } + + if (attachedInstances[i].rigidBody) + { + attachedInstances[i].instance.set3DAttributes(RuntimeUtils.To3DAttributes(attachedInstances[i].transform, attachedInstances[i].rigidBody)); + } + else + { + attachedInstances[i].instance.set3DAttributes(RuntimeUtils.To3DAttributes(attachedInstances[i].transform, attachedInstances[i].rigidBody2D)); + } + } + + #if UNITY_EDITOR + MuteAllEvents(UnityEditor.EditorUtility.audioMasterMute); + + for (int i = eventPositionWarnings.Count - 1; i >= 0; i--) + { + if (eventPositionWarnings[i].isValid()) + { + FMOD.ATTRIBUTES_3D attribs; + eventPositionWarnings[i].get3DAttributes(out attribs); + if (attribs.position.x == 1e+18F && + attribs.position.y == 1e+18F && + attribs.position.z == 1e+18F) + { + string path; + FMOD.Studio.EventDescription desc; + eventPositionWarnings[i].getDescription(out desc); + desc.getPath(out path); + Debug.LogWarningFormat("[FMOD] Instance of Event {0} has not had EventInstance.set3DAttributes() called on it yet!", path); + } + } + eventPositionWarnings.RemoveAt(i); + } + #endif + + studioSystem.update(); + } + } + + public static void AttachInstanceToGameObject(FMOD.Studio.EventInstance instance, Transform transform, Rigidbody rigidBody) + { + instance.set3DAttributes(RuntimeUtils.To3DAttributes(transform, rigidBody)); + var attachedInstance = new AttachedInstance(); + attachedInstance.transform = transform; + attachedInstance.instance = instance; + attachedInstance.rigidBody = rigidBody; + Instance.attachedInstances.Add(attachedInstance); + } + + public static void AttachInstanceToGameObject(FMOD.Studio.EventInstance instance, Transform transform, Rigidbody2D rigidBody2D) + { + instance.set3DAttributes(RuntimeUtils.To3DAttributes(transform, rigidBody2D)); + var attachedInstance = new AttachedInstance(); + attachedInstance.transform = transform; + attachedInstance.instance = instance; + attachedInstance.rigidBody2D = rigidBody2D; + attachedInstance.rigidBody = null; + Instance.attachedInstances.Add(attachedInstance); + } + + public static void DetachInstanceFromGameObject(FMOD.Studio.EventInstance instance) + { + var manager = Instance; + for (int i = 0; i < manager.attachedInstances.Count; i++) + { + if (manager.attachedInstances[i].instance.handle == instance.handle) + { + manager.attachedInstances.RemoveAt(i); + return; + } + } + } + + Rect windowRect = new Rect(10, 10, 300, 100); + void OnGUI() + { + if (studioSystem.isValid() && Settings.Instance.IsOverlayEnabled(fmodPlatform)) + { + windowRect = GUI.Window(0, windowRect, DrawDebugOverlay, "FMOD Studio Debug"); + } + } + + string lastDebugText; + float lastDebugUpdate = 0; + void DrawDebugOverlay(int windowID) + { + if (lastDebugUpdate + 0.25f < Time.unscaledTime) + { + if (initException != null) + { + lastDebugText = initException.Message; + } + else + { + if (!mixerHead.hasHandle()) + { + FMOD.ChannelGroup master; + coreSystem.getMasterChannelGroup(out master); + master.getDSP(0, out mixerHead); + mixerHead.setMeteringEnabled(false, true); + } + + StringBuilder debug = new StringBuilder(); + + FMOD.Studio.CPU_USAGE cpuUsage; + studioSystem.getCPUUsage(out cpuUsage); + debug.AppendFormat("CPU: dsp = {0:F1}%, studio = {1:F1}%\n", cpuUsage.dspusage, cpuUsage.studiousage); + + int currentAlloc, maxAlloc; + FMOD.Memory.GetStats(out currentAlloc, out maxAlloc); + debug.AppendFormat("MEMORY: cur = {0}MB, max = {1}MB\n", currentAlloc >> 20, maxAlloc >> 20); + + int realchannels, channels; + coreSystem.getChannelsPlaying(out channels, out realchannels); + debug.AppendFormat("CHANNELS: real = {0}, total = {1}\n", realchannels, channels); + + FMOD.DSP_METERING_INFO outputMetering; + mixerHead.getMeteringInfo(IntPtr.Zero, out outputMetering); + float rms = 0; + for (int i = 0; i < outputMetering.numchannels; i++) + { + rms += outputMetering.rmslevel[i] * outputMetering.rmslevel[i]; + } + rms = Mathf.Sqrt(rms / (float)outputMetering.numchannels); + + float db = rms > 0 ? 20.0f * Mathf.Log10(rms * Mathf.Sqrt(2.0f)) : -80.0f; + if (db > 10.0f) db = 10.0f; + + debug.AppendFormat("VOLUME: RMS = {0:f2}db\n", db); + lastDebugText = debug.ToString(); + lastDebugUpdate = Time.unscaledTime; + } + } + + GUI.Label(new Rect(10, 20, 290, 100), lastDebugText); + GUI.DragWindow(); + } + + void OnDisable() + { + // If we're being torn down for a script reload - cache the native pointers in something unity can serialize + cachedPointers[0] = (long)studioSystem.handle; + cachedPointers[1] = (long)coreSystem.handle; + } + + void OnDestroy() + { + if (studioSystem.isValid()) + { + studioSystem.release(); + studioSystem.clearHandle(); + } + initException = null; + instance = null; + } + + #if UNITY_EDITOR + public static void Destroy() + { + if (instance) + { + if (instance.studioSystem.isValid()) + { + instance.studioSystem.release(); + instance.studioSystem.clearHandle(); + } + DestroyImmediate(instance.gameObject); + initException = null; + instance = null; + } + } + + void HandlePlayModeStateChange(PlayModeStateChange state) + { + if (state == PlayModeStateChange.ExitingEditMode || state == PlayModeStateChange.EnteredEditMode) + { + Destroy(); + } + } + #endif + + #if UNITY_IOS + /* iOS alarm interruptions do not trigger OnApplicationPause + * Sending the app to the background does trigger OnApplicationFocus + * We don't want to use this on Android as other things (like the keyboard) + * can steal focus. + * https://docs.unity3d.com/ScriptReference/MonoBehaviour.OnApplicationFocus.html */ + + void OnApplicationFocus(bool focus) + { + if (studioSystem.isValid()) + { + // Strings bank is always loaded + if (loadedBanks.Count > 1) + PauseAllEvents(!focus); + + if (focus) + { + lowlevelSystem.mixerResume(); + } + else + { + lowlevelSystem.mixerSuspend(); + } + } + } + #else + void OnApplicationPause(bool pauseStatus) + { + if (studioSystem.isValid()) + { + PauseAllEvents(pauseStatus); + + if (pauseStatus) + { + coreSystem.mixerSuspend(); + } + else + { + coreSystem.mixerResume(); + } + } + } + #endif + + private void loadedBankRegister(LoadedBank loadedBank, string bankPath, string bankName, bool loadSamples, FMOD.RESULT loadResult) + { + if (loadResult == FMOD.RESULT.OK) + { + loadedBank.RefCount = 1; + + if (loadSamples) + { + loadedBank.Bank.loadSampleData(); + } + + Instance.loadedBanks.Add(bankName, loadedBank); + } + else if (loadResult == FMOD.RESULT.ERR_EVENT_ALREADY_LOADED) + { + // someone loaded this bank directly using the studio API + // TODO: will the null bank handle be an issue + loadedBank.RefCount = 2; + Instance.loadedBanks.Add(bankName, loadedBank); + } + else + { + throw new BankLoadException(bankPath, loadResult); + } + } + + #if UNITY_WEBGL + IEnumerator loadFromWeb(string bankPath, string bankName, bool loadSamples) + { + byte[] loadWebResult; + FMOD.RESULT loadResult; + + UnityEngine.Networking.UnityWebRequest www = UnityEngine.Networking.UnityWebRequest.Get(bankPath); + yield return www.SendWebRequest(); + loadWebResult = www.downloadHandler.data; + + LoadedBank loadedBank = new LoadedBank(); + loadResult = Instance.studioSystem.loadBankMemory(loadWebResult, FMOD.Studio.LOAD_BANK_FLAGS.NORMAL, out loadedBank.Bank); + if (loadResult != FMOD.RESULT.OK) + { + UnityEngine.Debug.LogWarningFormat("[FMOD] loadFromWeb. Path = {0}, result = {1}.", bankPath, loadResult); + } + loadedBankRegister(loadedBank, bankPath, bankName, loadSamples, loadResult); + + Debug.LogFormat("[FMOD] Finished loading {0}", bankPath); + } + #endif + + public static void LoadBank(string bankName, bool loadSamples = false) + { + if (Instance.loadedBanks.ContainsKey(bankName)) + { + LoadedBank loadedBank = Instance.loadedBanks[bankName]; + loadedBank.RefCount++; + + if (loadSamples) + { + loadedBank.Bank.loadSampleData(); + } + Instance.loadedBanks[bankName] = loadedBank; + } + else + { + string bankPath = RuntimeUtils.GetBankPath(bankName); + FMOD.RESULT loadResult; + #if UNITY_ANDROID && !UNITY_EDITOR + if (!bankPath.StartsWith("file:///android_asset")) + { + using (var www = new WWW(bankPath)) + { + while (!www.isDone) { } + if (!String.IsNullOrEmpty(www.error)) + { + throw new BankLoadException(bankPath, www.error); + } + else + { + LoadedBank loadedBank = new LoadedBank(); + loadResult = Instance.studioSystem.loadBankMemory(www.bytes, FMOD.Studio.LOAD_BANK_FLAGS.NORMAL, out loadedBank.Bank); + Instance.loadedBankRegister(loadedBank, bankPath, bankName, loadSamples, loadResult); + } + } + } + else + #elif UNITY_WEBGL + if (bankPath.Contains("://")) + { + Instance.StartCoroutine(Instance.loadFromWeb(bankPath, bankName, loadSamples)); + } + else + #endif + { + LoadedBank loadedBank = new LoadedBank(); + loadResult = Instance.studioSystem.loadBankFile(bankPath, FMOD.Studio.LOAD_BANK_FLAGS.NORMAL, out loadedBank.Bank); + Instance.loadedBankRegister(loadedBank, bankPath, bankName, loadSamples, loadResult); + } + } + } + + public static void LoadBank(TextAsset asset, bool loadSamples = false) + { + string bankName = asset.name; + if (Instance.loadedBanks.ContainsKey(bankName)) + { + LoadedBank loadedBank = Instance.loadedBanks[bankName]; + loadedBank.RefCount++; + + if (loadSamples) + { + loadedBank.Bank.loadSampleData(); + } + } + else + { + LoadedBank loadedBank = new LoadedBank(); + FMOD.RESULT loadResult = Instance.studioSystem.loadBankMemory(asset.bytes, FMOD.Studio.LOAD_BANK_FLAGS.NORMAL, out loadedBank.Bank); + + if (loadResult == FMOD.RESULT.OK) + { + loadedBank.RefCount = 1; + Instance.loadedBanks.Add(bankName, loadedBank); + + if (loadSamples) + { + loadedBank.Bank.loadSampleData(); + } + } + else if (loadResult == FMOD.RESULT.ERR_EVENT_ALREADY_LOADED) + { + // someone loaded this bank directly using the studio API + // TODO: will the null bank handle be an issue + loadedBank.RefCount = 2; + Instance.loadedBanks.Add(bankName, loadedBank); + } + else + { + throw new BankLoadException(bankName, loadResult); + } + } + } + + private void LoadBanks(Settings fmodSettings) + { + if (fmodSettings.ImportType == ImportType.StreamingAssets) + { + // Always load strings bank + try + { + switch (fmodSettings.BankLoadType) + { + case BankLoadType.All: + foreach (string masterBankFileName in fmodSettings.MasterBanks) + { + LoadBank(masterBankFileName + ".strings", fmodSettings.AutomaticSampleLoading); + LoadBank(masterBankFileName, fmodSettings.AutomaticSampleLoading); + } + + foreach (var bank in fmodSettings.Banks) + { + LoadBank(bank, fmodSettings.AutomaticSampleLoading); + } + + WaitForAllLoads(); + break; + case BankLoadType.Specified: + foreach (var bank in fmodSettings.BanksToLoad) + { + if (!string.IsNullOrEmpty(bank)) + { + LoadBank(bank, fmodSettings.AutomaticSampleLoading); + } + } + + WaitForAllLoads(); + break; + case BankLoadType.None: + break; + default: + break; + } + } + catch (BankLoadException e) + { + UnityEngine.Debug.LogException(e); + } + } + } + + public static void UnloadBank(string bankName) + { + LoadedBank loadedBank; + if (Instance.loadedBanks.TryGetValue(bankName, out loadedBank)) + { + loadedBank.RefCount--; + if (loadedBank.RefCount == 0) + { + loadedBank.Bank.unload(); + Instance.loadedBanks.Remove(bankName); + return; + } + Instance.loadedBanks[bankName] = loadedBank; + } + } + + public static bool AnyBankLoading() + { + bool loading = false; + foreach (LoadedBank bank in Instance.loadedBanks.Values) + { + FMOD.Studio.LOADING_STATE loadingState; + bank.Bank.getSampleLoadingState(out loadingState); + loading |= (loadingState == FMOD.Studio.LOADING_STATE.LOADING); + } + return loading; + } + + public static void WaitForAllLoads() + { + Instance.studioSystem.flushSampleLoading(); + } + + public static Guid PathToGUID(string path) + { + Guid guid = Guid.Empty; + if (path.StartsWith("{")) + { + FMOD.Studio.Util.parseID(path, out guid); + } + else + { + var result = Instance.studioSystem.lookupID(path, out guid); + if (result == FMOD.RESULT.ERR_EVENT_NOTFOUND) + { + throw new EventNotFoundException(path); + } + } + return guid; + } + + public static FMOD.Studio.EventInstance CreateInstance(string path) + { + try + { + return CreateInstance(PathToGUID(path)); + } + catch(EventNotFoundException) + { + // Switch from exception with GUID to exception with path + throw new EventNotFoundException(path); + } + } + + public static FMOD.Studio.EventInstance CreateInstance(Guid guid) + { + FMOD.Studio.EventDescription eventDesc = GetEventDescription(guid); + FMOD.Studio.EventInstance newInstance; + eventDesc.createInstance(out newInstance); + + #if UNITY_EDITOR + bool is3D = false; + eventDesc.is3D(out is3D); + if (is3D) + { + // Set position to 1e+18F, set3DAttributes should be called by the dev after this. + newInstance.set3DAttributes(RuntimeUtils.To3DAttributes(new Vector3(1e+18F, 1e+18F, 1e+18F))); + instance.eventPositionWarnings.Add(newInstance); + } + #endif + + return newInstance; + } + + public static void PlayOneShot(string path, Vector3 position = new Vector3()) + { + try + { + PlayOneShot(PathToGUID(path), position); + } + catch (EventNotFoundException) + { + Debug.LogWarning("[FMOD] Event not found: " + path); + } + } + + public static void PlayOneShot(Guid guid, Vector3 position = new Vector3()) + { + var instance = CreateInstance(guid); + instance.set3DAttributes(RuntimeUtils.To3DAttributes(position)); + instance.start(); + instance.release(); + } + + public static void PlayOneShotAttached(string path, GameObject gameObject) + { + try + { + PlayOneShotAttached(PathToGUID(path), gameObject); + } + catch (EventNotFoundException) + { + Debug.LogWarning("[FMOD] Event not found: " + path); + } + } + + public static void PlayOneShotAttached(Guid guid, GameObject gameObject) + { + var instance = CreateInstance(guid); + AttachInstanceToGameObject(instance, gameObject.transform, gameObject.GetComponent()); + instance.start(); + instance.release(); + } + + public static FMOD.Studio.EventDescription GetEventDescription(string path) + { + try + { + return GetEventDescription(PathToGUID(path)); + } + catch (EventNotFoundException) + { + throw new EventNotFoundException(path); + } + } + + public static FMOD.Studio.EventDescription GetEventDescription(Guid guid) + { + FMOD.Studio.EventDescription eventDesc; + if (Instance.cachedDescriptions.ContainsKey(guid) && Instance.cachedDescriptions[guid].isValid()) + { + eventDesc = Instance.cachedDescriptions[guid]; + } + else + { + var result = Instance.studioSystem.getEventByID(guid, out eventDesc); + + if (result != FMOD.RESULT.OK) + { + throw new EventNotFoundException(guid); + } + + if (eventDesc.isValid()) + { + Instance.cachedDescriptions[guid] = eventDesc; + } + } + return eventDesc; + } + + public static bool[] HasListener = new bool[FMOD.CONSTANTS.MAX_LISTENERS]; + + public static void SetListenerLocation(GameObject gameObject, Rigidbody rigidBody = null) + { + Instance.studioSystem.setListenerAttributes(0, RuntimeUtils.To3DAttributes(gameObject, rigidBody)); + } + + public static void SetListenerLocation(GameObject gameObject, Rigidbody2D rigidBody2D) + { + Instance.studioSystem.setListenerAttributes(0, RuntimeUtils.To3DAttributes(gameObject, rigidBody2D)); + } + + public static void SetListenerLocation(Transform transform) + { + Instance.studioSystem.setListenerAttributes(0, transform.To3DAttributes()); + } + + public static void SetListenerLocation(int listenerIndex, GameObject gameObject, Rigidbody rigidBody = null) + { + Instance.studioSystem.setListenerAttributes(listenerIndex, RuntimeUtils.To3DAttributes(gameObject, rigidBody)); + } + + public static void SetListenerLocation(int listenerIndex, GameObject gameObject, Rigidbody2D rigidBody2D) + { + Instance.studioSystem.setListenerAttributes(listenerIndex, RuntimeUtils.To3DAttributes(gameObject, rigidBody2D)); + } + + public static void SetListenerLocation(int listenerIndex, Transform transform) + { + Instance.studioSystem.setListenerAttributes(listenerIndex, transform.To3DAttributes()); + } + + public static FMOD.Studio.Bus GetBus(string path) + { + FMOD.Studio.Bus bus; + if (StudioSystem.getBus(path, out bus) != FMOD.RESULT.OK) + { + throw new BusNotFoundException(path); + } + return bus; + } + + public static FMOD.Studio.VCA GetVCA(string path) + { + FMOD.Studio.VCA vca; + if (StudioSystem.getVCA(path, out vca) != FMOD.RESULT.OK) + { + throw new VCANotFoundException(path); + } + return vca; + } + + public static void PauseAllEvents(bool paused) + { + if (HasBanksLoaded) + { + FMOD.Studio.Bus masterBus; + if (StudioSystem.getBus("bus:/", out masterBus) == FMOD.RESULT.OK) + { + masterBus.setPaused(paused); + } + } + } + + public static void MuteAllEvents(bool muted) + { + if (HasBanksLoaded) + { + FMOD.Studio.Bus masterBus; + if (StudioSystem.getBus("bus:/", out masterBus) == FMOD.RESULT.OK) + { + masterBus.setMute(muted); + } + } + } + + public static bool IsInitialized + { + get + { + return instance != null && instance.studioSystem.isValid(); + } + } + + public static bool HasBanksLoaded + { + get + { + return Instance.loadedBanks.Count > 1; + } + } + + public static bool HasBankLoaded(string loadedBank) + { + return (instance.loadedBanks.ContainsKey(loadedBank)); + } + + private void LoadPlugins(Settings fmodSettings) + { + #if (UNITY_IOS || UNITY_TVOS) && !UNITY_EDITOR + FmodUnityNativePluginInit(lowlevelSystem.handle); + #else + + FMOD.RESULT result; + foreach (var pluginName in fmodSettings.Plugins) + { + if (string.IsNullOrEmpty(pluginName)) + continue; + string pluginPath = RuntimeUtils.GetPluginPath(pluginName); + uint handle; + result = coreSystem.loadPlugin(pluginPath, out handle); + #if UNITY_64 || UNITY_EDITOR_64 + // Add a "64" suffix and try again + if (result == FMOD.RESULT.ERR_FILE_BAD || result == FMOD.RESULT.ERR_FILE_NOTFOUND) + { + string pluginPath64 = RuntimeUtils.GetPluginPath(pluginName + "64"); + result = coreSystem.loadPlugin(pluginPath64, out handle); + } + #endif + CheckInitResult(result, String.Format("Loading plugin '{0}' from '{1}'", pluginName, pluginPath)); + loadedPlugins.Add(pluginName, handle); + } + #endif + } + + private void SetThreadAffinity() + { + #if UNITY_PS4 && !UNITY_EDITOR + FMOD.PS4.THREADAFFINITY affinity = new FMOD.PS4.THREADAFFINITY + { + mixer = FMOD.PS4.THREAD.CORE2, + studioUpdate = FMOD.PS4.THREAD.CORE4, + studioLoadBank = FMOD.PS4.THREAD.CORE4, + studioLoadSample = FMOD.PS4.THREAD.CORE4 + }; + FMOD.RESULT result = FMOD.PS4.setThreadAffinity(ref affinity); + CheckInitResult(result, "FMOD.PS4.setThreadAffinity"); + + #elif UNITY_XBOXONE && !UNITY_EDITOR + FMOD.XboxOne.THREADAFFINITY affinity = new FMOD.XboxOne.THREADAFFINITY + { + mixer = FMOD.XboxOne.THREAD.CORE2, + studioUpdate = FMOD.XboxOne.THREAD.CORE4, + studioLoadBank = FMOD.XboxOne.THREAD.CORE4, + studioLoadSample = FMOD.XboxOne.THREAD.CORE4 + }; + FMOD.RESULT result = FMOD.XboxOne.setThreadAffinity(ref affinity); + CheckInitResult(result, "FMOD.XboxOne.setThreadAffinity"); + + #elif UNITY_SWITCH && !UNITY_EDITOR + FMOD.Switch.THREADAFFINITY affinity = new FMOD.Switch.THREADAFFINITY + { + mixer = FMOD.Switch.THREAD.CORE2, + studioUpdate = FMOD.Switch.THREAD.CORE2, + studioLoadBank = FMOD.Switch.THREAD.CORE2, + studioLoadSample = FMOD.Switch.THREAD.CORE2 + }; + FMOD.RESULT result = FMOD.Switch.setThreadAffinity(ref affinity); + CheckInitResult(result, "FMOD.Switch.setThreadAffinity"); + #endif + } + + #if (UNITY_IOS || UNITY_TVOS) && !UNITY_EDITOR + [DllImport("__Internal")] + private static extern FMOD.RESULT FmodUnityNativePluginInit(IntPtr system); + #endif + } +} \ No newline at end of file diff --git a/Assets/Plugins/FMOD/src/Runtime/RuntimeManager.cs.meta b/Assets/Plugins/FMOD/src/Runtime/RuntimeManager.cs.meta new file mode 100755 index 0000000..b0ae704 --- /dev/null +++ b/Assets/Plugins/FMOD/src/Runtime/RuntimeManager.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 5e5fb8ce07f0ce84b9d1852869527ea5 +timeCreated: 1444628977 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 100 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/src/Runtime/RuntimeUtils.cs b/Assets/Plugins/FMOD/src/Runtime/RuntimeUtils.cs new file mode 100755 index 0000000..ecf7404 --- /dev/null +++ b/Assets/Plugins/FMOD/src/Runtime/RuntimeUtils.cs @@ -0,0 +1,431 @@ +using System; +using UnityEngine; +#if UNITY_EDITOR +using UnityEditor; +#endif + +namespace FMODUnity +{ + public class EventNotFoundException : Exception + { + public Guid Guid; + public string Path; + public EventNotFoundException(string path) + : base("[FMOD] Event not found '" + path + "'") + { + Path = path; + } + + public EventNotFoundException(Guid guid) + : base("[FMOD] Event not found " + guid.ToString("b") + "") + { + Guid = guid; + } + } + + public class BusNotFoundException : Exception + { + public string Path; + public BusNotFoundException(string path) + : base("[FMOD] Bus not found '" + path + "'") + { + Path = path; + } + } + + public class VCANotFoundException : Exception + { + public string Path; + public VCANotFoundException(string path) + : base("[FMOD] VCA not found '" + path + "'") + { + Path = path; + } + } + + public class BankLoadException : Exception + { + public string Path; + public FMOD.RESULT Result; + + public BankLoadException(string path, FMOD.RESULT result) + : base(string.Format("[FMOD] Could not load bank '{0}' : {1} : {2}", path, result.ToString(), FMOD.Error.String(result))) + { + Path = path; + Result = result; + } + public BankLoadException(string path, string error) + : base(string.Format("[FMOD] Could not load bank '{0}' : {1}", path, error)) + { + Path = path; + Result = FMOD.RESULT.ERR_INTERNAL; + } + } + + public class SystemNotInitializedException : Exception + { + public FMOD.RESULT Result; + public string Location; + + public SystemNotInitializedException(FMOD.RESULT result, string location) + : base(string.Format("[FMOD] Initialization failed : {2} : {0} : {1}", result.ToString(), FMOD.Error.String(result), location)) + { + Result = result; + Location = location; + } + + public SystemNotInitializedException(Exception inner) + : base("[FMOD] Initialization failed", inner) + { + } + } + + public enum EmitterGameEvent : int + { + None, + ObjectStart, + ObjectDestroy, + TriggerEnter, + TriggerExit, + TriggerEnter2D, + TriggerExit2D, + CollisionEnter, + CollisionExit, + CollisionEnter2D, + CollisionExit2D, + ObjectEnable, + ObjectDisable + } + + public enum LoaderGameEvent : int + { + None, + ObjectStart, + ObjectDestroy, + TriggerEnter, + TriggerExit, + TriggerEnter2D, + TriggerExit2D, + } + + public static class RuntimeUtils + { + public static FMOD.VECTOR ToFMODVector(this Vector3 vec) + { + FMOD.VECTOR temp; + temp.x = vec.x; + temp.y = vec.y; + temp.z = vec.z; + + return temp; + } + + public static FMOD.ATTRIBUTES_3D To3DAttributes(this Vector3 pos) + { + FMOD.ATTRIBUTES_3D attributes = new FMOD.ATTRIBUTES_3D(); + attributes.forward = ToFMODVector(Vector3.forward); + attributes.up = ToFMODVector(Vector3.up); + attributes.position = ToFMODVector(pos); + + return attributes; + } + + public static FMOD.ATTRIBUTES_3D To3DAttributes(this Transform transform) + { + FMOD.ATTRIBUTES_3D attributes = new FMOD.ATTRIBUTES_3D(); + attributes.forward = transform.forward.ToFMODVector(); + attributes.up = transform.up.ToFMODVector(); + attributes.position = transform.position.ToFMODVector(); + + return attributes; + } + + public static FMOD.ATTRIBUTES_3D To3DAttributes(Transform transform, Rigidbody rigidbody = null) + { + FMOD.ATTRIBUTES_3D attributes = transform.To3DAttributes(); + + if (rigidbody) + { + attributes.velocity = rigidbody.velocity.ToFMODVector(); + } + + return attributes; + } + + public static FMOD.ATTRIBUTES_3D To3DAttributes(GameObject go, Rigidbody rigidbody = null) + { + FMOD.ATTRIBUTES_3D attributes = go.transform.To3DAttributes(); + + if (rigidbody) + { + attributes.velocity = rigidbody.velocity.ToFMODVector(); + } + + return attributes; + } + + public static FMOD.ATTRIBUTES_3D To3DAttributes(Transform transform, Rigidbody2D rigidbody) + { + FMOD.ATTRIBUTES_3D attributes = transform.To3DAttributes(); + + if (rigidbody) + { + FMOD.VECTOR vel; + vel.x = rigidbody.velocity.x; + vel.y = rigidbody.velocity.y; + vel.z = 0; + attributes.velocity = vel; + } + + return attributes; + } + + public static FMOD.ATTRIBUTES_3D To3DAttributes(GameObject go, Rigidbody2D rigidbody) + { + FMOD.ATTRIBUTES_3D attributes = go.transform.To3DAttributes(); + + if (rigidbody) + { + FMOD.VECTOR vel; + vel.x = rigidbody.velocity.x; + vel.y = rigidbody.velocity.y; + vel.z = 0; + attributes.velocity = vel; + } + + return attributes; + } + + // Internal Helper Functions + internal static FMODPlatform GetCurrentPlatform() + { + #if UNITY_EDITOR + return FMODPlatform.PlayInEditor; + #elif UNITY_STANDALONE_WIN + return FMODPlatform.Windows; + #elif UNITY_STANDALONE_OSX + return FMODPlatform.Mac; + #elif UNITY_STANDALONE_LINUX + return FMODPlatform.Linux; + #elif UNITY_TVOS + return FMODPlatform.AppleTV; + #elif UNITY_IOS + FMODPlatform result; + switch (UnityEngine.iOS.Device.generation) + { + case UnityEngine.iOS.DeviceGeneration.iPad1Gen: + case UnityEngine.iOS.DeviceGeneration.iPad2Gen: + case UnityEngine.iOS.DeviceGeneration.iPad3Gen: + case UnityEngine.iOS.DeviceGeneration.iPadMini1Gen: + case UnityEngine.iOS.DeviceGeneration.iPhone: + case UnityEngine.iOS.DeviceGeneration.iPhone3G: + case UnityEngine.iOS.DeviceGeneration.iPhone3GS: + case UnityEngine.iOS.DeviceGeneration.iPhone4: + case UnityEngine.iOS.DeviceGeneration.iPhone4S: + result = FMODPlatform.MobileLow; + break; + default: + result = FMODPlatform.MobileHigh; + break; + } + + UnityEngine.Debug.Log(String.Format("FMOD Studio: Device {0} classed as {1}", SystemInfo.deviceModel, result.ToString())); + return result; + #elif UNITY_ANDROID + FMODPlatform result; + if (SystemInfo.processorCount <= 2) + { + result = FMODPlatform.MobileLow; + } + else if (SystemInfo.processorCount >= 8) + { + result = FMODPlatform.MobileHigh; + } + else + { + // check the clock rate on quad core systems + string freqinfo = "/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq"; + try + { + using (global::System.IO.TextReader reader = new global::System.IO.StreamReader(freqinfo)) + { + string line = reader.ReadLine(); + int khz = Int32.Parse(line) / 1000; + if (khz >= 1600) + { + result = FMODPlatform.MobileHigh; + } + else + { + result = FMODPlatform.MobileLow; + } + } + } + catch + { + result = FMODPlatform.MobileLow; + } + } + + UnityEngine.Debug.Log(String.Format("[FMOD] Device {0} classed as {1}", SystemInfo.deviceModel, result.ToString())); + return result; + #elif UNITY_WINRT_8_1 + FMODPlatform result; + if (SystemInfo.processorCount <= 2) + { + result = FMODPlatform.MobileLow; + } + else + { + result = FMODPlatform.MobileHigh; + } + + UnityEngine.Debug.Log(String.Format("[FMOD] Device {0} classed as {1}", SystemInfo.deviceModel, result.ToString())); + return result; + + #elif UNITY_PS4 + return FMODPlatform.PS4; + #elif UNITY_XBOXONE + return FMODPlatform.XboxOne; + #elif UNITY_WSA_10_0 + return FMODPlatform.UWP; + #elif UNITY_SWITCH + return FMODPlatform.Switch; + #elif UNITY_WEBGL + return FMODPlatform.WebGL; + #endif + } + + const string BankExtension = ".bank"; + internal static string GetBankPath(string bankName) + { + #if UNITY_EDITOR + // For play in editor use original asset location because streaming asset folder will contain platform specific banks + string bankFolder = Settings.Instance.SourceBankPath; + if (Settings.Instance.HasPlatforms) + { + bankFolder = global::System.IO.Path.Combine(bankFolder, Settings.Instance.GetBankPlatform(FMODPlatform.PlayInEditor)); + } + #elif UNITY_ANDROID + string bankFolder = null; + if (System.IO.Path.GetExtension(Application.dataPath) == ".apk") + { + bankFolder = "file:///android_asset"; + } + else + { + bankFolder = String.Format("jar:file://{0}!/assets", Application.dataPath); + } + #elif UNITY_WINRT_8_1 || UNITY_WSA_10_0 + string bankFolder = "ms-appx:///Data/StreamingAssets"; + #else + string bankFolder = Application.streamingAssetsPath; + #endif + + // Special case for Switch, remove / at start if needed. + #if UNITY_SWITCH + if (bankFolder[0] == '/') + bankFolder = bankFolder.Substring(1); + #endif + + if (System.IO.Path.GetExtension(bankName) != BankExtension) + { + return string.Format("{0}/{1}.bank", bankFolder, bankName); + } + else + { + return string.Format("{0}/{1}", bankFolder, bankName); + } + } + + internal static string GetPluginPath(string pluginName) + { + #if UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || UNITY_XBOXONE || UNITY_WINRT_8_1 || UNITY_WSA_10_0 + string pluginFileName = pluginName + ".dll"; + #elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX + string pluginFileName = pluginName + ".bundle"; + #elif UNITY_PS4 + string pluginFileName = pluginName + ".prx"; + #elif UNITY_ANDROID || UNITY_STANDALONE_LINUX + string pluginFileName = "lib" + pluginName + ".so"; + #elif UNITY_WEBGL + string pluginFileName = pluginName + ".bc"; + #endif + + #if UNITY_EDITOR_WIN && UNITY_EDITOR_64 + string pluginFolder = Application.dataPath + "/Plugins/X86_64/"; + #elif UNITY_EDITOR_WIN + string pluginFolder = Application.dataPath + "/Plugins/X86/"; + #elif UNITY_STANDALONE_WIN || UNITY_PS4 || UNITY_XBOXONE || UNITY_STANDALONE_OSX || UNITY_EDITOR_OSX || UNITY_WEBGL + string pluginFolder = Application.dataPath + "/Plugins/"; + #elif UNITY_STANDALONE_LINUX + string pluginFolder = Application.dataPath + ((IntPtr.Size == 8) ? "/Plugins/x86_64/" : "/Plugins/x86/"); + #elif UNITY_WSA || UNITY_ANDROID + string pluginFolder = ""; + #else + string pluginFileName = ""; + string pluginFolder = ""; + #endif + + return pluginFolder + pluginFileName; + } + + public static void EnforceLibraryOrder() + { + #if UNITY_ANDROID && !UNITY_EDITOR + + AndroidJavaClass jSystem = new AndroidJavaClass("java.lang.System"); + jSystem.CallStatic("loadLibrary", FMOD.VERSION.dll); + jSystem.CallStatic("loadLibrary", FMOD.Studio.STUDIO_VERSION.dll); + + #endif + + // Call a function in fmod.dll to make sure it's loaded before fmodstudio.dll + int temp1, temp2; + FMOD.Memory.GetStats(out temp1, out temp2); + + Guid temp3; + FMOD.Studio.Util.parseID("", out temp3); + } + + #if UNITY_EDITOR + public static FMODPlatform GetEditorFMODPlatform() + { + switch (EditorUserBuildSettings.activeBuildTarget) + { + case BuildTarget.Android: + return FMODPlatform.Android; + case BuildTarget.iOS: + return FMODPlatform.iOS; + case BuildTarget.PS4: + return FMODPlatform.PS4; + case BuildTarget.StandaloneLinux: + case BuildTarget.StandaloneLinux64: + case BuildTarget.StandaloneLinuxUniversal: + return FMODPlatform.Linux; + case BuildTarget.StandaloneOSX: + return FMODPlatform.Mac; + case BuildTarget.StandaloneWindows: + case BuildTarget.StandaloneWindows64: + return FMODPlatform.Windows; + case BuildTarget.XboxOne: + return FMODPlatform.XboxOne; + case BuildTarget.WSAPlayer: + return FMODPlatform.UWP; + case BuildTarget.tvOS: + return FMODPlatform.AppleTV; + #if UNITY_SWITCH + case BuildTarget.Switch: + return FMODPlatform.Switch; + #endif + #if UNITY_WEBGL + case BuildTarget.WebGL: + return FMODPlatform.WebGL; + #endif + default: + return FMODPlatform.None; + } + } + #endif + } +} \ No newline at end of file diff --git a/Assets/Plugins/FMOD/src/Runtime/RuntimeUtils.cs.meta b/Assets/Plugins/FMOD/src/Runtime/RuntimeUtils.cs.meta new file mode 100755 index 0000000..825c75b --- /dev/null +++ b/Assets/Plugins/FMOD/src/Runtime/RuntimeUtils.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 6e349601408e423499e7b9f75216091d +timeCreated: 1433225261 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/src/Runtime/Settings.cs b/Assets/Plugins/FMOD/src/Runtime/Settings.cs new file mode 100755 index 0000000..88a137b --- /dev/null +++ b/Assets/Plugins/FMOD/src/Runtime/Settings.cs @@ -0,0 +1,453 @@ +using UnityEngine; +using System.Collections.Generic; +using System; +using System.IO; +#if UNITY_EDITOR +using UnityEditor; +#endif + +namespace FMODUnity +{ + [Serializable] + public enum FMODPlatform + { + None, + PlayInEditor, + Default, + Desktop, + Mobile, + MobileHigh, + MobileLow, + Console, + Windows, + Mac, + Linux, + iOS, + Android, + Deprecated_1, + XboxOne, + PS4, + Deprecated_2, + Deprecated_3, + AppleTV, + UWP, + Switch, + WebGL, + Count, + } + + [Serializable] + public enum ImportType + { + StreamingAssets, + AssetBundle, + } + + [Serializable] + public enum BankLoadType + { + All, + Specified, + None + } + + + public class PlatformSettingBase + { + public FMODPlatform Platform; + } + + public class PlatformSetting : PlatformSettingBase + { + public T Value; + } + + [Serializable] + public class PlatformIntSetting : PlatformSetting + { + } + + [Serializable] + public class PlatformStringSetting : PlatformSetting + { + } + + public enum TriStateBool + { + Disabled, + Enabled, + Development, + } + + [Serializable] + public class PlatformBoolSetting : PlatformSetting + { + } + + #if UNITY_EDITOR + [InitializeOnLoad] + #endif + public class Settings : ScriptableObject + { + [SerializeField] + bool SwitchSettingsMigration = false; + + const string SettingsAssetName = "FMODStudioSettings"; + + private static Settings instance = null; + + public static Settings Instance + { + get + { + if (instance == null) + { + instance = Resources.Load(SettingsAssetName) as Settings; + if (instance == null) + { + UnityEngine.Debug.Log("[FMOD] Cannot find integration settings, creating default settings"); + instance = CreateInstance(); + instance.name = "FMOD Studio Integration Settings"; + + #if UNITY_EDITOR + if (!Directory.Exists("Assets/Plugins/FMOD/Resources")) + { + AssetDatabase.CreateFolder("Assets/Plugins/FMOD", "Resources"); + } + AssetDatabase.CreateAsset(instance, "Assets/Plugins/FMOD/Resources/" + SettingsAssetName + ".asset"); + #endif + } + } + return instance; + } + } + + #if UNITY_EDITOR + [MenuItem("FMOD/Edit Settings", priority = 0)] + public static void EditSettings() + { + Selection.activeObject = Instance; + #if UNITY_2018_2_OR_NEWER + EditorApplication.ExecuteMenuItem("Window/General/Inspector"); + #else + EditorApplication.ExecuteMenuItem("Window/Inspector"); + #endif + } + #endif + + [SerializeField] + public bool HasSourceProject = true; + + [SerializeField] + public bool HasPlatforms = true; + + [SerializeField] + private string sourceProjectPath; + + public string SourceProjectPath + { + get + { + if (string.IsNullOrEmpty(sourceProjectPath) && !string.IsNullOrEmpty(SourceProjectPathUnformatted)) + { + sourceProjectPath = GetPlatformSpecificPath(SourceProjectPathUnformatted); + } + return sourceProjectPath; + } + set + { + sourceProjectPath = GetPlatformSpecificPath(value); + } + } + + [SerializeField] + public string SourceProjectPathUnformatted; + + private string sourceBankPath; + public string SourceBankPath + { + get + { + if (String.IsNullOrEmpty(sourceBankPath) && !String.IsNullOrEmpty(SourceBankPathUnformatted)) + { + sourceBankPath = GetPlatformSpecificPath(SourceBankPathUnformatted); + } + return sourceBankPath; + } + set + { + sourceBankPath = GetPlatformSpecificPath(value); + } + } + + [SerializeField] + public string SourceBankPathUnformatted; + + [SerializeField] + public bool AutomaticEventLoading; + + [SerializeField] + public BankLoadType BankLoadType; + + [SerializeField] + public bool AutomaticSampleLoading; + + [SerializeField] + public ImportType ImportType; + + [SerializeField] + public string TargetAssetPath; + + [SerializeField] + public FMOD.DEBUG_FLAGS LoggingLevel = FMOD.DEBUG_FLAGS.WARNING; + + [SerializeField] + public List SpeakerModeSettings; + + [SerializeField] + public List SampleRateSettings; + + [SerializeField] + public List LiveUpdateSettings; + + [SerializeField] + public List OverlaySettings; + + [SerializeField] + public List LoggingSettings; + + [SerializeField] + public List BankDirectorySettings; + + [SerializeField] + public List VirtualChannelSettings; + + [SerializeField] + public List RealChannelSettings; + + [SerializeField] + public List Plugins = new List(); + + [SerializeField] + public List MasterBanks; + + [SerializeField] + public List Banks; + + [SerializeField] + public List BanksToLoad; + + [SerializeField] + public ushort LiveUpdatePort = 9264; + + public static FMODPlatform GetParent(FMODPlatform platform) + { + switch (platform) + { + case FMODPlatform.Windows: + case FMODPlatform.Linux: + case FMODPlatform.Mac: + case FMODPlatform.UWP: + return FMODPlatform.Desktop; + case FMODPlatform.MobileHigh: + case FMODPlatform.MobileLow: + case FMODPlatform.iOS: + case FMODPlatform.Android: + case FMODPlatform.AppleTV: + return FMODPlatform.Mobile; + case FMODPlatform.Switch: + case FMODPlatform.XboxOne: + case FMODPlatform.PS4: + return FMODPlatform.Console; + case FMODPlatform.Desktop: + case FMODPlatform.Console: + case FMODPlatform.Mobile: + return FMODPlatform.Default; + case FMODPlatform.PlayInEditor: + case FMODPlatform.Default: + default: + return FMODPlatform.None; + } + } + + public static bool HasSetting(List list, FMODPlatform platform) where T : PlatformSettingBase + { + return list.Exists((x) => x.Platform == platform); + } + + public static U GetSetting(List list, FMODPlatform platform, U def) where T : PlatformSetting + { + T t = list.Find((x) => x.Platform == platform); + if (t == null) + { + FMODPlatform parent = GetParent(platform); + if (parent != FMODPlatform.None) + { + return GetSetting(list, parent, def); + } + else + { + return def; + } + } + return t.Value; + } + + public static void SetSetting(List list, FMODPlatform platform, U value) where T : PlatformSetting, new() + { + T setting = list.Find((x) => x.Platform == platform); + if (setting == null) + { + setting = new T(); + setting.Platform = platform; + list.Add(setting); + } + setting.Value = value; + } + + public static void RemoveSetting(List list, FMODPlatform platform) where T : PlatformSettingBase + { + list.RemoveAll((x) => x.Platform == platform); + } + + // -------- Live Update ---------------------- + public bool IsLiveUpdateEnabled(FMODPlatform platform) + { + #if DEVELOPMENT_BUILD || UNITY_EDITOR + return GetSetting(LiveUpdateSettings, platform, TriStateBool.Disabled) != TriStateBool.Disabled; + #else + return GetSetting(LiveUpdateSettings, platform, TriStateBool.Disabled) == TriStateBool.Enabled; + #endif + } + + // -------- Overlay Update ---------------------- + public bool IsOverlayEnabled(FMODPlatform platform) + { + #if DEVELOPMENT_BUILD || UNITY_EDITOR + return GetSetting(OverlaySettings, platform, TriStateBool.Disabled) != TriStateBool.Disabled; + #else + return GetSetting(OverlaySettings, platform, TriStateBool.Disabled) == TriStateBool.Enabled; + #endif + } + + // -------- Real channels ---------------------- + public int GetRealChannels(FMODPlatform platform) + { + return GetSetting(RealChannelSettings, platform, 64); + } + + // -------- Virtual channels ---------------------- + public int GetVirtualChannels(FMODPlatform platform) + { + return GetSetting(VirtualChannelSettings, platform, 128); + } + + // -------- Speaker Mode ---------------------- + public int GetSpeakerMode(FMODPlatform platform) + { + #if UNITY_EDITOR + if (platform == FMODPlatform.PlayInEditor) + { + return GetSetting(SpeakerModeSettings, platform, GetSetting(SpeakerModeSettings, RuntimeUtils.GetEditorFMODPlatform(), (int)FMOD.SPEAKERMODE.STEREO)); + } + else + #endif + { + return GetSetting(SpeakerModeSettings, platform, (int)FMOD.SPEAKERMODE.STEREO); + } + } + // -------- Sample Rate ---------------------- + public int GetSampleRate(FMODPlatform platform) + { + return GetSetting(SampleRateSettings, platform, 48000); + } + + // -------- Bank Platform ---------------------- + public string GetBankPlatform(FMODPlatform platform) + { + if (!HasPlatforms) + { + return ""; + } + #if UNITY_EDITOR + if (platform == FMODPlatform.PlayInEditor) + { + return GetSetting(BankDirectorySettings, platform, GetSetting(BankDirectorySettings, RuntimeUtils.GetEditorFMODPlatform(), "Desktop")); + } + else + #endif + { + return GetSetting(BankDirectorySettings, platform, "Desktop"); + } + } + + private Settings() + { + MasterBanks = new List(); + Banks = new List(); + RealChannelSettings = new List(); + VirtualChannelSettings = new List(); + LoggingSettings = new List(); + LiveUpdateSettings = new List(); + OverlaySettings = new List(); + SampleRateSettings = new List(); + SpeakerModeSettings = new List(); + BankDirectorySettings = new List(); + + // Default play in editor settings + SetSetting(LoggingSettings, FMODPlatform.PlayInEditor, TriStateBool.Enabled); + SetSetting(LiveUpdateSettings, FMODPlatform.PlayInEditor, TriStateBool.Enabled); + SetSetting(OverlaySettings, FMODPlatform.PlayInEditor, TriStateBool.Enabled); + SetSetting(SampleRateSettings, FMODPlatform.PlayInEditor, 48000); + // These are not editable, set them high + SetSetting(RealChannelSettings, FMODPlatform.PlayInEditor, 256); + SetSetting(VirtualChannelSettings, FMODPlatform.PlayInEditor, 1024); + + // Default runtime settings + SetSetting(LoggingSettings, FMODPlatform.Default, TriStateBool.Disabled); + SetSetting(LiveUpdateSettings, FMODPlatform.Default, TriStateBool.Disabled); + SetSetting(OverlaySettings, FMODPlatform.Default, TriStateBool.Disabled); + + SetSetting(RealChannelSettings, FMODPlatform.Default, 32); // Match the default in the low level + SetSetting(VirtualChannelSettings, FMODPlatform.Default, 128); + SetSetting(SampleRateSettings, FMODPlatform.Default, 0); + SetSetting(SpeakerModeSettings, FMODPlatform.Default, (int) FMOD.SPEAKERMODE.STEREO); + + ImportType = ImportType.StreamingAssets; + AutomaticEventLoading = true; + AutomaticSampleLoading = false; + TargetAssetPath = ""; + + } + + private void OnEnable() + { + if (SwitchSettingsMigration == false) + { + SetSetting(LoggingSettings, FMODPlatform.Switch, GetSetting(LoggingSettings, FMODPlatform.Mobile, TriStateBool.Disabled)); + SetSetting(LiveUpdateSettings, FMODPlatform.Switch, GetSetting(LiveUpdateSettings, FMODPlatform.Mobile, TriStateBool.Disabled)); + SetSetting(OverlaySettings, FMODPlatform.Switch, GetSetting(OverlaySettings, FMODPlatform.Mobile, TriStateBool.Disabled)); + + SetSetting(RealChannelSettings, FMODPlatform.Switch, GetSetting(RealChannelSettings, FMODPlatform.Mobile, 32)); // Match the default in the low level + SetSetting(VirtualChannelSettings, FMODPlatform.Switch, GetSetting(VirtualChannelSettings, FMODPlatform.Mobile, 128)); + SetSetting(SampleRateSettings, FMODPlatform.Switch, GetSetting(SampleRateSettings, FMODPlatform.Mobile, 0)); + SetSetting(SpeakerModeSettings, FMODPlatform.Switch, GetSetting(SpeakerModeSettings, FMODPlatform.Mobile, (int)FMOD.SPEAKERMODE.STEREO)); + SwitchSettingsMigration = true; + } + } + + private string GetPlatformSpecificPath(string path) + { + if (string.IsNullOrEmpty(path)) + { + return path; + } + + if (Path.DirectorySeparatorChar == '/') + { + return path.Replace('\\', '/'); + } + return path.Replace('/', '\\'); + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/FMOD/src/Runtime/Settings.cs.meta b/Assets/Plugins/FMOD/src/Runtime/Settings.cs.meta new file mode 100755 index 0000000..1388e86 --- /dev/null +++ b/Assets/Plugins/FMOD/src/Runtime/Settings.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: eef8d824ea7b63742966aaa0e94ac383 +timeCreated: 1435215721 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: -400 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/src/Runtime/StudioBankLoader.cs b/Assets/Plugins/FMOD/src/Runtime/StudioBankLoader.cs new file mode 100755 index 0000000..e720543 --- /dev/null +++ b/Assets/Plugins/FMOD/src/Runtime/StudioBankLoader.cs @@ -0,0 +1,104 @@ +using UnityEngine; +using System.Collections.Generic; + +namespace FMODUnity +{ + [AddComponentMenu("FMOD Studio/FMOD Studio Bank Loader")] + public class StudioBankLoader : MonoBehaviour + { + public LoaderGameEvent LoadEvent; + public LoaderGameEvent UnloadEvent; + [BankRef] + public List Banks; + public string CollisionTag; + public bool PreloadSamples; + private bool isQuitting; + + void HandleGameEvent(LoaderGameEvent gameEvent) + { + if (LoadEvent == gameEvent) + { + Load(); + } + if (UnloadEvent == gameEvent) + { + Unload(); + } + } + + void Start() + { + RuntimeUtils.EnforceLibraryOrder(); + HandleGameEvent(LoaderGameEvent.ObjectStart); + } + + void OnApplicationQuit() + { + isQuitting = true; + } + + void OnDestroy() + { + if (!isQuitting) + { + HandleGameEvent(LoaderGameEvent.ObjectDestroy); + } + } + + void OnTriggerEnter(Collider other) + { + if (string.IsNullOrEmpty(CollisionTag) || other.CompareTag(CollisionTag)) + { + HandleGameEvent(LoaderGameEvent.TriggerEnter); + } + } + + void OnTriggerExit(Collider other) + { + if (string.IsNullOrEmpty(CollisionTag) || other.CompareTag(CollisionTag)) + { + HandleGameEvent(LoaderGameEvent.TriggerExit); + } + } + + void OnTriggerEnter2D(Collider2D other) + { + if (string.IsNullOrEmpty(CollisionTag) || other.CompareTag(CollisionTag)) + { + HandleGameEvent(LoaderGameEvent.TriggerEnter2D); + } + } + + void OnTriggerExit2D(Collider2D other) + { + if (string.IsNullOrEmpty(CollisionTag) || other.CompareTag(CollisionTag)) + { + HandleGameEvent(LoaderGameEvent.TriggerExit2D); + } + } + + public void Load() + { + foreach (var bankRef in Banks) + { + try + { + RuntimeManager.LoadBank(bankRef, PreloadSamples); + } + catch (BankLoadException e) + { + UnityEngine.Debug.LogException(e); + } + } + RuntimeManager.WaitForAllLoads(); + } + + public void Unload() + { + foreach (var bankRef in Banks) + { + RuntimeManager.UnloadBank(bankRef); + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/FMOD/src/Runtime/StudioBankLoader.cs.meta b/Assets/Plugins/FMOD/src/Runtime/StudioBankLoader.cs.meta new file mode 100755 index 0000000..b799f70 --- /dev/null +++ b/Assets/Plugins/FMOD/src/Runtime/StudioBankLoader.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: b9468c5f457ace64f8d4df6d642b107f +timeCreated: 1440562167 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: -250 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/src/Runtime/StudioEventEmitter.cs b/Assets/Plugins/FMOD/src/Runtime/StudioEventEmitter.cs new file mode 100755 index 0000000..0c26736 --- /dev/null +++ b/Assets/Plugins/FMOD/src/Runtime/StudioEventEmitter.cs @@ -0,0 +1,252 @@ +using UnityEngine; +using System; + +namespace FMODUnity +{ + [AddComponentMenu("FMOD Studio/FMOD Studio Event Emitter")] + public class StudioEventEmitter : MonoBehaviour + { + [EventRef] + public string Event = ""; + public EmitterGameEvent PlayEvent = EmitterGameEvent.None; + public EmitterGameEvent StopEvent = EmitterGameEvent.None; + public string CollisionTag = ""; + public bool AllowFadeout = true; + public bool TriggerOnce = false; + public bool Preload = false; + public ParamRef[] Params = new ParamRef[0]; + public bool OverrideAttenuation = false; + public float OverrideMinDistance = -1.0f; + public float OverrideMaxDistance = -1.0f; + + protected FMOD.Studio.EventDescription eventDescription; + public FMOD.Studio.EventDescription EventDescription { get { return eventDescription; } } + + protected FMOD.Studio.EventInstance instance; + public FMOD.Studio.EventInstance EventInstance { get { return instance; } } + + private bool hasTriggered = false; + private bool isQuitting = false; + + void Start() + { + RuntimeUtils.EnforceLibraryOrder(); + if (Preload) + { + Lookup(); + eventDescription.loadSampleData(); + RuntimeManager.StudioSystem.update(); + FMOD.Studio.LOADING_STATE loadingState; + eventDescription.getSampleLoadingState(out loadingState); + while(loadingState == FMOD.Studio.LOADING_STATE.LOADING) + { + #if WINDOWS_UWP + System.Threading.Tasks.Task.Delay(1).Wait(); + #else + System.Threading.Thread.Sleep(1); + #endif + eventDescription.getSampleLoadingState(out loadingState); + } + } + HandleGameEvent(EmitterGameEvent.ObjectStart); + } + + void OnApplicationQuit() + { + isQuitting = true; + } + + void OnDestroy() + { + if (!isQuitting) + { + HandleGameEvent(EmitterGameEvent.ObjectDestroy); + if (instance.isValid()) + { + RuntimeManager.DetachInstanceFromGameObject(instance); + } + + if (Preload) + { + eventDescription.unloadSampleData(); + } + } + } + + void OnEnable() + { + HandleGameEvent(EmitterGameEvent.ObjectEnable); + } + + void OnDisable() + { + HandleGameEvent(EmitterGameEvent.ObjectDisable); + } + + void OnTriggerEnter(Collider other) + { + if (string.IsNullOrEmpty(CollisionTag) || other.CompareTag(CollisionTag)) + { + HandleGameEvent(EmitterGameEvent.TriggerEnter); + } + } + + void OnTriggerExit(Collider other) + { + if (string.IsNullOrEmpty(CollisionTag) || other.CompareTag(CollisionTag)) + { + HandleGameEvent(EmitterGameEvent.TriggerExit); + } + } + + void OnTriggerEnter2D(Collider2D other) + { + if (string.IsNullOrEmpty(CollisionTag) || other.CompareTag(CollisionTag)) + { + HandleGameEvent(EmitterGameEvent.TriggerEnter2D); + } + } + + void OnTriggerExit2D(Collider2D other) + { + if (string.IsNullOrEmpty(CollisionTag) || other.CompareTag(CollisionTag)) + { + HandleGameEvent(EmitterGameEvent.TriggerExit2D); + } + } + + void OnCollisionEnter() + { + HandleGameEvent(EmitterGameEvent.CollisionEnter); + } + + void OnCollisionExit() + { + HandleGameEvent(EmitterGameEvent.CollisionExit); + } + + void OnCollisionEnter2D() + { + HandleGameEvent(EmitterGameEvent.CollisionEnter2D); + } + + void OnCollisionExit2D() + { + HandleGameEvent(EmitterGameEvent.CollisionExit2D); + } + + void HandleGameEvent(EmitterGameEvent gameEvent) + { + if (PlayEvent == gameEvent) + { + Play(); + } + if (StopEvent == gameEvent) + { + Stop(); + } + } + + void Lookup() + { + eventDescription = RuntimeManager.GetEventDescription(Event); + } + + public void Play() + { + if (TriggerOnce && hasTriggered) + { + return; + } + + if (string.IsNullOrEmpty(Event)) + { + return; + } + + if (!eventDescription.isValid()) + { + Lookup(); + } + + bool isOneshot = false; + if (!Event.StartsWith("snapshot", StringComparison.CurrentCultureIgnoreCase)) + { + eventDescription.isOneshot(out isOneshot); + } + bool is3D; + eventDescription.is3D(out is3D); + + if (!instance.isValid()) + { + instance.clearHandle(); + } + + // Let previous oneshot instances play out + if (isOneshot && instance.isValid()) + { + instance.release(); + instance.clearHandle(); + } + + if (!instance.isValid()) + { + eventDescription.createInstance(out instance); + + // Only want to update if we need to set 3D attributes + if (is3D) + { + var rigidBody = GetComponent(); + var rigidBody2D = GetComponent(); + var transform = GetComponent(); + if (rigidBody) + { + instance.set3DAttributes(RuntimeUtils.To3DAttributes(gameObject, rigidBody)); + RuntimeManager.AttachInstanceToGameObject(instance, transform, rigidBody); + } + else + { + instance.set3DAttributes(RuntimeUtils.To3DAttributes(gameObject, rigidBody2D)); + RuntimeManager.AttachInstanceToGameObject(instance, transform, rigidBody2D); + } + } + } + + foreach(var param in Params) + { + instance.setParameterByID(param.ID, param.Value); + } + + if (is3D && OverrideAttenuation) + { + instance.setProperty(FMOD.Studio.EVENT_PROPERTY.MINIMUM_DISTANCE, OverrideMinDistance); + instance.setProperty(FMOD.Studio.EVENT_PROPERTY.MAXIMUM_DISTANCE, OverrideMaxDistance); + } + + instance.start(); + + hasTriggered = true; + } + + public void Stop() + { + if (instance.isValid()) + { + instance.stop(AllowFadeout ? FMOD.Studio.STOP_MODE.ALLOWFADEOUT : FMOD.Studio.STOP_MODE.IMMEDIATE); + instance.release(); + instance.clearHandle(); + } + } + + public bool IsPlaying() + { + if (instance.isValid() && instance.isValid()) + { + FMOD.Studio.PLAYBACK_STATE playbackState; + instance.getPlaybackState(out playbackState); + return (playbackState != FMOD.Studio.PLAYBACK_STATE.STOPPED); + } + return false; + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/FMOD/src/Runtime/StudioEventEmitter.cs.meta b/Assets/Plugins/FMOD/src/Runtime/StudioEventEmitter.cs.meta new file mode 100755 index 0000000..bc079bd --- /dev/null +++ b/Assets/Plugins/FMOD/src/Runtime/StudioEventEmitter.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 9a6610d2e704f1648819acc8d7460285 +timeCreated: 1444629021 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: -220 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/src/Runtime/StudioGlobalParameterTrigger.cs b/Assets/Plugins/FMOD/src/Runtime/StudioGlobalParameterTrigger.cs new file mode 100755 index 0000000..f8ab6c9 --- /dev/null +++ b/Assets/Plugins/FMOD/src/Runtime/StudioGlobalParameterTrigger.cs @@ -0,0 +1,124 @@ +using System; +using UnityEngine; + +namespace FMODUnity +{ + [AddComponentMenu("FMOD Studio/FMOD Studio Global Parameter Trigger")] + public class StudioGlobalParameterTrigger: MonoBehaviour + { + [ParamRef] + public string parameter; + public EmitterGameEvent TriggerEvent; + public string CollisionTag; + public float value; + + private FMOD.Studio.PARAMETER_DESCRIPTION parameterDescription; + public FMOD.Studio.PARAMETER_DESCRIPTION ParameterDesctription { get { return parameterDescription; } } + + FMOD.RESULT Lookup() + { + FMOD.RESULT result = RuntimeManager.StudioSystem.getParameterDescriptionByName(parameter, out parameterDescription); + return result; + } + + void Awake() + { + if (string.IsNullOrEmpty(parameterDescription.name)) + { + Lookup(); + } + } + + void Start() + { + HandleGameEvent(EmitterGameEvent.ObjectStart); + } + + void OnDestroy() + { + HandleGameEvent(EmitterGameEvent.ObjectDestroy); + } + + void OnEnable() + { + HandleGameEvent(EmitterGameEvent.ObjectEnable); + } + + void OnDisable() + { + HandleGameEvent(EmitterGameEvent.ObjectDisable); + } + + void OnTriggerEnter(Collider other) + { + if (string.IsNullOrEmpty(CollisionTag) || other.CompareTag(CollisionTag)) + { + HandleGameEvent(EmitterGameEvent.TriggerEnter); + } + } + + void OnTriggerExit(Collider other) + { + if (string.IsNullOrEmpty(CollisionTag) || other.CompareTag(CollisionTag)) + { + HandleGameEvent(EmitterGameEvent.TriggerExit); + } + } + + void OnTriggerEnter2D(Collider2D other) + { + if (string.IsNullOrEmpty(CollisionTag) || other.CompareTag(CollisionTag)) + { + HandleGameEvent(EmitterGameEvent.TriggerEnter2D); + } + } + + void OnTriggerExit2D(Collider2D other) + { + if (string.IsNullOrEmpty(CollisionTag) || other.CompareTag(CollisionTag)) + { + HandleGameEvent(EmitterGameEvent.TriggerExit2D); + } + } + + void OnCollisionEnter() + { + HandleGameEvent(EmitterGameEvent.CollisionEnter); + } + + void OnCollisionExit() + { + HandleGameEvent(EmitterGameEvent.CollisionExit); + } + + void OnCollisionEnter2D() + { + HandleGameEvent(EmitterGameEvent.CollisionEnter2D); + } + + void OnCollisionExit2D() + { + HandleGameEvent(EmitterGameEvent.CollisionExit2D); + } + + void HandleGameEvent(EmitterGameEvent gameEvent) + { + if (TriggerEvent == gameEvent) + { + TriggerParameters(); + } + } + + public void TriggerParameters() + { + if (!string.IsNullOrEmpty(parameter)) + { + FMOD.RESULT result = RuntimeManager.StudioSystem.setParameterByID(parameterDescription.id, value); + if (result != FMOD.RESULT.OK) + { + Debug.LogError(string.Format(("[FMOD] StudioGlobalParameterTrigger failed to set parameter {0} : result = {1}"), parameter, result)); + } + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/FMOD/src/Runtime/StudioGlobalParameterTrigger.cs.meta b/Assets/Plugins/FMOD/src/Runtime/StudioGlobalParameterTrigger.cs.meta new file mode 100755 index 0000000..af31c44 --- /dev/null +++ b/Assets/Plugins/FMOD/src/Runtime/StudioGlobalParameterTrigger.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 9b0e04e2572f9a940a47465f6f3c2f00 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/src/Runtime/StudioListener.cs b/Assets/Plugins/FMOD/src/Runtime/StudioListener.cs new file mode 100755 index 0000000..de5212b --- /dev/null +++ b/Assets/Plugins/FMOD/src/Runtime/StudioListener.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace FMODUnity +{ + [AddComponentMenu("FMOD Studio/FMOD Studio Listener")] + public class StudioListener : MonoBehaviour + { + Rigidbody rigidBody; + Rigidbody2D rigidBody2D; + + public int ListenerNumber = 0; + + void OnEnable() + { + RuntimeUtils.EnforceLibraryOrder(); + rigidBody = gameObject.GetComponent(); + rigidBody2D = gameObject.GetComponent(); + RuntimeManager.HasListener[ListenerNumber] = true; + SetListenerLocation(); + } + + void OnDisable() + { + RuntimeManager.HasListener[ListenerNumber] = false; + } + + void Update() + { + SetListenerLocation(); + } + + void SetListenerLocation() + { + if (rigidBody) + { + RuntimeManager.SetListenerLocation(ListenerNumber, gameObject, rigidBody); + } + else + { + RuntimeManager.SetListenerLocation(ListenerNumber, gameObject, rigidBody2D); + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/FMOD/src/Runtime/StudioListener.cs.meta b/Assets/Plugins/FMOD/src/Runtime/StudioListener.cs.meta new file mode 100755 index 0000000..ff0696f --- /dev/null +++ b/Assets/Plugins/FMOD/src/Runtime/StudioListener.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 86c6556701af9e04380698b89f691b6e +timeCreated: 1449016511 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 80 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/src/Runtime/StudioParameterTrigger.cs b/Assets/Plugins/FMOD/src/Runtime/StudioParameterTrigger.cs new file mode 100755 index 0000000..eaa76d1 --- /dev/null +++ b/Assets/Plugins/FMOD/src/Runtime/StudioParameterTrigger.cs @@ -0,0 +1,136 @@ +using System; +using UnityEngine; + +namespace FMODUnity +{ + [Serializable] + public class EmitterRef + { + public StudioEventEmitter Target; + public ParamRef[] Params; + } + + [AddComponentMenu("FMOD Studio/FMOD Studio Parameter Trigger")] + public class StudioParameterTrigger: MonoBehaviour + { + public EmitterRef[] Emitters; + public EmitterGameEvent TriggerEvent; + public string CollisionTag; + + void Awake() + { + for (int i = 0; i < Emitters.Length; i++) + { + var emitterRef = Emitters[i]; + if (emitterRef.Target != null && !string.IsNullOrEmpty(emitterRef.Target.Event)) + { + FMOD.Studio.EventDescription eventDesc = FMODUnity.RuntimeManager.GetEventDescription(emitterRef.Target.Event); + if (eventDesc.isValid()) + { + for (int j = 0; j < Emitters[i].Params.Length; j++) + { + FMOD.Studio.PARAMETER_DESCRIPTION param; + eventDesc.getParameterDescriptionByName(emitterRef.Target.Params[j].Name, out param); + emitterRef.Params[j].ID = param.id; + } + } + } + } + } + + void Start() + { + HandleGameEvent(EmitterGameEvent.ObjectStart); + } + + void OnDestroy() + { + HandleGameEvent(EmitterGameEvent.ObjectDestroy); + } + + void OnEnable() + { + HandleGameEvent(EmitterGameEvent.ObjectEnable); + } + + void OnDisable() + { + HandleGameEvent(EmitterGameEvent.ObjectDisable); + } + + void OnTriggerEnter(Collider other) + { + if (string.IsNullOrEmpty(CollisionTag) || other.CompareTag(CollisionTag)) + { + HandleGameEvent(EmitterGameEvent.TriggerEnter); + } + } + + void OnTriggerExit(Collider other) + { + if (string.IsNullOrEmpty(CollisionTag) || other.CompareTag(CollisionTag)) + { + HandleGameEvent(EmitterGameEvent.TriggerExit); + } + } + + void OnTriggerEnter2D(Collider2D other) + { + if (string.IsNullOrEmpty(CollisionTag) || other.CompareTag(CollisionTag)) + { + HandleGameEvent(EmitterGameEvent.TriggerEnter2D); + } + } + + void OnTriggerExit2D(Collider2D other) + { + if (string.IsNullOrEmpty(CollisionTag) || other.CompareTag(CollisionTag)) + { + HandleGameEvent(EmitterGameEvent.TriggerExit2D); + } + } + + void OnCollisionEnter() + { + HandleGameEvent(EmitterGameEvent.CollisionEnter); + } + + void OnCollisionExit() + { + HandleGameEvent(EmitterGameEvent.CollisionExit); + } + + void OnCollisionEnter2D() + { + HandleGameEvent(EmitterGameEvent.CollisionEnter2D); + } + + void OnCollisionExit2D() + { + HandleGameEvent(EmitterGameEvent.CollisionExit2D); + } + + void HandleGameEvent(EmitterGameEvent gameEvent) + { + if (TriggerEvent == gameEvent) + { + TriggerParameters(); + } + } + + public void TriggerParameters() + { + for (int i = 0; i < Emitters.Length; i++) + { + var emitterRef = Emitters[i]; + if (emitterRef.Target != null && emitterRef.Target.EventInstance.isValid()) + { + for (int j = 0; j < Emitters[i].Params.Length; j++) + { + emitterRef.Target.EventInstance.setParameterByID(Emitters[i].Params[j].ID, Emitters[i].Params[j].Value); + } + } + } + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/FMOD/src/Runtime/StudioParameterTrigger.cs.meta b/Assets/Plugins/FMOD/src/Runtime/StudioParameterTrigger.cs.meta new file mode 100755 index 0000000..7fe323f --- /dev/null +++ b/Assets/Plugins/FMOD/src/Runtime/StudioParameterTrigger.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 744a208c85da6d04c861d81b992e4ead +timeCreated: 1451968823 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/src/Runtime/Timeline.meta b/Assets/Plugins/FMOD/src/Runtime/Timeline.meta new file mode 100755 index 0000000..e434034 --- /dev/null +++ b/Assets/Plugins/FMOD/src/Runtime/Timeline.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 30aaa31bf04730941a12542740281e72 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/src/Runtime/Timeline/FMODEventPlayable.cs b/Assets/Plugins/FMOD/src/Runtime/Timeline/FMODEventPlayable.cs new file mode 100755 index 0000000..a7b3d3c --- /dev/null +++ b/Assets/Plugins/FMOD/src/Runtime/Timeline/FMODEventPlayable.cs @@ -0,0 +1,196 @@ +using System; +using UnityEngine; +using UnityEngine.Playables; +using UnityEngine.Timeline; + +[System.Serializable] +public class FMODEventPlayable : PlayableAsset, ITimelineClipAsset +{ + public FMODEventPlayableBehavior template = new FMODEventPlayableBehavior(); + + public GameObject TrackTargetObject { get; set; } + public float eventLength; //In seconds. + + FMODEventPlayableBehavior behavior; + + [FMODUnity.EventRef] + [SerializeField] public string eventName; + [SerializeField] public STOP_MODE stopType; + + [SerializeField] public FMODUnity.ParamRef[] parameters = new FMODUnity.ParamRef[0]; + + [NonSerialized] public bool cachedParameters = false; + + public override double duration + { + get + { + if (eventName == null) + { + return base.duration; + } + else + { + return eventLength; + } + } + } + + public ClipCaps clipCaps + { + get { return ClipCaps.None; } + } + + public TimelineClip OwningClip { get; set; } + + public override Playable CreatePlayable(PlayableGraph graph, GameObject owner) + { +#if UNITY_EDITOR + if (!string.IsNullOrEmpty(eventName)) +#else + if (!cachedParameters && !string.IsNullOrEmpty(eventName)) +#endif + { + FMOD.Studio.EventDescription eventDescription; + FMODUnity.RuntimeManager.StudioSystem.getEvent(eventName, out eventDescription); + for (int i = 0; i < parameters.Length; i++) + { + FMOD.Studio.PARAMETER_DESCRIPTION parameterDescription; + eventDescription.getParameterDescriptionByName(parameters[i].Name, out parameterDescription); + parameters[i].ID = parameterDescription.id; + } + cachedParameters = true; + } + + var playable = ScriptPlayable.Create(graph, template); + behavior = playable.GetBehaviour(); + + behavior.TrackTargetObject = TrackTargetObject; + behavior.eventName = eventName; + behavior.stopType = stopType; + behavior.parameters = parameters; + behavior.OwningClip = OwningClip; + + return playable; + } + +#if UNITY_EDITOR + public void UpdateEventDuration(float duration) + { + eventLength = duration / 1000f; + } + + public void OnValidate() + { + if (OwningClip != null && !string.IsNullOrEmpty(eventName)) + { + int index = eventName.LastIndexOf("/"); + OwningClip.displayName = eventName.Substring(index + 1); + } + if (behavior != null && !string.IsNullOrEmpty(behavior.eventName)) + { + behavior.eventName = eventName; + } + } +#endif //UNITY_EDITOR +} + +public enum STOP_MODE : int +{ + AllowFadeout, + Immediate, + None +} + +public class FMODEventPlayableBehavior : PlayableBehaviour +{ + public string eventName; + public STOP_MODE stopType = STOP_MODE.AllowFadeout; + public FMODUnity.ParamRef[] parameters = new FMODUnity.ParamRef[0]; + + public GameObject TrackTargetObject; + public TimelineClip OwningClip; + + private bool isPlayheadInside = false; + + private FMOD.Studio.EventInstance eventInstance; + + protected void PlayEvent() + { + if (!string.IsNullOrEmpty(eventName)) + { + eventInstance = FMODUnity.RuntimeManager.CreateInstance(eventName); + // Only attach to object if the game is actually playing, not auditioning. + if (Application.isPlaying && TrackTargetObject) + { + Rigidbody rb = TrackTargetObject.GetComponent(); + if (rb) + { + FMODUnity.RuntimeManager.AttachInstanceToGameObject(eventInstance, TrackTargetObject.transform, rb); + } + else + { + FMODUnity.RuntimeManager.AttachInstanceToGameObject(eventInstance, TrackTargetObject.transform, TrackTargetObject.GetComponent()); + } + } + else + { + eventInstance.set3DAttributes(FMODUnity.RuntimeUtils.To3DAttributes(Vector3.zero)); + } + + foreach (var param in parameters) + { + eventInstance.setParameterByID(param.ID, param.Value); + } + + eventInstance.start(); + } + } + + public void OnEnter() + { + if (!isPlayheadInside) + { + PlayEvent(); + isPlayheadInside = true; + } + } + + public void OnExit() + { + if (isPlayheadInside) + { + if (eventInstance.isValid()) + { + if (stopType != STOP_MODE.None) + { + eventInstance.stop(stopType == STOP_MODE.Immediate ? FMOD.Studio.STOP_MODE.IMMEDIATE : FMOD.Studio.STOP_MODE.ALLOWFADEOUT); + } + eventInstance.release(); + } + isPlayheadInside = false; + } + } + + public void UpdateBehaviour(float time) + { + if ((time >= OwningClip.start) && (time < OwningClip.end)) + { + OnEnter(); + } + else + { + OnExit(); + } + } + + public override void OnGraphStop(Playable playable) + { + isPlayheadInside = false; + if (eventInstance.isValid()) + { + eventInstance.stop(FMOD.Studio.STOP_MODE.IMMEDIATE); + eventInstance.release(); + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/FMOD/src/Runtime/Timeline/FMODEventPlayable.cs.meta b/Assets/Plugins/FMOD/src/Runtime/Timeline/FMODEventPlayable.cs.meta new file mode 100755 index 0000000..125fd1f --- /dev/null +++ b/Assets/Plugins/FMOD/src/Runtime/Timeline/FMODEventPlayable.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: 987a467495df9d942b56b1b51381d095 +timeCreated: 1523230466 +licenseType: Free +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {fileID: 2800000, guid: 392af304825cbe847bbf4e603852e4dd, type: 3} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/src/Runtime/Timeline/FMODEventTrack.cs b/Assets/Plugins/FMOD/src/Runtime/Timeline/FMODEventTrack.cs new file mode 100755 index 0000000..8538a18 --- /dev/null +++ b/Assets/Plugins/FMOD/src/Runtime/Timeline/FMODEventTrack.cs @@ -0,0 +1,68 @@ +using UnityEngine; +using UnityEngine.Playables; +using UnityEngine.Timeline; + +#if UNITY_EDITOR +using UnityEditor; +#endif + +[TrackColor(0.066f, 0.134f, 0.244f)] +[TrackClipType(typeof(FMODEventPlayable))] +[TrackBindingType(typeof(GameObject))] +public class FMODEventTrack : TrackAsset +{ + public override Playable CreateTrackMixer(PlayableGraph graph, GameObject go, int inputCount) + { + var director = go.GetComponent(); + var trackTargetObject = director.GetGenericBinding(this) as GameObject; + + foreach (var clip in GetClips()) + { + var playableAsset = clip.asset as FMODEventPlayable; + + if (playableAsset) + { + playableAsset.TrackTargetObject = trackTargetObject; + playableAsset.OwningClip = clip; + } + } + + var scriptPlayable = ScriptPlayable.Create(graph, inputCount); + return scriptPlayable; + } +} + +public class FMODEventMixerBehaviour : PlayableBehaviour +{ + public override void ProcessFrame(Playable playable, FrameData info, object playerData) + { +#if UNITY_EDITOR + /* + * Process frame is called from OnGUI() when auditioning. + * Check playing to avoid retriggering sounds while scrubbing or repainting. + * Check IsQuitting to avoid accessing the RuntimeManager during the Play-In-Editor to Editor transition. + */ + bool playing = playable.GetGraph().IsPlaying(); + if (!playing) + { + return; + } + /* When auditioning manually update the StudioSystem in place of the RuntimeManager. */ + if (!Application.isPlaying) + { + FMODUnity.RuntimeManager.StudioSystem.update(); + } +#endif //UNITY_EDITOR + + int inputCount = playable.GetInputCount(); + float time = (float)playable.GetGraph().GetRootPlayable(0).GetTime(); + + for (int i = 0; i < inputCount; i++) + { + ScriptPlayable inputPlayable = (ScriptPlayable)playable.GetInput(i); + FMODEventPlayableBehavior input = inputPlayable.GetBehaviour(); + + input.UpdateBehaviour(time); + } + } +} \ No newline at end of file diff --git a/Assets/Plugins/FMOD/src/Runtime/Timeline/FMODEventTrack.cs.meta b/Assets/Plugins/FMOD/src/Runtime/Timeline/FMODEventTrack.cs.meta new file mode 100755 index 0000000..1abbd38 --- /dev/null +++ b/Assets/Plugins/FMOD/src/Runtime/Timeline/FMODEventTrack.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: 133253f56854570409c222a87786b263 +timeCreated: 1523230466 +licenseType: Free +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {fileID: 2800000, guid: a4edfa5854cdec34b98b1c55f0562bdd, type: 3} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/src/Runtime/fmodplugins.cpp b/Assets/Plugins/FMOD/src/Runtime/fmodplugins.cpp new file mode 100755 index 0000000..ef619c0 --- /dev/null +++ b/Assets/Plugins/FMOD/src/Runtime/fmodplugins.cpp @@ -0,0 +1,58 @@ +struct FMOD_SYSTEM; +struct FMOD_DSP_DESCRIPTION; + +extern "C" uint32_t FMOD5_System_RegisterDSP(FMOD_SYSTEM *system, const FMOD_DSP_DESCRIPTION *description, uint32_t *handle); + +extern FMOD_DSP_DESCRIPTION* FMOD_Google_GVRListener_GetDSPDescription(); +extern FMOD_DSP_DESCRIPTION* FMOD_Google_GVRSoundfield_GetDSPDescription(); +extern FMOD_DSP_DESCRIPTION* FMOD_Google_GVRSource_GetDSPDescription(); + +extern FMOD_DSP_DESCRIPTION* FMOD_ResonanceAudioListener_GetDSPDescription(); +extern FMOD_DSP_DESCRIPTION* FMOD_ResonanceAudioSoundfield_GetDSPDescription(); +extern FMOD_DSP_DESCRIPTION* FMOD_ResonanceAudioSource_GetDSPDescription(); + +extern "C" uint32_t FmodUnityNativePluginInit(FMOD_SYSTEM* system) +{ + uint32_t result = 0; + + /* + + This function is invoked on iOS and tvOS after the system has been + initialized and before any banks are loaded. It can be used to manually + register plugins that have been statically linked into the executable. + + Each plugin will require a separate call to FMOD_System_RegisterDSP. + The DSP_DESCRIPTION argument is the same as what is returned by + FMODGetDSPDescription when building a dynamic plugin. + + */ + + /* + result = FMOD5_System_RegisterDSP(system, GetMyDSPDescription(), nullptr); + if (result != 0) + { + return result; + } + */ + + /* Uncomment this next section to use the Resonance Audio plugin on iOS */ + /* + result = FMOD5_System_RegisterDSP(system, FMOD_ResonanceAudioListener_GetDSPDescription(), nullptr); + if (result != 0) + { + return result; + } + result = FMOD5_System_RegisterDSP(system, FMOD_ResonanceAudioSoundfield_GetDSPDescription(), nullptr); + if (result != 0) + { + return result; + } + result = FMOD5_System_RegisterDSP(system, FMOD_ResonanceAudioSource_GetDSPDescription(), nullptr); + if (result != 0) + { + return result; + } + */ + + return result; +} diff --git a/Assets/Plugins/FMOD/src/Runtime/fmodplugins.cpp.meta b/Assets/Plugins/FMOD/src/Runtime/fmodplugins.cpp.meta new file mode 100755 index 0000000..ea4a9c4 --- /dev/null +++ b/Assets/Plugins/FMOD/src/Runtime/fmodplugins.cpp.meta @@ -0,0 +1,54 @@ +fileFormatVersion: 2 +guid: b609b2636c3bd40b6baa2df2e77d015e +timeCreated: 1466052174 +licenseType: Free +PluginImporter: + serializedVersion: 1 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + platformData: + Any: + enabled: 0 + settings: {} + Editor: + enabled: 0 + settings: + CPU: AnyCPU + DefaultValueInitialized: true + OS: AnyOS + Linux: + enabled: 0 + settings: + CPU: x86 + Linux64: + enabled: 0 + settings: + CPU: x86_64 + OSXIntel: + enabled: 0 + settings: + CPU: AnyCPU + OSXIntel64: + enabled: 0 + settings: + CPU: AnyCPU + Win: + enabled: 0 + settings: + CPU: AnyCPU + Win64: + enabled: 0 + settings: + CPU: AnyCPU + iOS: + enabled: 1 + settings: + CompileFlags: + FrameworkDependencies: + tvOS: + enabled: 1 + settings: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/src/Runtime/wrapper.meta b/Assets/Plugins/FMOD/src/Runtime/wrapper.meta new file mode 100755 index 0000000..ff65a17 --- /dev/null +++ b/Assets/Plugins/FMOD/src/Runtime/wrapper.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: bfaed09c888d2a24096887e3996f48a0 +folderAsset: yes +timeCreated: 1432600460 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/src/Runtime/wrapper/fmod.cs b/Assets/Plugins/FMOD/src/Runtime/wrapper/fmod.cs new file mode 100755 index 0000000..537332a --- /dev/null +++ b/Assets/Plugins/FMOD/src/Runtime/wrapper/fmod.cs @@ -0,0 +1,3764 @@ +/* ======================================================================================== */ +/* FMOD Core API - C# wrapper. */ +/* Copyright (c), Firelight Technologies Pty, Ltd. 2004-2019. */ +/* */ +/* For more detail visit: */ +/* https://fmod.com/resources/documentation-api?version=2.0&page=core-api.html */ +/* ======================================================================================== */ + +using System; +using System.Text; +using System.Runtime.InteropServices; +using System.Collections.Generic; + +namespace FMOD +{ + /* + FMOD version number. Check this against FMOD::System::getVersion / System_GetVersion + 0xaaaabbcc -> aaaa = major version number. bb = minor version number. cc = development version number. + */ + public class VERSION + { + public const int number = 0x00020000; +#if (UNITY_IPHONE || UNITY_TVOS || UNITY_SWITCH || UNITY_WEBGL) && !UNITY_EDITOR + public const string dll = "__Internal"; +#elif (UNITY_PS4) && DEVELOPMENT_BUILD + public const string dll = "libfmodL"; +#elif (UNITY_PS4) && !UNITY_EDITOR + public const string dll = "libfmod"; +#elif (UNITY_PSP2) && !UNITY_EDITOR + public const string dll = "libfmodstudio"; +/* Linux defines moved before the Windows define, otherwise Linux Editor tries to use Win lib when selected as build target.*/ +#elif (UNITY_EDITOR_LINUX) || ((UNITY_STANDALONE_LINUX || UNITY_ANDROID || UNITY_XBOXONE) && DEVELOPMENT_BUILD) + public const string dll = "fmodL"; +#elif (UNITY_EDITOR_OSX || UNITY_EDITOR_WIN) || ((UNITY_STANDALONE_OSX || UNITY_STANDALONE_WIN) && DEVELOPMENT_BUILD) + public const string dll = "fmodstudioL"; +#elif (UNITY_STANDALONE_OSX || UNITY_STANDALONE_WIN) + public const string dll = "fmodstudio"; +#else + public const string dll = "fmod"; +#endif + } + + public class CONSTANTS + { + public const int MAX_CHANNEL_WIDTH = 32; + public const int MAX_LISTENERS = 8; + public const int REVERB_MAXINSTANCES = 4; + public const int MAX_SYSTEMS = 8; + } + + /* + FMOD types + */ + public enum RESULT : int + { + OK, /* No errors. */ + ERR_BADCOMMAND, /* Tried to call a function on a data type that does not allow this type of functionality (ie calling Sound::lock on a streaming sound). */ + ERR_CHANNEL_ALLOC, /* Error trying to allocate a channel. */ + ERR_CHANNEL_STOLEN, /* The specified channel has been reused to play another sound. */ + ERR_DMA, /* DMA Failure. See debug output for more information. */ + ERR_DSP_CONNECTION, /* DSP connection error. Connection possibly caused a cyclic dependency or connected dsps with incompatible buffer counts. */ + ERR_DSP_DONTPROCESS, /* DSP return code from a DSP process query callback. Tells mixer not to call the process callback and therefore not consume CPU. Use this to optimize the DSP graph. */ + ERR_DSP_FORMAT, /* DSP Format error. A DSP unit may have attempted to connect to this network with the wrong format, or a matrix may have been set with the wrong size if the target unit has a specified channel map. */ + ERR_DSP_INUSE, /* DSP is already in the mixer's DSP network. It must be removed before being reinserted or released. */ + ERR_DSP_NOTFOUND, /* DSP connection error. Couldn't find the DSP unit specified. */ + ERR_DSP_RESERVED, /* DSP operation error. Cannot perform operation on this DSP as it is reserved by the system. */ + ERR_DSP_SILENCE, /* DSP return code from a DSP process query callback. Tells mixer silence would be produced from read, so go idle and not consume CPU. Use this to optimize the DSP graph. */ + ERR_DSP_TYPE, /* DSP operation cannot be performed on a DSP of this type. */ + ERR_FILE_BAD, /* Error loading file. */ + ERR_FILE_COULDNOTSEEK, /* Couldn't perform seek operation. This is a limitation of the medium (ie netstreams) or the file format. */ + ERR_FILE_DISKEJECTED, /* Media was ejected while reading. */ + ERR_FILE_EOF, /* End of file unexpectedly reached while trying to read essential data (truncated?). */ + ERR_FILE_ENDOFDATA, /* End of current chunk reached while trying to read data. */ + ERR_FILE_NOTFOUND, /* File not found. */ + ERR_FORMAT, /* Unsupported file or audio format. */ + ERR_HEADER_MISMATCH, /* There is a version mismatch between the FMOD header and either the FMOD Studio library or the FMOD Low Level library. */ + ERR_HTTP, /* A HTTP error occurred. This is a catch-all for HTTP errors not listed elsewhere. */ + ERR_HTTP_ACCESS, /* The specified resource requires authentication or is forbidden. */ + ERR_HTTP_PROXY_AUTH, /* Proxy authentication is required to access the specified resource. */ + ERR_HTTP_SERVER_ERROR, /* A HTTP server error occurred. */ + ERR_HTTP_TIMEOUT, /* The HTTP request timed out. */ + ERR_INITIALIZATION, /* FMOD was not initialized correctly to support this function. */ + ERR_INITIALIZED, /* Cannot call this command after System::init. */ + ERR_INTERNAL, /* An error occurred that wasn't supposed to. Contact support. */ + ERR_INVALID_FLOAT, /* Value passed in was a NaN, Inf or denormalized float. */ + ERR_INVALID_HANDLE, /* An invalid object handle was used. */ + ERR_INVALID_PARAM, /* An invalid parameter was passed to this function. */ + ERR_INVALID_POSITION, /* An invalid seek position was passed to this function. */ + ERR_INVALID_SPEAKER, /* An invalid speaker was passed to this function based on the current speaker mode. */ + ERR_INVALID_SYNCPOINT, /* The syncpoint did not come from this sound handle. */ + ERR_INVALID_THREAD, /* Tried to call a function on a thread that is not supported. */ + ERR_INVALID_VECTOR, /* The vectors passed in are not unit length, or perpendicular. */ + ERR_MAXAUDIBLE, /* Reached maximum audible playback count for this sound's soundgroup. */ + ERR_MEMORY, /* Not enough memory or resources. */ + ERR_MEMORY_CANTPOINT, /* Can't use FMOD_OPENMEMORY_POINT on non PCM source data, or non mp3/xma/adpcm data if FMOD_CREATECOMPRESSEDSAMPLE was used. */ + ERR_NEEDS3D, /* Tried to call a command on a 2d sound when the command was meant for 3d sound. */ + ERR_NEEDSHARDWARE, /* Tried to use a feature that requires hardware support. */ + ERR_NET_CONNECT, /* Couldn't connect to the specified host. */ + ERR_NET_SOCKET_ERROR, /* A socket error occurred. This is a catch-all for socket-related errors not listed elsewhere. */ + ERR_NET_URL, /* The specified URL couldn't be resolved. */ + ERR_NET_WOULD_BLOCK, /* Operation on a non-blocking socket could not complete immediately. */ + ERR_NOTREADY, /* Operation could not be performed because specified sound/DSP connection is not ready. */ + ERR_OUTPUT_ALLOCATED, /* Error initializing output device, but more specifically, the output device is already in use and cannot be reused. */ + ERR_OUTPUT_CREATEBUFFER, /* Error creating hardware sound buffer. */ + ERR_OUTPUT_DRIVERCALL, /* A call to a standard soundcard driver failed, which could possibly mean a bug in the driver or resources were missing or exhausted. */ + ERR_OUTPUT_FORMAT, /* Soundcard does not support the specified format. */ + ERR_OUTPUT_INIT, /* Error initializing output device. */ + ERR_OUTPUT_NODRIVERS, /* The output device has no drivers installed. If pre-init, FMOD_OUTPUT_NOSOUND is selected as the output mode. If post-init, the function just fails. */ + ERR_PLUGIN, /* An unspecified error has been returned from a plugin. */ + ERR_PLUGIN_MISSING, /* A requested output, dsp unit type or codec was not available. */ + ERR_PLUGIN_RESOURCE, /* A resource that the plugin requires cannot be found. (ie the DLS file for MIDI playback) */ + ERR_PLUGIN_VERSION, /* A plugin was built with an unsupported SDK version. */ + ERR_RECORD, /* An error occurred trying to initialize the recording device. */ + ERR_REVERB_CHANNELGROUP, /* Reverb properties cannot be set on this channel because a parent channelgroup owns the reverb connection. */ + ERR_REVERB_INSTANCE, /* Specified instance in FMOD_REVERB_PROPERTIES couldn't be set. Most likely because it is an invalid instance number or the reverb doesn't exist. */ + ERR_SUBSOUNDS, /* The error occurred because the sound referenced contains subsounds when it shouldn't have, or it doesn't contain subsounds when it should have. The operation may also not be able to be performed on a parent sound. */ + ERR_SUBSOUND_ALLOCATED, /* This subsound is already being used by another sound, you cannot have more than one parent to a sound. Null out the other parent's entry first. */ + ERR_SUBSOUND_CANTMOVE, /* Shared subsounds cannot be replaced or moved from their parent stream, such as when the parent stream is an FSB file. */ + ERR_TAGNOTFOUND, /* The specified tag could not be found or there are no tags. */ + ERR_TOOMANYCHANNELS, /* The sound created exceeds the allowable input channel count. This can be increased using the 'maxinputchannels' parameter in System::setSoftwareFormat. */ + ERR_TRUNCATED, /* The retrieved string is too long to fit in the supplied buffer and has been truncated. */ + ERR_UNIMPLEMENTED, /* Something in FMOD hasn't been implemented when it should be! contact support! */ + ERR_UNINITIALIZED, /* This command failed because System::init or System::setDriver was not called. */ + ERR_UNSUPPORTED, /* A command issued was not supported by this object. Possibly a plugin without certain callbacks specified. */ + ERR_VERSION, /* The version number of this file format is not supported. */ + ERR_EVENT_ALREADY_LOADED, /* The specified bank has already been loaded. */ + ERR_EVENT_LIVEUPDATE_BUSY, /* The live update connection failed due to the game already being connected. */ + ERR_EVENT_LIVEUPDATE_MISMATCH, /* The live update connection failed due to the game data being out of sync with the tool. */ + ERR_EVENT_LIVEUPDATE_TIMEOUT, /* The live update connection timed out. */ + ERR_EVENT_NOTFOUND, /* The requested event, bus or vca could not be found. */ + ERR_STUDIO_UNINITIALIZED, /* The Studio::System object is not yet initialized. */ + ERR_STUDIO_NOT_LOADED, /* The specified resource is not loaded, so it can't be unloaded. */ + ERR_INVALID_STRING, /* An invalid string was passed to this function. */ + ERR_ALREADY_LOCKED, /* The specified resource is already locked. */ + ERR_NOT_LOCKED, /* The specified resource is not locked, so it can't be unlocked. */ + ERR_RECORD_DISCONNECTED, /* The specified recording driver has been disconnected. */ + ERR_TOOMANYSAMPLES, /* The length provided exceed the allowable limit. */ + } + + public enum CHANNELCONTROL_TYPE : int + { + CHANNEL, + CHANNELGROUP, + MAX + } + + [StructLayout(LayoutKind.Sequential)] + public struct VECTOR + { + public float x; /* X co-ordinate in 3D space. */ + public float y; /* Y co-ordinate in 3D space. */ + public float z; /* Z co-ordinate in 3D space. */ + } + + [StructLayout(LayoutKind.Sequential)] + public struct ATTRIBUTES_3D + { + public VECTOR position; + public VECTOR velocity; + public VECTOR forward; + public VECTOR up; + } + + [StructLayout(LayoutKind.Sequential)] + public struct ASYNCREADINFO + { + public IntPtr handle; /* [r] The file handle that was filled out in the open callback. */ + public uint offset; /* [r] Seek position, make sure you read from this file offset. */ + public uint sizebytes; /* [r] how many bytes requested for read. */ + public int priority; /* [r] 0 = low importance. 100 = extremely important (ie 'must read now or stuttering may occur') */ + + public IntPtr userdata; /* [r] User data pointer. */ + public IntPtr buffer; /* [w] Buffer to read file data into. */ + public uint bytesread; /* [w] Fill this in before setting result code to tell FMOD how many bytes were read. */ + public FILE_ASYNCDONE_FUNC done; /* [r] FMOD file system wake up function. Call this when user file read is finished. Pass result of file read as a parameter. */ + } + + public enum OUTPUTTYPE : int + { + AUTODETECT, /* Picks the best output mode for the platform. This is the default. */ + + UNKNOWN, /* All - 3rd party plugin, unknown. This is for use with System::getOutput only. */ + NOSOUND, /* All - Perform all mixing but discard the final output. */ + WAVWRITER, /* All - Writes output to a .wav file. */ + NOSOUND_NRT, /* All - Non-realtime version of FMOD_OUTPUTTYPE_NOSOUND. User can drive mixer with System::update at whatever rate they want. */ + WAVWRITER_NRT, /* All - Non-realtime version of FMOD_OUTPUTTYPE_WAVWRITER. User can drive mixer with System::update at whatever rate they want. */ + + WASAPI, /* Win / Xbox One - Windows Audio Session API. (Default on Windows and Xbox One) */ + ASIO, /* Win - Low latency ASIO 2.0. */ + PULSEAUDIO, /* Linux - Pulse Audio. (Default on Linux if available) */ + ALSA, /* Linux - Advanced Linux Sound Architecture. (Default on Linux if PulseAudio isn't available) */ + COREAUDIO, /* Mac / iOS - Core Audio. (Default on Mac and iOS) */ + AUDIOTRACK, /* Android - Java Audio Track. (Default on Android 2.2 and below) */ + OPENSL, /* Android - OpenSL ES. (Default on Android 2.3 and above) */ + AUDIOOUT, /* PS4 - Audio Out. (Default on PS4) */ + AUDIO3D, /* PS4 - Audio3D. */ + WEBAUDIO, /* Web Browser - JavaScript webaudio output. (Default on JavaScript) */ + NNAUDIO, /* Switch - nn::audio. (Default on Switch) */ + WINSONIC, /* Win10 / Xbox One - Windows Sonic. */ + + MAX, /* Maximum number of output types supported. */ + } + + public enum DEBUG_MODE : int + { + TTY, /* Default log location per platform, i.e. Visual Studio output window, stderr, LogCat, etc */ + FILE, /* Write log to specified file path */ + CALLBACK, /* Call specified callback with log information */ + } + + [Flags] + public enum DEBUG_FLAGS : uint + { + NONE = 0x00000000, /* Disable all messages */ + ERROR = 0x00000001, /* Enable only error messages. */ + WARNING = 0x00000002, /* Enable warning and error messages. */ + LOG = 0x00000004, /* Enable informational, warning and error messages (default). */ + + TYPE_MEMORY = 0x00000100, /* Verbose logging for memory operations, only use this if you are debugging a memory related issue. */ + TYPE_FILE = 0x00000200, /* Verbose logging for file access, only use this if you are debugging a file related issue. */ + TYPE_CODEC = 0x00000400, /* Verbose logging for codec initialization, only use this if you are debugging a codec related issue. */ + TYPE_TRACE = 0x00000800, /* Verbose logging for internal errors, use this for tracking the origin of error codes. */ + + DISPLAY_TIMESTAMPS = 0x00010000, /* Display the time stamp of the log message in milliseconds. */ + DISPLAY_LINENUMBERS = 0x00020000, /* Display the source code file and line number for where the message originated. */ + DISPLAY_THREAD = 0x00040000, /* Display the thread ID of the calling function that generated the message. */ + } + + [Flags] + public enum MEMORY_TYPE : uint + { + NORMAL = 0x00000000, /* Standard memory. */ + STREAM_FILE = 0x00000001, /* Stream file buffer, size controllable with System::setStreamBufferSize. */ + STREAM_DECODE = 0x00000002, /* Stream decode buffer, size controllable with FMOD_CREATESOUNDEXINFO::decodebuffersize. */ + SAMPLEDATA = 0x00000004, /* Sample data buffer. Raw audio data, usually PCM/MPEG/ADPCM/XMA data. */ + DSP_BUFFER = 0x00000008, /* DSP memory block allocated when more than 1 output exists on a DSP node. */ + PLUGIN = 0x00000010, /* Memory allocated by a third party plugin. */ + PERSISTENT = 0x00200000, /* Persistent memory. Memory will be freed when System::release is called. */ + ALL = 0xFFFFFFFF + } + + public enum SPEAKERMODE : int + { + DEFAULT, /* Default speaker mode for the chosen output mode which will resolve after System::init. */ + RAW, /* Assume there is no special mapping from a given channel to a speaker, channels map 1:1 in order. Use System::setSoftwareFormat to specify the speaker count. */ + MONO, /* 1 speaker setup (monaural). */ + STEREO, /* 2 speaker setup (stereo) front left, front right. */ + QUAD, /* 4 speaker setup (4.0) front left, front right, surround left, surround right. */ + SURROUND, /* 5 speaker setup (5.0) front left, front right, center, surround left, surround right. */ + _5POINT1, /* 6 speaker setup (5.1) front left, front right, center, low frequency, surround left, surround right. */ + _7POINT1, /* 8 speaker setup (7.1) front left, front right, center, low frequency, surround left, surround right, back left, back right. */ + _7POINT1POINT4, /* 12 speaker setup (7.1.4) front left, front right, center, low frequency, surround left, surround right, back left, back right, top front left, top front right, top back left, top back right. */ + + MAX, /* Maximum number of speaker modes supported. */ + } + + public enum SPEAKER : int + { + FRONT_LEFT, /* The front left speaker */ + FRONT_RIGHT, /* The front right speaker */ + FRONT_CENTER, /* The front center speaker */ + LOW_FREQUENCY, /* The LFE or 'subwoofer' speaker */ + SURROUND_LEFT, /* The surround left (usually to the side) speaker */ + SURROUND_RIGHT, /* The surround right (usually to the side) speaker */ + BACK_LEFT, /* The back left speaker */ + BACK_RIGHT, /* The back right speaker */ + TOP_FRONT_LEFT, /* The top front left speaker */ + TOP_FRONT_RIGHT, /* The top front right speaker */ + TOP_BACK_LEFT, /* The top back left speaker */ + TOP_BACK_RIGHT, /* The top back right speaker */ + + MAX, /* Maximum number of speaker types supported. */ + } + + [Flags] + public enum CHANNELMASK : uint + { + FRONT_LEFT = 0x00000001, + FRONT_RIGHT = 0x00000002, + FRONT_CENTER = 0x00000004, + LOW_FREQUENCY = 0x00000008, + SURROUND_LEFT = 0x00000010, + SURROUND_RIGHT = 0x00000020, + BACK_LEFT = 0x00000040, + BACK_RIGHT = 0x00000080, + BACK_CENTER = 0x00000100, + + MONO = (FRONT_LEFT), + STEREO = (FRONT_LEFT | FRONT_RIGHT), + LRC = (FRONT_LEFT | FRONT_RIGHT | FRONT_CENTER), + QUAD = (FRONT_LEFT | FRONT_RIGHT | SURROUND_LEFT | SURROUND_RIGHT), + SURROUND = (FRONT_LEFT | FRONT_RIGHT | FRONT_CENTER | SURROUND_LEFT | SURROUND_RIGHT), + _5POINT1 = (FRONT_LEFT | FRONT_RIGHT | FRONT_CENTER | LOW_FREQUENCY | SURROUND_LEFT | SURROUND_RIGHT), + _5POINT1_REARS = (FRONT_LEFT | FRONT_RIGHT | FRONT_CENTER | LOW_FREQUENCY | BACK_LEFT | BACK_RIGHT), + _7POINT0 = (FRONT_LEFT | FRONT_RIGHT | FRONT_CENTER | SURROUND_LEFT | SURROUND_RIGHT | BACK_LEFT | BACK_RIGHT), + _7POINT1 = (FRONT_LEFT | FRONT_RIGHT | FRONT_CENTER | LOW_FREQUENCY | SURROUND_LEFT | SURROUND_RIGHT | BACK_LEFT | BACK_RIGHT) + } + + public enum CHANNELORDER : int + { + DEFAULT, /* Left, Right, Center, LFE, Surround Left, Surround Right, Back Left, Back Right (see FMOD_SPEAKER enumeration) */ + WAVEFORMAT, /* Left, Right, Center, LFE, Back Left, Back Right, Surround Left, Surround Right (as per Microsoft .wav WAVEFORMAT structure master order) */ + PROTOOLS, /* Left, Center, Right, Surround Left, Surround Right, LFE */ + ALLMONO, /* Mono, Mono, Mono, Mono, Mono, Mono, ... (each channel all the way up to 32 channels are treated as if they were mono) */ + ALLSTEREO, /* Left, Right, Left, Right, Left, Right, ... (each pair of channels is treated as stereo all the way up to 32 channels) */ + ALSA, /* Left, Right, Surround Left, Surround Right, Center, LFE (as per Linux ALSA channel order) */ + + MAX, /* Maximum number of channel orderings supported. */ + } + + public enum PLUGINTYPE : int + { + OUTPUT, /* The plugin type is an output module. FMOD mixed audio will play through one of these devices */ + CODEC, /* The plugin type is a file format codec. FMOD will use these codecs to load file formats for playback. */ + DSP, /* The plugin type is a DSP unit. FMOD will use these plugins as part of its DSP network to apply effects to output or generate sound in realtime. */ + + MAX, /* Maximum number of plugin types supported. */ + } + + [StructLayout(LayoutKind.Sequential)] + public struct PLUGINLIST + { + PLUGINTYPE type; + IntPtr description; + } + + [Flags] + public enum INITFLAGS : uint + { + NORMAL = 0x00000000, /* Initialize normally */ + STREAM_FROM_UPDATE = 0x00000001, /* No stream thread is created internally. Streams are driven from System::update. Mainly used with non-realtime outputs. */ + MIX_FROM_UPDATE = 0x00000002, /* FMOD Mixer thread is woken up to do a mix when System::update is called rather than waking periodically on its own timer. */ + _3D_RIGHTHANDED = 0x00000004, /* FMOD will treat +X as right, +Y as up and +Z as backwards (towards you). */ + CHANNEL_LOWPASS = 0x00000100, /* All FMOD_3D based voices will add a software lowpass filter effect into the DSP chain which is automatically used when Channel::set3DOcclusion is used or the geometry API. This also causes sounds to sound duller when the sound goes behind the listener, as a fake HRTF style effect. Use System::setAdvancedSettings to disable or adjust cutoff frequency for this feature. */ + CHANNEL_DISTANCEFILTER = 0x00000200, /* All FMOD_3D based voices will add a software lowpass and highpass filter effect into the DSP chain which will act as a distance-automated bandpass filter. Use System::setAdvancedSettings to adjust the center frequency. */ + PROFILE_ENABLE = 0x00010000, /* Enable TCP/IP based host which allows FMOD Designer or FMOD Profiler to connect to it, and view memory, CPU and the DSP network graph in real-time. */ + VOL0_BECOMES_VIRTUAL = 0x00020000, /* Any sounds that are 0 volume will go virtual and not be processed except for having their positions updated virtually. Use System::setAdvancedSettings to adjust what volume besides zero to switch to virtual at. */ + GEOMETRY_USECLOSEST = 0x00040000, /* With the geometry engine, only process the closest polygon rather than accumulating all polygons the sound to listener line intersects. */ + PREFER_DOLBY_DOWNMIX = 0x00080000, /* When using FMOD_SPEAKERMODE_5POINT1 with a stereo output device, use the Dolby Pro Logic II downmix algorithm instead of the default stereo downmix algorithm. */ + THREAD_UNSAFE = 0x00100000, /* Disables thread safety for API calls. Only use this if FMOD low level is being called from a single thread, and if Studio API is not being used! */ + PROFILE_METER_ALL = 0x00200000, /* Slower, but adds level metering for every single DSP unit in the graph. Use DSP::setMeteringEnabled to turn meters off individually. */ + } + + public enum SOUND_TYPE : int + { + UNKNOWN, /* 3rd party / unknown plugin format. */ + AIFF, /* AIFF. */ + ASF, /* Microsoft Advanced Systems Format (ie WMA/ASF/WMV). */ + DLS, /* Sound font / downloadable sound bank. */ + FLAC, /* FLAC lossless codec. */ + FSB, /* FMOD Sample Bank. */ + IT, /* Impulse Tracker. */ + MIDI, /* MIDI. extracodecdata is a pointer to an FMOD_MIDI_EXTRACODECDATA structure. */ + MOD, /* Protracker / Fasttracker MOD. */ + MPEG, /* MP2/MP3 MPEG. */ + OGGVORBIS, /* Ogg vorbis. */ + PLAYLIST, /* Information only from ASX/PLS/M3U/WAX playlists */ + RAW, /* Raw PCM data. */ + S3M, /* ScreamTracker 3. */ + USER, /* User created sound. */ + WAV, /* Microsoft WAV. */ + XM, /* FastTracker 2 XM. */ + XMA, /* Xbox One XMA */ + AUDIOQUEUE, /* iPhone hardware decoder, supports AAC, ALAC and MP3. extracodecdata is a pointer to an FMOD_AUDIOQUEUE_EXTRACODECDATA structure. */ + AT9, /* PS4 ATRAC 9 format */ + VORBIS, /* Vorbis */ + MEDIA_FOUNDATION,/* Windows Store Application built in system codecs */ + MEDIACODEC, /* Android MediaCodec */ + FADPCM, /* FMOD Adaptive Differential Pulse Code Modulation */ + + MAX, /* Maximum number of sound types supported. */ + } + + public enum SOUND_FORMAT : int + { + NONE, /* Unitialized / unknown */ + PCM8, /* 8bit integer PCM data */ + PCM16, /* 16bit integer PCM data */ + PCM24, /* 24bit integer PCM data */ + PCM32, /* 32bit integer PCM data */ + PCMFLOAT, /* 32bit floating point PCM data */ + BITSTREAM, /* Sound data is in its native compressed format. */ + + MAX /* Maximum number of sound formats supported. */ + } + + [Flags] + public enum MODE : uint + { + DEFAULT = 0x00000000, /* Default for all modes listed below. FMOD_LOOP_OFF, FMOD_2D, FMOD_3D_WORLDRELATIVE, FMOD_3D_INVERSEROLLOFF */ + LOOP_OFF = 0x00000001, /* For non looping sounds. (default). Overrides FMOD_LOOP_NORMAL / FMOD_LOOP_BIDI. */ + LOOP_NORMAL = 0x00000002, /* For forward looping sounds. */ + LOOP_BIDI = 0x00000004, /* For bidirectional looping sounds. (only works on software mixed static sounds). */ + _2D = 0x00000008, /* Ignores any 3d processing. (default). */ + _3D = 0x00000010, /* Makes the sound positionable in 3D. Overrides FMOD_2D. */ + CREATESTREAM = 0x00000080, /* Decompress at runtime, streaming from the source provided (standard stream). Overrides FMOD_CREATESAMPLE. */ + CREATESAMPLE = 0x00000100, /* Decompress at loadtime, decompressing or decoding whole file into memory as the target sample format. (standard sample). */ + CREATECOMPRESSEDSAMPLE = 0x00000200, /* Load MP2, MP3, IMAADPCM or XMA into memory and leave it compressed. During playback the FMOD software mixer will decode it in realtime as a 'compressed sample'. Can only be used in combination with FMOD_SOFTWARE. */ + OPENUSER = 0x00000400, /* Opens a user created static sample or stream. Use FMOD_CREATESOUNDEXINFO to specify format and/or read callbacks. If a user created 'sample' is created with no read callback, the sample will be empty. Use FMOD_Sound_Lock and FMOD_Sound_Unlock to place sound data into the sound if this is the case. */ + OPENMEMORY = 0x00000800, /* "name_or_data" will be interpreted as a pointer to memory instead of filename for creating sounds. */ + OPENMEMORY_POINT = 0x10000000, /* "name_or_data" will be interpreted as a pointer to memory instead of filename for creating sounds. Use FMOD_CREATESOUNDEXINFO to specify length. This differs to FMOD_OPENMEMORY in that it uses the memory as is, without duplicating the memory into its own buffers. Cannot be freed after open, only after Sound::release. Will not work if the data is compressed and FMOD_CREATECOMPRESSEDSAMPLE is not used. */ + OPENRAW = 0x00001000, /* Will ignore file format and treat as raw pcm. User may need to declare if data is FMOD_SIGNED or FMOD_UNSIGNED */ + OPENONLY = 0x00002000, /* Just open the file, dont prebuffer or read. Good for fast opens for info, or when sound::readData is to be used. */ + ACCURATETIME = 0x00004000, /* For FMOD_CreateSound - for accurate FMOD_Sound_GetLength / FMOD_Channel_SetPosition on VBR MP3, AAC and MOD/S3M/XM/IT/MIDI files. Scans file first, so takes longer to open. FMOD_OPENONLY does not affect this. */ + MPEGSEARCH = 0x00008000, /* For corrupted / bad MP3 files. This will search all the way through the file until it hits a valid MPEG header. Normally only searches for 4k. */ + NONBLOCKING = 0x00010000, /* For opening sounds and getting streamed subsounds (seeking) asyncronously. Use Sound::getOpenState to poll the state of the sound as it opens or retrieves the subsound in the background. */ + UNIQUE = 0x00020000, /* Unique sound, can only be played one at a time */ + _3D_HEADRELATIVE = 0x00040000, /* Make the sound's position, velocity and orientation relative to the listener. */ + _3D_WORLDRELATIVE = 0x00080000, /* Make the sound's position, velocity and orientation absolute (relative to the world). (DEFAULT) */ + _3D_INVERSEROLLOFF = 0x00100000, /* This sound will follow the inverse rolloff model where mindistance = full volume, maxdistance = where sound stops attenuating, and rolloff is fixed according to the global rolloff factor. (DEFAULT) */ + _3D_LINEARROLLOFF = 0x00200000, /* This sound will follow a linear rolloff model where mindistance = full volume, maxdistance = silence. */ + _3D_LINEARSQUAREROLLOFF= 0x00400000, /* This sound will follow a linear-square rolloff model where mindistance = full volume, maxdistance = silence. Rolloffscale is ignored. */ + _3D_INVERSETAPEREDROLLOFF = 0x00800000, /* This sound will follow the inverse rolloff model at distances close to mindistance and a linear-square rolloff close to maxdistance. */ + _3D_CUSTOMROLLOFF = 0x04000000, /* This sound will follow a rolloff model defined by Sound::set3DCustomRolloff / Channel::set3DCustomRolloff. */ + _3D_IGNOREGEOMETRY = 0x40000000, /* Is not affect by geometry occlusion. If not specified in Sound::setMode, or Channel::setMode, the flag is cleared and it is affected by geometry again. */ + IGNORETAGS = 0x02000000, /* Skips id3v2/asf/etc tag checks when opening a sound, to reduce seek/read overhead when opening files (helps with CD performance). */ + LOWMEM = 0x08000000, /* Removes some features from samples to give a lower memory overhead, like Sound::getName. */ + VIRTUAL_PLAYFROMSTART = 0x80000000 /* For sounds that start virtual (due to being quiet or low importance), instead of swapping back to audible, and playing at the correct offset according to time, this flag makes the sound play from the start. */ + } + + public enum OPENSTATE : int + { + READY = 0, /* Opened and ready to play */ + LOADING, /* Initial load in progress */ + ERROR, /* Failed to open - file not found, out of memory etc. See return value of Sound::getOpenState for what happened. */ + CONNECTING, /* Connecting to remote host (internet sounds only) */ + BUFFERING, /* Buffering data */ + SEEKING, /* Seeking to subsound and re-flushing stream buffer. */ + PLAYING, /* Ready and playing, but not possible to release at this time without stalling the main thread. */ + SETPOSITION, /* Seeking within a stream to a different position. */ + + MAX, /* Maximum number of open state types. */ + } + + public enum SOUNDGROUP_BEHAVIOR : int + { + BEHAVIOR_FAIL, /* Any sound played that puts the sound count over the SoundGroup::setMaxAudible setting, will simply fail during System::playSound. */ + BEHAVIOR_MUTE, /* Any sound played that puts the sound count over the SoundGroup::setMaxAudible setting, will be silent, then if another sound in the group stops the sound that was silent before becomes audible again. */ + BEHAVIOR_STEALLOWEST, /* Any sound played that puts the sound count over the SoundGroup::setMaxAudible setting, will steal the quietest / least important sound playing in the group. */ + + MAX, /* Maximum number of sound group behaviors. */ + } + + public enum CHANNELCONTROL_CALLBACK_TYPE : int + { + END, /* Called when a sound ends. */ + VIRTUALVOICE, /* Called when a voice is swapped out or swapped in. */ + SYNCPOINT, /* Called when a syncpoint is encountered. Can be from wav file markers. */ + OCCLUSION, /* Called when the channel has its geometry occlusion value calculated. Can be used to clamp or change the value. */ + + MAX, /* Maximum number of callback types supported. */ + } + + public struct CHANNELCONTROL_DSP_INDEX + { + public const int HEAD = -1; /* Head of the DSP chain. Equivalent of index 0. */ + public const int FADER = -2; /* Built in fader DSP. */ + public const int TAIL = -3; /* Tail of the DSP chain. Equivalent of the number of dsps minus 1. */ + } + + public enum ERRORCALLBACK_INSTANCETYPE : int + { + NONE, + SYSTEM, + CHANNEL, + CHANNELGROUP, + CHANNELCONTROL, + SOUND, + SOUNDGROUP, + DSP, + DSPCONNECTION, + GEOMETRY, + REVERB3D, + STUDIO_SYSTEM, + STUDIO_EVENTDESCRIPTION, + STUDIO_EVENTINSTANCE, + STUDIO_PARAMETERINSTANCE, + STUDIO_BUS, + STUDIO_VCA, + STUDIO_BANK, + STUDIO_COMMANDREPLAY + } + + [StructLayout(LayoutKind.Sequential)] + public struct ERRORCALLBACK_INFO + { + public RESULT result; /* Error code result */ + public ERRORCALLBACK_INSTANCETYPE instancetype; /* Type of instance the error occurred on */ + public IntPtr instance; /* Instance pointer */ + public StringWrapper functionname; /* Function that the error occurred on */ + public StringWrapper functionparams; /* Function parameters that the error ocurred on */ + } + + [Flags] + public enum SYSTEM_CALLBACK_TYPE : uint + { + DEVICELISTCHANGED = 0x00000001, /* Called from System::update when the enumerated list of devices has changed. */ + DEVICELOST = 0x00000002, /* Called from System::update when an output device has been lost due to control panel parameter changes and FMOD cannot automatically recover. */ + MEMORYALLOCATIONFAILED = 0x00000004, /* Called directly when a memory allocation fails somewhere in FMOD. (NOTE - 'system' will be NULL in this callback type.)*/ + THREADCREATED = 0x00000008, /* Called directly when a thread is created. (NOTE - 'system' will be NULL in this callback type.) */ + BADDSPCONNECTION = 0x00000010, /* Called when a bad connection was made with DSP::addInput. Usually called from mixer thread because that is where the connections are made. */ + PREMIX = 0x00000020, /* Called each tick before a mix update happens. */ + POSTMIX = 0x00000040, /* Called each tick after a mix update happens. */ + ERROR = 0x00000080, /* Called when each API function returns an error code, including delayed async functions. */ + MIDMIX = 0x00000100, /* Called each tick in mix update after clocks have been updated before the main mix occurs. */ + THREADDESTROYED = 0x00000200, /* Called directly when a thread is destroyed. */ + PREUPDATE = 0x00000400, /* Called at start of System::update function. */ + POSTUPDATE = 0x00000800, /* Called at end of System::update function. */ + RECORDLISTCHANGED = 0x00001000, /* Called from System::update when the enumerated list of recording devices has changed. */ + ALL = 0xFFFFFFFF, /* Pass this mask to System::setCallback to receive all callback types. */ + } + + /* + FMOD Callbacks + */ + public delegate RESULT DEBUG_CALLBACK (DEBUG_FLAGS flags, StringWrapper file, int line, StringWrapper func, StringWrapper message); + public delegate RESULT SYSTEM_CALLBACK (IntPtr system, SYSTEM_CALLBACK_TYPE type, IntPtr commanddata1, IntPtr commanddata2, IntPtr userdata); + public delegate RESULT CHANNELCONTROL_CALLBACK(IntPtr channelcontrol, CHANNELCONTROL_TYPE controltype, CHANNELCONTROL_CALLBACK_TYPE callbacktype, IntPtr commanddata1, IntPtr commanddata2); + public delegate RESULT SOUND_NONBLOCK_CALLBACK (IntPtr sound, RESULT result); + public delegate RESULT SOUND_PCMREAD_CALLBACK (IntPtr sound, IntPtr data, uint datalen); + public delegate RESULT SOUND_PCMSETPOS_CALLBACK (IntPtr sound, int subsound, uint position, TIMEUNIT postype); + public delegate RESULT FILE_OPEN_CALLBACK (StringWrapper name, ref uint filesize, ref IntPtr handle, IntPtr userdata); + public delegate RESULT FILE_CLOSE_CALLBACK (IntPtr handle, IntPtr userdata); + public delegate RESULT FILE_READ_CALLBACK (IntPtr handle, IntPtr buffer, uint sizebytes, ref uint bytesread, IntPtr userdata); + public delegate RESULT FILE_SEEK_CALLBACK (IntPtr handle, uint pos, IntPtr userdata); + public delegate RESULT FILE_ASYNCREAD_CALLBACK (IntPtr info, IntPtr userdata); + public delegate RESULT FILE_ASYNCCANCEL_CALLBACK(IntPtr info, IntPtr userdata); + public delegate RESULT FILE_ASYNCDONE_FUNC (IntPtr info, RESULT result); + public delegate IntPtr MEMORY_ALLOC_CALLBACK (uint size, MEMORY_TYPE type, StringWrapper sourcestr); + public delegate IntPtr MEMORY_REALLOC_CALLBACK (IntPtr ptr, uint size, MEMORY_TYPE type, StringWrapper sourcestr); + public delegate void MEMORY_FREE_CALLBACK (IntPtr ptr, MEMORY_TYPE type, StringWrapper sourcestr); + public delegate float CB_3D_ROLLOFF_CALLBACK (IntPtr channelcontrol, float distance); + + public enum DSP_RESAMPLER : int + { + DEFAULT, /* Default interpolation method. Currently equal to FMOD_DSP_RESAMPLER_LINEAR. */ + NOINTERP, /* No interpolation. High frequency aliasing hiss will be audible depending on the sample rate of the sound. */ + LINEAR, /* Linear interpolation (default method). Fast and good quality, causes very slight lowpass effect on low frequency sounds. */ + CUBIC, /* Cubic interpolation. Slower than linear interpolation but better quality. */ + SPLINE, /* 5 point spline interpolation. Slowest resampling method but best quality. */ + + MAX, /* Maximum number of resample methods supported. */ + } + + public enum DSPCONNECTION_TYPE : int + { + STANDARD, /* Default connection type. Audio is mixed from the input to the output DSP's audible buffer. */ + SIDECHAIN, /* Sidechain connection type. Audio is mixed from the input to the output DSP's sidechain buffer. */ + SEND, /* Send connection type. Audio is mixed from the input to the output DSP's audible buffer, but the input is NOT executed, only copied from. A standard connection or sidechain needs to make an input execute to generate data. */ + SEND_SIDECHAIN, /* Send sidechain connection type. Audio is mixed from the input to the output DSP's sidechain buffer, but the input is NOT executed, only copied from. A standard connection or sidechain needs to make an input execute to generate data. */ + + MAX, /* Maximum number of DSP connection types supported. */ + } + + public enum TAGTYPE : int + { + UNKNOWN = 0, + ID3V1, + ID3V2, + VORBISCOMMENT, + SHOUTCAST, + ICECAST, + ASF, + MIDI, + PLAYLIST, + FMOD, + USER, + + MAX /* Maximum number of tag types supported. */ + } + + public enum TAGDATATYPE : int + { + BINARY = 0, + INT, + FLOAT, + STRING, + STRING_UTF16, + STRING_UTF16BE, + STRING_UTF8, + + MAX /* Maximum number of tag datatypes supported. */ + } + + [StructLayout(LayoutKind.Sequential)] + public struct TAG + { + public TAGTYPE type; /* [r] The type of this tag. */ + public TAGDATATYPE datatype; /* [r] The type of data that this tag contains */ + public StringWrapper name; /* [r] The name of this tag i.e. "TITLE", "ARTIST" etc. */ + public IntPtr data; /* [r] Pointer to the tag data - its format is determined by the datatype member */ + public uint datalen; /* [r] Length of the data contained in this tag */ + public bool updated; /* [r] True if this tag has been updated since last being accessed with Sound::getTag */ + } + + [Flags] + public enum TIMEUNIT : uint + { + MS = 0x00000001, /* Milliseconds. */ + PCM = 0x00000002, /* PCM Samples, related to milliseconds * samplerate / 1000. */ + PCMBYTES = 0x00000004, /* Bytes, related to PCM samples * channels * datawidth (ie 16bit = 2 bytes). */ + RAWBYTES = 0x00000008, /* Raw file bytes of (compressed) sound data (does not include headers). Only used by Sound::getLength and Channel::getPosition. */ + PCMFRACTION = 0x00000010, /* Fractions of 1 PCM sample. Unsigned int range 0 to 0xFFFFFFFF. Used for sub-sample granularity for DSP purposes. */ + MODORDER = 0x00000100, /* MOD/S3M/XM/IT. Order in a sequenced module format. Use Sound::getFormat to determine the format. */ + MODROW = 0x00000200, /* MOD/S3M/XM/IT. Current row in a sequenced module format. Cannot use with Channel::setPosition. Sound::getLength will return the number if rows in the currently playing or seeked to pattern. */ + MODPATTERN = 0x00000400, /* MOD/S3M/XM/IT. Current pattern in a sequenced module format. Cannot use with Channel::setPosition. Sound::getLength will return the number of patterns in the song and Channel::getPosition will return the currently playing pattern. */ + } + + public struct PORT_INDEX + { + public const ulong NONE = 0xFFFFFFFFFFFFFFFF; + } + + [StructLayout(LayoutKind.Sequential)] + public struct CREATESOUNDEXINFO + { + public int cbsize; /* [w] Size of this structure. This is used so the structure can be expanded in the future and still work on older versions of FMOD Ex. */ + public uint length; /* [w] Optional. Specify 0 to ignore. Size in bytes of file to load, or sound to create (in this case only if FMOD_OPENUSER is used). Required if loading from memory. If 0 is specified, then it will use the size of the file (unless loading from memory then an error will be returned). */ + public uint fileoffset; /* [w] Optional. Specify 0 to ignore. Offset from start of the file to start loading from. This is useful for loading files from inside big data files. */ + public int numchannels; /* [w] Optional. Specify 0 to ignore. Number of channels in a sound specified only if OPENUSER is used. */ + public int defaultfrequency; /* [w] Optional. Specify 0 to ignore. Default frequency of sound in a sound specified only if OPENUSER is used. Other formats use the frequency determined by the file format. */ + public SOUND_FORMAT format; /* [w] Optional. Specify 0 or SOUND_FORMAT_NONE to ignore. Format of the sound specified only if OPENUSER is used. Other formats use the format determined by the file format. */ + public uint decodebuffersize; /* [w] Optional. Specify 0 to ignore. For streams. This determines the size of the double buffer (in PCM samples) that a stream uses. Use this for user created streams if you want to determine the size of the callback buffer passed to you. Specify 0 to use FMOD's default size which is currently equivalent to 400ms of the sound format created/loaded. */ + public int initialsubsound; /* [w] Optional. Specify 0 to ignore. In a multi-sample file format such as .FSB/.DLS/.SF2, specify the initial subsound to seek to, only if CREATESTREAM is used. */ + public int numsubsounds; /* [w] Optional. Specify 0 to ignore or have no subsounds. In a user created multi-sample sound, specify the number of subsounds within the sound that are accessable with Sound::getSubSound / SoundGetSubSound. */ + public IntPtr inclusionlist; /* [w] Optional. Specify 0 to ignore. In a multi-sample format such as .FSB/.DLS/.SF2 it may be desirable to specify only a subset of sounds to be loaded out of the whole file. This is an array of subsound indicies to load into memory when created. */ + public int inclusionlistnum; /* [w] Optional. Specify 0 to ignore. This is the number of integers contained within the */ + public SOUND_PCMREAD_CALLBACK pcmreadcallback; /* [w] Optional. Specify 0 to ignore. Callback to 'piggyback' on FMOD's read functions and accept or even write PCM data while FMOD is opening the sound. Used for user sounds created with OPENUSER or for capturing decoded data as FMOD reads it. */ + public SOUND_PCMSETPOS_CALLBACK pcmsetposcallback; /* [w] Optional. Specify 0 to ignore. Callback for when the user calls a seeking function such as Channel::setPosition within a multi-sample sound, and for when it is opened.*/ + public SOUND_NONBLOCK_CALLBACK nonblockcallback; /* [w] Optional. Specify 0 to ignore. Callback for successful completion, or error while loading a sound that used the FMOD_NONBLOCKING flag.*/ + public IntPtr dlsname; /* [w] Optional. Specify 0 to ignore. Filename for a DLS or SF2 sample set when loading a MIDI file. If not specified, on windows it will attempt to open /windows/system32/drivers/gm.dls, otherwise the MIDI will fail to open. */ + public IntPtr encryptionkey; /* [w] Optional. Specify 0 to ignore. Key for encrypted FSB file. Without this key an encrypted FSB file will not load. */ + public int maxpolyphony; /* [w] Optional. Specify 0 to ingore. For sequenced formats with dynamic channel allocation such as .MID and .IT, this specifies the maximum voice count allowed while playing. .IT defaults to 64. .MID defaults to 32. */ + public IntPtr userdata; /* [w] Optional. Specify 0 to ignore. This is user data to be attached to the sound during creation. Access via Sound::getUserData. */ + public SOUND_TYPE suggestedsoundtype; /* [w] Optional. Specify 0 or FMOD_SOUND_TYPE_UNKNOWN to ignore. Instead of scanning all codec types, use this to speed up loading by making it jump straight to this codec. */ + public FILE_OPEN_CALLBACK fileuseropen; /* [w] Optional. Specify 0 to ignore. Callback for opening this file. */ + public FILE_CLOSE_CALLBACK fileuserclose; /* [w] Optional. Specify 0 to ignore. Callback for closing this file. */ + public FILE_READ_CALLBACK fileuserread; /* [w] Optional. Specify 0 to ignore. Callback for reading from this file. */ + public FILE_SEEK_CALLBACK fileuserseek; /* [w] Optional. Specify 0 to ignore. Callback for seeking within this file. */ + public FILE_ASYNCREAD_CALLBACK fileuserasyncread; /* [w] Optional. Specify 0 to ignore. Callback for asyncronously reading from this file. */ + public FILE_ASYNCCANCEL_CALLBACK fileuserasynccancel; /* [w] Optional. Specify 0 to ignore. Callback for cancelling an asyncronous read. */ + public IntPtr fileuserdata; /* [w] Optional. Specify 0 to ignore. User data to be passed into the file callbacks. */ + public int filebuffersize; /* [w] Optional. Specify 0 to ignore. Buffer size for reading the file, -1 to disable buffering, or 0 for system default. */ + public CHANNELORDER channelorder; /* [w] Optional. Specify 0 to ignore. Use this to differ the way fmod maps multichannel sounds to speakers. See FMOD_CHANNELORDER for more. */ + public IntPtr initialsoundgroup; /* [w] Optional. Specify 0 to ignore. Specify a sound group if required, to put sound in as it is created. */ + public uint initialseekposition; /* [w] Optional. Specify 0 to ignore. For streams. Specify an initial position to seek the stream to. */ + public TIMEUNIT initialseekpostype; /* [w] Optional. Specify 0 to ignore. For streams. Specify the time unit for the position set in initialseekposition. */ + public int ignoresetfilesystem; /* [w] Optional. Specify 0 to ignore. Set to 1 to use fmod's built in file system. Ignores setFileSystem callbacks and also FMOD_CREATESOUNEXINFO file callbacks. Useful for specific cases where you don't want to use your own file system but want to use fmod's file system (ie net streaming). */ + public uint audioqueuepolicy; /* [w] Optional. Specify 0 or FMOD_AUDIOQUEUE_CODECPOLICY_DEFAULT to ignore. Policy used to determine whether hardware or software is used for decoding, see FMOD_AUDIOQUEUE_CODECPOLICY for options (iOS >= 3.0 required, otherwise only hardware is available) */ + public uint minmidigranularity; /* [w] Optional. Specify 0 to ignore. Allows you to set a minimum desired MIDI mixer granularity. Values smaller than 512 give greater than default accuracy at the cost of more CPU and vise versa. Specify 0 for default (512 samples). */ + public int nonblockthreadid; /* [w] Optional. Specify 0 to ignore. Specifies a thread index to execute non blocking load on. Allows for up to 5 threads to be used for loading at once. This is to avoid one load blocking another. Maximum value = 4. */ + public IntPtr fsbguid; /* [r/w] Optional. Specify 0 to ignore. Allows you to provide the GUID lookup for cached FSB header info. Once loaded the GUID will be written back to the pointer. This is to avoid seeking and reading the FSB header. */ + } + +#pragma warning disable 414 + [StructLayout(LayoutKind.Sequential)] + public struct REVERB_PROPERTIES + { /* MIN MAX DEFAULT DESCRIPTION */ + public float DecayTime; /* [r/w] 0.0 20000.0 1500.0 Reverberation decay time in ms */ + public float EarlyDelay; /* [r/w] 0.0 300.0 7.0 Initial reflection delay time */ + public float LateDelay; /* [r/w] 0.0 100 11.0 Late reverberation delay time relative to initial reflection */ + public float HFReference; /* [r/w] 20.0 20000.0 5000 Reference high frequency (hz) */ + public float HFDecayRatio; /* [r/w] 10.0 100.0 50.0 High-frequency to mid-frequency decay time ratio */ + public float Diffusion; /* [r/w] 0.0 100.0 100.0 Value that controls the echo density in the late reverberation decay. */ + public float Density; /* [r/w] 0.0 100.0 100.0 Value that controls the modal density in the late reverberation decay */ + public float LowShelfFrequency; /* [r/w] 20.0 1000.0 250.0 Reference low frequency (hz) */ + public float LowShelfGain; /* [r/w] -36.0 12.0 0.0 Relative room effect level at low frequencies */ + public float HighCut; /* [r/w] 20.0 20000.0 20000.0 Relative room effect level at high frequencies */ + public float EarlyLateMix; /* [r/w] 0.0 100.0 50.0 Early reflections level relative to room effect */ + public float WetLevel; /* [r/w] -80.0 20.0 -6.0 Room effect level (at mid frequencies) + * */ + #region wrapperinternal + public REVERB_PROPERTIES(float decayTime, float earlyDelay, float lateDelay, float hfReference, + float hfDecayRatio, float diffusion, float density, float lowShelfFrequency, float lowShelfGain, + float highCut, float earlyLateMix, float wetLevel) + { + DecayTime = decayTime; + EarlyDelay = earlyDelay; + LateDelay = lateDelay; + HFReference = hfReference; + HFDecayRatio = hfDecayRatio; + Diffusion = diffusion; + Density = density; + LowShelfFrequency = lowShelfFrequency; + LowShelfGain = lowShelfGain; + HighCut = highCut; + EarlyLateMix = earlyLateMix; + WetLevel = wetLevel; + } + #endregion + } +#pragma warning restore 414 + + public class PRESET + { + /* Instance Env Diffus Room RoomHF RmLF DecTm DecHF DecLF Refl RefDel Revb RevDel ModTm ModDp HFRef LFRef Diffus Densty FLAGS */ + public static REVERB_PROPERTIES OFF() { return new REVERB_PROPERTIES( 1000, 7, 11, 5000, 100, 100, 100, 250, 0, 20, 96, -80.0f );} + public static REVERB_PROPERTIES GENERIC() { return new REVERB_PROPERTIES( 1500, 7, 11, 5000, 83, 100, 100, 250, 0, 14500, 96, -8.0f );} + public static REVERB_PROPERTIES PADDEDCELL() { return new REVERB_PROPERTIES( 170, 1, 2, 5000, 10, 100, 100, 250, 0, 160, 84, -7.8f );} + public static REVERB_PROPERTIES ROOM() { return new REVERB_PROPERTIES( 400, 2, 3, 5000, 83, 100, 100, 250, 0, 6050, 88, -9.4f );} + public static REVERB_PROPERTIES BATHROOM() { return new REVERB_PROPERTIES( 1500, 7, 11, 5000, 54, 100, 60, 250, 0, 2900, 83, 0.5f );} + public static REVERB_PROPERTIES LIVINGROOM() { return new REVERB_PROPERTIES( 500, 3, 4, 5000, 10, 100, 100, 250, 0, 160, 58, -19.0f );} + public static REVERB_PROPERTIES STONEROOM() { return new REVERB_PROPERTIES( 2300, 12, 17, 5000, 64, 100, 100, 250, 0, 7800, 71, -8.5f );} + public static REVERB_PROPERTIES AUDITORIUM() { return new REVERB_PROPERTIES( 4300, 20, 30, 5000, 59, 100, 100, 250, 0, 5850, 64, -11.7f );} + public static REVERB_PROPERTIES CONCERTHALL() { return new REVERB_PROPERTIES( 3900, 20, 29, 5000, 70, 100, 100, 250, 0, 5650, 80, -9.8f );} + public static REVERB_PROPERTIES CAVE() { return new REVERB_PROPERTIES( 2900, 15, 22, 5000, 100, 100, 100, 250, 0, 20000, 59, -11.3f );} + public static REVERB_PROPERTIES ARENA() { return new REVERB_PROPERTIES( 7200, 20, 30, 5000, 33, 100, 100, 250, 0, 4500, 80, -9.6f );} + public static REVERB_PROPERTIES HANGAR() { return new REVERB_PROPERTIES( 10000, 20, 30, 5000, 23, 100, 100, 250, 0, 3400, 72, -7.4f );} + public static REVERB_PROPERTIES CARPETTEDHALLWAY() { return new REVERB_PROPERTIES( 300, 2, 30, 5000, 10, 100, 100, 250, 0, 500, 56, -24.0f );} + public static REVERB_PROPERTIES HALLWAY() { return new REVERB_PROPERTIES( 1500, 7, 11, 5000, 59, 100, 100, 250, 0, 7800, 87, -5.5f );} + public static REVERB_PROPERTIES STONECORRIDOR() { return new REVERB_PROPERTIES( 270, 13, 20, 5000, 79, 100, 100, 250, 0, 9000, 86, -6.0f );} + public static REVERB_PROPERTIES ALLEY() { return new REVERB_PROPERTIES( 1500, 7, 11, 5000, 86, 100, 100, 250, 0, 8300, 80, -9.8f );} + public static REVERB_PROPERTIES FOREST() { return new REVERB_PROPERTIES( 1500, 162, 88, 5000, 54, 79, 100, 250, 0, 760, 94, -12.3f );} + public static REVERB_PROPERTIES CITY() { return new REVERB_PROPERTIES( 1500, 7, 11, 5000, 67, 50, 100, 250, 0, 4050, 66, -26.0f );} + public static REVERB_PROPERTIES MOUNTAINS() { return new REVERB_PROPERTIES( 1500, 300, 100, 5000, 21, 27, 100, 250, 0, 1220, 82, -24.0f );} + public static REVERB_PROPERTIES QUARRY() { return new REVERB_PROPERTIES( 1500, 61, 25, 5000, 83, 100, 100, 250, 0, 3400, 100, -5.0f );} + public static REVERB_PROPERTIES PLAIN() { return new REVERB_PROPERTIES( 1500, 179, 100, 5000, 50, 21, 100, 250, 0, 1670, 65, -28.0f );} + public static REVERB_PROPERTIES PARKINGLOT() { return new REVERB_PROPERTIES( 1700, 8, 12, 5000, 100, 100, 100, 250, 0, 20000, 56, -19.5f );} + public static REVERB_PROPERTIES SEWERPIPE() { return new REVERB_PROPERTIES( 2800, 14, 21, 5000, 14, 80, 60, 250, 0, 3400, 66, 1.2f );} + public static REVERB_PROPERTIES UNDERWATER() { return new REVERB_PROPERTIES( 1500, 7, 11, 5000, 10, 100, 100, 250, 0, 500, 92, 7.0f );} + } + + [StructLayout(LayoutKind.Sequential)] + public struct ADVANCEDSETTINGS + { + public int cbSize; /* [w] Size of this structure. Use sizeof(FMOD_ADVANCEDSETTINGS) */ + public int maxMPEGCodecs; /* [r/w] Optional. Specify 0 to ignore. For use with FMOD_CREATECOMPRESSEDSAMPLE only. MPEG codecs consume 30,528 bytes per instance and this number will determine how many MPEG channels can be played simultaneously. Default = 32. */ + public int maxADPCMCodecs; /* [r/w] Optional. Specify 0 to ignore. For use with FMOD_CREATECOMPRESSEDSAMPLE only. ADPCM codecs consume 3,128 bytes per instance and this number will determine how many ADPCM channels can be played simultaneously. Default = 32. */ + public int maxXMACodecs; /* [r/w] Optional. Specify 0 to ignore. For use with FMOD_CREATECOMPRESSEDSAMPLE only. XMA codecs consume 14,836 bytes per instance and this number will determine how many XMA channels can be played simultaneously. Default = 32. */ + public int maxVorbisCodecs; /* [r/w] Optional. Specify 0 to ignore. For use with FMOD_CREATECOMPRESSEDSAMPLE only. Vorbis codecs consume 23,256 bytes per instance and this number will determine how many Vorbis channels can be played simultaneously. Default = 32. */ + public int maxAT9Codecs; /* [r/w] Optional. Specify 0 to ignore. For use with FMOD_CREATECOMPRESSEDSAMPLE only. AT9 codecs consume 8,720 bytes per instance and this number will determine how many AT9 channels can be played simultaneously. Default = 32. */ + public int maxFADPCMCodecs; /* [r/w] Optional. Specify 0 to ignore. For use with FMOD_CREATECOMPRESSEDSAMPLE only. This number will determine how many FADPCM channels can be played simultaneously. Default = 32. */ + public int maxPCMCodecs; /* [r/w] Unsupported. */ + public int ASIONumChannels; /* [r/w] Optional. Specify 0 to ignore. Number of channels available on the ASIO device. */ + public IntPtr ASIOChannelList; /* [r/w] Optional. Specify 0 to ignore. Pointer to an array of strings (number of entries defined by ASIONumChannels) with ASIO channel names. */ + public IntPtr ASIOSpeakerList; /* [r/w] Optional. Specify 0 to ignore. Pointer to a list of speakers that the ASIO channels map to. This can be called after System::init to remap ASIO output. */ + public float vol0virtualvol; /* [r/w] Optional. Specify 0 to ignore. For use with FMOD_INIT_VOL0_BECOMES_VIRTUAL. If this flag is used, and the volume is below this, then the sound will become virtual. Use this value to raise the threshold to a different point where a sound goes virtual. */ + public uint defaultDecodeBufferSize; /* [r/w] Optional. Specify 0 to ignore. For streams. This determines the default size of the double buffer (in milliseconds) that a stream uses. Default = 400ms */ + public ushort profilePort; /* [r/w] Optional. Specify 0 to ignore. For use with FMOD_INIT_PROFILE_ENABLE. Specify the port to listen on for connections by the profiler application. */ + public uint geometryMaxFadeTime; /* [r/w] Optional. Specify 0 to ignore. The maximum time in miliseconds it takes for a channel to fade to the new level when its occlusion changes. */ + public float distanceFilterCenterFreq; /* [r/w] Optional. Specify 0 to ignore. For use with FMOD_INIT_DISTANCE_FILTERING. The default center frequency in Hz for the distance filtering effect. Default = 1500.0. */ + public int reverb3Dinstance; /* [r/w] Optional. Specify 0 to ignore. Out of 0 to 3, 3d reverb spheres will create a phyical reverb unit on this instance slot. See FMOD_REVERB_PROPERTIES. */ + public int DSPBufferPoolSize; /* [r/w] Optional. Specify 0 to ignore. Number of buffers in DSP buffer pool. Each buffer will be DSPBlockSize * sizeof(float) * SpeakerModeChannelCount. ie 7.1 @ 1024 DSP block size = 8 * 1024 * 4 = 32kb. Default = 8. */ + public uint stackSizeStream; /* [r/w] Optional. Specify 0 to ignore. Specify the stack size for the FMOD Stream thread in bytes. Useful for custom codecs that use excess stack. Default 49,152 (48kb) */ + public uint stackSizeNonBlocking; /* [r/w] Optional. Specify 0 to ignore. Specify the stack size for the FMOD_NONBLOCKING loading thread. Useful for custom codecs that use excess stack. Default 65,536 (64kb) */ + public uint stackSizeMixer; /* [r/w] Optional. Specify 0 to ignore. Specify the stack size for the FMOD mixer thread. Useful for custom dsps that use excess stack. Default 49,152 (48kb) */ + public DSP_RESAMPLER resamplerMethod; /* [r/w] Optional. Specify 0 to ignore. Resampling method used with fmod's software mixer. See FMOD_DSP_RESAMPLER for details on methods. */ + public uint commandQueueSize; /* [r/w] Optional. Specify 0 to ignore. Specify the command queue size for thread safe processing. Default 2048 (2kb) */ + public uint randomSeed; /* [r/w] Optional. Specify 0 to ignore. Seed value that FMOD will use to initialize its internal random number generators. */ + } + + [Flags] + public enum DRIVER_STATE : uint + { + CONNECTED = 0x00000001, /* Device is currently plugged in. */ + DEFAULT = 0x00000002, /* Device is the users preferred choice. */ + } + + /* + FMOD System factory functions. Use this to create an FMOD System Instance. below you will see System init/close to get started. + */ + public struct Factory + { + public static RESULT System_Create(out System system) + { + return FMOD5_System_Create(out system.handle); + } + + #region importfunctions + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_Create(out IntPtr system); + + #endregion + } + + public struct Memory + { + public static RESULT Initialize(IntPtr poolmem, int poollen, MEMORY_ALLOC_CALLBACK useralloc, MEMORY_REALLOC_CALLBACK userrealloc, MEMORY_FREE_CALLBACK userfree, MEMORY_TYPE memtypeflags = MEMORY_TYPE.ALL) + { + return FMOD5_Memory_Initialize(poolmem, poollen, useralloc, userrealloc, userfree, memtypeflags); + } + + public static RESULT GetStats(out int currentalloced, out int maxalloced, bool blocking = true) + { + return FMOD5_Memory_GetStats(out currentalloced, out maxalloced, blocking); + } + + #region importfunctions + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Memory_Initialize(IntPtr poolmem, int poollen, MEMORY_ALLOC_CALLBACK useralloc, MEMORY_REALLOC_CALLBACK userrealloc, MEMORY_FREE_CALLBACK userfree, MEMORY_TYPE memtypeflags); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Memory_GetStats (out int currentalloced, out int maxalloced, bool blocking); + + #endregion + } + + public struct Debug + { + public static RESULT Initialize(DEBUG_FLAGS flags, DEBUG_MODE mode = DEBUG_MODE.TTY, DEBUG_CALLBACK callback = null, string filename = null) + { + using (StringHelper.ThreadSafeEncoding encoder = StringHelper.GetFreeHelper()) + { + return FMOD5_Debug_Initialize(flags, mode, callback, encoder.byteFromStringUTF8(filename)); + } + } + + #region importfunctions + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Debug_Initialize(DEBUG_FLAGS flags, DEBUG_MODE mode, DEBUG_CALLBACK callback, byte[] filename); + + #endregion + } + + /* + 'System' API. + */ + public struct System + { + public RESULT release() + { + return FMOD5_System_Release(this.handle); + } + + // Pre-init functions. + public RESULT setOutput(OUTPUTTYPE output) + { + return FMOD5_System_SetOutput(this.handle, output); + } + public RESULT getOutput(out OUTPUTTYPE output) + { + return FMOD5_System_GetOutput(this.handle, out output); + } + public RESULT getNumDrivers(out int numdrivers) + { + return FMOD5_System_GetNumDrivers(this.handle, out numdrivers); + } + public RESULT getDriverInfo(int id, out string name, int namelen, out Guid guid, out int systemrate, out SPEAKERMODE speakermode, out int speakermodechannels) + { + IntPtr stringMem = Marshal.AllocHGlobal(namelen); + + RESULT result = FMOD5_System_GetDriverInfo(this.handle, id, stringMem, namelen, out guid, out systemrate, out speakermode, out speakermodechannels); + using (StringHelper.ThreadSafeEncoding encoding = StringHelper.GetFreeHelper()) + { + name = encoding.stringFromNative(stringMem); + } + Marshal.FreeHGlobal(stringMem); + + return result; + } + public RESULT getDriverInfo(int id, out Guid guid, out int systemrate, out SPEAKERMODE speakermode, out int speakermodechannels) + { + return FMOD5_System_GetDriverInfo(this.handle, id, IntPtr.Zero, 0, out guid, out systemrate, out speakermode, out speakermodechannels); + } + public RESULT setDriver(int driver) + { + return FMOD5_System_SetDriver(this.handle, driver); + } + public RESULT getDriver(out int driver) + { + return FMOD5_System_GetDriver(this.handle, out driver); + } + public RESULT setSoftwareChannels(int numsoftwarechannels) + { + return FMOD5_System_SetSoftwareChannels(this.handle, numsoftwarechannels); + } + public RESULT getSoftwareChannels(out int numsoftwarechannels) + { + return FMOD5_System_GetSoftwareChannels(this.handle, out numsoftwarechannels); + } + public RESULT setSoftwareFormat(int samplerate, SPEAKERMODE speakermode, int numrawspeakers) + { + return FMOD5_System_SetSoftwareFormat(this.handle, samplerate, speakermode, numrawspeakers); + } + public RESULT getSoftwareFormat(out int samplerate, out SPEAKERMODE speakermode, out int numrawspeakers) + { + return FMOD5_System_GetSoftwareFormat(this.handle, out samplerate, out speakermode, out numrawspeakers); + } + public RESULT setDSPBufferSize(uint bufferlength, int numbuffers) + { + return FMOD5_System_SetDSPBufferSize(this.handle, bufferlength, numbuffers); + } + public RESULT getDSPBufferSize(out uint bufferlength, out int numbuffers) + { + return FMOD5_System_GetDSPBufferSize(this.handle, out bufferlength, out numbuffers); + } + public RESULT setFileSystem(FILE_OPEN_CALLBACK useropen, FILE_CLOSE_CALLBACK userclose, FILE_READ_CALLBACK userread, FILE_SEEK_CALLBACK userseek, FILE_ASYNCREAD_CALLBACK userasyncread, FILE_ASYNCCANCEL_CALLBACK userasynccancel, int blockalign) + { + return FMOD5_System_SetFileSystem(this.handle, useropen, userclose, userread, userseek, userasyncread, userasynccancel, blockalign); + } + public RESULT attachFileSystem(FILE_OPEN_CALLBACK useropen, FILE_CLOSE_CALLBACK userclose, FILE_READ_CALLBACK userread, FILE_SEEK_CALLBACK userseek) + { + return FMOD5_System_AttachFileSystem(this.handle, useropen, userclose, userread, userseek); + } + public RESULT setAdvancedSettings(ref ADVANCEDSETTINGS settings) + { + settings.cbSize = Marshal.SizeOf(settings); + return FMOD5_System_SetAdvancedSettings(this.handle, ref settings); + } + public RESULT getAdvancedSettings(ref ADVANCEDSETTINGS settings) + { + settings.cbSize = Marshal.SizeOf(settings); + return FMOD5_System_GetAdvancedSettings(this.handle, ref settings); + } + public RESULT setCallback(SYSTEM_CALLBACK callback, SYSTEM_CALLBACK_TYPE callbackmask = SYSTEM_CALLBACK_TYPE.ALL) + { + return FMOD5_System_SetCallback(this.handle, callback, callbackmask); + } + + // Plug-in support. + public RESULT setPluginPath(string path) + { + using (StringHelper.ThreadSafeEncoding encoder = StringHelper.GetFreeHelper()) + { + return FMOD5_System_SetPluginPath(this.handle, encoder.byteFromStringUTF8(path)); + } + } + public RESULT loadPlugin(string filename, out uint handle, uint priority = 0) + { + using (StringHelper.ThreadSafeEncoding encoder = StringHelper.GetFreeHelper()) + { + return FMOD5_System_LoadPlugin(this.handle, encoder.byteFromStringUTF8(filename), out handle, priority); + } + } + public RESULT unloadPlugin(uint handle) + { + return FMOD5_System_UnloadPlugin(this.handle, handle); + } + public RESULT getNumNestedPlugins(uint handle, out int count) + { + return FMOD5_System_GetNumNestedPlugins(this.handle, handle, out count); + } + public RESULT getNestedPlugin(uint handle, int index, out uint nestedhandle) + { + return FMOD5_System_GetNestedPlugin(this.handle, handle, index, out nestedhandle); + } + public RESULT getNumPlugins(PLUGINTYPE plugintype, out int numplugins) + { + return FMOD5_System_GetNumPlugins(this.handle, plugintype, out numplugins); + } + public RESULT getPluginHandle(PLUGINTYPE plugintype, int index, out uint handle) + { + return FMOD5_System_GetPluginHandle(this.handle, plugintype, index, out handle); + } + public RESULT getPluginInfo(uint handle, out PLUGINTYPE plugintype, out string name, int namelen, out uint version) + { + IntPtr stringMem = Marshal.AllocHGlobal(namelen); + + RESULT result = FMOD5_System_GetPluginInfo(this.handle, handle, out plugintype, stringMem, namelen, out version); + using (StringHelper.ThreadSafeEncoding encoder = StringHelper.GetFreeHelper()) + { + name = encoder.stringFromNative(stringMem); + } + Marshal.FreeHGlobal(stringMem); + + return result; + } + public RESULT getPluginInfo(uint handle, out PLUGINTYPE plugintype, out uint version) + { + return FMOD5_System_GetPluginInfo(this.handle, handle, out plugintype, IntPtr.Zero, 0, out version); + } + public RESULT setOutputByPlugin(uint handle) + { + return FMOD5_System_SetOutputByPlugin(this.handle, handle); + } + public RESULT getOutputByPlugin(out uint handle) + { + return FMOD5_System_GetOutputByPlugin(this.handle, out handle); + } + public RESULT createDSPByPlugin(uint handle, out DSP dsp) + { + return FMOD5_System_CreateDSPByPlugin(this.handle, handle, out dsp.handle); + } + public RESULT getDSPInfoByPlugin(uint handle, out IntPtr description) + { + return FMOD5_System_GetDSPInfoByPlugin(this.handle, handle, out description); + } + /* + public RESULT registerCodec (ref CODEC_DESCRIPTION description, out uint handle, uint priority) + public RESULT registerCodec (ref CODEC_DESCRIPTION description, out uint handle, uint priority = 0) + public RESULT registerCodec(ref CODEC_DESCRIPTION description, out uint handle, uint priority) + { + return FMOD5_System_RegisterCodec(this.handle, ref description, out handle, priority); + } + */ + public RESULT registerDSP(ref DSP_DESCRIPTION description, out uint handle) + { + return FMOD5_System_RegisterDSP(this.handle, ref description, out handle); + } + /* + public RESULT registerOutput(ref OUTPUT_DESCRIPTION description, out uint handle) + { + return FMOD5_System_RegisterOutput(this.handle, ref description, out handle); + } + */ + + // Init/Close. + public RESULT init(int maxchannels, INITFLAGS flags, IntPtr extradriverdata) + { + return FMOD5_System_Init(this.handle, maxchannels, flags, extradriverdata); + } + public RESULT close() + { + return FMOD5_System_Close(this.handle); + } + + // General post-init system functions. + public RESULT update() + { + return FMOD5_System_Update(this.handle); + } + public RESULT setSpeakerPosition(SPEAKER speaker, float x, float y, bool active) + { + return FMOD5_System_SetSpeakerPosition(this.handle, speaker, x, y, active); + } + public RESULT getSpeakerPosition(SPEAKER speaker, out float x, out float y, out bool active) + { + return FMOD5_System_GetSpeakerPosition(this.handle, speaker, out x, out y, out active); + } + public RESULT setStreamBufferSize(uint filebuffersize, TIMEUNIT filebuffersizetype) + { + return FMOD5_System_SetStreamBufferSize(this.handle, filebuffersize, filebuffersizetype); + } + public RESULT getStreamBufferSize(out uint filebuffersize, out TIMEUNIT filebuffersizetype) + { + return FMOD5_System_GetStreamBufferSize(this.handle, out filebuffersize, out filebuffersizetype); + } + public RESULT set3DSettings(float dopplerscale, float distancefactor, float rolloffscale) + { + return FMOD5_System_Set3DSettings(this.handle, dopplerscale, distancefactor, rolloffscale); + } + public RESULT get3DSettings(out float dopplerscale, out float distancefactor, out float rolloffscale) + { + return FMOD5_System_Get3DSettings(this.handle, out dopplerscale, out distancefactor, out rolloffscale); + } + public RESULT set3DNumListeners(int numlisteners) + { + return FMOD5_System_Set3DNumListeners(this.handle, numlisteners); + } + public RESULT get3DNumListeners(out int numlisteners) + { + return FMOD5_System_Get3DNumListeners(this.handle, out numlisteners); + } + public RESULT set3DListenerAttributes(int listener, ref VECTOR pos, ref VECTOR vel, ref VECTOR forward, ref VECTOR up) + { + return FMOD5_System_Set3DListenerAttributes(this.handle, listener, ref pos, ref vel, ref forward, ref up); + } + public RESULT get3DListenerAttributes(int listener, out VECTOR pos, out VECTOR vel, out VECTOR forward, out VECTOR up) + { + return FMOD5_System_Get3DListenerAttributes(this.handle, listener, out pos, out vel, out forward, out up); + } + public RESULT set3DRolloffCallback(CB_3D_ROLLOFF_CALLBACK callback) + { + return FMOD5_System_Set3DRolloffCallback(this.handle, callback); + } + public RESULT mixerSuspend() + { + return FMOD5_System_MixerSuspend(this.handle); + } + public RESULT mixerResume() + { + return FMOD5_System_MixerResume(this.handle); + } + public RESULT getDefaultMixMatrix(SPEAKERMODE sourcespeakermode, SPEAKERMODE targetspeakermode, float[] matrix, int matrixhop) + { + return FMOD5_System_GetDefaultMixMatrix(this.handle, sourcespeakermode, targetspeakermode, matrix, matrixhop); + } + public RESULT getSpeakerModeChannels(SPEAKERMODE mode, out int channels) + { + return FMOD5_System_GetSpeakerModeChannels(this.handle, mode, out channels); + } + + // System information functions. + public RESULT getVersion(out uint version) + { + return FMOD5_System_GetVersion(this.handle, out version); + } + public RESULT getOutputHandle(out IntPtr handle) + { + return FMOD5_System_GetOutputHandle(this.handle, out handle); + } + public RESULT getChannelsPlaying(out int channels) + { + return FMOD5_System_GetChannelsPlaying(this.handle, out channels, IntPtr.Zero); + } + public RESULT getChannelsPlaying(out int channels, out int realchannels) + { + return FMOD5_System_GetChannelsPlaying(this.handle, out channels, out realchannels); + } + public RESULT getCPUUsage(out float dsp, out float stream, out float geometry, out float update, out float total) + { + return FMOD5_System_GetCPUUsage(this.handle, out dsp, out stream, out geometry, out update, out total); + } + public RESULT getFileUsage(out Int64 sampleBytesRead, out Int64 streamBytesRead, out Int64 otherBytesRead) + { + return FMOD5_System_GetFileUsage(this.handle, out sampleBytesRead, out streamBytesRead, out otherBytesRead); + } + + // Sound/DSP/Channel/FX creation and retrieval. + public RESULT createSound(string name, MODE mode, ref CREATESOUNDEXINFO exinfo, out Sound sound) + { + using (StringHelper.ThreadSafeEncoding encoder = StringHelper.GetFreeHelper()) + { + return FMOD5_System_CreateSound(this.handle, encoder.byteFromStringUTF8(name), mode, ref exinfo, out sound.handle); + } + } + public RESULT createSound(byte[] data, MODE mode, ref CREATESOUNDEXINFO exinfo, out Sound sound) + { + return FMOD5_System_CreateSound(this.handle, data, mode, ref exinfo, out sound.handle); + } + public RESULT createSound(IntPtr name_or_data, MODE mode, ref CREATESOUNDEXINFO exinfo, out Sound sound) + { + return FMOD5_System_CreateSound(this.handle, name_or_data, mode, ref exinfo, out sound.handle); + } + public RESULT createSound(string name, MODE mode, out Sound sound) + { + CREATESOUNDEXINFO exinfo = new CREATESOUNDEXINFO(); + exinfo.cbsize = Marshal.SizeOf(exinfo); + + return createSound(name, mode, ref exinfo, out sound); + } + public RESULT createStream(string name, MODE mode, ref CREATESOUNDEXINFO exinfo, out Sound sound) + { + using (StringHelper.ThreadSafeEncoding encoder = StringHelper.GetFreeHelper()) + { + return FMOD5_System_CreateStream(this.handle, encoder.byteFromStringUTF8(name), mode, ref exinfo, out sound.handle); + } + } + public RESULT createStream(byte[] data, MODE mode, ref CREATESOUNDEXINFO exinfo, out Sound sound) + { + return FMOD5_System_CreateStream(this.handle, data, mode, ref exinfo, out sound.handle); + } + public RESULT createStream(IntPtr name_or_data, MODE mode, ref CREATESOUNDEXINFO exinfo, out Sound sound) + { + return FMOD5_System_CreateStream(this.handle, name_or_data, mode, ref exinfo, out sound.handle); + } + public RESULT createStream(string name, MODE mode, out Sound sound) + { + CREATESOUNDEXINFO exinfo = new CREATESOUNDEXINFO(); + exinfo.cbsize = Marshal.SizeOf(exinfo); + + return createStream(name, mode, ref exinfo, out sound); + } + public RESULT createDSP(ref DSP_DESCRIPTION description, out DSP dsp) + { + return FMOD5_System_CreateDSP(this.handle, ref description, out dsp.handle); + } + public RESULT createDSPByType(DSP_TYPE type, out DSP dsp) + { + return FMOD5_System_CreateDSPByType(this.handle, type, out dsp.handle); + } + public RESULT createChannelGroup(string name, out ChannelGroup channelgroup) + { + using (StringHelper.ThreadSafeEncoding encoder = StringHelper.GetFreeHelper()) + { + return FMOD5_System_CreateChannelGroup(this.handle, encoder.byteFromStringUTF8(name), out channelgroup.handle); + } + } + public RESULT createSoundGroup(string name, out SoundGroup soundgroup) + { + using (StringHelper.ThreadSafeEncoding encoder = StringHelper.GetFreeHelper()) + { + return FMOD5_System_CreateSoundGroup(this.handle, encoder.byteFromStringUTF8(name), out soundgroup.handle); + } + } + public RESULT createReverb3D(out Reverb3D reverb) + { + return FMOD5_System_CreateReverb3D(this.handle, out reverb.handle); + } + public RESULT playSound(Sound sound, ChannelGroup channelgroup, bool paused, out Channel channel) + { + return FMOD5_System_PlaySound(this.handle, sound.handle, channelgroup.handle, paused, out channel.handle); + } + public RESULT playDSP(DSP dsp, ChannelGroup channelgroup, bool paused, out Channel channel) + { + return FMOD5_System_PlayDSP(this.handle, dsp.handle, channelgroup.handle, paused, out channel.handle); + } + public RESULT getChannel(int channelid, out Channel channel) + { + return FMOD5_System_GetChannel(this.handle, channelid, out channel.handle); + } + public RESULT getMasterChannelGroup(out ChannelGroup channelgroup) + { + return FMOD5_System_GetMasterChannelGroup(this.handle, out channelgroup.handle); + } + public RESULT getMasterSoundGroup(out SoundGroup soundgroup) + { + return FMOD5_System_GetMasterSoundGroup(this.handle, out soundgroup.handle); + } + + // Routing to ports. + public RESULT attachChannelGroupToPort(uint portType, ulong portIndex, ChannelGroup channelgroup, bool passThru = false) + { + return FMOD5_System_AttachChannelGroupToPort(this.handle, portType, portIndex, channelgroup.handle, passThru); + } + public RESULT detachChannelGroupFromPort(ChannelGroup channelgroup) + { + return FMOD5_System_DetachChannelGroupFromPort(this.handle, channelgroup.handle); + } + + // Reverb api. + public RESULT setReverbProperties(int instance, ref REVERB_PROPERTIES prop) + { + return FMOD5_System_SetReverbProperties(this.handle, instance, ref prop); + } + public RESULT getReverbProperties(int instance, out REVERB_PROPERTIES prop) + { + return FMOD5_System_GetReverbProperties(this.handle, instance, out prop); + } + + // System level DSP functionality. + public RESULT lockDSP() + { + return FMOD5_System_LockDSP(this.handle); + } + public RESULT unlockDSP() + { + return FMOD5_System_UnlockDSP(this.handle); + } + + // Recording api + public RESULT getRecordNumDrivers(out int numdrivers, out int numconnected) + { + return FMOD5_System_GetRecordNumDrivers(this.handle, out numdrivers, out numconnected); + } + public RESULT getRecordDriverInfo(int id, out string name, int namelen, out Guid guid, out int systemrate, out SPEAKERMODE speakermode, out int speakermodechannels, out DRIVER_STATE state) + { + IntPtr stringMem = Marshal.AllocHGlobal(namelen); + + RESULT result = FMOD5_System_GetRecordDriverInfo(this.handle, id, stringMem, namelen, out guid, out systemrate, out speakermode, out speakermodechannels, out state); + + using (StringHelper.ThreadSafeEncoding encoder = StringHelper.GetFreeHelper()) + { + name = encoder.stringFromNative(stringMem); + } + Marshal.FreeHGlobal(stringMem); + + return result; + } + public RESULT getRecordDriverInfo(int id, out Guid guid, out int systemrate, out SPEAKERMODE speakermode, out int speakermodechannels, out DRIVER_STATE state) + { + return FMOD5_System_GetRecordDriverInfo(this.handle, id, IntPtr.Zero, 0, out guid, out systemrate, out speakermode, out speakermodechannels, out state); + } + public RESULT getRecordPosition(int id, out uint position) + { + return FMOD5_System_GetRecordPosition(this.handle, id, out position); + } + public RESULT recordStart(int id, Sound sound, bool loop) + { + return FMOD5_System_RecordStart(this.handle, id, sound.handle, loop); + } + public RESULT recordStop(int id) + { + return FMOD5_System_RecordStop(this.handle, id); + } + public RESULT isRecording(int id, out bool recording) + { + return FMOD5_System_IsRecording(this.handle, id, out recording); + } + + // Geometry api + public RESULT createGeometry(int maxpolygons, int maxvertices, out Geometry geometry) + { + return FMOD5_System_CreateGeometry(this.handle, maxpolygons, maxvertices, out geometry.handle); + } + public RESULT setGeometrySettings(float maxworldsize) + { + return FMOD5_System_SetGeometrySettings(this.handle, maxworldsize); + } + public RESULT getGeometrySettings(out float maxworldsize) + { + return FMOD5_System_GetGeometrySettings(this.handle, out maxworldsize); + } + public RESULT loadGeometry(IntPtr data, int datasize, out Geometry geometry) + { + return FMOD5_System_LoadGeometry(this.handle, data, datasize, out geometry.handle); + } + public RESULT getGeometryOcclusion(ref VECTOR listener, ref VECTOR source, out float direct, out float reverb) + { + return FMOD5_System_GetGeometryOcclusion(this.handle, ref listener, ref source, out direct, out reverb); + } + + // Network functions + public RESULT setNetworkProxy(string proxy) + { + using (StringHelper.ThreadSafeEncoding encoder = StringHelper.GetFreeHelper()) + { + return FMOD5_System_SetNetworkProxy(this.handle, encoder.byteFromStringUTF8(proxy)); + } + } + public RESULT getNetworkProxy(out string proxy, int proxylen) + { + IntPtr stringMem = Marshal.AllocHGlobal(proxylen); + + RESULT result = FMOD5_System_GetNetworkProxy(this.handle, stringMem, proxylen); + using (StringHelper.ThreadSafeEncoding encoder = StringHelper.GetFreeHelper()) + { + proxy = encoder.stringFromNative(stringMem); + } + Marshal.FreeHGlobal(stringMem); + + return result; + } + public RESULT setNetworkTimeout(int timeout) + { + return FMOD5_System_SetNetworkTimeout(this.handle, timeout); + } + public RESULT getNetworkTimeout(out int timeout) + { + return FMOD5_System_GetNetworkTimeout(this.handle, out timeout); + } + + // Userdata set/get + public RESULT setUserData(IntPtr userdata) + { + return FMOD5_System_SetUserData(this.handle, userdata); + } + public RESULT getUserData(out IntPtr userdata) + { + return FMOD5_System_GetUserData(this.handle, out userdata); + } + + #region importfunctions + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_Release (IntPtr system); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_SetOutput (IntPtr system, OUTPUTTYPE output); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_GetOutput (IntPtr system, out OUTPUTTYPE output); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_GetNumDrivers (IntPtr system, out int numdrivers); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_GetDriverInfo (IntPtr system, int id, IntPtr name, int namelen, out Guid guid, out int systemrate, out SPEAKERMODE speakermode, out int speakermodechannels); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_SetDriver (IntPtr system, int driver); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_GetDriver (IntPtr system, out int driver); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_SetSoftwareChannels (IntPtr system, int numsoftwarechannels); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_GetSoftwareChannels (IntPtr system, out int numsoftwarechannels); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_SetSoftwareFormat (IntPtr system, int samplerate, SPEAKERMODE speakermode, int numrawspeakers); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_GetSoftwareFormat (IntPtr system, out int samplerate, out SPEAKERMODE speakermode, out int numrawspeakers); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_SetDSPBufferSize (IntPtr system, uint bufferlength, int numbuffers); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_GetDSPBufferSize (IntPtr system, out uint bufferlength, out int numbuffers); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_SetFileSystem (IntPtr system, FILE_OPEN_CALLBACK useropen, FILE_CLOSE_CALLBACK userclose, FILE_READ_CALLBACK userread, FILE_SEEK_CALLBACK userseek, FILE_ASYNCREAD_CALLBACK userasyncread, FILE_ASYNCCANCEL_CALLBACK userasynccancel, int blockalign); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_AttachFileSystem (IntPtr system, FILE_OPEN_CALLBACK useropen, FILE_CLOSE_CALLBACK userclose, FILE_READ_CALLBACK userread, FILE_SEEK_CALLBACK userseek); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_SetAdvancedSettings (IntPtr system, ref ADVANCEDSETTINGS settings); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_GetAdvancedSettings (IntPtr system, ref ADVANCEDSETTINGS settings); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_SetCallback (IntPtr system, SYSTEM_CALLBACK callback, SYSTEM_CALLBACK_TYPE callbackmask); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_SetPluginPath (IntPtr system, byte[] path); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_LoadPlugin (IntPtr system, byte[] filename, out uint handle, uint priority); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_UnloadPlugin (IntPtr system, uint handle); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_GetNumNestedPlugins (IntPtr system, uint handle, out int count); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_GetNestedPlugin (IntPtr system, uint handle, int index, out uint nestedhandle); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_GetNumPlugins (IntPtr system, PLUGINTYPE plugintype, out int numplugins); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_GetPluginHandle (IntPtr system, PLUGINTYPE plugintype, int index, out uint handle); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_GetPluginInfo (IntPtr system, uint handle, out PLUGINTYPE plugintype, IntPtr name, int namelen, out uint version); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_SetOutputByPlugin (IntPtr system, uint handle); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_GetOutputByPlugin (IntPtr system, out uint handle); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_CreateDSPByPlugin (IntPtr system, uint handle, out IntPtr dsp); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_GetDSPInfoByPlugin (IntPtr system, uint handle, out IntPtr description); + //[DllImport(VERSION.dll)] + //private static extern RESULT FMOD5_System_RegisterCodec (IntPtr system, out CODEC_DESCRIPTION description, out uint handle, uint priority); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_RegisterDSP (IntPtr system, ref DSP_DESCRIPTION description, out uint handle); + //[DllImport(VERSION.dll)] + //private static extern RESULT FMOD5_System_RegisterOutput (IntPtr system, ref OUTPUT_DESCRIPTION description, out uint handle); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_Init (IntPtr system, int maxchannels, INITFLAGS flags, IntPtr extradriverdata); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_Close (IntPtr system); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_Update (IntPtr system); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_SetSpeakerPosition (IntPtr system, SPEAKER speaker, float x, float y, bool active); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_GetSpeakerPosition (IntPtr system, SPEAKER speaker, out float x, out float y, out bool active); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_SetStreamBufferSize (IntPtr system, uint filebuffersize, TIMEUNIT filebuffersizetype); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_GetStreamBufferSize (IntPtr system, out uint filebuffersize, out TIMEUNIT filebuffersizetype); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_Set3DSettings (IntPtr system, float dopplerscale, float distancefactor, float rolloffscale); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_Get3DSettings (IntPtr system, out float dopplerscale, out float distancefactor, out float rolloffscale); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_Set3DNumListeners (IntPtr system, int numlisteners); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_Get3DNumListeners (IntPtr system, out int numlisteners); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_Set3DListenerAttributes (IntPtr system, int listener, ref VECTOR pos, ref VECTOR vel, ref VECTOR forward, ref VECTOR up); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_Get3DListenerAttributes (IntPtr system, int listener, out VECTOR pos, out VECTOR vel, out VECTOR forward, out VECTOR up); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_Set3DRolloffCallback (IntPtr system, CB_3D_ROLLOFF_CALLBACK callback); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_MixerSuspend (IntPtr system); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_MixerResume (IntPtr system); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_GetDefaultMixMatrix (IntPtr system, SPEAKERMODE sourcespeakermode, SPEAKERMODE targetspeakermode, float[] matrix, int matrixhop); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_GetSpeakerModeChannels (IntPtr system, SPEAKERMODE mode, out int channels); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_GetVersion (IntPtr system, out uint version); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_GetOutputHandle (IntPtr system, out IntPtr handle); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_GetChannelsPlaying (IntPtr system, out int channels, IntPtr zero); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_GetChannelsPlaying (IntPtr system, out int channels, out int realchannels); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_GetCPUUsage (IntPtr system, out float dsp, out float stream, out float geometry, out float update, out float total); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_GetFileUsage (IntPtr system, out Int64 sampleBytesRead, out Int64 streamBytesRead, out Int64 otherBytesRead); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_CreateSound (IntPtr system, byte[] name_or_data, MODE mode, ref CREATESOUNDEXINFO exinfo, out IntPtr sound); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_CreateSound (IntPtr system, IntPtr name_or_data, MODE mode, ref CREATESOUNDEXINFO exinfo, out IntPtr sound); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_CreateStream (IntPtr system, byte[] name_or_data, MODE mode, ref CREATESOUNDEXINFO exinfo, out IntPtr sound); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_CreateStream (IntPtr system, IntPtr name_or_data, MODE mode, ref CREATESOUNDEXINFO exinfo, out IntPtr sound); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_CreateDSP (IntPtr system, ref DSP_DESCRIPTION description, out IntPtr dsp); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_CreateDSPByType (IntPtr system, DSP_TYPE type, out IntPtr dsp); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_CreateChannelGroup (IntPtr system, byte[] name, out IntPtr channelgroup); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_CreateSoundGroup (IntPtr system, byte[] name, out IntPtr soundgroup); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_CreateReverb3D (IntPtr system, out IntPtr reverb); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_PlaySound (IntPtr system, IntPtr sound, IntPtr channelgroup, bool paused, out IntPtr channel); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_PlayDSP (IntPtr system, IntPtr dsp, IntPtr channelgroup, bool paused, out IntPtr channel); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_GetChannel (IntPtr system, int channelid, out IntPtr channel); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_GetMasterChannelGroup (IntPtr system, out IntPtr channelgroup); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_GetMasterSoundGroup (IntPtr system, out IntPtr soundgroup); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_AttachChannelGroupToPort (IntPtr system, uint portType, ulong portIndex, IntPtr channelgroup, bool passThru); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_DetachChannelGroupFromPort(IntPtr system, IntPtr channelgroup); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_SetReverbProperties (IntPtr system, int instance, ref REVERB_PROPERTIES prop); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_GetReverbProperties (IntPtr system, int instance, out REVERB_PROPERTIES prop); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_LockDSP (IntPtr system); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_UnlockDSP (IntPtr system); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_GetRecordNumDrivers (IntPtr system, out int numdrivers, out int numconnected); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_GetRecordDriverInfo (IntPtr system, int id, IntPtr name, int namelen, out Guid guid, out int systemrate, out SPEAKERMODE speakermode, out int speakermodechannels, out DRIVER_STATE state); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_GetRecordPosition (IntPtr system, int id, out uint position); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_RecordStart (IntPtr system, int id, IntPtr sound, bool loop); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_RecordStop (IntPtr system, int id); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_IsRecording (IntPtr system, int id, out bool recording); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_CreateGeometry (IntPtr system, int maxpolygons, int maxvertices, out IntPtr geometry); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_SetGeometrySettings (IntPtr system, float maxworldsize); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_GetGeometrySettings (IntPtr system, out float maxworldsize); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_LoadGeometry (IntPtr system, IntPtr data, int datasize, out IntPtr geometry); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_GetGeometryOcclusion (IntPtr system, ref VECTOR listener, ref VECTOR source, out float direct, out float reverb); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_SetNetworkProxy (IntPtr system, byte[] proxy); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_GetNetworkProxy (IntPtr system, IntPtr proxy, int proxylen); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_SetNetworkTimeout (IntPtr system, int timeout); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_GetNetworkTimeout (IntPtr system, out int timeout); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_SetUserData (IntPtr system, IntPtr userdata); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_System_GetUserData (IntPtr system, out IntPtr userdata); + #endregion + + #region wrapperinternal + + public IntPtr handle; + + public bool hasHandle() { return this.handle != IntPtr.Zero; } + public void clearHandle() { this.handle = IntPtr.Zero; } + + #endregion + } + + + /* + 'Sound' API. + */ + public struct Sound + { + public RESULT release() + { + return FMOD5_Sound_Release(this.handle); + } + public RESULT getSystemObject(out System system) + { + return FMOD5_Sound_GetSystemObject(this.handle, out system.handle); + } + + // Standard sound manipulation functions. + public RESULT @lock(uint offset, uint length, out IntPtr ptr1, out IntPtr ptr2, out uint len1, out uint len2) + { + return FMOD5_Sound_Lock(this.handle, offset, length, out ptr1, out ptr2, out len1, out len2); + } + public RESULT unlock(IntPtr ptr1, IntPtr ptr2, uint len1, uint len2) + { + return FMOD5_Sound_Unlock(this.handle, ptr1, ptr2, len1, len2); + } + public RESULT setDefaults(float frequency, int priority) + { + return FMOD5_Sound_SetDefaults(this.handle, frequency, priority); + } + public RESULT getDefaults(out float frequency, out int priority) + { + return FMOD5_Sound_GetDefaults(this.handle, out frequency, out priority); + } + public RESULT set3DMinMaxDistance(float min, float max) + { + return FMOD5_Sound_Set3DMinMaxDistance(this.handle, min, max); + } + public RESULT get3DMinMaxDistance(out float min, out float max) + { + return FMOD5_Sound_Get3DMinMaxDistance(this.handle, out min, out max); + } + public RESULT set3DConeSettings(float insideconeangle, float outsideconeangle, float outsidevolume) + { + return FMOD5_Sound_Set3DConeSettings(this.handle, insideconeangle, outsideconeangle, outsidevolume); + } + public RESULT get3DConeSettings(out float insideconeangle, out float outsideconeangle, out float outsidevolume) + { + return FMOD5_Sound_Get3DConeSettings(this.handle, out insideconeangle, out outsideconeangle, out outsidevolume); + } + public RESULT set3DCustomRolloff(ref VECTOR points, int numpoints) + { + return FMOD5_Sound_Set3DCustomRolloff(this.handle, ref points, numpoints); + } + public RESULT get3DCustomRolloff(out IntPtr points, out int numpoints) + { + return FMOD5_Sound_Get3DCustomRolloff(this.handle, out points, out numpoints); + } + + public RESULT getSubSound(int index, out Sound subsound) + { + return FMOD5_Sound_GetSubSound(this.handle, index, out subsound.handle); + } + public RESULT getSubSoundParent(out Sound parentsound) + { + return FMOD5_Sound_GetSubSoundParent(this.handle, out parentsound.handle); + } + public RESULT getName(out string name, int namelen) + { + IntPtr stringMem = Marshal.AllocHGlobal(namelen); + + RESULT result = FMOD5_Sound_GetName(this.handle, stringMem, namelen); + using (StringHelper.ThreadSafeEncoding encoder = StringHelper.GetFreeHelper()) + { + name = encoder.stringFromNative(stringMem); + } + Marshal.FreeHGlobal(stringMem); + + return result; + } + public RESULT getLength(out uint length, TIMEUNIT lengthtype) + { + return FMOD5_Sound_GetLength(this.handle, out length, lengthtype); + } + public RESULT getFormat(out SOUND_TYPE type, out SOUND_FORMAT format, out int channels, out int bits) + { + return FMOD5_Sound_GetFormat(this.handle, out type, out format, out channels, out bits); + } + public RESULT getNumSubSounds(out int numsubsounds) + { + return FMOD5_Sound_GetNumSubSounds(this.handle, out numsubsounds); + } + public RESULT getNumTags(out int numtags, out int numtagsupdated) + { + return FMOD5_Sound_GetNumTags(this.handle, out numtags, out numtagsupdated); + } + public RESULT getTag(string name, int index, out TAG tag) + { + using (StringHelper.ThreadSafeEncoding encoder = StringHelper.GetFreeHelper()) + { + return FMOD5_Sound_GetTag(this.handle, encoder.byteFromStringUTF8(name), index, out tag); + } + } + public RESULT getOpenState(out OPENSTATE openstate, out uint percentbuffered, out bool starving, out bool diskbusy) + { + return FMOD5_Sound_GetOpenState(this.handle, out openstate, out percentbuffered, out starving, out diskbusy); + } + public RESULT readData(IntPtr buffer, uint length, out uint read) + { + return FMOD5_Sound_ReadData(this.handle, buffer, length, out read); + } + public RESULT seekData(uint pcm) + { + return FMOD5_Sound_SeekData(this.handle, pcm); + } + public RESULT setSoundGroup(SoundGroup soundgroup) + { + return FMOD5_Sound_SetSoundGroup(this.handle, soundgroup.handle); + } + public RESULT getSoundGroup(out SoundGroup soundgroup) + { + return FMOD5_Sound_GetSoundGroup(this.handle, out soundgroup.handle); + } + + // Synchronization point API. These points can come from markers embedded in wav files, and can also generate channel callbacks. + public RESULT getNumSyncPoints(out int numsyncpoints) + { + return FMOD5_Sound_GetNumSyncPoints(this.handle, out numsyncpoints); + } + public RESULT getSyncPoint(int index, out IntPtr point) + { + return FMOD5_Sound_GetSyncPoint(this.handle, index, out point); + } + public RESULT getSyncPointInfo(IntPtr point, out string name, int namelen, out uint offset, TIMEUNIT offsettype) + { + IntPtr stringMem = Marshal.AllocHGlobal(namelen); + + RESULT result = FMOD5_Sound_GetSyncPointInfo(this.handle, point, stringMem, namelen, out offset, offsettype); + using (StringHelper.ThreadSafeEncoding encoder = StringHelper.GetFreeHelper()) + { + name = encoder.stringFromNative(stringMem); + } + Marshal.FreeHGlobal(stringMem); + + return result; + } + public RESULT getSyncPointInfo(IntPtr point, out uint offset, TIMEUNIT offsettype) + { + return FMOD5_Sound_GetSyncPointInfo(this.handle, point, IntPtr.Zero, 0, out offset, offsettype); + } + public RESULT addSyncPoint(uint offset, TIMEUNIT offsettype, string name, out IntPtr point) + { + using (StringHelper.ThreadSafeEncoding encoder = StringHelper.GetFreeHelper()) + { + return FMOD5_Sound_AddSyncPoint(this.handle, offset, offsettype, encoder.byteFromStringUTF8(name), out point); + } + } + public RESULT deleteSyncPoint(IntPtr point) + { + return FMOD5_Sound_DeleteSyncPoint(this.handle, point); + } + + // Functions also in Channel class but here they are the 'default' to save having to change it in Channel all the time. + public RESULT setMode(MODE mode) + { + return FMOD5_Sound_SetMode(this.handle, mode); + } + public RESULT getMode(out MODE mode) + { + return FMOD5_Sound_GetMode(this.handle, out mode); + } + public RESULT setLoopCount(int loopcount) + { + return FMOD5_Sound_SetLoopCount(this.handle, loopcount); + } + public RESULT getLoopCount(out int loopcount) + { + return FMOD5_Sound_GetLoopCount(this.handle, out loopcount); + } + public RESULT setLoopPoints(uint loopstart, TIMEUNIT loopstarttype, uint loopend, TIMEUNIT loopendtype) + { + return FMOD5_Sound_SetLoopPoints(this.handle, loopstart, loopstarttype, loopend, loopendtype); + } + public RESULT getLoopPoints(out uint loopstart, TIMEUNIT loopstarttype, out uint loopend, TIMEUNIT loopendtype) + { + return FMOD5_Sound_GetLoopPoints(this.handle, out loopstart, loopstarttype, out loopend, loopendtype); + } + + // For MOD/S3M/XM/IT/MID sequenced formats only. + public RESULT getMusicNumChannels(out int numchannels) + { + return FMOD5_Sound_GetMusicNumChannels(this.handle, out numchannels); + } + public RESULT setMusicChannelVolume(int channel, float volume) + { + return FMOD5_Sound_SetMusicChannelVolume(this.handle, channel, volume); + } + public RESULT getMusicChannelVolume(int channel, out float volume) + { + return FMOD5_Sound_GetMusicChannelVolume(this.handle, channel, out volume); + } + public RESULT setMusicSpeed(float speed) + { + return FMOD5_Sound_SetMusicSpeed(this.handle, speed); + } + public RESULT getMusicSpeed(out float speed) + { + return FMOD5_Sound_GetMusicSpeed(this.handle, out speed); + } + + // Userdata set/get. + public RESULT setUserData(IntPtr userdata) + { + return FMOD5_Sound_SetUserData(this.handle, userdata); + } + public RESULT getUserData(out IntPtr userdata) + { + return FMOD5_Sound_GetUserData(this.handle, out userdata); + } + + #region importfunctions + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Sound_Release (IntPtr sound); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Sound_GetSystemObject (IntPtr sound, out IntPtr system); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Sound_Lock (IntPtr sound, uint offset, uint length, out IntPtr ptr1, out IntPtr ptr2, out uint len1, out uint len2); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Sound_Unlock (IntPtr sound, IntPtr ptr1, IntPtr ptr2, uint len1, uint len2); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Sound_SetDefaults (IntPtr sound, float frequency, int priority); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Sound_GetDefaults (IntPtr sound, out float frequency, out int priority); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Sound_Set3DMinMaxDistance (IntPtr sound, float min, float max); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Sound_Get3DMinMaxDistance (IntPtr sound, out float min, out float max); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Sound_Set3DConeSettings (IntPtr sound, float insideconeangle, float outsideconeangle, float outsidevolume); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Sound_Get3DConeSettings (IntPtr sound, out float insideconeangle, out float outsideconeangle, out float outsidevolume); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Sound_Set3DCustomRolloff (IntPtr sound, ref VECTOR points, int numpoints); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Sound_Get3DCustomRolloff (IntPtr sound, out IntPtr points, out int numpoints); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Sound_GetSubSound (IntPtr sound, int index, out IntPtr subsound); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Sound_GetSubSoundParent (IntPtr sound, out IntPtr parentsound); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Sound_GetName (IntPtr sound, IntPtr name, int namelen); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Sound_GetLength (IntPtr sound, out uint length, TIMEUNIT lengthtype); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Sound_GetFormat (IntPtr sound, out SOUND_TYPE type, out SOUND_FORMAT format, out int channels, out int bits); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Sound_GetNumSubSounds (IntPtr sound, out int numsubsounds); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Sound_GetNumTags (IntPtr sound, out int numtags, out int numtagsupdated); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Sound_GetTag (IntPtr sound, byte[] name, int index, out TAG tag); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Sound_GetOpenState (IntPtr sound, out OPENSTATE openstate, out uint percentbuffered, out bool starving, out bool diskbusy); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Sound_ReadData (IntPtr sound, IntPtr buffer, uint length, out uint read); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Sound_SeekData (IntPtr sound, uint pcm); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Sound_SetSoundGroup (IntPtr sound, IntPtr soundgroup); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Sound_GetSoundGroup (IntPtr sound, out IntPtr soundgroup); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Sound_GetNumSyncPoints (IntPtr sound, out int numsyncpoints); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Sound_GetSyncPoint (IntPtr sound, int index, out IntPtr point); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Sound_GetSyncPointInfo (IntPtr sound, IntPtr point, IntPtr name, int namelen, out uint offset, TIMEUNIT offsettype); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Sound_AddSyncPoint (IntPtr sound, uint offset, TIMEUNIT offsettype, byte[] name, out IntPtr point); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Sound_DeleteSyncPoint (IntPtr sound, IntPtr point); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Sound_SetMode (IntPtr sound, MODE mode); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Sound_GetMode (IntPtr sound, out MODE mode); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Sound_SetLoopCount (IntPtr sound, int loopcount); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Sound_GetLoopCount (IntPtr sound, out int loopcount); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Sound_SetLoopPoints (IntPtr sound, uint loopstart, TIMEUNIT loopstarttype, uint loopend, TIMEUNIT loopendtype); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Sound_GetLoopPoints (IntPtr sound, out uint loopstart, TIMEUNIT loopstarttype, out uint loopend, TIMEUNIT loopendtype); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Sound_GetMusicNumChannels (IntPtr sound, out int numchannels); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Sound_SetMusicChannelVolume (IntPtr sound, int channel, float volume); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Sound_GetMusicChannelVolume (IntPtr sound, int channel, out float volume); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Sound_SetMusicSpeed (IntPtr sound, float speed); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Sound_GetMusicSpeed (IntPtr sound, out float speed); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Sound_SetUserData (IntPtr sound, IntPtr userdata); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Sound_GetUserData (IntPtr sound, out IntPtr userdata); + #endregion + + #region wrapperinternal + + public IntPtr handle; + + public bool hasHandle() { return this.handle != IntPtr.Zero; } + public void clearHandle() { this.handle = IntPtr.Zero; } + + #endregion + } + + /* + 'ChannelControl' API + */ + interface IChannelControl + { + RESULT getSystemObject (out System system); + + // General control functionality for Channels and ChannelGroups. + RESULT stop (); + RESULT setPaused (bool paused); + RESULT getPaused (out bool paused); + RESULT setVolume (float volume); + RESULT getVolume (out float volume); + RESULT setVolumeRamp (bool ramp); + RESULT getVolumeRamp (out bool ramp); + RESULT getAudibility (out float audibility); + RESULT setPitch (float pitch); + RESULT getPitch (out float pitch); + RESULT setMute (bool mute); + RESULT getMute (out bool mute); + RESULT setReverbProperties (int instance, float wet); + RESULT getReverbProperties (int instance, out float wet); + RESULT setLowPassGain (float gain); + RESULT getLowPassGain (out float gain); + RESULT setMode (MODE mode); + RESULT getMode (out MODE mode); + RESULT setCallback (CHANNELCONTROL_CALLBACK callback); + RESULT isPlaying (out bool isplaying); + + // Panning and level adjustment. + RESULT setPan (float pan); + RESULT setMixLevelsOutput (float frontleft, float frontright, float center, float lfe, float surroundleft, float surroundright, float backleft, float backright); + RESULT setMixLevelsInput (float[] levels, int numlevels); + RESULT setMixMatrix (float[] matrix, int outchannels, int inchannels, int inchannel_hop); + RESULT getMixMatrix (float[] matrix, out int outchannels, out int inchannels, int inchannel_hop); + + // Clock based functionality. + RESULT getDSPClock (out ulong dspclock, out ulong parentclock); + RESULT setDelay (ulong dspclock_start, ulong dspclock_end, bool stopchannels); + RESULT getDelay (out ulong dspclock_start, out ulong dspclock_end); + RESULT getDelay (out ulong dspclock_start, out ulong dspclock_end, out bool stopchannels); + RESULT addFadePoint (ulong dspclock, float volume); + RESULT setFadePointRamp (ulong dspclock, float volume); + RESULT removeFadePoints (ulong dspclock_start, ulong dspclock_end); + RESULT getFadePoints (ref uint numpoints, ulong[] point_dspclock, float[] point_volume); + + // DSP effects. + RESULT getDSP (int index, out DSP dsp); + RESULT addDSP (int index, DSP dsp); + RESULT removeDSP (DSP dsp); + RESULT getNumDSPs (out int numdsps); + RESULT setDSPIndex (DSP dsp, int index); + RESULT getDSPIndex (DSP dsp, out int index); + + // 3D functionality. + RESULT set3DAttributes (ref VECTOR pos, ref VECTOR vel); + RESULT get3DAttributes (out VECTOR pos, out VECTOR vel); + RESULT set3DMinMaxDistance (float mindistance, float maxdistance); + RESULT get3DMinMaxDistance (out float mindistance, out float maxdistance); + RESULT set3DConeSettings (float insideconeangle, float outsideconeangle, float outsidevolume); + RESULT get3DConeSettings (out float insideconeangle, out float outsideconeangle, out float outsidevolume); + RESULT set3DConeOrientation (ref VECTOR orientation); + RESULT get3DConeOrientation (out VECTOR orientation); + RESULT set3DCustomRolloff (ref VECTOR points, int numpoints); + RESULT get3DCustomRolloff (out IntPtr points, out int numpoints); + RESULT set3DOcclusion (float directocclusion, float reverbocclusion); + RESULT get3DOcclusion (out float directocclusion, out float reverbocclusion); + RESULT set3DSpread (float angle); + RESULT get3DSpread (out float angle); + RESULT set3DLevel (float level); + RESULT get3DLevel (out float level); + RESULT set3DDopplerLevel (float level); + RESULT get3DDopplerLevel (out float level); + RESULT set3DDistanceFilter (bool custom, float customLevel, float centerFreq); + RESULT get3DDistanceFilter (out bool custom, out float customLevel, out float centerFreq); + + // Userdata set/get. + RESULT setUserData (IntPtr userdata); + RESULT getUserData (out IntPtr userdata); + } + + /* + 'Channel' API + */ + public struct Channel : IChannelControl + { + // Channel specific control functionality. + public RESULT setFrequency(float frequency) + { + return FMOD5_Channel_SetFrequency(this.handle, frequency); + } + public RESULT getFrequency(out float frequency) + { + return FMOD5_Channel_GetFrequency(this.handle, out frequency); + } + public RESULT setPriority(int priority) + { + return FMOD5_Channel_SetPriority(this.handle, priority); + } + public RESULT getPriority(out int priority) + { + return FMOD5_Channel_GetPriority(this.handle, out priority); + } + public RESULT setPosition(uint position, TIMEUNIT postype) + { + return FMOD5_Channel_SetPosition(this.handle, position, postype); + } + public RESULT getPosition(out uint position, TIMEUNIT postype) + { + return FMOD5_Channel_GetPosition(this.handle, out position, postype); + } + public RESULT setChannelGroup(ChannelGroup channelgroup) + { + return FMOD5_Channel_SetChannelGroup(this.handle, channelgroup.handle); + } + public RESULT getChannelGroup(out ChannelGroup channelgroup) + { + return FMOD5_Channel_GetChannelGroup(this.handle, out channelgroup.handle); + } + public RESULT setLoopCount(int loopcount) + { + return FMOD5_Channel_SetLoopCount(this.handle, loopcount); + } + public RESULT getLoopCount(out int loopcount) + { + return FMOD5_Channel_GetLoopCount(this.handle, out loopcount); + } + public RESULT setLoopPoints(uint loopstart, TIMEUNIT loopstarttype, uint loopend, TIMEUNIT loopendtype) + { + return FMOD5_Channel_SetLoopPoints(this.handle, loopstart, loopstarttype, loopend, loopendtype); + } + public RESULT getLoopPoints(out uint loopstart, TIMEUNIT loopstarttype, out uint loopend, TIMEUNIT loopendtype) + { + return FMOD5_Channel_GetLoopPoints(this.handle, out loopstart, loopstarttype, out loopend, loopendtype); + } + + // Information only functions. + public RESULT isVirtual(out bool isvirtual) + { + return FMOD5_Channel_IsVirtual(this.handle, out isvirtual); + } + public RESULT getCurrentSound(out Sound sound) + { + return FMOD5_Channel_GetCurrentSound(this.handle, out sound.handle); + } + public RESULT getIndex(out int index) + { + return FMOD5_Channel_GetIndex(this.handle, out index); + } + public RESULT getSystemObject(out System system) + { + return FMOD5_Channel_GetSystemObject(this.handle, out system.handle); + } + + // General control functionality for Channels and ChannelGroups. + public RESULT stop() + { + return FMOD5_Channel_Stop(this.handle); + } + public RESULT setPaused(bool paused) + { + return FMOD5_Channel_SetPaused(this.handle, paused); + } + public RESULT getPaused(out bool paused) + { + return FMOD5_Channel_GetPaused(this.handle, out paused); + } + public RESULT setVolume(float volume) + { + return FMOD5_Channel_SetVolume(this.handle, volume); + } + public RESULT getVolume(out float volume) + { + return FMOD5_Channel_GetVolume(this.handle, out volume); + } + public RESULT setVolumeRamp(bool ramp) + { + return FMOD5_Channel_SetVolumeRamp(this.handle, ramp); + } + public RESULT getVolumeRamp(out bool ramp) + { + return FMOD5_Channel_GetVolumeRamp(this.handle, out ramp); + } + public RESULT getAudibility(out float audibility) + { + return FMOD5_Channel_GetAudibility(this.handle, out audibility); + } + public RESULT setPitch(float pitch) + { + return FMOD5_Channel_SetPitch(this.handle, pitch); + } + public RESULT getPitch(out float pitch) + { + return FMOD5_Channel_GetPitch(this.handle, out pitch); + } + public RESULT setMute(bool mute) + { + return FMOD5_Channel_SetMute(this.handle, mute); + } + public RESULT getMute(out bool mute) + { + return FMOD5_Channel_GetMute(this.handle, out mute); + } + public RESULT setReverbProperties(int instance, float wet) + { + return FMOD5_Channel_SetReverbProperties(this.handle, instance, wet); + } + public RESULT getReverbProperties(int instance, out float wet) + { + return FMOD5_Channel_GetReverbProperties(this.handle, instance, out wet); + } + public RESULT setLowPassGain(float gain) + { + return FMOD5_Channel_SetLowPassGain(this.handle, gain); + } + public RESULT getLowPassGain(out float gain) + { + return FMOD5_Channel_GetLowPassGain(this.handle, out gain); + } + public RESULT setMode(MODE mode) + { + return FMOD5_Channel_SetMode(this.handle, mode); + } + public RESULT getMode(out MODE mode) + { + return FMOD5_Channel_GetMode(this.handle, out mode); + } + public RESULT setCallback(CHANNELCONTROL_CALLBACK callback) + { + return FMOD5_Channel_SetCallback(this.handle, callback); + } + public RESULT isPlaying(out bool isplaying) + { + return FMOD5_Channel_IsPlaying(this.handle, out isplaying); + } + + // Panning and level adjustment. + public RESULT setPan(float pan) + { + return FMOD5_Channel_SetPan(this.handle, pan); + } + public RESULT setMixLevelsOutput(float frontleft, float frontright, float center, float lfe, float surroundleft, float surroundright, float backleft, float backright) + { + return FMOD5_Channel_SetMixLevelsOutput(this.handle, frontleft, frontright, center, lfe, surroundleft, surroundright, backleft, backright); + } + public RESULT setMixLevelsInput(float[] levels, int numlevels) + { + return FMOD5_Channel_SetMixLevelsInput(this.handle, levels, numlevels); + } + public RESULT setMixMatrix(float[] matrix, int outchannels, int inchannels, int inchannel_hop = 0) + { + return FMOD5_Channel_SetMixMatrix(this.handle, matrix, outchannels, inchannels, inchannel_hop); + } + public RESULT getMixMatrix(float[] matrix, out int outchannels, out int inchannels, int inchannel_hop = 0) + { + return FMOD5_Channel_GetMixMatrix(this.handle, matrix, out outchannels, out inchannels, inchannel_hop); + } + + // Clock based functionality. + public RESULT getDSPClock(out ulong dspclock, out ulong parentclock) + { + return FMOD5_Channel_GetDSPClock(this.handle, out dspclock, out parentclock); + } + public RESULT setDelay(ulong dspclock_start, ulong dspclock_end, bool stopchannels = true) + { + return FMOD5_Channel_SetDelay(this.handle, dspclock_start, dspclock_end, stopchannels); + } + public RESULT getDelay(out ulong dspclock_start, out ulong dspclock_end) + { + return FMOD5_Channel_GetDelay(this.handle, out dspclock_start, out dspclock_end, IntPtr.Zero); + } + public RESULT getDelay(out ulong dspclock_start, out ulong dspclock_end, out bool stopchannels) + { + return FMOD5_Channel_GetDelay(this.handle, out dspclock_start, out dspclock_end, out stopchannels); + } + public RESULT addFadePoint(ulong dspclock, float volume) + { + return FMOD5_Channel_AddFadePoint(this.handle, dspclock, volume); + } + public RESULT setFadePointRamp(ulong dspclock, float volume) + { + return FMOD5_Channel_SetFadePointRamp(this.handle, dspclock, volume); + } + public RESULT removeFadePoints(ulong dspclock_start, ulong dspclock_end) + { + return FMOD5_Channel_RemoveFadePoints(this.handle, dspclock_start, dspclock_end); + } + public RESULT getFadePoints(ref uint numpoints, ulong[] point_dspclock, float[] point_volume) + { + return FMOD5_Channel_GetFadePoints(this.handle, ref numpoints, point_dspclock, point_volume); + } + + // DSP effects. + public RESULT getDSP(int index, out DSP dsp) + { + return FMOD5_Channel_GetDSP(this.handle, index, out dsp.handle); + } + public RESULT addDSP(int index, DSP dsp) + { + return FMOD5_Channel_AddDSP(this.handle, index, dsp.handle); + } + public RESULT removeDSP(DSP dsp) + { + return FMOD5_Channel_RemoveDSP(this.handle, dsp.handle); + } + public RESULT getNumDSPs(out int numdsps) + { + return FMOD5_Channel_GetNumDSPs(this.handle, out numdsps); + } + public RESULT setDSPIndex(DSP dsp, int index) + { + return FMOD5_Channel_SetDSPIndex(this.handle, dsp.handle, index); + } + public RESULT getDSPIndex(DSP dsp, out int index) + { + return FMOD5_Channel_GetDSPIndex(this.handle, dsp.handle, out index); + } + + // 3D functionality. + public RESULT set3DAttributes(ref VECTOR pos, ref VECTOR vel) + { + return FMOD5_Channel_Set3DAttributes(this.handle, ref pos, ref vel); + } + public RESULT get3DAttributes(out VECTOR pos, out VECTOR vel) + { + return FMOD5_Channel_Get3DAttributes(this.handle, out pos, out vel); + } + public RESULT set3DMinMaxDistance(float mindistance, float maxdistance) + { + return FMOD5_Channel_Set3DMinMaxDistance(this.handle, mindistance, maxdistance); + } + public RESULT get3DMinMaxDistance(out float mindistance, out float maxdistance) + { + return FMOD5_Channel_Get3DMinMaxDistance(this.handle, out mindistance, out maxdistance); + } + public RESULT set3DConeSettings(float insideconeangle, float outsideconeangle, float outsidevolume) + { + return FMOD5_Channel_Set3DConeSettings(this.handle, insideconeangle, outsideconeangle, outsidevolume); + } + public RESULT get3DConeSettings(out float insideconeangle, out float outsideconeangle, out float outsidevolume) + { + return FMOD5_Channel_Get3DConeSettings(this.handle, out insideconeangle, out outsideconeangle, out outsidevolume); + } + public RESULT set3DConeOrientation(ref VECTOR orientation) + { + return FMOD5_Channel_Set3DConeOrientation(this.handle, ref orientation); + } + public RESULT get3DConeOrientation(out VECTOR orientation) + { + return FMOD5_Channel_Get3DConeOrientation(this.handle, out orientation); + } + public RESULT set3DCustomRolloff(ref VECTOR points, int numpoints) + { + return FMOD5_Channel_Set3DCustomRolloff(this.handle, ref points, numpoints); + } + public RESULT get3DCustomRolloff(out IntPtr points, out int numpoints) + { + return FMOD5_Channel_Get3DCustomRolloff(this.handle, out points, out numpoints); + } + public RESULT set3DOcclusion(float directocclusion, float reverbocclusion) + { + return FMOD5_Channel_Set3DOcclusion(this.handle, directocclusion, reverbocclusion); + } + public RESULT get3DOcclusion(out float directocclusion, out float reverbocclusion) + { + return FMOD5_Channel_Get3DOcclusion(this.handle, out directocclusion, out reverbocclusion); + } + public RESULT set3DSpread(float angle) + { + return FMOD5_Channel_Set3DSpread(this.handle, angle); + } + public RESULT get3DSpread(out float angle) + { + return FMOD5_Channel_Get3DSpread(this.handle, out angle); + } + public RESULT set3DLevel(float level) + { + return FMOD5_Channel_Set3DLevel(this.handle, level); + } + public RESULT get3DLevel(out float level) + { + return FMOD5_Channel_Get3DLevel(this.handle, out level); + } + public RESULT set3DDopplerLevel(float level) + { + return FMOD5_Channel_Set3DDopplerLevel(this.handle, level); + } + public RESULT get3DDopplerLevel(out float level) + { + return FMOD5_Channel_Get3DDopplerLevel(this.handle, out level); + } + public RESULT set3DDistanceFilter(bool custom, float customLevel, float centerFreq) + { + return FMOD5_Channel_Set3DDistanceFilter(this.handle, custom, customLevel, centerFreq); + } + public RESULT get3DDistanceFilter(out bool custom, out float customLevel, out float centerFreq) + { + return FMOD5_Channel_Get3DDistanceFilter(this.handle, out custom, out customLevel, out centerFreq); + } + + // Userdata set/get. + public RESULT setUserData(IntPtr userdata) + { + return FMOD5_Channel_SetUserData(this.handle, userdata); + } + public RESULT getUserData(out IntPtr userdata) + { + return FMOD5_Channel_GetUserData(this.handle, out userdata); + } + + #region importfunctions + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_SetFrequency (IntPtr channel, float frequency); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_GetFrequency (IntPtr channel, out float frequency); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_SetPriority (IntPtr channel, int priority); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_GetPriority (IntPtr channel, out int priority); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_SetPosition (IntPtr channel, uint position, TIMEUNIT postype); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_GetPosition (IntPtr channel, out uint position, TIMEUNIT postype); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_SetChannelGroup (IntPtr channel, IntPtr channelgroup); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_GetChannelGroup (IntPtr channel, out IntPtr channelgroup); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_SetLoopCount (IntPtr channel, int loopcount); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_GetLoopCount (IntPtr channel, out int loopcount); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_SetLoopPoints (IntPtr channel, uint loopstart, TIMEUNIT loopstarttype, uint loopend, TIMEUNIT loopendtype); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_GetLoopPoints (IntPtr channel, out uint loopstart, TIMEUNIT loopstarttype, out uint loopend, TIMEUNIT loopendtype); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_IsVirtual (IntPtr channel, out bool isvirtual); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_GetCurrentSound (IntPtr channel, out IntPtr sound); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_GetIndex (IntPtr channel, out int index); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_GetSystemObject (IntPtr channel, out IntPtr system); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_Stop (IntPtr channel); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_SetPaused (IntPtr channel, bool paused); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_GetPaused (IntPtr channel, out bool paused); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_SetVolume (IntPtr channel, float volume); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_GetVolume (IntPtr channel, out float volume); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_SetVolumeRamp (IntPtr channel, bool ramp); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_GetVolumeRamp (IntPtr channel, out bool ramp); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_GetAudibility (IntPtr channel, out float audibility); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_SetPitch (IntPtr channel, float pitch); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_GetPitch (IntPtr channel, out float pitch); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_SetMute (IntPtr channel, bool mute); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_GetMute (IntPtr channel, out bool mute); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_SetReverbProperties (IntPtr channel, int instance, float wet); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_GetReverbProperties (IntPtr channel, int instance, out float wet); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_SetLowPassGain (IntPtr channel, float gain); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_GetLowPassGain (IntPtr channel, out float gain); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_SetMode (IntPtr channel, MODE mode); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_GetMode (IntPtr channel, out MODE mode); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_SetCallback (IntPtr channel, CHANNELCONTROL_CALLBACK callback); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_IsPlaying (IntPtr channel, out bool isplaying); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_SetPan (IntPtr channel, float pan); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_SetMixLevelsOutput (IntPtr channel, float frontleft, float frontright, float center, float lfe, float surroundleft, float surroundright, float backleft, float backright); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_SetMixLevelsInput (IntPtr channel, float[] levels, int numlevels); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_SetMixMatrix (IntPtr channel, float[] matrix, int outchannels, int inchannels, int inchannel_hop); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_GetMixMatrix (IntPtr channel, float[] matrix, out int outchannels, out int inchannels, int inchannel_hop); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_GetDSPClock (IntPtr channel, out ulong dspclock, out ulong parentclock); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_SetDelay (IntPtr channel, ulong dspclock_start, ulong dspclock_end, bool stopchannels); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_GetDelay (IntPtr channel, out ulong dspclock_start, out ulong dspclock_end, IntPtr zero); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_GetDelay (IntPtr channel, out ulong dspclock_start, out ulong dspclock_end, out bool stopchannels); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_AddFadePoint (IntPtr channel, ulong dspclock, float volume); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_SetFadePointRamp (IntPtr channel, ulong dspclock, float volume); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_RemoveFadePoints (IntPtr channel, ulong dspclock_start, ulong dspclock_end); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_GetFadePoints (IntPtr channel, ref uint numpoints, ulong[] point_dspclock, float[] point_volume); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_GetDSP (IntPtr channel, int index, out IntPtr dsp); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_AddDSP (IntPtr channel, int index, IntPtr dsp); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_RemoveDSP (IntPtr channel, IntPtr dsp); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_GetNumDSPs (IntPtr channel, out int numdsps); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_SetDSPIndex (IntPtr channel, IntPtr dsp, int index); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_GetDSPIndex (IntPtr channel, IntPtr dsp, out int index); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_Set3DAttributes (IntPtr channel, ref VECTOR pos, ref VECTOR vel); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_Get3DAttributes (IntPtr channel, out VECTOR pos, out VECTOR vel); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_Set3DMinMaxDistance (IntPtr channel, float mindistance, float maxdistance); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_Get3DMinMaxDistance (IntPtr channel, out float mindistance, out float maxdistance); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_Set3DConeSettings (IntPtr channel, float insideconeangle, float outsideconeangle, float outsidevolume); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_Get3DConeSettings (IntPtr channel, out float insideconeangle, out float outsideconeangle, out float outsidevolume); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_Set3DConeOrientation (IntPtr channel, ref VECTOR orientation); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_Get3DConeOrientation (IntPtr channel, out VECTOR orientation); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_Set3DCustomRolloff (IntPtr channel, ref VECTOR points, int numpoints); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_Get3DCustomRolloff (IntPtr channel, out IntPtr points, out int numpoints); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_Set3DOcclusion (IntPtr channel, float directocclusion, float reverbocclusion); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_Get3DOcclusion (IntPtr channel, out float directocclusion, out float reverbocclusion); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_Set3DSpread (IntPtr channel, float angle); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_Get3DSpread (IntPtr channel, out float angle); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_Set3DLevel (IntPtr channel, float level); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_Get3DLevel (IntPtr channel, out float level); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_Set3DDopplerLevel (IntPtr channel, float level); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_Get3DDopplerLevel (IntPtr channel, out float level); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_Set3DDistanceFilter (IntPtr channel, bool custom, float customLevel, float centerFreq); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_Get3DDistanceFilter (IntPtr channel, out bool custom, out float customLevel, out float centerFreq); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_SetUserData (IntPtr channel, IntPtr userdata); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Channel_GetUserData (IntPtr channel, out IntPtr userdata); + #endregion + + #region wrapperinternal + + public IntPtr handle; + + public bool hasHandle() { return this.handle != IntPtr.Zero; } + public void clearHandle() { this.handle = IntPtr.Zero; } + + #endregion + } + + /* + 'ChannelGroup' API + */ + public struct ChannelGroup : IChannelControl + { + public RESULT release() + { + return FMOD5_ChannelGroup_Release(this.handle); + } + + // Nested channel groups. + public RESULT addGroup(ChannelGroup group, bool propagatedspclock = true) + { + return FMOD5_ChannelGroup_AddGroup(this.handle, group.handle, propagatedspclock, IntPtr.Zero); + } + public RESULT addGroup(ChannelGroup group, bool propagatedspclock, out DSPConnection connection) + { + return FMOD5_ChannelGroup_AddGroup(this.handle, group.handle, propagatedspclock, out connection.handle); + } + public RESULT getNumGroups(out int numgroups) + { + return FMOD5_ChannelGroup_GetNumGroups(this.handle, out numgroups); + } + public RESULT getGroup(int index, out ChannelGroup group) + { + return FMOD5_ChannelGroup_GetGroup(this.handle, index, out group.handle); + } + public RESULT getParentGroup(out ChannelGroup group) + { + return FMOD5_ChannelGroup_GetParentGroup(this.handle, out group.handle); + } + + // Information only functions. + public RESULT getName(out string name, int namelen) + { + IntPtr stringMem = Marshal.AllocHGlobal(namelen); + + RESULT result = FMOD5_ChannelGroup_GetName(this.handle, stringMem, namelen); + using (StringHelper.ThreadSafeEncoding encoder = StringHelper.GetFreeHelper()) + { + name = encoder.stringFromNative(stringMem); + } + Marshal.FreeHGlobal(stringMem); + + return result; + } + public RESULT getNumChannels(out int numchannels) + { + return FMOD5_ChannelGroup_GetNumChannels(this.handle, out numchannels); + } + public RESULT getChannel(int index, out Channel channel) + { + return FMOD5_ChannelGroup_GetChannel(this.handle, index, out channel.handle); + } + + public RESULT getSystemObject(out System system) + { + return FMOD5_ChannelGroup_GetSystemObject(this.handle, out system.handle); + } + + // General control functionality for Channels and ChannelGroups. + public RESULT stop() + { + return FMOD5_ChannelGroup_Stop(this.handle); + } + public RESULT setPaused(bool paused) + { + return FMOD5_ChannelGroup_SetPaused(this.handle, paused); + } + public RESULT getPaused(out bool paused) + { + return FMOD5_ChannelGroup_GetPaused(this.handle, out paused); + } + public RESULT setVolume(float volume) + { + return FMOD5_ChannelGroup_SetVolume(this.handle, volume); + } + public RESULT getVolume(out float volume) + { + return FMOD5_ChannelGroup_GetVolume(this.handle, out volume); + } + public RESULT setVolumeRamp(bool ramp) + { + return FMOD5_ChannelGroup_SetVolumeRamp(this.handle, ramp); + } + public RESULT getVolumeRamp(out bool ramp) + { + return FMOD5_ChannelGroup_GetVolumeRamp(this.handle, out ramp); + } + public RESULT getAudibility(out float audibility) + { + return FMOD5_ChannelGroup_GetAudibility(this.handle, out audibility); + } + public RESULT setPitch(float pitch) + { + return FMOD5_ChannelGroup_SetPitch(this.handle, pitch); + } + public RESULT getPitch(out float pitch) + { + return FMOD5_ChannelGroup_GetPitch(this.handle, out pitch); + } + public RESULT setMute(bool mute) + { + return FMOD5_ChannelGroup_SetMute(this.handle, mute); + } + public RESULT getMute(out bool mute) + { + return FMOD5_ChannelGroup_GetMute(this.handle, out mute); + } + public RESULT setReverbProperties(int instance, float wet) + { + return FMOD5_ChannelGroup_SetReverbProperties(this.handle, instance, wet); + } + public RESULT getReverbProperties(int instance, out float wet) + { + return FMOD5_ChannelGroup_GetReverbProperties(this.handle, instance, out wet); + } + public RESULT setLowPassGain(float gain) + { + return FMOD5_ChannelGroup_SetLowPassGain(this.handle, gain); + } + public RESULT getLowPassGain(out float gain) + { + return FMOD5_ChannelGroup_GetLowPassGain(this.handle, out gain); + } + public RESULT setMode(MODE mode) + { + return FMOD5_ChannelGroup_SetMode(this.handle, mode); + } + public RESULT getMode(out MODE mode) + { + return FMOD5_ChannelGroup_GetMode(this.handle, out mode); + } + public RESULT setCallback(CHANNELCONTROL_CALLBACK callback) + { + return FMOD5_ChannelGroup_SetCallback(this.handle, callback); + } + public RESULT isPlaying(out bool isplaying) + { + return FMOD5_ChannelGroup_IsPlaying(this.handle, out isplaying); + } + + // Panning and level adjustment. + public RESULT setPan(float pan) + { + return FMOD5_ChannelGroup_SetPan(this.handle, pan); + } + public RESULT setMixLevelsOutput(float frontleft, float frontright, float center, float lfe, float surroundleft, float surroundright, float backleft, float backright) + { + return FMOD5_ChannelGroup_SetMixLevelsOutput(this.handle, frontleft, frontright, center, lfe, surroundleft, surroundright, backleft, backright); + } + public RESULT setMixLevelsInput(float[] levels, int numlevels) + { + return FMOD5_ChannelGroup_SetMixLevelsInput(this.handle, levels, numlevels); + } + public RESULT setMixMatrix(float[] matrix, int outchannels, int inchannels, int inchannel_hop) + { + return FMOD5_ChannelGroup_SetMixMatrix(this.handle, matrix, outchannels, inchannels, inchannel_hop); + } + public RESULT getMixMatrix(float[] matrix, out int outchannels, out int inchannels, int inchannel_hop) + { + return FMOD5_ChannelGroup_GetMixMatrix(this.handle, matrix, out outchannels, out inchannels, inchannel_hop); + } + + // Clock based functionality. + public RESULT getDSPClock(out ulong dspclock, out ulong parentclock) + { + return FMOD5_ChannelGroup_GetDSPClock(this.handle, out dspclock, out parentclock); + } + public RESULT setDelay(ulong dspclock_start, ulong dspclock_end, bool stopchannels) + { + return FMOD5_ChannelGroup_SetDelay(this.handle, dspclock_start, dspclock_end, stopchannels); + } + public RESULT getDelay(out ulong dspclock_start, out ulong dspclock_end) + { + return FMOD5_ChannelGroup_GetDelay(this.handle, out dspclock_start, out dspclock_end, IntPtr.Zero); + } + public RESULT getDelay(out ulong dspclock_start, out ulong dspclock_end, out bool stopchannels) + { + return FMOD5_ChannelGroup_GetDelay(this.handle, out dspclock_start, out dspclock_end, out stopchannels); + } + public RESULT addFadePoint(ulong dspclock, float volume) + { + return FMOD5_ChannelGroup_AddFadePoint(this.handle, dspclock, volume); + } + public RESULT setFadePointRamp(ulong dspclock, float volume) + { + return FMOD5_ChannelGroup_SetFadePointRamp(this.handle, dspclock, volume); + } + public RESULT removeFadePoints(ulong dspclock_start, ulong dspclock_end) + { + return FMOD5_ChannelGroup_RemoveFadePoints(this.handle, dspclock_start, dspclock_end); + } + public RESULT getFadePoints(ref uint numpoints, ulong[] point_dspclock, float[] point_volume) + { + return FMOD5_ChannelGroup_GetFadePoints(this.handle, ref numpoints, point_dspclock, point_volume); + } + + // DSP effects. + public RESULT getDSP(int index, out DSP dsp) + { + return FMOD5_ChannelGroup_GetDSP(this.handle, index, out dsp.handle); + } + public RESULT addDSP(int index, DSP dsp) + { + return FMOD5_ChannelGroup_AddDSP(this.handle, index, dsp.handle); + } + public RESULT removeDSP(DSP dsp) + { + return FMOD5_ChannelGroup_RemoveDSP(this.handle, dsp.handle); + } + public RESULT getNumDSPs(out int numdsps) + { + return FMOD5_ChannelGroup_GetNumDSPs(this.handle, out numdsps); + } + public RESULT setDSPIndex(DSP dsp, int index) + { + return FMOD5_ChannelGroup_SetDSPIndex(this.handle, dsp.handle, index); + } + public RESULT getDSPIndex(DSP dsp, out int index) + { + return FMOD5_ChannelGroup_GetDSPIndex(this.handle, dsp.handle, out index); + } + + // 3D functionality. + public RESULT set3DAttributes(ref VECTOR pos, ref VECTOR vel) + { + return FMOD5_ChannelGroup_Set3DAttributes(this.handle, ref pos, ref vel); + } + public RESULT get3DAttributes(out VECTOR pos, out VECTOR vel) + { + return FMOD5_ChannelGroup_Get3DAttributes(this.handle, out pos, out vel); + } + public RESULT set3DMinMaxDistance(float mindistance, float maxdistance) + { + return FMOD5_ChannelGroup_Set3DMinMaxDistance(this.handle, mindistance, maxdistance); + } + public RESULT get3DMinMaxDistance(out float mindistance, out float maxdistance) + { + return FMOD5_ChannelGroup_Get3DMinMaxDistance(this.handle, out mindistance, out maxdistance); + } + public RESULT set3DConeSettings(float insideconeangle, float outsideconeangle, float outsidevolume) + { + return FMOD5_ChannelGroup_Set3DConeSettings(this.handle, insideconeangle, outsideconeangle, outsidevolume); + } + public RESULT get3DConeSettings(out float insideconeangle, out float outsideconeangle, out float outsidevolume) + { + return FMOD5_ChannelGroup_Get3DConeSettings(this.handle, out insideconeangle, out outsideconeangle, out outsidevolume); + } + public RESULT set3DConeOrientation(ref VECTOR orientation) + { + return FMOD5_ChannelGroup_Set3DConeOrientation(this.handle, ref orientation); + } + public RESULT get3DConeOrientation(out VECTOR orientation) + { + return FMOD5_ChannelGroup_Get3DConeOrientation(this.handle, out orientation); + } + public RESULT set3DCustomRolloff(ref VECTOR points, int numpoints) + { + return FMOD5_ChannelGroup_Set3DCustomRolloff(this.handle, ref points, numpoints); + } + public RESULT get3DCustomRolloff(out IntPtr points, out int numpoints) + { + return FMOD5_ChannelGroup_Get3DCustomRolloff(this.handle, out points, out numpoints); + } + public RESULT set3DOcclusion(float directocclusion, float reverbocclusion) + { + return FMOD5_ChannelGroup_Set3DOcclusion(this.handle, directocclusion, reverbocclusion); + } + public RESULT get3DOcclusion(out float directocclusion, out float reverbocclusion) + { + return FMOD5_ChannelGroup_Get3DOcclusion(this.handle, out directocclusion, out reverbocclusion); + } + public RESULT set3DSpread(float angle) + { + return FMOD5_ChannelGroup_Set3DSpread(this.handle, angle); + } + public RESULT get3DSpread(out float angle) + { + return FMOD5_ChannelGroup_Get3DSpread(this.handle, out angle); + } + public RESULT set3DLevel(float level) + { + return FMOD5_ChannelGroup_Set3DLevel(this.handle, level); + } + public RESULT get3DLevel(out float level) + { + return FMOD5_ChannelGroup_Get3DLevel(this.handle, out level); + } + public RESULT set3DDopplerLevel(float level) + { + return FMOD5_ChannelGroup_Set3DDopplerLevel(this.handle, level); + } + public RESULT get3DDopplerLevel(out float level) + { + return FMOD5_ChannelGroup_Get3DDopplerLevel(this.handle, out level); + } + public RESULT set3DDistanceFilter(bool custom, float customLevel, float centerFreq) + { + return FMOD5_ChannelGroup_Set3DDistanceFilter(this.handle, custom, customLevel, centerFreq); + } + public RESULT get3DDistanceFilter(out bool custom, out float customLevel, out float centerFreq) + { + return FMOD5_ChannelGroup_Get3DDistanceFilter(this.handle, out custom, out customLevel, out centerFreq); + } + + // Userdata set/get. + public RESULT setUserData(IntPtr userdata) + { + return FMOD5_ChannelGroup_SetUserData(this.handle, userdata); + } + public RESULT getUserData(out IntPtr userdata) + { + return FMOD5_ChannelGroup_GetUserData(this.handle, out userdata); + } + + #region importfunctions + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_Release (IntPtr channelgroup); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_AddGroup (IntPtr channelgroup, IntPtr group, bool propagatedspclock, IntPtr zero); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_AddGroup (IntPtr channelgroup, IntPtr group, bool propagatedspclock, out IntPtr connection); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_GetNumGroups (IntPtr channelgroup, out int numgroups); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_GetGroup (IntPtr channelgroup, int index, out IntPtr group); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_GetParentGroup (IntPtr channelgroup, out IntPtr group); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_GetName (IntPtr channelgroup, IntPtr name, int namelen); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_GetNumChannels (IntPtr channelgroup, out int numchannels); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_GetChannel (IntPtr channelgroup, int index, out IntPtr channel); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_GetSystemObject (IntPtr channelgroup, out IntPtr system); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_Stop (IntPtr channelgroup); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_SetPaused (IntPtr channelgroup, bool paused); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_GetPaused (IntPtr channelgroup, out bool paused); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_SetVolume (IntPtr channelgroup, float volume); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_GetVolume (IntPtr channelgroup, out float volume); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_SetVolumeRamp (IntPtr channelgroup, bool ramp); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_GetVolumeRamp (IntPtr channelgroup, out bool ramp); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_GetAudibility (IntPtr channelgroup, out float audibility); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_SetPitch (IntPtr channelgroup, float pitch); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_GetPitch (IntPtr channelgroup, out float pitch); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_SetMute (IntPtr channelgroup, bool mute); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_GetMute (IntPtr channelgroup, out bool mute); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_SetReverbProperties (IntPtr channelgroup, int instance, float wet); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_GetReverbProperties (IntPtr channelgroup, int instance, out float wet); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_SetLowPassGain (IntPtr channelgroup, float gain); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_GetLowPassGain (IntPtr channelgroup, out float gain); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_SetMode (IntPtr channelgroup, MODE mode); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_GetMode (IntPtr channelgroup, out MODE mode); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_SetCallback (IntPtr channelgroup, CHANNELCONTROL_CALLBACK callback); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_IsPlaying (IntPtr channelgroup, out bool isplaying); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_SetPan (IntPtr channelgroup, float pan); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_SetMixLevelsOutput (IntPtr channelgroup, float frontleft, float frontright, float center, float lfe, float surroundleft, float surroundright, float backleft, float backright); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_SetMixLevelsInput (IntPtr channelgroup, float[] levels, int numlevels); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_SetMixMatrix (IntPtr channelgroup, float[] matrix, int outchannels, int inchannels, int inchannel_hop); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_GetMixMatrix (IntPtr channelgroup, float[] matrix, out int outchannels, out int inchannels, int inchannel_hop); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_GetDSPClock (IntPtr channelgroup, out ulong dspclock, out ulong parentclock); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_SetDelay (IntPtr channelgroup, ulong dspclock_start, ulong dspclock_end, bool stopchannels); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_GetDelay (IntPtr channelgroup, out ulong dspclock_start, out ulong dspclock_end, IntPtr zero); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_GetDelay (IntPtr channelgroup, out ulong dspclock_start, out ulong dspclock_end, out bool stopchannels); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_AddFadePoint (IntPtr channelgroup, ulong dspclock, float volume); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_SetFadePointRamp (IntPtr channelgroup, ulong dspclock, float volume); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_RemoveFadePoints (IntPtr channelgroup, ulong dspclock_start, ulong dspclock_end); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_GetFadePoints (IntPtr channelgroup, ref uint numpoints, ulong[] point_dspclock, float[] point_volume); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_GetDSP (IntPtr channelgroup, int index, out IntPtr dsp); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_AddDSP (IntPtr channelgroup, int index, IntPtr dsp); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_RemoveDSP (IntPtr channelgroup, IntPtr dsp); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_GetNumDSPs (IntPtr channelgroup, out int numdsps); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_SetDSPIndex (IntPtr channelgroup, IntPtr dsp, int index); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_GetDSPIndex (IntPtr channelgroup, IntPtr dsp, out int index); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_Set3DAttributes (IntPtr channelgroup, ref VECTOR pos, ref VECTOR vel); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_Get3DAttributes (IntPtr channelgroup, out VECTOR pos, out VECTOR vel); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_Set3DMinMaxDistance (IntPtr channelgroup, float mindistance, float maxdistance); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_Get3DMinMaxDistance (IntPtr channelgroup, out float mindistance, out float maxdistance); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_Set3DConeSettings (IntPtr channelgroup, float insideconeangle, float outsideconeangle, float outsidevolume); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_Get3DConeSettings (IntPtr channelgroup, out float insideconeangle, out float outsideconeangle, out float outsidevolume); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_Set3DConeOrientation(IntPtr channelgroup, ref VECTOR orientation); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_Get3DConeOrientation(IntPtr channelgroup, out VECTOR orientation); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_Set3DCustomRolloff (IntPtr channelgroup, ref VECTOR points, int numpoints); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_Get3DCustomRolloff (IntPtr channelgroup, out IntPtr points, out int numpoints); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_Set3DOcclusion (IntPtr channelgroup, float directocclusion, float reverbocclusion); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_Get3DOcclusion (IntPtr channelgroup, out float directocclusion, out float reverbocclusion); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_Set3DSpread (IntPtr channelgroup, float angle); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_Get3DSpread (IntPtr channelgroup, out float angle); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_Set3DLevel (IntPtr channelgroup, float level); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_Get3DLevel (IntPtr channelgroup, out float level); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_Set3DDopplerLevel (IntPtr channelgroup, float level); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_Get3DDopplerLevel (IntPtr channelgroup, out float level); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_Set3DDistanceFilter (IntPtr channelgroup, bool custom, float customLevel, float centerFreq); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_Get3DDistanceFilter (IntPtr channelgroup, out bool custom, out float customLevel, out float centerFreq); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_SetUserData (IntPtr channelgroup, IntPtr userdata); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_ChannelGroup_GetUserData (IntPtr channelgroup, out IntPtr userdata); + #endregion + + #region wrapperinternal + + public IntPtr handle; + + public bool hasHandle() { return this.handle != IntPtr.Zero; } + public void clearHandle() { this.handle = IntPtr.Zero; } + + #endregion + } + + /* + 'SoundGroup' API + */ + public struct SoundGroup + { + public RESULT release() + { + return FMOD5_SoundGroup_Release(this.handle); + } + + public RESULT getSystemObject(out System system) + { + return FMOD5_SoundGroup_GetSystemObject(this.handle, out system.handle); + } + + // SoundGroup control functions. + public RESULT setMaxAudible(int maxaudible) + { + return FMOD5_SoundGroup_SetMaxAudible(this.handle, maxaudible); + } + public RESULT getMaxAudible(out int maxaudible) + { + return FMOD5_SoundGroup_GetMaxAudible(this.handle, out maxaudible); + } + public RESULT setMaxAudibleBehavior(SOUNDGROUP_BEHAVIOR behavior) + { + return FMOD5_SoundGroup_SetMaxAudibleBehavior(this.handle, behavior); + } + public RESULT getMaxAudibleBehavior(out SOUNDGROUP_BEHAVIOR behavior) + { + return FMOD5_SoundGroup_GetMaxAudibleBehavior(this.handle, out behavior); + } + public RESULT setMuteFadeSpeed(float speed) + { + return FMOD5_SoundGroup_SetMuteFadeSpeed(this.handle, speed); + } + public RESULT getMuteFadeSpeed(out float speed) + { + return FMOD5_SoundGroup_GetMuteFadeSpeed(this.handle, out speed); + } + public RESULT setVolume(float volume) + { + return FMOD5_SoundGroup_SetVolume(this.handle, volume); + } + public RESULT getVolume(out float volume) + { + return FMOD5_SoundGroup_GetVolume(this.handle, out volume); + } + public RESULT stop() + { + return FMOD5_SoundGroup_Stop(this.handle); + } + + // Information only functions. + public RESULT getName(out string name, int namelen) + { + IntPtr stringMem = Marshal.AllocHGlobal(namelen); + + RESULT result = FMOD5_SoundGroup_GetName(this.handle, stringMem, namelen); + using (StringHelper.ThreadSafeEncoding encoder = StringHelper.GetFreeHelper()) + { + name = encoder.stringFromNative(stringMem); + } + Marshal.FreeHGlobal(stringMem); + + return result; + } + public RESULT getNumSounds(out int numsounds) + { + return FMOD5_SoundGroup_GetNumSounds(this.handle, out numsounds); + } + public RESULT getSound(int index, out Sound sound) + { + return FMOD5_SoundGroup_GetSound(this.handle, index, out sound.handle); + } + public RESULT getNumPlaying(out int numplaying) + { + return FMOD5_SoundGroup_GetNumPlaying(this.handle, out numplaying); + } + + // Userdata set/get. + public RESULT setUserData(IntPtr userdata) + { + return FMOD5_SoundGroup_SetUserData(this.handle, userdata); + } + public RESULT getUserData(out IntPtr userdata) + { + return FMOD5_SoundGroup_GetUserData(this.handle, out userdata); + } + + #region importfunctions + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_SoundGroup_Release (IntPtr soundgroup); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_SoundGroup_GetSystemObject (IntPtr soundgroup, out IntPtr system); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_SoundGroup_SetMaxAudible (IntPtr soundgroup, int maxaudible); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_SoundGroup_GetMaxAudible (IntPtr soundgroup, out int maxaudible); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_SoundGroup_SetMaxAudibleBehavior (IntPtr soundgroup, SOUNDGROUP_BEHAVIOR behavior); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_SoundGroup_GetMaxAudibleBehavior (IntPtr soundgroup, out SOUNDGROUP_BEHAVIOR behavior); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_SoundGroup_SetMuteFadeSpeed (IntPtr soundgroup, float speed); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_SoundGroup_GetMuteFadeSpeed (IntPtr soundgroup, out float speed); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_SoundGroup_SetVolume (IntPtr soundgroup, float volume); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_SoundGroup_GetVolume (IntPtr soundgroup, out float volume); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_SoundGroup_Stop (IntPtr soundgroup); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_SoundGroup_GetName (IntPtr soundgroup, IntPtr name, int namelen); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_SoundGroup_GetNumSounds (IntPtr soundgroup, out int numsounds); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_SoundGroup_GetSound (IntPtr soundgroup, int index, out IntPtr sound); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_SoundGroup_GetNumPlaying (IntPtr soundgroup, out int numplaying); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_SoundGroup_SetUserData (IntPtr soundgroup, IntPtr userdata); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_SoundGroup_GetUserData (IntPtr soundgroup, out IntPtr userdata); + #endregion + + #region wrapperinternal + + public IntPtr handle; + + public bool hasHandle() { return this.handle != IntPtr.Zero; } + public void clearHandle() { this.handle = IntPtr.Zero; } + + #endregion + } + + /* + 'DSP' API + */ + public struct DSP + { + public RESULT release() + { + return FMOD5_DSP_Release(this.handle); + } + public RESULT getSystemObject(out System system) + { + return FMOD5_DSP_GetSystemObject(this.handle, out system.handle); + } + + // Connection / disconnection / input and output enumeration. + public RESULT addInput(DSP input) + { + return FMOD5_DSP_AddInput(this.handle, input.handle, IntPtr.Zero, DSPCONNECTION_TYPE.STANDARD); + } + public RESULT addInput(DSP input, out DSPConnection connection, DSPCONNECTION_TYPE type = DSPCONNECTION_TYPE.STANDARD) + { + return FMOD5_DSP_AddInput(this.handle, input.handle, out connection.handle, type); + } + public RESULT disconnectFrom(DSP target, DSPConnection connection) + { + return FMOD5_DSP_DisconnectFrom(this.handle, target.handle, connection.handle); + } + public RESULT disconnectAll(bool inputs, bool outputs) + { + return FMOD5_DSP_DisconnectAll(this.handle, inputs, outputs); + } + public RESULT getNumInputs(out int numinputs) + { + return FMOD5_DSP_GetNumInputs(this.handle, out numinputs); + } + public RESULT getNumOutputs(out int numoutputs) + { + return FMOD5_DSP_GetNumOutputs(this.handle, out numoutputs); + } + public RESULT getInput(int index, out DSP input, out DSPConnection inputconnection) + { + return FMOD5_DSP_GetInput(this.handle, index, out input.handle, out inputconnection.handle); + } + public RESULT getOutput(int index, out DSP output, out DSPConnection outputconnection) + { + return FMOD5_DSP_GetOutput(this.handle, index, out output.handle, out outputconnection.handle); + } + + // DSP unit control. + public RESULT setActive(bool active) + { + return FMOD5_DSP_SetActive(this.handle, active); + } + public RESULT getActive(out bool active) + { + return FMOD5_DSP_GetActive(this.handle, out active); + } + public RESULT setBypass(bool bypass) + { + return FMOD5_DSP_SetBypass(this.handle, bypass); + } + public RESULT getBypass(out bool bypass) + { + return FMOD5_DSP_GetBypass(this.handle, out bypass); + } + public RESULT setWetDryMix(float prewet, float postwet, float dry) + { + return FMOD5_DSP_SetWetDryMix(this.handle, prewet, postwet, dry); + } + public RESULT getWetDryMix(out float prewet, out float postwet, out float dry) + { + return FMOD5_DSP_GetWetDryMix(this.handle, out prewet, out postwet, out dry); + } + public RESULT setChannelFormat(CHANNELMASK channelmask, int numchannels, SPEAKERMODE source_speakermode) + { + return FMOD5_DSP_SetChannelFormat(this.handle, channelmask, numchannels, source_speakermode); + } + public RESULT getChannelFormat(out CHANNELMASK channelmask, out int numchannels, out SPEAKERMODE source_speakermode) + { + return FMOD5_DSP_GetChannelFormat(this.handle, out channelmask, out numchannels, out source_speakermode); + } + public RESULT getOutputChannelFormat(CHANNELMASK inmask, int inchannels, SPEAKERMODE inspeakermode, out CHANNELMASK outmask, out int outchannels, out SPEAKERMODE outspeakermode) + { + return FMOD5_DSP_GetOutputChannelFormat(this.handle, inmask, inchannels, inspeakermode, out outmask, out outchannels, out outspeakermode); + } + public RESULT reset() + { + return FMOD5_DSP_Reset(this.handle); + } + + // DSP parameter control. + public RESULT setParameterFloat(int index, float value) + { + return FMOD5_DSP_SetParameterFloat(this.handle, index, value); + } + public RESULT setParameterInt(int index, int value) + { + return FMOD5_DSP_SetParameterInt(this.handle, index, value); + } + public RESULT setParameterBool(int index, bool value) + { + return FMOD5_DSP_SetParameterBool(this.handle, index, value); + } + public RESULT setParameterData(int index, byte[] data) + { + return FMOD5_DSP_SetParameterData(this.handle, index, Marshal.UnsafeAddrOfPinnedArrayElement(data, 0), (uint)data.Length); + } + public RESULT getParameterFloat(int index, out float value) + { + return FMOD5_DSP_GetParameterFloat(this.handle, index, out value, IntPtr.Zero, 0); + } + public RESULT getParameterInt(int index, out int value) + { + return FMOD5_DSP_GetParameterInt(this.handle, index, out value, IntPtr.Zero, 0); + } + public RESULT getParameterBool(int index, out bool value) + { + return FMOD5_DSP_GetParameterBool(this.handle, index, out value, IntPtr.Zero, 0); + } + public RESULT getParameterData(int index, out IntPtr data, out uint length) + { + return FMOD5_DSP_GetParameterData(this.handle, index, out data, out length, IntPtr.Zero, 0); + } + public RESULT getNumParameters(out int numparams) + { + return FMOD5_DSP_GetNumParameters(this.handle, out numparams); + } + public RESULT getParameterInfo(int index, out DSP_PARAMETER_DESC desc) + { + return FMOD5_DSP_GetParameterInfo(this.handle, index, out desc); + } + public RESULT getDataParameterIndex(int datatype, out int index) + { + return FMOD5_DSP_GetDataParameterIndex(this.handle, datatype, out index); + } + public RESULT showConfigDialog(IntPtr hwnd, bool show) + { + return FMOD5_DSP_ShowConfigDialog(this.handle, hwnd, show); + } + + // DSP attributes. + public RESULT getInfo(out string name, out uint version, out int channels, out int configwidth, out int configheight) + { + IntPtr nameMem = Marshal.AllocHGlobal(32); + + RESULT result = FMOD5_DSP_GetInfo(this.handle, nameMem, out version, out channels, out configwidth, out configheight); + using (StringHelper.ThreadSafeEncoding encoder = StringHelper.GetFreeHelper()) + { + name = encoder.stringFromNative(nameMem); + } + Marshal.FreeHGlobal(nameMem); + return result; + } + public RESULT getInfo(out uint version, out int channels, out int configwidth, out int configheight) + { + return FMOD5_DSP_GetInfo(this.handle, IntPtr.Zero, out version, out channels, out configwidth, out configheight); ; + } + public RESULT getType(out DSP_TYPE type) + { + return FMOD5_DSP_GetType(this.handle, out type); + } + public RESULT getIdle(out bool idle) + { + return FMOD5_DSP_GetIdle(this.handle, out idle); + } + + // Userdata set/get. + public RESULT setUserData(IntPtr userdata) + { + return FMOD5_DSP_SetUserData(this.handle, userdata); + } + public RESULT getUserData(out IntPtr userdata) + { + return FMOD5_DSP_GetUserData(this.handle, out userdata); + } + + // Metering. + public RESULT setMeteringEnabled(bool inputEnabled, bool outputEnabled) + { + return FMOD5_DSP_SetMeteringEnabled(this.handle, inputEnabled, outputEnabled); + } + public RESULT getMeteringEnabled(out bool inputEnabled, out bool outputEnabled) + { + return FMOD5_DSP_GetMeteringEnabled(this.handle, out inputEnabled, out outputEnabled); + } + + public RESULT getMeteringInfo(IntPtr zero, out DSP_METERING_INFO outputInfo) + { + return FMOD5_DSP_GetMeteringInfo(this.handle, zero, out outputInfo); + } + public RESULT getMeteringInfo(out DSP_METERING_INFO inputInfo, IntPtr zero) + { + return FMOD5_DSP_GetMeteringInfo(this.handle, out inputInfo, zero); + } + public RESULT getMeteringInfo(out DSP_METERING_INFO inputInfo, out DSP_METERING_INFO outputInfo) + { + return FMOD5_DSP_GetMeteringInfo(this.handle, out inputInfo, out outputInfo); + } + + public RESULT getCPUUsage(out uint exclusive, out uint inclusive) + { + return FMOD5_DSP_GetCPUUsage(this.handle, out exclusive, out inclusive); + } + + #region importfunctions + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_DSP_Release (IntPtr dsp); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_DSP_GetSystemObject (IntPtr dsp, out IntPtr system); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_DSP_AddInput (IntPtr dsp, IntPtr input, IntPtr zero, DSPCONNECTION_TYPE type); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_DSP_AddInput (IntPtr dsp, IntPtr input, out IntPtr connection, DSPCONNECTION_TYPE type); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_DSP_DisconnectFrom (IntPtr dsp, IntPtr target, IntPtr connection); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_DSP_DisconnectAll (IntPtr dsp, bool inputs, bool outputs); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_DSP_GetNumInputs (IntPtr dsp, out int numinputs); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_DSP_GetNumOutputs (IntPtr dsp, out int numoutputs); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_DSP_GetInput (IntPtr dsp, int index, out IntPtr input, out IntPtr inputconnection); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_DSP_GetOutput (IntPtr dsp, int index, out IntPtr output, out IntPtr outputconnection); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_DSP_SetActive (IntPtr dsp, bool active); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_DSP_GetActive (IntPtr dsp, out bool active); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_DSP_SetBypass (IntPtr dsp, bool bypass); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_DSP_GetBypass (IntPtr dsp, out bool bypass); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_DSP_SetWetDryMix (IntPtr dsp, float prewet, float postwet, float dry); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_DSP_GetWetDryMix (IntPtr dsp, out float prewet, out float postwet, out float dry); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_DSP_SetChannelFormat (IntPtr dsp, CHANNELMASK channelmask, int numchannels, SPEAKERMODE source_speakermode); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_DSP_GetChannelFormat (IntPtr dsp, out CHANNELMASK channelmask, out int numchannels, out SPEAKERMODE source_speakermode); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_DSP_GetOutputChannelFormat (IntPtr dsp, CHANNELMASK inmask, int inchannels, SPEAKERMODE inspeakermode, out CHANNELMASK outmask, out int outchannels, out SPEAKERMODE outspeakermode); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_DSP_Reset (IntPtr dsp); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_DSP_SetParameterFloat (IntPtr dsp, int index, float value); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_DSP_SetParameterInt (IntPtr dsp, int index, int value); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_DSP_SetParameterBool (IntPtr dsp, int index, bool value); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_DSP_SetParameterData (IntPtr dsp, int index, IntPtr data, uint length); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_DSP_GetParameterFloat (IntPtr dsp, int index, out float value, IntPtr valuestr, int valuestrlen); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_DSP_GetParameterInt (IntPtr dsp, int index, out int value, IntPtr valuestr, int valuestrlen); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_DSP_GetParameterBool (IntPtr dsp, int index, out bool value, IntPtr valuestr, int valuestrlen); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_DSP_GetParameterData (IntPtr dsp, int index, out IntPtr data, out uint length, IntPtr valuestr, int valuestrlen); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_DSP_GetNumParameters (IntPtr dsp, out int numparams); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_DSP_GetParameterInfo (IntPtr dsp, int index, out DSP_PARAMETER_DESC desc); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_DSP_GetDataParameterIndex (IntPtr dsp, int datatype, out int index); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_DSP_ShowConfigDialog (IntPtr dsp, IntPtr hwnd, bool show); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_DSP_GetInfo (IntPtr dsp, IntPtr name, out uint version, out int channels, out int configwidth, out int configheight); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_DSP_GetType (IntPtr dsp, out DSP_TYPE type); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_DSP_GetIdle (IntPtr dsp, out bool idle); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_DSP_SetUserData (IntPtr dsp, IntPtr userdata); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_DSP_GetUserData (IntPtr dsp, out IntPtr userdata); + [DllImport(VERSION.dll)] + public static extern RESULT FMOD5_DSP_SetMeteringEnabled (IntPtr dsp, bool inputEnabled, bool outputEnabled); + [DllImport(VERSION.dll)] + public static extern RESULT FMOD5_DSP_GetMeteringEnabled (IntPtr dsp, out bool inputEnabled, out bool outputEnabled); + [DllImport(VERSION.dll)] + public static extern RESULT FMOD5_DSP_GetMeteringInfo (IntPtr dsp, IntPtr zero, out DSP_METERING_INFO outputInfo); + [DllImport(VERSION.dll)] + public static extern RESULT FMOD5_DSP_GetMeteringInfo (IntPtr dsp, out DSP_METERING_INFO inputInfo, IntPtr zero); + [DllImport(VERSION.dll)] + public static extern RESULT FMOD5_DSP_GetMeteringInfo (IntPtr dsp, out DSP_METERING_INFO inputInfo, out DSP_METERING_INFO outputInfo); + [DllImport(VERSION.dll)] + public static extern RESULT FMOD5_DSP_GetCPUUsage (IntPtr dsp, out uint exclusive, out uint inclusive); + #endregion + + #region wrapperinternal + + public IntPtr handle; + + public bool hasHandle() { return this.handle != IntPtr.Zero; } + public void clearHandle() { this.handle = IntPtr.Zero; } + + #endregion + } + + /* + 'DSPConnection' API + */ + public struct DSPConnection + { + public RESULT getInput(out DSP input) + { + return FMOD5_DSPConnection_GetInput(this.handle, out input.handle); + } + public RESULT getOutput(out DSP output) + { + return FMOD5_DSPConnection_GetOutput(this.handle, out output.handle); + } + public RESULT setMix(float volume) + { + return FMOD5_DSPConnection_SetMix(this.handle, volume); + } + public RESULT getMix(out float volume) + { + return FMOD5_DSPConnection_GetMix(this.handle, out volume); + } + public RESULT setMixMatrix(float[] matrix, int outchannels, int inchannels, int inchannel_hop = 0) + { + return FMOD5_DSPConnection_SetMixMatrix(this.handle, matrix, outchannels, inchannels, inchannel_hop); + } + public RESULT getMixMatrix(float[] matrix, out int outchannels, out int inchannels, int inchannel_hop = 0) + { + return FMOD5_DSPConnection_GetMixMatrix(this.handle, matrix, out outchannels, out inchannels, inchannel_hop); + } + public RESULT getType(out DSPCONNECTION_TYPE type) + { + return FMOD5_DSPConnection_GetType(this.handle, out type); + } + + // Userdata set/get. + public RESULT setUserData(IntPtr userdata) + { + return FMOD5_DSPConnection_SetUserData(this.handle, userdata); + } + public RESULT getUserData(out IntPtr userdata) + { + return FMOD5_DSPConnection_GetUserData(this.handle, out userdata); + } + + #region importfunctions + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_DSPConnection_GetInput (IntPtr dspconnection, out IntPtr input); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_DSPConnection_GetOutput (IntPtr dspconnection, out IntPtr output); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_DSPConnection_SetMix (IntPtr dspconnection, float volume); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_DSPConnection_GetMix (IntPtr dspconnection, out float volume); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_DSPConnection_SetMixMatrix (IntPtr dspconnection, float[] matrix, int outchannels, int inchannels, int inchannel_hop); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_DSPConnection_GetMixMatrix (IntPtr dspconnection, float[] matrix, out int outchannels, out int inchannels, int inchannel_hop); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_DSPConnection_GetType (IntPtr dspconnection, out DSPCONNECTION_TYPE type); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_DSPConnection_SetUserData (IntPtr dspconnection, IntPtr userdata); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_DSPConnection_GetUserData (IntPtr dspconnection, out IntPtr userdata); + #endregion + + #region wrapperinternal + + public IntPtr handle; + + public bool hasHandle() { return this.handle != IntPtr.Zero; } + public void clearHandle() { this.handle = IntPtr.Zero; } + + #endregion + } + + /* + 'Geometry' API + */ + public struct Geometry + { + public RESULT release() + { + return FMOD5_Geometry_Release(this.handle); + } + + // Polygon manipulation. + public RESULT addPolygon(float directocclusion, float reverbocclusion, bool doublesided, int numvertices, VECTOR[] vertices, out int polygonindex) + { + return FMOD5_Geometry_AddPolygon(this.handle, directocclusion, reverbocclusion, doublesided, numvertices, vertices, out polygonindex); + } + public RESULT getNumPolygons(out int numpolygons) + { + return FMOD5_Geometry_GetNumPolygons(this.handle, out numpolygons); + } + public RESULT getMaxPolygons(out int maxpolygons, out int maxvertices) + { + return FMOD5_Geometry_GetMaxPolygons(this.handle, out maxpolygons, out maxvertices); + } + public RESULT getPolygonNumVertices(int index, out int numvertices) + { + return FMOD5_Geometry_GetPolygonNumVertices(this.handle, index, out numvertices); + } + public RESULT setPolygonVertex(int index, int vertexindex, ref VECTOR vertex) + { + return FMOD5_Geometry_SetPolygonVertex(this.handle, index, vertexindex, ref vertex); + } + public RESULT getPolygonVertex(int index, int vertexindex, out VECTOR vertex) + { + return FMOD5_Geometry_GetPolygonVertex(this.handle, index, vertexindex, out vertex); + } + public RESULT setPolygonAttributes(int index, float directocclusion, float reverbocclusion, bool doublesided) + { + return FMOD5_Geometry_SetPolygonAttributes(this.handle, index, directocclusion, reverbocclusion, doublesided); + } + public RESULT getPolygonAttributes(int index, out float directocclusion, out float reverbocclusion, out bool doublesided) + { + return FMOD5_Geometry_GetPolygonAttributes(this.handle, index, out directocclusion, out reverbocclusion, out doublesided); + } + + // Object manipulation. + public RESULT setActive(bool active) + { + return FMOD5_Geometry_SetActive(this.handle, active); + } + public RESULT getActive(out bool active) + { + return FMOD5_Geometry_GetActive(this.handle, out active); + } + public RESULT setRotation(ref VECTOR forward, ref VECTOR up) + { + return FMOD5_Geometry_SetRotation(this.handle, ref forward, ref up); + } + public RESULT getRotation(out VECTOR forward, out VECTOR up) + { + return FMOD5_Geometry_GetRotation(this.handle, out forward, out up); + } + public RESULT setPosition(ref VECTOR position) + { + return FMOD5_Geometry_SetPosition(this.handle, ref position); + } + public RESULT getPosition(out VECTOR position) + { + return FMOD5_Geometry_GetPosition(this.handle, out position); + } + public RESULT setScale(ref VECTOR scale) + { + return FMOD5_Geometry_SetScale(this.handle, ref scale); + } + public RESULT getScale(out VECTOR scale) + { + return FMOD5_Geometry_GetScale(this.handle, out scale); + } + public RESULT save(IntPtr data, out int datasize) + { + return FMOD5_Geometry_Save(this.handle, data, out datasize); + } + + // Userdata set/get. + public RESULT setUserData(IntPtr userdata) + { + return FMOD5_Geometry_SetUserData(this.handle, userdata); + } + public RESULT getUserData(out IntPtr userdata) + { + return FMOD5_Geometry_GetUserData(this.handle, out userdata); + } + + #region importfunctions + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Geometry_Release (IntPtr geometry); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Geometry_AddPolygon (IntPtr geometry, float directocclusion, float reverbocclusion, bool doublesided, int numvertices, VECTOR[] vertices, out int polygonindex); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Geometry_GetNumPolygons (IntPtr geometry, out int numpolygons); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Geometry_GetMaxPolygons (IntPtr geometry, out int maxpolygons, out int maxvertices); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Geometry_GetPolygonNumVertices(IntPtr geometry, int index, out int numvertices); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Geometry_SetPolygonVertex (IntPtr geometry, int index, int vertexindex, ref VECTOR vertex); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Geometry_GetPolygonVertex (IntPtr geometry, int index, int vertexindex, out VECTOR vertex); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Geometry_SetPolygonAttributes (IntPtr geometry, int index, float directocclusion, float reverbocclusion, bool doublesided); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Geometry_GetPolygonAttributes (IntPtr geometry, int index, out float directocclusion, out float reverbocclusion, out bool doublesided); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Geometry_SetActive (IntPtr geometry, bool active); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Geometry_GetActive (IntPtr geometry, out bool active); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Geometry_SetRotation (IntPtr geometry, ref VECTOR forward, ref VECTOR up); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Geometry_GetRotation (IntPtr geometry, out VECTOR forward, out VECTOR up); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Geometry_SetPosition (IntPtr geometry, ref VECTOR position); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Geometry_GetPosition (IntPtr geometry, out VECTOR position); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Geometry_SetScale (IntPtr geometry, ref VECTOR scale); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Geometry_GetScale (IntPtr geometry, out VECTOR scale); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Geometry_Save (IntPtr geometry, IntPtr data, out int datasize); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Geometry_SetUserData (IntPtr geometry, IntPtr userdata); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Geometry_GetUserData (IntPtr geometry, out IntPtr userdata); + #endregion + + #region wrapperinternal + + public IntPtr handle; + + public bool hasHandle() { return this.handle != IntPtr.Zero; } + public void clearHandle() { this.handle = IntPtr.Zero; } + + #endregion + } + + /* + 'Reverb3D' API + */ + public struct Reverb3D + { + public RESULT release() + { + return FMOD5_Reverb3D_Release(this.handle); + } + + // Reverb manipulation. + public RESULT set3DAttributes(ref VECTOR position, float mindistance, float maxdistance) + { + return FMOD5_Reverb3D_Set3DAttributes(this.handle, ref position, mindistance, maxdistance); + } + public RESULT get3DAttributes(ref VECTOR position, ref float mindistance, ref float maxdistance) + { + return FMOD5_Reverb3D_Get3DAttributes(this.handle, ref position, ref mindistance, ref maxdistance); + } + public RESULT setProperties(ref REVERB_PROPERTIES properties) + { + return FMOD5_Reverb3D_SetProperties(this.handle, ref properties); + } + public RESULT getProperties(ref REVERB_PROPERTIES properties) + { + return FMOD5_Reverb3D_GetProperties(this.handle, ref properties); + } + public RESULT setActive(bool active) + { + return FMOD5_Reverb3D_SetActive(this.handle, active); + } + public RESULT getActive(out bool active) + { + return FMOD5_Reverb3D_GetActive(this.handle, out active); + } + + // Userdata set/get. + public RESULT setUserData(IntPtr userdata) + { + return FMOD5_Reverb3D_SetUserData(this.handle, userdata); + } + public RESULT getUserData(out IntPtr userdata) + { + return FMOD5_Reverb3D_GetUserData(this.handle, out userdata); + } + + #region importfunctions + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Reverb3D_Release (IntPtr reverb3d); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Reverb3D_Set3DAttributes (IntPtr reverb3d, ref VECTOR position, float mindistance, float maxdistance); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Reverb3D_Get3DAttributes (IntPtr reverb3d, ref VECTOR position, ref float mindistance, ref float maxdistance); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Reverb3D_SetProperties (IntPtr reverb3d, ref REVERB_PROPERTIES properties); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Reverb3D_GetProperties (IntPtr reverb3d, ref REVERB_PROPERTIES properties); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Reverb3D_SetActive (IntPtr reverb3d, bool active); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Reverb3D_GetActive (IntPtr reverb3d, out bool active); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Reverb3D_SetUserData (IntPtr reverb3d, IntPtr userdata); + [DllImport(VERSION.dll)] + private static extern RESULT FMOD5_Reverb3D_GetUserData (IntPtr reverb3d, out IntPtr userdata); + #endregion + + #region wrapperinternal + + public IntPtr handle; + + public bool hasHandle() { return this.handle != IntPtr.Zero; } + public void clearHandle() { this.handle = IntPtr.Zero; } + + #endregion + } + + #region String Helper Functions + [StructLayout(LayoutKind.Sequential)] + public struct StringWrapper + { + IntPtr nativeUtf8Ptr; + + public static implicit operator string(StringWrapper fstring) + { + using (StringHelper.ThreadSafeEncoding encoder = StringHelper.GetFreeHelper()) + { + return encoder.stringFromNative(fstring.nativeUtf8Ptr); + } + } + } + + static class StringHelper + { + public class ThreadSafeEncoding : IDisposable + { + UTF8Encoding encoding = new UTF8Encoding(); + byte[] encodedBuffer = new byte[128]; + char[] decodedBuffer = new char[128]; + bool inUse; + + public bool InUse() { return inUse; } + public void SetInUse() { inUse = true; } + + private int roundUpPowerTwo(int number) + { + int newNumber = 1; + while (newNumber <= number) + { + newNumber *= 2; + } + + return newNumber; + } + + public byte[] byteFromStringUTF8(string s) + { + if (s == null) + { + return null; + } + + int maximumLength = encoding.GetMaxByteCount(s.Length) + 1; // +1 for null terminator + if (maximumLength > encodedBuffer.Length) + { + int encodedLength = encoding.GetByteCount(s) + 1; // +1 for null terminator + if (encodedLength > encodedBuffer.Length) + { + encodedBuffer = new byte[roundUpPowerTwo(encodedLength)]; + } + } + + int byteCount = encoding.GetBytes(s, 0, s.Length, encodedBuffer, 0); + encodedBuffer[byteCount] = 0; // Apply null terminator + + return encodedBuffer; + } + + public string stringFromNative(IntPtr nativePtr) + { + if (nativePtr == IntPtr.Zero) + { + return ""; + } + + int nativeLen = 0; + while (Marshal.ReadByte(nativePtr, nativeLen) != 0) + { + nativeLen++; + } + + if (nativeLen == 0) + { + return ""; + } + + if (nativeLen > encodedBuffer.Length) + { + encodedBuffer = new byte[roundUpPowerTwo(nativeLen)]; + } + + Marshal.Copy(nativePtr, encodedBuffer, 0, nativeLen); + + int maximumLength = encoding.GetMaxCharCount(nativeLen); + if (maximumLength > decodedBuffer.Length) + { + int decodedLength = encoding.GetCharCount(encodedBuffer, 0, nativeLen); + if (decodedLength > decodedBuffer.Length) + { + decodedBuffer = new char[roundUpPowerTwo(decodedLength)]; + } + } + + int charCount = encoding.GetChars(encodedBuffer, 0, nativeLen, decodedBuffer, 0); + + return new String(decodedBuffer, 0, charCount); + } + + public void Dispose() + { + lock (encoders) + { + inUse = false; + } + } + } + + static List encoders = new List(1); + + public static ThreadSafeEncoding GetFreeHelper() + { + lock (encoders) + { + ThreadSafeEncoding helper = null; + // Search for not in use helper + for (int i = 0; i < encoders.Count; i++) + { + if (!encoders[i].InUse()) + { + helper = encoders[i]; + break; + } + } + // Otherwise create another helper + if (helper == null) + { + helper = new ThreadSafeEncoding(); + encoders.Add(helper); + } + helper.SetInUse(); + return helper; + } + } + } + + #endregion +} diff --git a/Assets/Plugins/FMOD/src/Runtime/wrapper/fmod.cs.meta b/Assets/Plugins/FMOD/src/Runtime/wrapper/fmod.cs.meta new file mode 100755 index 0000000..07641e1 --- /dev/null +++ b/Assets/Plugins/FMOD/src/Runtime/wrapper/fmod.cs.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: bd0d0c955caff8940ac1667ee36dd4c9 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/src/Runtime/wrapper/fmod_dsp.cs b/Assets/Plugins/FMOD/src/Runtime/wrapper/fmod_dsp.cs new file mode 100755 index 0000000..4d102a6 --- /dev/null +++ b/Assets/Plugins/FMOD/src/Runtime/wrapper/fmod_dsp.cs @@ -0,0 +1,798 @@ +/* ======================================================================================== */ +/* FMOD Core API - DSP header file. */ +/* Copyright (c), Firelight Technologies Pty, Ltd. 2004-2019. */ +/* */ +/* Use this header if you are wanting to develop your own DSP plugin to use with FMODs */ +/* dsp system. With this header you can make your own DSP plugin that FMOD can */ +/* register and use. See the documentation and examples on how to make a working plugin. */ +/* */ +/* For more detail visit: */ +/* https://fmod.com/resources/documentation-api?version=2.0&page=plugin-api-dsp.html */ +/* =========================================================================================*/ + +using System; +using System.Text; +using System.Runtime.InteropServices; + +namespace FMOD +{ + [StructLayout(LayoutKind.Sequential)] + public struct DSP_BUFFER_ARRAY + { + public int numbuffers; /* [r/w] number of buffers */ + public int[] buffernumchannels; /* [r/w] array of number of channels for each buffer */ + public CHANNELMASK[] bufferchannelmask; /* [r/w] array of channel masks for each buffer */ + public IntPtr[] buffers; /* [r/w] array of buffers */ + public SPEAKERMODE speakermode; /* [r/w] speaker mode for all buffers in the array */ + } + + public enum DSP_PROCESS_OPERATION + { + PROCESS_PERFORM = 0, /* Process the incoming audio in 'inbufferarray' and output to 'outbufferarray'. */ + PROCESS_QUERY /* The DSP is being queried for the expected output format and whether it needs to process audio or should be bypassed. The function should return any value other than FMOD_OK if audio can pass through unprocessed. If audio is to be processed, 'outbufferarray' must be filled with the expected output format, channel count and mask. */ + } + + [StructLayout(LayoutKind.Sequential)] + public struct COMPLEX + { + public float real; /* Real component */ + public float imag; /* Imaginary component */ + } + + public enum DSP_PAN_SURROUND_FLAGS + { + DEFAULT = 0, + ROTATION_NOT_BIASED = 1, + } + + + /* + DSP callbacks + */ + public delegate RESULT DSP_CREATECALLBACK (ref DSP_STATE dsp_state); + public delegate RESULT DSP_RELEASECALLBACK (ref DSP_STATE dsp_state); + public delegate RESULT DSP_RESETCALLBACK (ref DSP_STATE dsp_state); + public delegate RESULT DSP_SETPOSITIONCALLBACK (ref DSP_STATE dsp_state, uint pos); + public delegate RESULT DSP_READCALLBACK (ref DSP_STATE dsp_state, IntPtr inbuffer, IntPtr outbuffer, uint length, int inchannels, ref int outchannels); + public delegate RESULT DSP_SHOULDIPROCESS_CALLBACK (ref DSP_STATE dsp_state, bool inputsidle, uint length, CHANNELMASK inmask, int inchannels, SPEAKERMODE speakermode); + public delegate RESULT DSP_PROCESS_CALLBACK (ref DSP_STATE dsp_state, uint length, ref DSP_BUFFER_ARRAY inbufferarray, ref DSP_BUFFER_ARRAY outbufferarray, bool inputsidle, DSP_PROCESS_OPERATION op); + public delegate RESULT DSP_SETPARAM_FLOAT_CALLBACK (ref DSP_STATE dsp_state, int index, float value); + public delegate RESULT DSP_SETPARAM_INT_CALLBACK (ref DSP_STATE dsp_state, int index, int value); + public delegate RESULT DSP_SETPARAM_BOOL_CALLBACK (ref DSP_STATE dsp_state, int index, bool value); + public delegate RESULT DSP_SETPARAM_DATA_CALLBACK (ref DSP_STATE dsp_state, int index, IntPtr data, uint length); + public delegate RESULT DSP_GETPARAM_FLOAT_CALLBACK (ref DSP_STATE dsp_state, int index, ref float value, IntPtr valuestr); + public delegate RESULT DSP_GETPARAM_INT_CALLBACK (ref DSP_STATE dsp_state, int index, ref int value, IntPtr valuestr); + public delegate RESULT DSP_GETPARAM_BOOL_CALLBACK (ref DSP_STATE dsp_state, int index, ref bool value, IntPtr valuestr); + public delegate RESULT DSP_GETPARAM_DATA_CALLBACK (ref DSP_STATE dsp_state, int index, ref IntPtr data, ref uint length, IntPtr valuestr); + public delegate RESULT DSP_SYSTEM_REGISTER_CALLBACK (ref DSP_STATE dsp_state); + public delegate RESULT DSP_SYSTEM_DEREGISTER_CALLBACK (ref DSP_STATE dsp_state); + public delegate RESULT DSP_SYSTEM_MIX_CALLBACK (ref DSP_STATE dsp_state, int stage); + + + /* + DSP functions + */ + public delegate IntPtr DSP_ALLOC_FUNC (uint size, MEMORY_TYPE type, StringWrapper sourcestr); + public delegate IntPtr DSP_REALLOC_FUNC (IntPtr ptr, uint size, MEMORY_TYPE type, StringWrapper sourcestr); + public delegate void DSP_FREE_FUNC (IntPtr ptr, MEMORY_TYPE type, StringWrapper sourcestr); + public delegate void DSP_LOG_FUNC (DEBUG_FLAGS level, StringWrapper file, int line, StringWrapper function, StringWrapper format); + public delegate RESULT DSP_GETSAMPLERATE_FUNC (ref DSP_STATE dsp_state, ref int rate); + public delegate RESULT DSP_GETBLOCKSIZE_FUNC (ref DSP_STATE dsp_state, ref uint blocksize); + public delegate RESULT DSP_GETSPEAKERMODE_FUNC (ref DSP_STATE dsp_state, ref int speakermode_mixer, ref int speakermode_output); + public delegate RESULT DSP_GETCLOCK_FUNC (ref DSP_STATE dsp_state, out ulong clock, out uint offset, out uint length); + public delegate RESULT DSP_GETLISTENERATTRIBUTES_FUNC (ref DSP_STATE dsp_state, ref int numlisteners, IntPtr attributes); + public delegate RESULT DSP_GETUSERDATA_FUNC (ref DSP_STATE dsp_state, out IntPtr userdata); + public delegate RESULT DSP_DFT_FFTREAL_FUNC (ref DSP_STATE dsp_state, int size, IntPtr signal, IntPtr dft, IntPtr window, int signalhop); + public delegate RESULT DSP_DFT_IFFTREAL_FUNC (ref DSP_STATE dsp_state, int size, IntPtr dft, IntPtr signal, IntPtr window, int signalhop); + public delegate RESULT DSP_PAN_SUMMONOMATRIX_FUNC (ref DSP_STATE dsp_state, int sourceSpeakerMode, float lowFrequencyGain, float overallGain, IntPtr matrix); + public delegate RESULT DSP_PAN_SUMSTEREOMATRIX_FUNC (ref DSP_STATE dsp_state, int sourceSpeakerMode, float pan, float lowFrequencyGain, float overallGain, int matrixHop, IntPtr matrix); + public delegate RESULT DSP_PAN_SUMSURROUNDMATRIX_FUNC (ref DSP_STATE dsp_state, int sourceSpeakerMode, int targetSpeakerMode, float direction, float extent, float rotation, float lowFrequencyGain, float overallGain, int matrixHop, IntPtr matrix, DSP_PAN_SURROUND_FLAGS flags); + public delegate RESULT DSP_PAN_SUMMONOTOSURROUNDMATRIX_FUNC (ref DSP_STATE dsp_state, int targetSpeakerMode, float direction, float extent, float lowFrequencyGain, float overallGain, int matrixHop, IntPtr matrix); + public delegate RESULT DSP_PAN_SUMSTEREOTOSURROUNDMATRIX_FUNC (ref DSP_STATE dsp_state, int targetSpeakerMode, float direction, float extent, float rotation, float lowFrequencyGain, float overallGain, int matrixHop, IntPtr matrix); + public delegate RESULT DSP_PAN_GETROLLOFFGAIN_FUNC (ref DSP_STATE dsp_state, DSP_PAN_3D_ROLLOFF_TYPE rolloff, float distance, float mindistance, float maxdistance, out float gain); + + + public enum DSP_TYPE : int + { + UNKNOWN, /* This unit was created via a non FMOD plugin so has an unknown purpose. */ + MIXER, /* This unit does nothing but take inputs and mix them together then feed the result to the soundcard unit. */ + OSCILLATOR, /* This unit generates sine/square/saw/triangle or noise tones. */ + LOWPASS, /* This unit filters sound using a high quality, resonant lowpass filter algorithm but consumes more CPU time. */ + ITLOWPASS, /* This unit filters sound using a resonant lowpass filter algorithm that is used in Impulse Tracker, but with limited cutoff range (0 to 8060hz). */ + HIGHPASS, /* This unit filters sound using a resonant highpass filter algorithm. */ + ECHO, /* This unit produces an echo on the sound and fades out at the desired rate. */ + FADER, /* This unit pans and scales the volume of a unit. */ + FLANGE, /* This unit produces a flange effect on the sound. */ + DISTORTION, /* This unit distorts the sound. */ + NORMALIZE, /* This unit normalizes or amplifies the sound to a certain level. */ + LIMITER, /* This unit limits the sound to a certain level. */ + PARAMEQ, /* This unit attenuates or amplifies a selected frequency range. */ + PITCHSHIFT, /* This unit bends the pitch of a sound without changing the speed of playback. */ + CHORUS, /* This unit produces a chorus effect on the sound. */ + VSTPLUGIN, /* This unit allows the use of Steinberg VST plugins */ + WINAMPPLUGIN, /* This unit allows the use of Nullsoft Winamp plugins */ + ITECHO, /* This unit produces an echo on the sound and fades out at the desired rate as is used in Impulse Tracker. */ + COMPRESSOR, /* This unit implements dynamic compression (linked multichannel, wideband) */ + SFXREVERB, /* This unit implements SFX reverb */ + LOWPASS_SIMPLE, /* This unit filters sound using a simple lowpass with no resonance, but has flexible cutoff and is fast. */ + DELAY, /* This unit produces different delays on individual channels of the sound. */ + TREMOLO, /* This unit produces a tremolo / chopper effect on the sound. */ + LADSPAPLUGIN, /* This unit allows the use of LADSPA standard plugins. */ + SEND, /* This unit sends a copy of the signal to a return DSP anywhere in the DSP tree. */ + RETURN, /* This unit receives signals from a number of send DSPs. */ + HIGHPASS_SIMPLE, /* This unit filters sound using a simple highpass with no resonance, but has flexible cutoff and is fast. */ + PAN, /* This unit pans the signal, possibly upmixing or downmixing as well. */ + THREE_EQ, /* This unit is a three-band equalizer. */ + FFT, /* This unit simply analyzes the signal and provides spectrum information back through getParameter. */ + LOUDNESS_METER, /* This unit analyzes the loudness and true peak of the signal. */ + ENVELOPEFOLLOWER, /* This unit tracks the envelope of the input/sidechain signal. Deprecated and will be removed in a future release. */ + CONVOLUTIONREVERB, /* This unit implements convolution reverb. */ + CHANNELMIX, /* This unit provides per signal channel gain, and output channel mapping to allow 1 multichannel signal made up of many groups of signals to map to a single output signal. */ + TRANSCEIVER, /* This unit 'sends' and 'receives' from a selection of up to 32 different slots. It is like a send/return but it uses global slots rather than returns as the destination. It also has other features. Multiple transceivers can receive from a single channel, or multiple transceivers can send to a single channel, or a combination of both. */ + OBJECTPAN, /* This unit sends the signal to a 3d object encoder like Dolby Atmos. */ + MULTIBAND_EQ, /* This unit is a flexible five band parametric equalizer. */ + MAX + } + + public enum DSP_PARAMETER_TYPE + { + FLOAT = 0, + INT, + BOOL, + DATA, + MAX + } + + public enum DSP_PARAMETER_FLOAT_MAPPING_TYPE + { + DSP_PARAMETER_FLOAT_MAPPING_TYPE_LINEAR = 0, /* Values mapped linearly across range. */ + DSP_PARAMETER_FLOAT_MAPPING_TYPE_AUTO, /* A mapping is automatically chosen based on range and units. See remarks. */ + DSP_PARAMETER_FLOAT_MAPPING_TYPE_PIECEWISE_LINEAR, /* Values mapped in a piecewise linear fashion defined by FMOD_DSP_PARAMETER_DESC_FLOAT::mapping.piecewiselinearmapping. */ + } + + [StructLayout(LayoutKind.Sequential)] + public struct DSP_PARAMETER_FLOAT_MAPPING_PIECEWISE_LINEAR + { + public int numpoints; /* [w] The number of pairs in the piecewise mapping (at least 2). */ + public IntPtr pointparamvalues; /* [w] The values in the parameter's units for each point */ + public IntPtr pointpositions; /* [w] The positions along the control's scale (e.g. dial angle) corresponding to each parameter value. The range of this scale is arbitrary and all positions will be relative to the minimum and maximum values (e.g. [0,1,3] is equivalent to [1,2,4] and [2,4,8]). If this array is zero, pointparamvalues will be distributed with equal spacing. */ + } + + [StructLayout(LayoutKind.Sequential)] + public struct DSP_PARAMETER_FLOAT_MAPPING + { + public DSP_PARAMETER_FLOAT_MAPPING_TYPE type; + public DSP_PARAMETER_FLOAT_MAPPING_PIECEWISE_LINEAR piecewiselinearmapping; /* [w] Only required for FMOD_DSP_PARAMETER_FLOAT_MAPPING_TYPE_PIECEWISE_LINEAR type mapping. */ + } + + + [StructLayout(LayoutKind.Sequential)] + public struct DSP_PARAMETER_DESC_FLOAT + { + public float min; /* [w] Minimum parameter value. */ + public float max; /* [w] Maximum parameter value. */ + public float defaultval; /* [w] Default parameter value. */ + public DSP_PARAMETER_FLOAT_MAPPING mapping; /* [w] How the values are distributed across dials and automation curves (e.g. linearly, exponentially etc). */ + } + + [StructLayout(LayoutKind.Sequential)] + public struct DSP_PARAMETER_DESC_INT + { + public int min; /* [w] Minimum parameter value. */ + public int max; /* [w] Maximum parameter value. */ + public int defaultval; /* [w] Default parameter value. */ + public bool goestoinf; /* [w] Whether the last value represents infiniy. */ + public IntPtr valuenames; /* [w] Names for each value. There should be as many strings as there are possible values (max - min + 1). Optional. */ + } + + [StructLayout(LayoutKind.Sequential)] + public struct DSP_PARAMETER_DESC_BOOL + { + public bool defaultval; /* [w] Default parameter value. */ + public IntPtr valuenames; /* [w] Names for false and true, respectively. There should be two strings. Optional. */ + } + + [StructLayout(LayoutKind.Sequential)] + public struct DSP_PARAMETER_DESC_DATA + { + public int datatype; /* [w] The type of data for this parameter. Use 0 or above for custom types or set to one of the FMOD_DSP_PARAMETER_DATA_TYPE values. */ + } + + [StructLayout(LayoutKind.Explicit)] + public struct DSP_PARAMETER_DESC_UNION + { + [FieldOffset(0)] + public DSP_PARAMETER_DESC_FLOAT floatdesc; /* [w] Struct containing information about the parameter in floating point format. Use when type is FMOD_DSP_PARAMETER_TYPE_FLOAT. */ + [FieldOffset(0)] + public DSP_PARAMETER_DESC_INT intdesc; /* [w] Struct containing information about the parameter in integer format. Use when type is FMOD_DSP_PARAMETER_TYPE_INT. */ + [FieldOffset(0)] + public DSP_PARAMETER_DESC_BOOL booldesc; /* [w] Struct containing information about the parameter in boolean format. Use when type is FMOD_DSP_PARAMETER_TYPE_BOOL. */ + [FieldOffset(0)] + public DSP_PARAMETER_DESC_DATA datadesc; /* [w] Struct containing information about the parameter in data format. Use when type is FMOD_DSP_PARAMETER_TYPE_DATA. */ + } + + [StructLayout(LayoutKind.Sequential)] + public struct DSP_PARAMETER_DESC + { + public DSP_PARAMETER_TYPE type; /* [w] Type of this parameter. */ + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] + public char[] name; /* [w] Name of the parameter to be displayed (ie "Cutoff frequency"). */ + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] + public char[] label; /* [w] Short string to be put next to value to denote the unit type (ie "hz"). */ + public string description; /* [w] Description of the parameter to be displayed as a help item / tooltip for this parameter. */ + + public DSP_PARAMETER_DESC_UNION desc; + } + + public enum DSP_PARAMETER_DATA_TYPE + { + DSP_PARAMETER_DATA_TYPE_USER = 0, /* The default data type. All user data types should be 0 or above. */ + DSP_PARAMETER_DATA_TYPE_OVERALLGAIN = -1, /* The data type for FMOD_DSP_PARAMETER_OVERALLGAIN parameters. There should a maximum of one per DSP. */ + DSP_PARAMETER_DATA_TYPE_3DATTRIBUTES = -2, /* The data type for FMOD_DSP_PARAMETER_3DATTRIBUTES parameters. There should a maximum of one per DSP. */ + DSP_PARAMETER_DATA_TYPE_SIDECHAIN = -3, /* The data type for FMOD_DSP_PARAMETER_SIDECHAIN parameters. There should a maximum of one per DSP. */ + DSP_PARAMETER_DATA_TYPE_FFT = -4, /* The data type for FMOD_DSP_PARAMETER_FFT parameters. There should a maximum of one per DSP. */ + DSP_PARAMETER_DATA_TYPE_3DATTRIBUTES_MULTI = -5 /* The data type for FMOD_DSP_PARAMETER_3DATTRIBUTES_MULTI parameters. There should a maximum of one per DSP. */ + } + + [StructLayout(LayoutKind.Sequential)] + public struct DSP_PARAMETER_OVERALLGAIN + { + public float linear_gain; /* [r] The overall linear gain of the effect on the direct signal path */ + public float linear_gain_additive; /* [r] Additive gain, for parallel signal paths */ + } + + [StructLayout(LayoutKind.Sequential)] + public struct DSP_PARAMETER_3DATTRIBUTES + { + public ATTRIBUTES_3D relative; /* [w] The position of the sound relative to the listener. */ + public ATTRIBUTES_3D absolute; /* [w] The position of the sound in world coordinates. */ + } + + [StructLayout(LayoutKind.Sequential)] + public struct DSP_PARAMETER_3DATTRIBUTES_MULTI + { + public int numlisteners; /* [w] The number of listeners. */ + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] + public ATTRIBUTES_3D[] relative; /* [w] The position of the sound relative to the listeners. */ + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] + public float[] weight; /* [w] The weighting of the listeners where 0 means listener has no contribution and 1 means full contribution. */ + public ATTRIBUTES_3D absolute; /* [w] The position of the sound in world coordinates. */ + } + + [StructLayout(LayoutKind.Sequential)] + public struct DSP_PARAMETER_SIDECHAIN + { + public int sidechainenable; /* [r/w] Whether sidechains are enabled. */ + } + + [StructLayout(LayoutKind.Sequential)] + public struct DSP_PARAMETER_FFT + { + public int length; /* [r] Number of entries in this spectrum window. Divide this by the output rate to get the hz per entry. */ + public int numchannels; /* [r] Number of channels in spectrum. */ + + [MarshalAs(UnmanagedType.ByValArray,SizeConst=32)] + private IntPtr[] spectrum_internal; /* [r] Per channel spectrum arrays. See remarks for more. */ + + public float[][] spectrum + { + get + { + var buffer = new float[numchannels][]; + + for (int i = 0; i < numchannels; ++i) + { + buffer[i] = new float[length]; + Marshal.Copy(spectrum_internal[i], buffer[i], 0, length); + } + + return buffer; + } + } + } + + [StructLayout(LayoutKind.Sequential)] + public struct DSP_DESCRIPTION + { + public uint pluginsdkversion; /* [w] The plugin SDK version this plugin is built for. set to this to FMOD_PLUGIN_SDK_VERSION defined above. */ + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public char[] name; /* [w] Name of the unit to be displayed in the network. */ + public uint version; /* [w] Plugin writer's version number. */ + public int numinputbuffers; /* [w] Number of input buffers to process. Use 0 for DSPs that only generate sound and 1 for effects that process incoming sound. */ + public int numoutputbuffers; /* [w] Number of audio output buffers. Only one output buffer is currently supported. */ + public DSP_CREATECALLBACK create; /* [w] Create callback. This is called when DSP unit is created. Can be null. */ + public DSP_RELEASECALLBACK release; /* [w] Release callback. This is called just before the unit is freed so the user can do any cleanup needed for the unit. Can be null. */ + public DSP_RESETCALLBACK reset; /* [w] Reset callback. This is called by the user to reset any history buffers that may need resetting for a filter, when it is to be used or re-used for the first time to its initial clean state. Use to avoid clicks or artifacts. */ + public DSP_READCALLBACK read; /* [w] Read callback. Processing is done here. Can be null. */ + public DSP_PROCESS_CALLBACK process; /* [w] Process callback. Can be specified instead of the read callback if any channel format changes occur between input and output. This also replaces shouldiprocess and should return an error if the effect is to be bypassed. Can be null. */ + public DSP_SETPOSITIONCALLBACK setposition; /* [w] Setposition callback. This is called if the unit wants to update its position info but not process data. Can be null. */ + + public int numparameters; /* [w] Number of parameters used in this filter. The user finds this with DSP::getNumParameters */ + public IntPtr paramdesc; /* [w] Variable number of parameter structures. */ + public DSP_SETPARAM_FLOAT_CALLBACK setparameterfloat; /* [w] This is called when the user calls DSP.setParameterFloat. Can be null. */ + public DSP_SETPARAM_INT_CALLBACK setparameterint; /* [w] This is called when the user calls DSP.setParameterInt. Can be null. */ + public DSP_SETPARAM_BOOL_CALLBACK setparameterbool; /* [w] This is called when the user calls DSP.setParameterBool. Can be null. */ + public DSP_SETPARAM_DATA_CALLBACK setparameterdata; /* [w] This is called when the user calls DSP.setParameterData. Can be null. */ + public DSP_GETPARAM_FLOAT_CALLBACK getparameterfloat; /* [w] This is called when the user calls DSP.getParameterFloat. Can be null. */ + public DSP_GETPARAM_INT_CALLBACK getparameterint; /* [w] This is called when the user calls DSP.getParameterInt. Can be null. */ + public DSP_GETPARAM_BOOL_CALLBACK getparameterbool; /* [w] This is called when the user calls DSP.getParameterBool. Can be null. */ + public DSP_GETPARAM_DATA_CALLBACK getparameterdata; /* [w] This is called when the user calls DSP.getParameterData. Can be null. */ + public DSP_SHOULDIPROCESS_CALLBACK shouldiprocess; /* [w] This is called before processing. You can detect if inputs are idle and return FMOD_OK to process, or any other error code to avoid processing the effect. Use a count down timer to allow effect tails to process before idling! */ + public IntPtr userdata; /* [w] Optional. Specify 0 to ignore. This is user data to be attached to the DSP unit during creation. Access via FMOD_DSP_STATE_FUNCTIONS::getuserdata. */ + + public DSP_SYSTEM_REGISTER_CALLBACK sys_register; /* [w] Register callback. This is called when DSP unit is loaded/registered. Useful for 'global'/per system object init for plugin. Can be null. */ + public DSP_SYSTEM_DEREGISTER_CALLBACK sys_deregister; /* [w] Deregister callback. This is called when DSP unit is unloaded/deregistered. Useful as 'global'/per system object shutdown for plugin. Can be null. */ + public DSP_SYSTEM_MIX_CALLBACK sys_mix; /* [w] System mix stage callback. This is called when the mixer starts to execute or is just finishing executing. Useful for 'global'/per system object once a mix update calls for a plugin. Can be null. */ + } + + [StructLayout(LayoutKind.Sequential)] + public struct DSP_STATE_DFT_FUNCTIONS + { + public DSP_DFT_FFTREAL_FUNC fftreal; /* [r] Function for performing an FFT on a real signal. */ + public DSP_DFT_IFFTREAL_FUNC inversefftreal; /* [r] Function for performing an inverse FFT to get a real signal. */ + } + + [StructLayout(LayoutKind.Sequential)] + public struct DSP_STATE_PAN_FUNCTIONS + { + public DSP_PAN_SUMMONOMATRIX_FUNC summonomatrix; /* [r] TBD. */ + public DSP_PAN_SUMSTEREOMATRIX_FUNC sumstereomatrix; /* [r] TBD. */ + public DSP_PAN_SUMSURROUNDMATRIX_FUNC sumsurroundmatrix; /* [r] TBD. */ + public DSP_PAN_SUMMONOTOSURROUNDMATRIX_FUNC summonotosurroundmatrix; /* [r] TBD. */ + public DSP_PAN_SUMSTEREOTOSURROUNDMATRIX_FUNC sumstereotosurroundmatrix; /* [r] TBD. */ + public DSP_PAN_GETROLLOFFGAIN_FUNC getrolloffgain; /* [r] TBD. */ + } + + [StructLayout(LayoutKind.Sequential)] + public struct DSP_STATE_FUNCTIONS + { + DSP_ALLOC_FUNC alloc; /* [r] Memory allocation callback. Use this for all dynamic memory allocation within the plugin. */ + DSP_REALLOC_FUNC realloc; /* [r] Memory reallocation callback. */ + DSP_FREE_FUNC free; /* [r] Memory free callback. */ + DSP_GETSAMPLERATE_FUNC getsamplerate; /* [r] Callback for getting the system samplerate. */ + DSP_GETBLOCKSIZE_FUNC getblocksize; /* [r] Callback for getting the system's block size. DSPs will be requested to process blocks of varying length up to this size.*/ + IntPtr dft; /* [r] Struct containing callbacks for performing FFTs and inverse FFTs. */ + IntPtr pan; /* [r] Pointer to a structure of callbacks for calculating pan, up-mix and down-mix matrices. */ + DSP_GETSPEAKERMODE_FUNC getspeakermode; /* [r] Callback for getting the system's speaker modes. One is the mixer's default speaker mode, the other is the output mode the system is downmixing or upmixing to.*/ + DSP_GETCLOCK_FUNC getclock; /* [r] Callback for getting the clock of the current DSP, as well as the subset of the input buffer that contains the signal */ + DSP_GETLISTENERATTRIBUTES_FUNC getlistenerattributes; /* [r] Callback for getting the absolute listener attributes set via the API (returned as left-handed co-ordinates). */ + DSP_LOG_FUNC log; /* [r] Function to write to the FMOD logging system. */ + DSP_GETUSERDATA_FUNC getuserdata; /* [r] Function to get the user data attached to this DSP. See FMOD_DSP_DESCRIPTION::userdata. */ + } + + [StructLayout(LayoutKind.Sequential)] + public struct DSP_STATE + { + public IntPtr instance; /* [r] Handle to the DSP hand the user created. Not to be modified. C++ users cast to FMOD::DSP to use. */ + public IntPtr plugindata; /* [r/w] Plugin writer created data the output author wants to attach to this object. */ + public uint channelmask; /* [r] Specifies which speakers the DSP effect is active on */ + public int source_speakermode; /* [r] Specifies which speaker mode the signal originated for information purposes, ie in case panning needs to be done differently. */ + public IntPtr sidechaindata; /* [r] The mixed result of all incoming sidechains is stored at this pointer address. */ + public int sidechainchannels; /* [r] The number of channels of pcm data stored within the sidechain buffer. */ + public IntPtr functions; /* [r] Struct containing callbacks for system level functionality. */ + public int systemobject; /* [r] FMOD::System object index, relating to the System object that created this DSP. */ + } + + [StructLayout(LayoutKind.Sequential)] + public struct DSP_METERING_INFO + { + public int numsamples; /* [r] The number of samples considered for this metering info. */ + [MarshalAs(UnmanagedType.ByValArray, SizeConst=32)] + public float[] peaklevel; /* [r] The peak level per channel. */ + [MarshalAs(UnmanagedType.ByValArray, SizeConst=32)] + public float[] rmslevel; /* [r] The rms level per channel. */ + public short numchannels; /* [r] Number of channels. */ + } + + /* + ============================================================================================================== + + FMOD built in effect parameters. + Use DSP::setParameter with these enums for the 'index' parameter. + + ============================================================================================================== + */ + + public enum DSP_OSCILLATOR : int + { + TYPE, /* Waveform type. 0 = sine. 1 = square. 2 = sawup. 3 = sawdown. 4 = triangle. 5 = noise. */ + RATE /* Frequency of the sinewave in hz. 1.0 to 22000.0. Default = 220.0. */ + } + + public enum DSP_LOWPASS : int + { + CUTOFF, /* Lowpass cutoff frequency in hz. 1.0 to 22000.0. Default = 5000.0. */ + RESONANCE /* Lowpass resonance Q value. 1.0 to 10.0. Default = 1.0. */ + } + + public enum DSP_ITLOWPASS : int + { + CUTOFF, /* Lowpass cutoff frequency in hz. 1.0 to 22000.0. Default = 5000.0/ */ + RESONANCE /* Lowpass resonance Q value. 0.0 to 127.0. Default = 1.0. */ + } + + public enum DSP_HIGHPASS : int + { + CUTOFF, /* (Type:float) - Highpass cutoff frequency in hz. 1.0 to output 22000.0. Default = 5000.0. */ + RESONANCE /* (Type:float) - Highpass resonance Q value. 1.0 to 10.0. Default = 1.0. */ + } + + public enum DSP_ECHO : int + { + DELAY, /* (Type:float) - Echo delay in ms. 10 to 5000. Default = 500. */ + FEEDBACK, /* (Type:float) - Echo decay per delay. 0 to 100. 100.0 = No decay, 0.0 = total decay (ie simple 1 line delay). Default = 50.0. */ + DRYLEVEL, /* (Type:float) - Original sound volume in dB. -80.0 to 10.0. Default = 0. */ + WETLEVEL /* (Type:float) - Volume of echo signal to pass to output in dB. -80.0 to 10.0. Default = 0. */ + } + + public enum DSP_FADER : int + { + GAIN, /* (Type:float) - Signal gain in dB. -80.0 to 10.0. Default = 0.0. */ + OVERALL_GAIN, /* (Type:data) - Overall gain. For information only, not set by user. Data of type FMOD_DSP_PARAMETER_DATA_TYPE_OVERALLGAIN to provide to FMOD, to allow FMOD to know the DSP is scaling the signal for virtualization purposes. */ + } + + public enum DSP_DELAY : int + { + CH0, /* Channel #0 Delay in ms. 0 to 10000. Default = 0. */ + CH1, /* Channel #1 Delay in ms. 0 to 10000. Default = 0. */ + CH2, /* Channel #2 Delay in ms. 0 to 10000. Default = 0. */ + CH3, /* Channel #3 Delay in ms. 0 to 10000. Default = 0. */ + CH4, /* Channel #4 Delay in ms. 0 to 10000. Default = 0. */ + CH5, /* Channel #5 Delay in ms. 0 to 10000. Default = 0. */ + CH6, /* Channel #6 Delay in ms. 0 to 10000. Default = 0. */ + CH7, /* Channel #7 Delay in ms. 0 to 10000. Default = 0. */ + CH8, /* Channel #8 Delay in ms. 0 to 10000. Default = 0. */ + CH9, /* Channel #9 Delay in ms. 0 to 10000. Default = 0. */ + CH10, /* Channel #10 Delay in ms. 0 to 10000. Default = 0. */ + CH11, /* Channel #11 Delay in ms. 0 to 10000. Default = 0. */ + CH12, /* Channel #12 Delay in ms. 0 to 10000. Default = 0. */ + CH13, /* Channel #13 Delay in ms. 0 to 10000. Default = 0. */ + CH14, /* Channel #14 Delay in ms. 0 to 10000. Default = 0. */ + CH15, /* Channel #15 Delay in ms. 0 to 10000. Default = 0. */ + MAXDELAY, /* Maximum delay in ms. 0 to 1000. Default = 10. */ + } + + public enum DSP_FLANGE : int + { + MIX, /* (Type:float) - Percentage of wet signal in mix. 0 to 100. Default = 50. */ + DEPTH, /* (Type:float) - Flange depth (percentage of 40ms delay). 0.01 to 1.0. Default = 1.0. */ + RATE /* (Type:float) - Flange speed in hz. 0.0 to 20.0. Default = 0.1. */ + } + + public enum DSP_TREMOLO : int + { + FREQUENCY, /* LFO frequency in Hz. 0.1 to 20. Default = 4. */ + DEPTH, /* Tremolo depth. 0 to 1. Default = 0. */ + SHAPE, /* LFO shape morph between triangle and sine. 0 to 1. Default = 0. */ + SKEW, /* Time-skewing of LFO cycle. -1 to 1. Default = 0. */ + DUTY, /* LFO on-time. 0 to 1. Default = 0.5. */ + SQUARE, /* Flatness of the LFO shape. 0 to 1. Default = 0. */ + PHASE, /* Instantaneous LFO phase. 0 to 1. Default = 0. */ + SPREAD /* Rotation / auto-pan effect. -1 to 1. Default = 0. */ + } + + public enum DSP_DISTORTION : int + { + LEVEL /* Distortion value. 0.0 to 1.0. Default = 0.5. */ + } + + public enum DSP_NORMALIZE : int + { + FADETIME, /* Time to ramp the silence to full in ms. 0.0 to 20000.0. Default = 5000.0. */ + THRESHHOLD, /* Lower volume range threshold to ignore. 0.0 to 1.0. Default = 0.1. Raise higher to stop amplification of very quiet signals. */ + MAXAMP /* Maximum amplification allowed. 1.0 to 100000.0. Default = 20.0. 1.0 = no amplifaction, higher values allow more boost. */ + } + + public enum DSP_LIMITER : int + { + RELEASETIME, /* (Type:float) - Time to ramp the silence to full in ms. 1.0 to 1000.0. Default = 10.0. */ + CEILING, /* (Type:float) - Maximum level of the output signal in dB. -12.0 to 0.0. Default = 0.0. */ + MAXIMIZERGAIN, /* (Type:float) - Maximum amplification allowed in dB. 0.0 to 12.0. Default = 0.0. 0.0 = no amplifaction, higher values allow more boost. */ + MODE, /* (Type:float) - Channel processing mode. 0 or 1. Default = 0. 0 = Independent (limiter per channel), 1 = Linked. */ + } + + public enum DSP_PARAMEQ : int + { + CENTER, /* Frequency center. 20.0 to 22000.0. Default = 8000.0. */ + BANDWIDTH, /* Octave range around the center frequency to filter. 0.2 to 5.0. Default = 1.0. */ + GAIN /* Frequency Gain. 0.05 to 3.0. Default = 1.0. */ + } + + public enum DSP_MULTIBAND_EQ : int + { + A_FILTER, /* (Type:int) - Band A: FMOD_DSP_MULTIBAND_EQ_FILTER_TYPE used to interpret the behavior of the remaining parameters. Default = FMOD_DSP_MULTIBAND_EQ_FILTER_LOWPASS_12DB */ + A_FREQUENCY, /* (Type:float) - Band A: Significant frequency in Hz, cutoff [low/high pass, low/high shelf], center [notch, peaking, band-pass], phase transition point [all-pass]. 20 to 24000. Default = 8000. */ + A_Q, /* (Type:float) - Band A: Quality factory, resonance [low/high pass], bandwidth [notch, peaking, band-pass], phase transition sharpness [all-pass], unused [low/high shelf]. 0.1 to 10.0. Default = 0.707. */ + A_GAIN, /* (Type:float) - Band A: Boost or attenuation in dB [peaking, high/low shelf only]. -30 to 30. Default = 0. */ + B_FILTER, /* (Type:int) - Band B: See Band A. Default = FMOD_DSP_MULTIBAND_EQ_FILTER_DISABLED */ + B_FREQUENCY, /* (Type:float) - Band B: See Band A */ + B_Q, /* (Type:float) - Band B: See Band A */ + B_GAIN, /* (Type:float) - Band B: See Band A */ + C_FILTER, /* (Type:int) - Band C: See Band A. Default = FMOD_DSP_MULTIBAND_EQ_FILTER_DISABLED */ + C_FREQUENCY, /* (Type:float) - Band C: See Band A. */ + C_Q, /* (Type:float) - Band C: See Band A. */ + C_GAIN, /* (Type:float) - Band C: See Band A. */ + D_FILTER, /* (Type:int) - Band D: See Band A. Default = FMOD_DSP_MULTIBAND_EQ_FILTER_DISABLED */ + D_FREQUENCY, /* (Type:float) - Band D: See Band A. */ + D_Q, /* (Type:float) - Band D: See Band A. */ + D_GAIN, /* (Type:float) - Band D: See Band A. */ + E_FILTER, /* (Type:int) - Band E: See Band A. Default = FMOD_DSP_MULTIBAND_EQ_FILTER_DISABLED */ + E_FREQUENCY, /* (Type:float) - Band E: See Band A. */ + E_Q, /* (Type:float) - Band E: See Band A. */ + E_GAIN, /* (Type:float) - Band E: See Band A. */ + } + + public enum DSP_MULTIBAND_EQ_FILTER_TYPE : int + { + DISABLED, /* Disabled filter, no processing. */ + LOWPASS_12DB, /* Resonant low-pass filter, attenuates frequencies (12dB per octave) above a given point (with specificed resonance) while allowing the rest to pass. */ + LOWPASS_24DB, /* Resonant low-pass filter, attenuates frequencies (24dB per octave) above a given point (with specificed resonance) while allowing the rest to pass. */ + LOWPASS_48DB, /* Resonant low-pass filter, attenuates frequencies (48dB per octave) above a given point (with specificed resonance) while allowing the rest to pass. */ + HIGHPASS_12DB, /* Resonant low-pass filter, attenuates frequencies (12dB per octave) below a given point (with specificed resonance) while allowing the rest to pass. */ + HIGHPASS_24DB, /* Resonant low-pass filter, attenuates frequencies (24dB per octave) below a given point (with specificed resonance) while allowing the rest to pass. */ + HIGHPASS_48DB, /* Resonant low-pass filter, attenuates frequencies (48dB per octave) below a given point (with specificed resonance) while allowing the rest to pass. */ + LOWSHELF, /* Low-shelf filter, boosts or attenuates frequencies (with specified gain) below a given point while allowing the rest to pass. */ + HIGHSHELF, /* High-shelf filter, boosts or attenuates frequencies (with specified gain) above a given point while allowing the rest to pass. */ + PEAKING, /* Peaking filter, boosts or attenuates frequencies (with specified gain) at a given point (with specificed bandwidth) while allowing the rest to pass. */ + BANDPASS, /* Band-pass filter, allows frequencies at a given point (with specificed bandwidth) to pass while attenuating frequencies outside this range. */ + NOTCH, /* Notch or band-reject filter, attenuates frequencies at a given point (with specificed bandwidth) while allowing frequencies outside this range to pass. */ + ALLPASS, /* All-pass filter, allows all frequencies to pass, but changes the phase response at a given point (with specified sharpness). */ + } + + public enum DSP_PITCHSHIFT : int + { + PITCH, /* Pitch value. 0.5 to 2.0. Default = 1.0. 0.5 = one octave down, 2.0 = one octave up. 1.0 does not change the pitch. */ + FFTSIZE, /* FFT window size. 256, 512, 1024, 2048, 4096. Default = 1024. Increase this to reduce 'smearing'. This effect is a warbling sound similar to when an mp3 is encoded at very low bitrates. */ + OVERLAP, /* Window overlap. 1 to 32. Default = 4. Increase this to reduce 'tremolo' effect. Increasing it by a factor of 2 doubles the CPU usage. */ + MAXCHANNELS /* Maximum channels supported. 0 to 16. 0 = same as fmod's default output polyphony, 1 = mono, 2 = stereo etc. See remarks for more. Default = 0. It is suggested to leave at 0! */ + } + + public enum DSP_CHORUS : int + { + MIX, /* (Type:float) - Volume of original signal to pass to output. 0.0 to 100.0. Default = 50.0. */ + RATE, /* (Type:float) - Chorus modulation rate in Hz. 0.0 to 20.0. Default = 0.8 Hz. */ + DEPTH, /* (Type:float) - Chorus modulation depth. 0.0 to 100.0. Default = 3.0. */ + } + + public enum DSP_ITECHO : int + { + WETDRYMIX, /* (Type:float) - Ratio of wet (processed) signal to dry (unprocessed) signal. Must be in the range from 0.0 through 100.0 (all wet). Default = 50. */ + FEEDBACK, /* (Type:float) - Percentage of output fed back into input, in the range from 0.0 through 100.0. Default = 50. */ + LEFTDELAY, /* (Type:float) - Delay for left channel, in milliseconds, in the range from 1.0 through 2000.0. Default = 500 ms. */ + RIGHTDELAY, /* (Type:float) - Delay for right channel, in milliseconds, in the range from 1.0 through 2000.0. Default = 500 ms. */ + PANDELAY /* (Type:float) - Value that specifies whether to swap left and right delays with each successive echo. Ranges from 0.0 (equivalent to FALSE) to 1.0 (equivalent to TRUE), meaning no swap. Default = 0. CURRENTLY NOT SUPPORTED. */ + } + + public enum DSP_COMPRESSOR : int + { + THRESHOLD, /* (Type:float) - Threshold level (dB) in the range from -80 through 0. The default value is 0. */ + RATIO, /* (Type:float) - Compression Ratio (dB/dB) in the range from 1 to 50. The default value is 2.5. */ + ATTACK, /* (Type:float) - Attack time (milliseconds), in the range from 0.1 through 1000. The default value is 20. */ + RELEASE, /* (Type:float) - Release time (milliseconds), in the range from 10 through 5000. The default value is 100 */ + GAINMAKEUP, /* (Type:float) - Make-up gain (dB) applied after limiting, in the range from 0 through 30. The default value is 0. */ + USESIDECHAIN,/* (Type:bool) - Whether to analyse the sidechain signal instead of the input signal. The default value is false */ + LINKED /* (Type:bool) - FALSE = Independent (compressor per channel), TRUE = Linked. The default value is TRUE. */ + } + + public enum DSP_SFXREVERB : int + { + DECAYTIME, /* (Type:float) - Decay Time : Reverberation decay time at low-frequencies in milliseconds. Ranges from 100.0 to 20000.0. Default is 1500. */ + EARLYDELAY, /* (Type:float) - Early Delay : Delay time of first reflection in milliseconds. Ranges from 0.0 to 300.0. Default is 20. */ + LATEDELAY, /* (Type:float) - Reverb Delay : Late reverberation delay time relative to first reflection in milliseconds. Ranges from 0.0 to 100.0. Default is 40. */ + HFREFERENCE, /* (Type:float) - HF Reference : Reference frequency for high-frequency decay in Hz. Ranges from 20.0 to 20000.0. Default is 5000. */ + HFDECAYRATIO, /* (Type:float) - Decay HF Ratio : High-frequency decay time relative to decay time in percent. Ranges from 10.0 to 100.0. Default is 50. */ + DIFFUSION, /* (Type:float) - Diffusion : Reverberation diffusion (echo density) in percent. Ranges from 0.0 to 100.0. Default is 100. */ + DENSITY, /* (Type:float) - Density : Reverberation density (modal density) in percent. Ranges from 0.0 to 100.0. Default is 100. */ + LOWSHELFFREQUENCY, /* (Type:float) - Low Shelf Frequency : Transition frequency of low-shelf filter in Hz. Ranges from 20.0 to 1000.0. Default is 250. */ + LOWSHELFGAIN, /* (Type:float) - Low Shelf Gain : Gain of low-shelf filter in dB. Ranges from -36.0 to 12.0. Default is 0. */ + HIGHCUT, /* (Type:float) - High Cut : Cutoff frequency of low-pass filter in Hz. Ranges from 20.0 to 20000.0. Default is 20000. */ + EARLYLATEMIX, /* (Type:float) - Early/Late Mix : Blend ratio of late reverb to early reflections in percent. Ranges from 0.0 to 100.0. Default is 50. */ + WETLEVEL, /* (Type:float) - Wet Level : Reverb signal level in dB. Ranges from -80.0 to 20.0. Default is -6. */ + DRYLEVEL /* (Type:float) - Dry Level : Dry signal level in dB. Ranges from -80.0 to 20.0. Default is 0. */ + } + + public enum DSP_LOWPASS_SIMPLE : int + { + CUTOFF /* Lowpass cutoff frequency in hz. 10.0 to 22000.0. Default = 5000.0 */ + } + + public enum DSP_SEND : int + { + RETURNID, /* (Type:int) - ID of the Return DSP this send is connected to (integer values only). -1 indicates no connected Return DSP. Default = -1. */ + LEVEL, /* (Type:float) - Send level. 0.0 to 1.0. Default = 1.0 */ + } + + public enum DSP_RETURN : int + { + ID, /* (Type:int) - ID of this Return DSP. Read-only. Default = -1. */ + INPUT_SPEAKER_MODE /* (Type:int) - Input speaker mode of this return. Default = FMOD_SPEAKERMODE_DEFAULT. */ + } + + public enum DSP_HIGHPASS_SIMPLE : int + { + CUTOFF /* (Type:float) - Highpass cutoff frequency in hz. 10.0 to 22000.0. Default = 1000.0 */ + } + + public enum DSP_PAN_2D_STEREO_MODE_TYPE : int + { + DISTRIBUTED, /* The parts of a stereo sound are spread around desination speakers based on FMOD_DSP_PAN_2D_EXTENT / FMOD_DSP_PAN_2D_DIRECTION */ + DISCRETE /* The L/R parts of a stereo sound are rotated around a circle based on FMOD_DSP_PAN_2D_STEREO_AXIS / FMOD_DSP_PAN_2D_STEREO_SEPARATION. */ + } + + public enum DSP_PAN_MODE_TYPE : int + { + MONO, + STEREO, + SURROUND + } + + public enum DSP_PAN_3D_ROLLOFF_TYPE : int + { + LINEARSQUARED, + LINEAR, + INVERSE, + INVERSETAPERED, + CUSTOM + } + + public enum DSP_PAN_3D_EXTENT_MODE_TYPE : int + { + AUTO, + USER, + OFF + } + + public enum DSP_PAN : int + { + MODE, /* (Type:int) - Panner mode. FMOD_DSP_PAN_MODE_MONO for mono down-mix, FMOD_DSP_PAN_MODE_STEREO for stereo panning or FMOD_DSP_PAN_MODE_SURROUND for surround panning. Default = FMOD_DSP_PAN_MODE_SURROUND */ + _2D_STEREO_POSITION, /* (Type:float) - 2D Stereo pan position. -100.0 to 100.0. Default = 0.0. */ + _2D_DIRECTION, /* (Type:float) - 2D Surround pan direction. Direction from center point of panning circle. -180.0 (degrees) to 180.0 (degrees). 0 = front center, -180 or +180 = rear speakers center point. Default = 0.0. */ + _2D_EXTENT, /* (Type:float) - 2D Surround pan extent. Distance from center point of panning circle. 0.0 (degrees) to 360.0 (degrees). Default = 360.0. */ + _2D_ROTATION, /* (Type:float) - 2D Surround pan rotation. -180.0 (degrees) to 180.0 (degrees). Default = 0.0. */ + _2D_LFE_LEVEL, /* (Type:float) - 2D Surround pan LFE level. 2D LFE level in dB. -80.0 (db) to 20.0 (db). Default = 0.0. */ + _2D_STEREO_MODE, /* (Type:int) - Stereo-To-Surround Mode. FMOD_DSP_PAN_2D_STEREO_MODE_DISTRIBUTED to FMOD_DSP_PAN_2D_STEREO_MODE_DISCRETE. Default = FMOD_DSP_PAN_2D_STEREO_MODE_DISCRETE.*/ + _2D_STEREO_SEPARATION, /* (Type:float) - Stereo-To-Surround Stereo For FMOD_DSP_PAN_2D_STEREO_MODE_DISCRETE mode. Separation/width of L/R parts of stereo sound. -180.0 (degrees) to +180.0 (degrees). Default = 60.0. */ + _2D_STEREO_AXIS, /* (Type:float) - Stereo-To-Surround Stereo For FMOD_DSP_PAN_2D_STEREO_MODE_DISCRETE mode. Axis/rotation of L/R parts of stereo sound. -180.0 (degrees) to +180.0 (degrees). Default = 0.0. */ + ENABLED_SPEAKERS, /* (Type:int) - Speakers Enabled. Bitmask for each speaker from 0 to 32 to be considered by panner. Use to disable speakers from being panned to. 0 to 0xFFF. Default = 0xFFF (All on). */ + _3D_POSITION, /* (Type:data) - 3D Position. Data of type FMOD_DSP_PARAMETER_3DATTRIBUTES_MULTI. See remarks on what to fill out. */ + _3D_ROLLOFF, /* (Type:int) - 3D Rolloff. FMOD_DSP_PAN_3D_ROLLOFF_LINEARSQUARED to FMOD_DSP_PAN_3D_ROLLOFF_CUSTOM. Default = FMOD_DSP_PAN_3D_ROLLOFF_LINEARSQUARED. */ + _3D_MIN_DISTANCE, /* (Type:float) - 3D Min Distance. 0.0 to 1e+18f. Default = 1.0. */ + _3D_MAX_DISTANCE, /* (Type:float) - 3D Max Distance. 0.0 to 1e+18f. Default = 20.0. */ + _3D_EXTENT_MODE, /* (Type:int) - 3D Extent Mode. FMOD_DSP_PAN_3D_EXTENT_MODE_AUTO to FMOD_DSP_PAN_3D_EXTENT_MODE_OFF. Default = FMOD_DSP_PAN_3D_EXTENT_MODE_AUTO. */ + _3D_SOUND_SIZE, /* (Type:float) - 3D Sound Size. 0.0 to 1e+18f. Default = 0.0. */ + _3D_MIN_EXTENT, /* (Type:float) - 3D Min Extent. 0.0 (degrees) to 360.0 (degrees). Default = 0.0. */ + _3D_PAN_BLEND, /* (Type:float) - 3D Pan Blend. 0.0 (fully 2D) to 1.0 (fully 3D). Default = 0.0. */ + LFE_UPMIX_ENABLED, /* (Type:int) - LFE Upmix Enabled. Determines whether non-LFE source channels should mix to the LFE or leave it alone. 0 (off) to 1 (on). Default = 0 (off). */ + OVERALL_GAIN, /* (Type:data) - Overall gain. For information only, not set by user. Data of type FMOD_DSP_PARAMETER_DATA_TYPE_OVERALLGAIN to provide to FMOD, to allow FMOD to know the DSP is scaling the signal for virtualization purposes. */ + SURROUND_SPEAKER_MODE, /* (Type:int) - Surround speaker mode. Target speaker mode for surround panning. Default = FMOD_SPEAKERMODE_DEFAULT. */ + _2D_HEIGHT_BLEND, /* (Type:float) - 2D Height blend. When FMOD_DSP_PAN_SURROUND_SPEAKER_MODE has height speakers, control the blend between ground and height. 0.0 (ground speakers only) to 1.0 (top speakers only). Default = 0.0. */ + } + + public enum DSP_THREE_EQ_CROSSOVERSLOPE_TYPE : int + { + _12DB, + _24DB, + _48DB + } + + public enum DSP_THREE_EQ : int + { + LOWGAIN, /* (Type:float) - Low frequency gain in dB. -80.0 to 10.0. Default = 0. */ + MIDGAIN, /* (Type:float) - Mid frequency gain in dB. -80.0 to 10.0. Default = 0. */ + HIGHGAIN, /* (Type:float) - High frequency gain in dB. -80.0 to 10.0. Default = 0. */ + LOWCROSSOVER, /* (Type:float) - Low-to-mid crossover frequency in Hz. 10.0 to 22000.0. Default = 400.0. */ + HIGHCROSSOVER, /* (Type:float) - Mid-to-high crossover frequency in Hz. 10.0 to 22000.0. Default = 4000.0. */ + CROSSOVERSLOPE /* (Type:int) - Crossover Slope. 0 = 12dB/Octave, 1 = 24dB/Octave, 2 = 48dB/Octave. Default = 1 (24dB/Octave). */ + } + + public enum DSP_FFT_WINDOW : int + { + RECT, /* w[n] = 1.0 */ + TRIANGLE, /* w[n] = TRI(2n/N) */ + HAMMING, /* w[n] = 0.54 - (0.46 * COS(n/N) ) */ + HANNING, /* w[n] = 0.5 * (1.0 - COS(n/N) ) */ + BLACKMAN, /* w[n] = 0.42 - (0.5 * COS(n/N) ) + (0.08 * COS(2.0 * n/N) ) */ + BLACKMANHARRIS /* w[n] = 0.35875 - (0.48829 * COS(1.0 * n/N)) + (0.14128 * COS(2.0 * n/N)) - (0.01168 * COS(3.0 * n/N)) */ + } + + public enum DSP_FFT : int + { + WINDOWSIZE, /* (Type:int) - [r/w] Must be a power of 2 between 128 and 16384. 128, 256, 512, 1024, 2048, 4096, 8192, 16384 are accepted. Default = 2048. */ + WINDOWTYPE, /* (Type:int) - [r/w] Refer to FMOD_DSP_FFT_WINDOW enumeration. Default = FMOD_DSP_FFT_WINDOW_HAMMING. */ + SPECTRUMDATA, /* (Type:data) - [r] Returns the current spectrum values between 0 and 1 for each 'fft bin'. Cast data to FMOD_DSP_PARAMETER_DATA_TYPE_FFT. Divide the niquist rate by the window size to get the hz value per entry. */ + DOMINANT_FREQ /* (Type:float) - [r] Returns the dominant frequencies for each channel. */ + } + + public enum DSP_ENVELOPEFOLLOWER : int + { + ATTACK, /* (Type:float) - Attack time (milliseconds), in the range from 0.1 through 1000. The default value is 20. */ + RELEASE, /* (Type:float) - Release time (milliseconds), in the range from 10 through 5000. The default value is 100 */ + ENVELOPE, /* (Type:float) - Current value of the envelope, in the range 0 to 1. Read-only. */ + USESIDECHAIN /* (Type:bool) - Whether to analyse the sidechain signal instead of the input signal. The default value is false */ + } + + public enum DSP_CONVOLUTION_REVERB : int + { + IR, /* (Type:data) - [w] 16-bit reverb IR (short*) with an extra sample prepended to the start which specifies the number of channels. */ + WET, /* (Type:float) - [r/w] Volume of echo signal to pass to output in dB. -80.0 to 10.0. Default = 0. */ + DRY, /* (Type:float) - [r/w] Original sound volume in dB. -80.0 to 10.0. Default = 0. */ + LINKED /* (Type:bool) - [r/w] Linked - channels are mixed together before processing through the reverb. Default = TRUE. */ + } + + public enum DSP_CHANNELMIX_OUTPUT : int + { + DEFAULT, /* Output channel count = input channel count. Mapping: See FMOD_SPEAKER enumeration. */ + ALLMONO, /* Output channel count = 1. Mapping: Mono, Mono, Mono, Mono, Mono, Mono, ... (each channel all the way up to FMOD_MAX_CHANNEL_WIDTH channels are treated as if they were mono) */ + ALLSTEREO, /* Output channel count = 2. Mapping: Left, Right, Left, Right, Left, Right, ... (each pair of channels is treated as stereo all the way up to FMOD_MAX_CHANNEL_WIDTH channels) */ + ALLQUAD, /* Output channel count = 4. Mapping: Repeating pattern of Front Left, Front Right, Surround Left, Surround Right. */ + ALL5POINT1, /* Output channel count = 6. Mapping: Repeating pattern of Front Left, Front Right, Center, LFE, Surround Left, Surround Right. */ + ALL7POINT1, /* Output channel count = 8. Mapping: Repeating pattern of Front Left, Front Right, Center, LFE, Surround Left, Surround Right, Back Left, Back Right. */ + ALLLFE /* Output channel count = 6. Mapping: Repeating pattern of LFE in a 5.1 output signal. */ + } + + public enum DSP_CHANNELMIX : int + { + OUTPUTGROUPING, /* (Type:int) - Refer to FMOD_DSP_CHANNELMIX_OUTPUT enumeration. Default = FMOD_DSP_CHANNELMIX_OUTPUT_DEFAULT. See remarks. */ + GAIN_CH0, /* (Type:float) - Channel #0 gain in dB. -80.0 to 10.0. Default = 0. */ + GAIN_CH1, /* (Type:float) - Channel #1 gain in dB. -80.0 to 10.0. Default = 0. */ + GAIN_CH2, /* (Type:float) - Channel #2 gain in dB. -80.0 to 10.0. Default = 0. */ + GAIN_CH3, /* (Type:float) - Channel #3 gain in dB. -80.0 to 10.0. Default = 0. */ + GAIN_CH4, /* (Type:float) - Channel #4 gain in dB. -80.0 to 10.0. Default = 0. */ + GAIN_CH5, /* (Type:float) - Channel #5 gain in dB. -80.0 to 10.0. Default = 0. */ + GAIN_CH6, /* (Type:float) - Channel #6 gain in dB. -80.0 to 10.0. Default = 0. */ + GAIN_CH7, /* (Type:float) - Channel #7 gain in dB. -80.0 to 10.0. Default = 0. */ + GAIN_CH8, /* (Type:float) - Channel #8 gain in dB. -80.0 to 10.0. Default = 0. */ + GAIN_CH9, /* (Type:float) - Channel #9 gain in dB. -80.0 to 10.0. Default = 0. */ + GAIN_CH10, /* (Type:float) - Channel #10 gain in dB. -80.0 to 10.0. Default = 0. */ + GAIN_CH11, /* (Type:float) - Channel #11 gain in dB. -80.0 to 10.0. Default = 0. */ + GAIN_CH12, /* (Type:float) - Channel #12 gain in dB. -80.0 to 10.0. Default = 0. */ + GAIN_CH13, /* (Type:float) - Channel #13 gain in dB. -80.0 to 10.0. Default = 0. */ + GAIN_CH14, /* (Type:float) - Channel #14 gain in dB. -80.0 to 10.0. Default = 0. */ + GAIN_CH15, /* (Type:float) - Channel #15 gain in dB. -80.0 to 10.0. Default = 0. */ + GAIN_CH16, /* (Type:float) - Channel #16 gain in dB. -80.0 to 10.0. Default = 0. */ + GAIN_CH17, /* (Type:float) - Channel #17 gain in dB. -80.0 to 10.0. Default = 0. */ + GAIN_CH18, /* (Type:float) - Channel #18 gain in dB. -80.0 to 10.0. Default = 0. */ + GAIN_CH19, /* (Type:float) - Channel #19 gain in dB. -80.0 to 10.0. Default = 0. */ + GAIN_CH20, /* (Type:float) - Channel #20 gain in dB. -80.0 to 10.0. Default = 0. */ + GAIN_CH21, /* (Type:float) - Channel #21 gain in dB. -80.0 to 10.0. Default = 0. */ + GAIN_CH22, /* (Type:float) - Channel #22 gain in dB. -80.0 to 10.0. Default = 0. */ + GAIN_CH23, /* (Type:float) - Channel #23 gain in dB. -80.0 to 10.0. Default = 0. */ + GAIN_CH24, /* (Type:float) - Channel #24 gain in dB. -80.0 to 10.0. Default = 0. */ + GAIN_CH25, /* (Type:float) - Channel #25 gain in dB. -80.0 to 10.0. Default = 0. */ + GAIN_CH26, /* (Type:float) - Channel #26 gain in dB. -80.0 to 10.0. Default = 0. */ + GAIN_CH27, /* (Type:float) - Channel #27 gain in dB. -80.0 to 10.0. Default = 0. */ + GAIN_CH28, /* (Type:float) - Channel #28 gain in dB. -80.0 to 10.0. Default = 0. */ + GAIN_CH29, /* (Type:float) - Channel #29 gain in dB. -80.0 to 10.0. Default = 0. */ + GAIN_CH30, /* (Type:float) - Channel #30 gain in dB. -80.0 to 10.0. Default = 0. */ + GAIN_CH31 /* (Type:float) - Channel #31 gain in dB. -80.0 to 10.0. Default = 0. */ + } + + public enum DSP_TRANSCEIVER_SPEAKERMODE : int + { + AUTO = -1, /* A transmitter will use whatever signal channel count coming in to the transmitter, to determine which speaker mode is allocated for the transceiver channel. */ + MONO = 0, /* A transmitter will always downmix to a mono channel buffer. */ + STEREO, /* A transmitter will always upmix or downmix to a stereo channel buffer. */ + SURROUND, /* A transmitter will always upmix or downmix to a surround channel buffer. Surround is the speaker mode of the system above stereo, so could be quad/surround/5.1/7.1. */ + } + + public enum DSP_TRANSCEIVER : int + { + TRANSMIT, /* (Type:bool) - [r/w] - FALSE = Transceiver is a 'receiver' (like a return) and accepts data from a channel. TRUE = Transceiver is a 'transmitter' (like a send). Default = FALSE. */ + GAIN, /* (Type:float) - [r/w] - Gain to receive or transmit at in dB. -80.0 to 10.0. Default = 0. */ + CHANNEL, /* (Type:int) - [r/w] - Integer to select current global slot, shared by all Transceivers, that can be transmitted to or received from. 0 to 31. Default = 0.*/ + TRANSMITSPEAKERMODE /* (Type:int) - [r/w] - Speaker mode (transmitter mode only). Specifies either 0 (Auto) Default = 0.*/ + } + + public enum DSP_OBJECTPAN : int + { + _3D_POSITION, /* (Type:data) - 3D Position. data of type FMOD_DSP_PARAMETER_3DATTRIBUTES_MULTI */ + _3D_ROLLOFF, /* (Type:int) - 3D Rolloff. FMOD_DSP_PAN_3D_ROLLOFF_LINEARSQUARED to FMOD_DSP_PAN_3D_ROLLOFF_CUSTOM. Default = FMOD_DSP_PAN_3D_ROLLOFF_LINEARSQUARED. */ + _3D_MIN_DISTANCE, /* (Type:float) - 3D Min Distance. 0.0 to 1e+19f. Default = 1.0. */ + _3D_MAX_DISTANCE, /* (Type:float) - 3D Max Distance. 0.0 to 1e+19f. Default = 20.0. */ + _3D_EXTENT_MODE, /* (Type:int) - 3D Extent Mode. FMOD_DSP_PAN_3D_EXTENT_MODE_AUTO to FMOD_DSP_PAN_3D_EXTENT_MODE_OFF. Default = FMOD_DSP_PAN_3D_EXTENT_MODE_AUTO. */ + _3D_SOUND_SIZE, /* (Type:float) - 3D Sound Size. 0.0 to 1e+19f. Default = 0.0. */ + _3D_MIN_EXTENT, /* (Type:float) - 3D Min Extent. 0.0 (degrees) to 360.0 (degrees). Default = 0.0. */ + OVERALL_GAIN, /* (Type:data) - Overall gain. For information only, not set by user. Data of type FMOD_DSP_PARAMETER_DATA_TYPE_OVERALLGAIN to provide to FMOD, to allow FMOD to know the DSP is scaling the signal for virtualization purposes. */ + OUTPUTGAIN /* (Type:float) - Output gain level. 0.0 to 1.0 linear scale. For the user to scale the output of the object panner's signal. */ + } +} diff --git a/Assets/Plugins/FMOD/src/Runtime/wrapper/fmod_dsp.cs.meta b/Assets/Plugins/FMOD/src/Runtime/wrapper/fmod_dsp.cs.meta new file mode 100755 index 0000000..5d5c6ab --- /dev/null +++ b/Assets/Plugins/FMOD/src/Runtime/wrapper/fmod_dsp.cs.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: b7b10c26cf550794183b926ffae615a7 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/src/Runtime/wrapper/fmod_errors.cs b/Assets/Plugins/FMOD/src/Runtime/wrapper/fmod_errors.cs new file mode 100755 index 0000000..c232ada --- /dev/null +++ b/Assets/Plugins/FMOD/src/Runtime/wrapper/fmod_errors.cs @@ -0,0 +1,106 @@ +/* ============================================================================================== */ +/* FMOD Core / Studio API - Error string header file. */ +/* Copyright (c), Firelight Technologies Pty, Ltd. 2004-2019. */ +/* */ +/* Use this header if you want to store or display a string version / english explanation */ +/* of the FMOD error codes. */ +/* */ +/* For more detail visit: */ +/* https://fmod.com/resources/documentation-api?version=2.0&page=core-api-common.html#fmod_result */ +/* =============================================================================================== */ + +namespace FMOD +{ + public class Error + { + public static string String(FMOD.RESULT errcode) + { + switch (errcode) + { + case FMOD.RESULT.OK: return "No errors."; + case FMOD.RESULT.ERR_BADCOMMAND: return "Tried to call a function on a data type that does not allow this type of functionality (ie calling Sound::lock on a streaming sound)."; + case FMOD.RESULT.ERR_CHANNEL_ALLOC: return "Error trying to allocate a channel."; + case FMOD.RESULT.ERR_CHANNEL_STOLEN: return "The specified channel has been reused to play another sound."; + case FMOD.RESULT.ERR_DMA: return "DMA Failure. See debug output for more information."; + case FMOD.RESULT.ERR_DSP_CONNECTION: return "DSP connection error. Connection possibly caused a cyclic dependency or connected dsps with incompatible buffer counts."; + case FMOD.RESULT.ERR_DSP_DONTPROCESS: return "DSP return code from a DSP process query callback. Tells mixer not to call the process callback and therefore not consume CPU. Use this to optimize the DSP graph."; + case FMOD.RESULT.ERR_DSP_FORMAT: return "DSP Format error. A DSP unit may have attempted to connect to this network with the wrong format, or a matrix may have been set with the wrong size if the target unit has a specified channel map."; + case FMOD.RESULT.ERR_DSP_INUSE: return "DSP is already in the mixer's DSP network. It must be removed before being reinserted or released."; + case FMOD.RESULT.ERR_DSP_NOTFOUND: return "DSP connection error. Couldn't find the DSP unit specified."; + case FMOD.RESULT.ERR_DSP_RESERVED: return "DSP operation error. Cannot perform operation on this DSP as it is reserved by the system."; + case FMOD.RESULT.ERR_DSP_SILENCE: return "DSP return code from a DSP process query callback. Tells mixer silence would be produced from read, so go idle and not consume CPU. Use this to optimize the DSP graph."; + case FMOD.RESULT.ERR_DSP_TYPE: return "DSP operation cannot be performed on a DSP of this type."; + case FMOD.RESULT.ERR_FILE_BAD: return "Error loading file."; + case FMOD.RESULT.ERR_FILE_COULDNOTSEEK: return "Couldn't perform seek operation. This is a limitation of the medium (ie netstreams) or the file format."; + case FMOD.RESULT.ERR_FILE_DISKEJECTED: return "Media was ejected while reading."; + case FMOD.RESULT.ERR_FILE_EOF: return "End of file unexpectedly reached while trying to read essential data (truncated?)."; + case FMOD.RESULT.ERR_FILE_ENDOFDATA: return "End of current chunk reached while trying to read data."; + case FMOD.RESULT.ERR_FILE_NOTFOUND: return "File not found."; + case FMOD.RESULT.ERR_FORMAT: return "Unsupported file or audio format."; + case FMOD.RESULT.ERR_HEADER_MISMATCH: return "There is a version mismatch between the FMOD header and either the FMOD Studio library or the FMOD Low Level library."; + case FMOD.RESULT.ERR_HTTP: return "A HTTP error occurred. This is a catch-all for HTTP errors not listed elsewhere."; + case FMOD.RESULT.ERR_HTTP_ACCESS: return "The specified resource requires authentication or is forbidden."; + case FMOD.RESULT.ERR_HTTP_PROXY_AUTH: return "Proxy authentication is required to access the specified resource."; + case FMOD.RESULT.ERR_HTTP_SERVER_ERROR: return "A HTTP server error occurred."; + case FMOD.RESULT.ERR_HTTP_TIMEOUT: return "The HTTP request timed out."; + case FMOD.RESULT.ERR_INITIALIZATION: return "FMOD was not initialized correctly to support this function."; + case FMOD.RESULT.ERR_INITIALIZED: return "Cannot call this command after System::init."; + case FMOD.RESULT.ERR_INTERNAL: return "An error occurred that wasn't supposed to. Contact support."; + case FMOD.RESULT.ERR_INVALID_FLOAT: return "Value passed in was a NaN, Inf or denormalized float."; + case FMOD.RESULT.ERR_INVALID_HANDLE: return "An invalid object handle was used."; + case FMOD.RESULT.ERR_INVALID_PARAM: return "An invalid parameter was passed to this function."; + case FMOD.RESULT.ERR_INVALID_POSITION: return "An invalid seek position was passed to this function."; + case FMOD.RESULT.ERR_INVALID_SPEAKER: return "An invalid speaker was passed to this function based on the current speaker mode."; + case FMOD.RESULT.ERR_INVALID_SYNCPOINT: return "The syncpoint did not come from this sound handle."; + case FMOD.RESULT.ERR_INVALID_THREAD: return "Tried to call a function on a thread that is not supported."; + case FMOD.RESULT.ERR_INVALID_VECTOR: return "The vectors passed in are not unit length, or perpendicular."; + case FMOD.RESULT.ERR_MAXAUDIBLE: return "Reached maximum audible playback count for this sound's soundgroup."; + case FMOD.RESULT.ERR_MEMORY: return "Not enough memory or resources."; + case FMOD.RESULT.ERR_MEMORY_CANTPOINT: return "Can't use FMOD_OPENMEMORY_POINT on non PCM source data, or non mp3/xma/adpcm data if FMOD_CREATECOMPRESSEDSAMPLE was used."; + case FMOD.RESULT.ERR_NEEDS3D: return "Tried to call a command on a 2d sound when the command was meant for 3d sound."; + case FMOD.RESULT.ERR_NEEDSHARDWARE: return "Tried to use a feature that requires hardware support."; + case FMOD.RESULT.ERR_NET_CONNECT: return "Couldn't connect to the specified host."; + case FMOD.RESULT.ERR_NET_SOCKET_ERROR: return "A socket error occurred. This is a catch-all for socket-related errors not listed elsewhere."; + case FMOD.RESULT.ERR_NET_URL: return "The specified URL couldn't be resolved."; + case FMOD.RESULT.ERR_NET_WOULD_BLOCK: return "Operation on a non-blocking socket could not complete immediately."; + case FMOD.RESULT.ERR_NOTREADY: return "Operation could not be performed because specified sound/DSP connection is not ready."; + case FMOD.RESULT.ERR_OUTPUT_ALLOCATED: return "Error initializing output device, but more specifically, the output device is already in use and cannot be reused."; + case FMOD.RESULT.ERR_OUTPUT_CREATEBUFFER: return "Error creating hardware sound buffer."; + case FMOD.RESULT.ERR_OUTPUT_DRIVERCALL: return "A call to a standard soundcard driver failed, which could possibly mean a bug in the driver or resources were missing or exhausted."; + case FMOD.RESULT.ERR_OUTPUT_FORMAT: return "Soundcard does not support the specified format."; + case FMOD.RESULT.ERR_OUTPUT_INIT: return "Error initializing output device."; + case FMOD.RESULT.ERR_OUTPUT_NODRIVERS: return "The output device has no drivers installed. If pre-init, FMOD_OUTPUT_NOSOUND is selected as the output mode. If post-init, the function just fails."; + case FMOD.RESULT.ERR_PLUGIN: return "An unspecified error has been returned from a plugin."; + case FMOD.RESULT.ERR_PLUGIN_MISSING: return "A requested output, dsp unit type or codec was not available."; + case FMOD.RESULT.ERR_PLUGIN_RESOURCE: return "A resource that the plugin requires cannot be found. (ie the DLS file for MIDI playback)"; + case FMOD.RESULT.ERR_PLUGIN_VERSION: return "A plugin was built with an unsupported SDK version."; + case FMOD.RESULT.ERR_RECORD: return "An error occurred trying to initialize the recording device."; + case FMOD.RESULT.ERR_REVERB_CHANNELGROUP: return "Reverb properties cannot be set on this channel because a parent channelgroup owns the reverb connection."; + case FMOD.RESULT.ERR_REVERB_INSTANCE: return "Specified instance in FMOD_REVERB_PROPERTIES couldn't be set. Most likely because it is an invalid instance number or the reverb doesn't exist."; + case FMOD.RESULT.ERR_SUBSOUNDS: return "The error occurred because the sound referenced contains subsounds when it shouldn't have, or it doesn't contain subsounds when it should have. The operation may also not be able to be performed on a parent sound."; + case FMOD.RESULT.ERR_SUBSOUND_ALLOCATED: return "This subsound is already being used by another sound, you cannot have more than one parent to a sound. Null out the other parent's entry first."; + case FMOD.RESULT.ERR_SUBSOUND_CANTMOVE: return "Shared subsounds cannot be replaced or moved from their parent stream, such as when the parent stream is an FSB file."; + case FMOD.RESULT.ERR_TAGNOTFOUND: return "The specified tag could not be found or there are no tags."; + case FMOD.RESULT.ERR_TOOMANYCHANNELS: return "The sound created exceeds the allowable input channel count. This can be increased using the 'maxinputchannels' parameter in System::setSoftwareFormat."; + case FMOD.RESULT.ERR_TRUNCATED: return "The retrieved string is too long to fit in the supplied buffer and has been truncated."; + case FMOD.RESULT.ERR_UNIMPLEMENTED: return "Something in FMOD hasn't been implemented when it should be! contact support!"; + case FMOD.RESULT.ERR_UNINITIALIZED: return "This command failed because System::init or System::setDriver was not called."; + case FMOD.RESULT.ERR_UNSUPPORTED: return "A command issued was not supported by this object. Possibly a plugin without certain callbacks specified."; + case FMOD.RESULT.ERR_VERSION: return "The version number of this file format is not supported."; + case FMOD.RESULT.ERR_EVENT_ALREADY_LOADED: return "The specified bank has already been loaded."; + case FMOD.RESULT.ERR_EVENT_LIVEUPDATE_BUSY: return "The live update connection failed due to the game already being connected."; + case FMOD.RESULT.ERR_EVENT_LIVEUPDATE_MISMATCH: return "The live update connection failed due to the game data being out of sync with the tool."; + case FMOD.RESULT.ERR_EVENT_LIVEUPDATE_TIMEOUT: return "The live update connection timed out."; + case FMOD.RESULT.ERR_EVENT_NOTFOUND: return "The requested event, bus or vca could not be found."; + case FMOD.RESULT.ERR_STUDIO_UNINITIALIZED: return "The Studio::System object is not yet initialized."; + case FMOD.RESULT.ERR_STUDIO_NOT_LOADED: return "The specified resource is not loaded, so it can't be unloaded."; + case FMOD.RESULT.ERR_INVALID_STRING: return "An invalid string was passed to this function."; + case FMOD.RESULT.ERR_ALREADY_LOCKED: return "The specified resource is already locked."; + case FMOD.RESULT.ERR_NOT_LOCKED: return "The specified resource is not locked, so it can't be unlocked."; + case FMOD.RESULT.ERR_RECORD_DISCONNECTED: return "The specified recording driver has been disconnected."; + case FMOD.RESULT.ERR_TOOMANYSAMPLES: return "The length provided exceed the allowable limit."; + default: return "Unknown error."; + } + } + } +} diff --git a/Assets/Plugins/FMOD/src/Runtime/wrapper/fmod_errors.cs.meta b/Assets/Plugins/FMOD/src/Runtime/wrapper/fmod_errors.cs.meta new file mode 100755 index 0000000..2b15a75 --- /dev/null +++ b/Assets/Plugins/FMOD/src/Runtime/wrapper/fmod_errors.cs.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 6e0992509b0077e479d2da05c8f52eb0 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/FMOD/src/Runtime/wrapper/fmod_studio.cs b/Assets/Plugins/FMOD/src/Runtime/wrapper/fmod_studio.cs new file mode 100755 index 0000000..c773943 --- /dev/null +++ b/Assets/Plugins/FMOD/src/Runtime/wrapper/fmod_studio.cs @@ -0,0 +1,1976 @@ +/* ======================================================================================== */ +/* FMOD Studio API - C# wrapper. */ +/* Copyright (c), Firelight Technologies Pty, Ltd. 2004-2019. */ +/* */ +/* For more detail visit: */ +/* https://fmod.com/resources/documentation-api?version=2.0&page=page=studio-api.html */ +/* ======================================================================================== */ + +using System; +using System.Text; +using System.Runtime.InteropServices; +using System.Collections; + +namespace FMOD.Studio +{ + public class STUDIO_VERSION + { +#if (UNITY_IPHONE || UNITY_TVOS || UNITY_SWITCH || UNITY_WEBGL) && !UNITY_EDITOR + public const string dll = "__Internal"; +#elif (UNITY_PS4) && DEVELOPMENT_BUILD + public const string dll = "libfmodstudioL"; +#elif (UNITY_PS4 || UNITY_WIIU || UNITY_PSP2) && !UNITY_EDITOR + public const string dll = "libfmodstudio"; +#elif UNITY_EDITOR || ((UNITY_STANDALONE || UNITY_ANDROID || UNITY_XBOXONE) && DEVELOPMENT_BUILD) + public const string dll = "fmodstudioL"; +#else + public const string dll = "fmodstudio"; +#endif + } + + public enum STOP_MODE : int + { + ALLOWFADEOUT, /* Allows AHDSR modulators to complete their release, and DSP effect tails to play out. */ + IMMEDIATE, /* Stops the event instance immediately. */ + } + + public enum LOADING_STATE : int + { + UNLOADING, /* Currently unloading. */ + UNLOADED, /* Not loaded. */ + LOADING, /* Loading in progress. */ + LOADED, /* Loaded and ready to play. */ + ERROR, /* Failed to load and is now in error state. */ + } + + [StructLayout(LayoutKind.Sequential)] + public struct PROGRAMMER_SOUND_PROPERTIES + { + public StringWrapper name; + public IntPtr sound; + public int subsoundIndex; + } + + [StructLayout(LayoutKind.Sequential)] + public struct TIMELINE_MARKER_PROPERTIES + { + public StringWrapper name; + public int position; + } + + [StructLayout(LayoutKind.Sequential)] + public struct TIMELINE_BEAT_PROPERTIES + { + public int bar; + public int beat; + public int position; + public float tempo; + public int timesignatureupper; + public int timesignaturelower; + } + + [StructLayout(LayoutKind.Sequential)] + public struct ADVANCEDSETTINGS + { + public int cbsize; /* [w] Size of this structure. NOTE: For C# wrapper, users can leave this at 0. ! */ + public int commandqueuesize; /* [r/w] Optional. Specify 0 to ignore. Specify the command queue size for studio async processing. Default 4096 (4kb) */ + public int handleinitialsize; /* [r/w] Optional. Specify 0 to ignore. Specify the initial size to allocate for handles. Memory for handles will grow as needed in pages. */ + public int studioupdateperiod; /* [r/w] Optional. Specify 0 to ignore. Specify the update period of Studio when in async mode, in milliseconds. Will be quantised to the nearest multiple of mixer duration. Default is 20ms. */ + public int idlesampledatapoolsize; /* [r/w] Optional. Specify 0 to ignore. Specify the amount of sample data to keep in memory when no longer used, to avoid repeated disk IO. Use -1 to disable. Default is 256kB. */ + public int streamingscheduledelay; /* [r/w] Optional. Specify 0 to ignore. Specify the schedule delay for streams, in samples. Lower values can reduce latency when scheduling events containing streams but may cause scheduling issues if too small. Default is 8192 samples. */ + public StringWrapper encryptionkey; /* [w] Optional. Specify 0 to ignore. Specify the key for loading sounds from encrypted banks. */ + } + + [StructLayout(LayoutKind.Sequential)] + public struct CPU_USAGE + { + public float dspusage; /* Returns the % CPU time taken by DSP processing on the low level mixer thread. */ + public float streamusage; /* Returns the % CPU time taken by stream processing on the low level stream thread. */ + public float geometryusage; /* Returns the % CPU time taken by geometry processing on the low level geometry thread. */ + public float updateusage; /* Returns the % CPU time taken by low level update, called as part of the studio update. */ + public float studiousage; /* Returns the % CPU time taken by studio update, called from the studio thread. Does not include low level update time. */ + } + + [StructLayout(LayoutKind.Sequential)] + public struct BUFFER_INFO + { + public int currentusage; /* Current buffer usage in bytes. */ + public int peakusage; /* Peak buffer usage in bytes. */ + public int capacity; /* Buffer capacity in bytes. */ + public int stallcount; /* Number of stalls due to buffer overflow. */ + public float stalltime; /* Amount of time stalled due to buffer overflow, in seconds. */ + } + + [StructLayout(LayoutKind.Sequential)] + public struct BUFFER_USAGE + { + public BUFFER_INFO studiocommandqueue; /* Information for the Studio Async Command buffer, controlled by FMOD_STUDIO_ADVANCEDSETTINGS commandqueuesize. */ + public BUFFER_INFO studiohandle; /* Information for the Studio handle table, controlled by FMOD_STUDIO_ADVANCEDSETTINGS handleinitialsize. */ + } + + [StructLayout(LayoutKind.Sequential)] + public struct BANK_INFO + { + public int size; /* The size of this struct (for binary compatibility) */ + public IntPtr userdata; /* User data to be passed to the file callbacks */ + public int userdatalength; /* If this is non-zero, userdata will be copied internally */ + public FILE_OPEN_CALLBACK opencallback; /* Callback for opening this file. */ + public FILE_CLOSE_CALLBACK closecallback; /* Callback for closing this file. */ + public FILE_READ_CALLBACK readcallback; /* Callback for reading from this file. */ + public FILE_SEEK_CALLBACK seekcallback; /* Callback for seeking within this file. */ + } + + [Flags] + public enum SYSTEM_CALLBACK_TYPE : uint + { + PREUPDATE = 0x00000001, /* Called at the start of the main Studio update. For async mode this will be on its own thread. */ + POSTUPDATE = 0x00000002, /* Called at the end of the main Studio update. For async mode this will be on its own thread. */ + BANK_UNLOAD = 0x00000004, /* Called when bank has just been unloaded, after all resources are freed. CommandData will be the bank handle.*/ + ALL = 0xFFFFFFFF, /* Pass this mask to Studio::System::setCallback to receive all callback types. */ + } + + public delegate RESULT SYSTEM_CALLBACK(IntPtr system, SYSTEM_CALLBACK_TYPE type, IntPtr commanddata, IntPtr userdata); + + public enum PARAMETER_TYPE : int + { + GAME_CONTROLLED, /* Controlled via the API using Studio::ParameterInstance::setValue. */ + AUTOMATIC_DISTANCE, /* Distance between the event and the listener. */ + AUTOMATIC_EVENT_CONE_ANGLE, /* Angle between the event's forward vector and the vector pointing from the event to the listener (0 to 180 degrees). */ + AUTOMATIC_EVENT_ORIENTATION, /* Horizontal angle between the event's forward vector and listener's forward vector (-180 to 180 degrees). */ + AUTOMATIC_DIRECTION, /* Horizontal angle between the listener's forward vector and the vector pointing from the listener to the event (-180 to 180 degrees). */ + AUTOMATIC_ELEVATION, /* Angle between the listener's XZ plane and the vector pointing from the listener to the event (-90 to 90 degrees). */ + AUTOMATIC_LISTENER_ORIENTATION, /* Horizontal angle between the listener's forward vector and the global positive Z axis (-180 to 180 degrees). */ + AUTOMATIC_SPEED, /* Magnitude of the relative velocity of the event and the listener */ + MAX + } + + [Flags] + public enum PARAMETER_FLAGS : uint + { + READONLY = 0x00000001, /* The parameter is read-only. Its value cannot be set from the API. */ + AUTOMATIC = 0x00000002, /* The parameter is automatic. See FMOD_STUDIO_PARAMETER_TYPE. */ + GLOBAL = 0x00000004, /* The parameter is global. All instances share the same value. */ + } + + [StructLayout(LayoutKind.Sequential)] + public struct PARAMETER_ID + { + public uint data1; /* The first half of the ID. */ + public uint data2; /* The second half of the ID. */ + } + + [StructLayout(LayoutKind.Sequential)] + public struct PARAMETER_DESCRIPTION + { + public StringWrapper name; /* Name of the parameter. */ + public PARAMETER_ID id; /* ID of the parameter. */ + public float minimum; /* Minimum parameter value. */ + public float maximum; /* Maximum parameter value. */ + public float defaultvalue; /* Default parameter value. */ + public PARAMETER_TYPE type; /* Type of the parameter. */ + public PARAMETER_FLAGS flags; /* Flags describing the behavior of the parameter. */ + } + + // This is only need for loading memory and given our C# wrapper LOAD_MEMORY_POINT isn't feasible anyway + enum LOAD_MEMORY_MODE : int + { + LOAD_MEMORY, + LOAD_MEMORY_POINT, + } + + enum LOAD_MEMORY_ALIGNMENT : int + { + VALUE = 32 + } + + [StructLayout(LayoutKind.Sequential)] + public struct SOUND_INFO + { + public IntPtr name_or_data; /* The filename or memory buffer that contains the sound. */ + public MODE mode; /* Mode flags required for loading the sound. */ + public CREATESOUNDEXINFO exinfo; /* Extra information required for loading the sound. */ + public int subsoundindex; /* Subsound index for loading the sound. */ + + public string name + { + get + { + using (StringHelper.ThreadSafeEncoding encoding = StringHelper.GetFreeHelper()) + { + return ((mode & (MODE.OPENMEMORY | MODE.OPENMEMORY_POINT)) == 0) ? encoding.stringFromNative(name_or_data) : String.Empty; + } + } + } + } + + public enum USER_PROPERTY_TYPE : int + { + INTEGER, /* Integer property */ + BOOLEAN, /* Boolean property */ + FLOAT, /* Float property */ + STRING, /* String property */ + } + + [StructLayout(LayoutKind.Sequential)] + public struct USER_PROPERTY + { + public StringWrapper name; /* Name of the user property. */ + public USER_PROPERTY_TYPE type; /* Type of the user property. Use this to select one of the following values. */ + private Union_IntBoolFloatString value; + + public int intValue() { return (type == USER_PROPERTY_TYPE.INTEGER) ? value.intvalue : -1; } + public bool boolValue() { return (type == USER_PROPERTY_TYPE.BOOLEAN) ? value.boolvalue : false; } + public float floatValue() { return (type == USER_PROPERTY_TYPE.FLOAT) ? value.floatvalue : -1; } + public string stringValue() { return (type == USER_PROPERTY_TYPE.STRING) ? value.stringvalue : ""; } + }; + + [StructLayout(LayoutKind.Explicit)] + struct Union_IntBoolFloatString + { + [FieldOffset(0)] + public int intvalue; + [FieldOffset(0)] + public bool boolvalue; + [FieldOffset(0)] + public float floatvalue; + [FieldOffset(0)] + public StringWrapper stringvalue; + } + + [Flags] + public enum INITFLAGS : uint + { + NORMAL = 0x00000000, /* Initialize normally. */ + LIVEUPDATE = 0x00000001, /* Enable live update. */ + ALLOW_MISSING_PLUGINS = 0x00000002, /* Load banks even if they reference plugins that have not been loaded. */ + SYNCHRONOUS_UPDATE = 0x00000004, /* Disable asynchronous processing and perform all processing on the calling thread instead. */ + DEFERRED_CALLBACKS = 0x00000008, /* Defer timeline callbacks until the main update. See Studio::EventInstance::setCallback for more information. */ + LOAD_FROM_UPDATE = 0x00000010, /* No additional threads are created for bank and resource loading. Loading is driven from Studio::System::update. Mainly used in non-realtime situations. */ + } + + [Flags] + public enum LOAD_BANK_FLAGS : uint + { + NORMAL = 0x00000000, /* Standard behaviour. */ + NONBLOCKING = 0x00000001, /* Bank loading occurs asynchronously rather than occurring immediately. */ + DECOMPRESS_SAMPLES = 0x00000002, /* Force samples to decompress into memory when they are loaded, rather than staying compressed. */ + UNENCRYPTED = 0x00000004, /* Ignore the encryption key specified by Studio::System::setAdvancedSettings when loading sounds from this bank. */ + } + + [Flags] + public enum COMMANDCAPTURE_FLAGS : uint + { + NORMAL = 0x00000000, /* Standard behaviour. */ + FILEFLUSH = 0x00000001, /* Call file flush on every command. */ + SKIP_INITIAL_STATE = 0x00000002, /* Normally the initial state of banks and instances is captured, unless this flag is set. */ + } + + [Flags] + public enum COMMANDREPLAY_FLAGS : uint + { + NORMAL = 0x00000000, /* Standard behaviour. */ + SKIP_CLEANUP = 0x00000001, /* Normally the playback will release any created resources when it stops, unless this flag is set. */ + FAST_FORWARD = 0x00000002, /* Play back at maximum speed, ignoring the timing of the original replay. */ + SKIP_BANK_LOAD = 0x00000004, /* Skip commands related to bank loading. */ + } + + public enum PLAYBACK_STATE : int + { + PLAYING, /* Currently playing. */ + SUSTAINING, /* The timeline cursor is paused on a sustain point. */ + STOPPED, /* Not playing. */ + STARTING, /* Start has been called but the instance is not fully started yet. */ + STOPPING, /* Stop has been called but the instance is not fully stopped yet. */ + } + + public enum EVENT_PROPERTY : int + { + CHANNELPRIORITY, /* Priority to set on low-level channels created by this event instance (-1 to 256). */ + SCHEDULE_DELAY, /* Schedule delay to synchronized playback for multiple tracks in DS clocks, or -1 for default. */ + SCHEDULE_LOOKAHEAD, /* Schedule look-ahead on the timeline in DSP clocks, or -1 for default. */ + MINIMUM_DISTANCE, /* Override the event's 3D minimum distance, or -1 for default. */ + MAXIMUM_DISTANCE, /* Override the event's 3D maximum distance, or -1 for default. */ + MAX + }; + + [StructLayout(LayoutKind.Sequential)] + public struct PLUGIN_INSTANCE_PROPERTIES + { + public IntPtr name; /* The name of the plugin effect or sound (set in FMOD Studio). */ + public IntPtr dsp; /* The DSP plugin instance. This can be cast to/from FMOD::DSP* type. */ + } + + [Flags] + public enum EVENT_CALLBACK_TYPE : uint + { + CREATED = 0x00000001, /* Called when an instance is fully created. Parameters = unused. */ + DESTROYED = 0x00000002, /* Called when an instance is just about to be destroyed. Parameters = unused. */ + STARTING = 0x00000004, /* Called when an instance is preparing to start. Parameters = unused. */ + STARTED = 0x00000008, /* Called when an instance starts playing. Parameters = unused. */ + RESTARTED = 0x00000010, /* Called when an instance is restarted. Parameters = unused. */ + STOPPED = 0x00000020, /* Called when an instance stops. Parameters = unused. */ + START_FAILED = 0x00000040, /* Called when an instance did not start, e.g. due to polyphony. Parameters = unused. */ + CREATE_PROGRAMMER_SOUND = 0x00000080, /* Called when a programmer sound needs to be created in order to play a programmer instrument. Parameters = FMOD_STUDIO_PROGRAMMER_SOUND_PROPERTIES. */ + DESTROY_PROGRAMMER_SOUND = 0x00000100, /* Called when a programmer sound needs to be destroyed. Parameters = FMOD_STUDIO_PROGRAMMER_SOUND_PROPERTIES. */ + PLUGIN_CREATED = 0x00000200, /* Called when a DSP plugin instance has just been created. Parameters = FMOD_STUDIO_PLUGIN_INSTANCE_PROPERTIES. */ + PLUGIN_DESTROYED = 0x00000400, /* Called when a DSP plugin instance is about to be destroyed. Parameters = FMOD_STUDIO_PLUGIN_INSTANCE_PROPERTIES. */ + TIMELINE_MARKER = 0x00000800, /* Called when the timeline passes a named marker. Parameters = FMOD_STUDIO_TIMELINE_MARKER_PROPERTIES. */ + TIMELINE_BEAT = 0x00001000, /* Called when the timeline hits a beat in a tempo section. Parameters = FMOD_STUDIO_TIMELINE_BEAT_PROPERTIES. */ + SOUND_PLAYED = 0x00002000, /* Called when the event plays a sound. Parameters = FMOD::Sound. */ + SOUND_STOPPED = 0x00004000, /* Called when the event finishes playing a sound. Parameters = FMOD::Sound. */ + REAL_TO_VIRTUAL = 0x00008000, /* Called when the event becomes virtual. Parameters = unused. */ + VIRTUAL_TO_REAL = 0x00010000, /* Called when the event becomes real. Parameters = unused. */ + + ALL = 0xFFFFFFFF, /* Pass this mask to Studio::EventDescription::setCallback or Studio::EventInstance::setCallback to receive all callback types. */ + } + + public delegate RESULT EVENT_CALLBACK(EVENT_CALLBACK_TYPE type, EventInstance _event, IntPtr parameters); + + public delegate RESULT COMMANDREPLAY_FRAME_CALLBACK(CommandReplay replay, int commandindex, float currenttime, IntPtr userdata); + public delegate RESULT COMMANDREPLAY_LOAD_BANK_CALLBACK(CommandReplay replay, int commandindex, Guid bankguid, StringWrapper bankfilename, LOAD_BANK_FLAGS flags, out Bank bank, IntPtr userdata); + public delegate RESULT COMMANDREPLAY_CREATE_INSTANCE_CALLBACK(CommandReplay replay, int commandindex, EventDescription eventdescription, out EventInstance instance, IntPtr userdata); + + public enum INSTANCETYPE : int + { + NONE, + SYSTEM, + EVENTDESCRIPTION, + EVENTINSTANCE, + PARAMETERINSTANCE, + BUS, + VCA, + BANK, + COMMANDREPLAY, + } + + [StructLayout(LayoutKind.Sequential)] + public struct COMMAND_INFO + { + public StringWrapper commandname; /* The full name of the API function for this command. */ + public int parentcommandindex; /* For commands that operate on an instance, this is the command that created the instance */ + public int framenumber; /* The frame the command belongs to */ + public float frametime; /* The playback time at which this command will be executed */ + public INSTANCETYPE instancetype; /* The type of object that this command uses as an instance */ + public INSTANCETYPE outputtype; /* The type of object that this command outputs, if any */ + public UInt32 instancehandle; /* The original handle value of the instance. This will no longer correspond to any actual object in playback. */ + public UInt32 outputhandle; /* The original handle value of the command output. This will no longer correspond to any actual object in playback. */ + } + + public struct Util + { + public static RESULT parseID(string idString, out Guid id) + { + using (StringHelper.ThreadSafeEncoding encoder = StringHelper.GetFreeHelper()) + { + return FMOD_Studio_ParseID(encoder.byteFromStringUTF8(idString), out id); + } + } + + #region importfunctions + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_ParseID(byte[] idString, out Guid id); + #endregion + } + + public struct System + { + // Initialization / system functions. + public static RESULT create(out System system) + { + return FMOD_Studio_System_Create(out system.handle, VERSION.number); + } + public RESULT setAdvancedSettings(ADVANCEDSETTINGS settings) + { + settings.cbsize = Marshal.SizeOf(typeof(ADVANCEDSETTINGS)); + return FMOD_Studio_System_SetAdvancedSettings(this.handle, ref settings); + } + public RESULT getAdvancedSettings(out ADVANCEDSETTINGS settings) + { + settings.cbsize = Marshal.SizeOf(typeof(ADVANCEDSETTINGS)); + return FMOD_Studio_System_GetAdvancedSettings(this.handle, out settings); + } + public RESULT initialize(int maxchannels, INITFLAGS studioflags, FMOD.INITFLAGS flags, IntPtr extradriverdata) + { + return FMOD_Studio_System_Initialize(this.handle, maxchannels, studioflags, flags, extradriverdata); + } + public RESULT release() + { + return FMOD_Studio_System_Release(this.handle); + } + public RESULT update() + { + return FMOD_Studio_System_Update(this.handle); + } + public RESULT getCoreSystem(out FMOD.System coresystem) + { + return FMOD_Studio_System_GetCoreSystem(this.handle, out coresystem.handle); + } + public RESULT getEvent(string path, out EventDescription _event) + { + using (StringHelper.ThreadSafeEncoding encoder = StringHelper.GetFreeHelper()) + { + return FMOD_Studio_System_GetEvent(this.handle, encoder.byteFromStringUTF8(path), out _event.handle); + } + } + public RESULT getBus(string path, out Bus bus) + { + using (StringHelper.ThreadSafeEncoding encoder = StringHelper.GetFreeHelper()) + { + return FMOD_Studio_System_GetBus(this.handle, encoder.byteFromStringUTF8(path), out bus.handle); + } + } + public RESULT getVCA(string path, out VCA vca) + { + using (StringHelper.ThreadSafeEncoding encoder = StringHelper.GetFreeHelper()) + { + return FMOD_Studio_System_GetVCA(this.handle, encoder.byteFromStringUTF8(path), out vca.handle); + } + } + public RESULT getBank(string path, out Bank bank) + { + using (StringHelper.ThreadSafeEncoding encoder = StringHelper.GetFreeHelper()) + { + return FMOD_Studio_System_GetBank(this.handle, encoder.byteFromStringUTF8(path), out bank.handle); + } + } + + public RESULT getEventByID(Guid id, out EventDescription _event) + { + return FMOD_Studio_System_GetEventByID(this.handle, ref id, out _event.handle); + } + public RESULT getBusByID(Guid id, out Bus bus) + { + return FMOD_Studio_System_GetBusByID(this.handle, ref id, out bus.handle); + } + public RESULT getVCAByID(Guid id, out VCA vca) + { + return FMOD_Studio_System_GetVCAByID(this.handle, ref id, out vca.handle); + } + public RESULT getBankByID(Guid id, out Bank bank) + { + return FMOD_Studio_System_GetBankByID(this.handle, ref id, out bank.handle); + } + public RESULT getSoundInfo(string key, out SOUND_INFO info) + { + using (StringHelper.ThreadSafeEncoding encoder = StringHelper.GetFreeHelper()) + { + return FMOD_Studio_System_GetSoundInfo(this.handle, encoder.byteFromStringUTF8(key), out info); + } + } + public RESULT getParameterDescriptionByName(string name, out PARAMETER_DESCRIPTION parameter) + { + using (StringHelper.ThreadSafeEncoding encoder = StringHelper.GetFreeHelper()) + { + return FMOD_Studio_System_GetParameterDescriptionByName(this.handle, encoder.byteFromStringUTF8(name), out parameter); + } + } + public RESULT getParameterDescriptionByID(PARAMETER_ID id, out PARAMETER_DESCRIPTION parameter) + { + return FMOD_Studio_System_GetParameterDescriptionByID(this.handle, id, out parameter); + } + public RESULT getParameterByID(PARAMETER_ID id, out float value) + { + float finalValue; + return getParameterByID(id, out value, out finalValue); + } + public RESULT getParameterByID(PARAMETER_ID id, out float value, out float finalvalue) + { + return FMOD_Studio_System_GetParameterByID(this.handle, id, out value, out finalvalue); + } + public RESULT setParameterByID(PARAMETER_ID id, float value, bool ignoreseekspeed = false) + { + return FMOD_Studio_System_SetParameterByID(this.handle, id, value, ignoreseekspeed); + } + public RESULT setParametersByIDs(PARAMETER_ID[] ids, float[] values, int count, bool ignoreseekspeed = false) + { + return FMOD_Studio_System_SetParametersByIDs(this.handle, ids, values, count, ignoreseekspeed); + } + public RESULT getParameterByName(string name, out float value) + { + float finalValue; + return getParameterByName(name, out value, out finalValue); + } + public RESULT getParameterByName(string name, out float value, out float finalvalue) + { + using (StringHelper.ThreadSafeEncoding encoder = StringHelper.GetFreeHelper()) + { + return FMOD_Studio_System_GetParameterByName(this.handle, encoder.byteFromStringUTF8(name), out value, out finalvalue); + } + } + public RESULT setParameterByName(string name, float value, bool ignoreseekspeed = false) + { + using (StringHelper.ThreadSafeEncoding encoder = StringHelper.GetFreeHelper()) + { + return FMOD_Studio_System_SetParameterByName(this.handle, encoder.byteFromStringUTF8(name), value, ignoreseekspeed); + } + } + public RESULT lookupID(string path, out Guid id) + { + using (StringHelper.ThreadSafeEncoding encoder = StringHelper.GetFreeHelper()) + { + return FMOD_Studio_System_LookupID(this.handle, encoder.byteFromStringUTF8(path), out id); + } + } + public RESULT lookupPath(Guid id, out string path) + { + path = null; + + using (StringHelper.ThreadSafeEncoding encoder = StringHelper.GetFreeHelper()) + { + IntPtr stringMem = Marshal.AllocHGlobal(256); + int retrieved = 0; + RESULT result = FMOD_Studio_System_LookupPath(this.handle, ref id, stringMem, 256, out retrieved); + + if (result == RESULT.ERR_TRUNCATED) + { + Marshal.FreeHGlobal(stringMem); + stringMem = Marshal.AllocHGlobal(retrieved); + result = FMOD_Studio_System_LookupPath(this.handle, ref id, stringMem, retrieved, out retrieved); + } + + if (result == RESULT.OK) + { + path = encoder.stringFromNative(stringMem); + } + Marshal.FreeHGlobal(stringMem); + return result; + } + } + public RESULT getNumListeners(out int numlisteners) + { + return FMOD_Studio_System_GetNumListeners(this.handle, out numlisteners); + } + public RESULT setNumListeners(int numlisteners) + { + return FMOD_Studio_System_SetNumListeners(this.handle, numlisteners); + } + public RESULT getListenerAttributes(int listener, out ATTRIBUTES_3D attributes) + { + return FMOD_Studio_System_GetListenerAttributes(this.handle, listener, out attributes); + } + public RESULT setListenerAttributes(int listener, ATTRIBUTES_3D attributes) + { + return FMOD_Studio_System_SetListenerAttributes(this.handle, listener, ref attributes); + } + public RESULT getListenerWeight(int listener, out float weight) + { + return FMOD_Studio_System_GetListenerWeight(this.handle, listener, out weight); + } + public RESULT setListenerWeight(int listener, float weight) + { + return FMOD_Studio_System_SetListenerWeight(this.handle, listener, weight); + } + public RESULT loadBankFile(string filename, LOAD_BANK_FLAGS flags, out Bank bank) + { + using (StringHelper.ThreadSafeEncoding encoder = StringHelper.GetFreeHelper()) + { + return FMOD_Studio_System_LoadBankFile(this.handle, encoder.byteFromStringUTF8(filename), flags, out bank.handle); + } + } + public RESULT loadBankMemory(byte[] buffer, LOAD_BANK_FLAGS flags, out Bank bank) + { + // Manually pin the byte array. It's what the marshaller should do anyway but don't leave it to chance. + GCHandle pinnedArray = GCHandle.Alloc(buffer, GCHandleType.Pinned); + IntPtr pointer = pinnedArray.AddrOfPinnedObject(); + RESULT result = FMOD_Studio_System_LoadBankMemory(this.handle, pointer, buffer.Length, LOAD_MEMORY_MODE.LOAD_MEMORY, flags, out bank.handle); + pinnedArray.Free(); + return result; + } + public RESULT loadBankCustom(BANK_INFO info, LOAD_BANK_FLAGS flags, out Bank bank) + { + info.size = Marshal.SizeOf(info); + return FMOD_Studio_System_LoadBankCustom(this.handle, ref info, flags, out bank.handle); + } + public RESULT unloadAll() + { + return FMOD_Studio_System_UnloadAll(this.handle); + } + public RESULT flushCommands() + { + return FMOD_Studio_System_FlushCommands(this.handle); + } + public RESULT flushSampleLoading() + { + return FMOD_Studio_System_FlushSampleLoading(this.handle); + } + public RESULT startCommandCapture(string filename, COMMANDCAPTURE_FLAGS flags) + { + using (StringHelper.ThreadSafeEncoding encoder = StringHelper.GetFreeHelper()) + { + return FMOD_Studio_System_StartCommandCapture(this.handle, encoder.byteFromStringUTF8(filename), flags); + } + } + public RESULT stopCommandCapture() + { + return FMOD_Studio_System_StopCommandCapture(this.handle); + } + public RESULT loadCommandReplay(string filename, COMMANDREPLAY_FLAGS flags, out CommandReplay replay) + { + using (StringHelper.ThreadSafeEncoding encoder = StringHelper.GetFreeHelper()) + { + return FMOD_Studio_System_LoadCommandReplay(this.handle, encoder.byteFromStringUTF8(filename), flags, out replay.handle); + } + } + public RESULT getBankCount(out int count) + { + return FMOD_Studio_System_GetBankCount(this.handle, out count); + } + public RESULT getBankList(out Bank[] array) + { + array = null; + + RESULT result; + int capacity; + result = FMOD_Studio_System_GetBankCount(this.handle, out capacity); + if (result != RESULT.OK) + { + return result; + } + if (capacity == 0) + { + array = new Bank[0]; + return result; + } + + IntPtr[] rawArray = new IntPtr[capacity]; + int actualCount; + result = FMOD_Studio_System_GetBankList(this.handle, rawArray, capacity, out actualCount); + if (result != RESULT.OK) + { + return result; + } + if (actualCount > capacity) // More items added since we queried just now? + { + actualCount = capacity; + } + array = new Bank[actualCount]; + for (int i = 0; i < actualCount; ++i) + { + array[i].handle = rawArray[i]; + } + return RESULT.OK; + } + public RESULT getParameterDescriptionCount(out int count) + { + return FMOD_Studio_System_GetParameterDescriptionCount(this.handle, out count); + } + public RESULT getParameterDescriptionList(out PARAMETER_DESCRIPTION[] array) + { + array = null; + + int capacity; + RESULT result = FMOD_Studio_System_GetParameterDescriptionCount(this.handle, out capacity); + if (result != RESULT.OK) + { + return result; + } + if (capacity == 0) + { + array = new PARAMETER_DESCRIPTION[0]; + return RESULT.OK; + } + + PARAMETER_DESCRIPTION[] tempArray = new PARAMETER_DESCRIPTION[capacity]; + int actualCount; + result = FMOD_Studio_System_GetParameterDescriptionList(this.handle, tempArray, capacity, out actualCount); + if (result != RESULT.OK) + { + return result; + } + + if (actualCount != capacity) + { + Array.Resize(ref tempArray, actualCount); + } + + array = tempArray; + + return RESULT.OK; + } + public RESULT getCPUUsage(out CPU_USAGE usage) + { + return FMOD_Studio_System_GetCPUUsage(this.handle, out usage); + } + public RESULT getBufferUsage(out BUFFER_USAGE usage) + { + return FMOD_Studio_System_GetBufferUsage(this.handle, out usage); + } + public RESULT resetBufferUsage() + { + return FMOD_Studio_System_ResetBufferUsage(this.handle); + } + + public RESULT setCallback(SYSTEM_CALLBACK callback, SYSTEM_CALLBACK_TYPE callbackmask = SYSTEM_CALLBACK_TYPE.ALL) + { + return FMOD_Studio_System_SetCallback(this.handle, callback, callbackmask); + } + + public RESULT getUserData(out IntPtr userdata) + { + return FMOD_Studio_System_GetUserData(this.handle, out userdata); + } + + public RESULT setUserData(IntPtr userdata) + { + return FMOD_Studio_System_SetUserData(this.handle, userdata); + } + + #region importfunctions + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_System_Create (out IntPtr system, uint headerversion); + [DllImport(STUDIO_VERSION.dll)] + private static extern bool FMOD_Studio_System_IsValid (IntPtr system); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_System_SetAdvancedSettings (IntPtr system, ref ADVANCEDSETTINGS settings); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_System_GetAdvancedSettings (IntPtr system, out ADVANCEDSETTINGS settings); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_System_Initialize (IntPtr system, int maxchannels, INITFLAGS studioflags, FMOD.INITFLAGS flags, IntPtr extradriverdata); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_System_Release (IntPtr system); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_System_Update (IntPtr system); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_System_GetCoreSystem (IntPtr system, out IntPtr coresystem); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_System_GetEvent (IntPtr system, byte[] path, out IntPtr _event); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_System_GetBus (IntPtr system, byte[] path, out IntPtr bus); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_System_GetVCA (IntPtr system, byte[] path, out IntPtr vca); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_System_GetBank (IntPtr system, byte[] path, out IntPtr bank); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_System_GetEventByID (IntPtr system, ref Guid id, out IntPtr _event); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_System_GetBusByID (IntPtr system, ref Guid id, out IntPtr bus); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_System_GetVCAByID (IntPtr system, ref Guid id, out IntPtr vca); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_System_GetBankByID (IntPtr system, ref Guid id, out IntPtr bank); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_System_GetSoundInfo (IntPtr system, byte[] key, out SOUND_INFO info); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_System_GetParameterDescriptionByName(IntPtr system, byte[] name, out PARAMETER_DESCRIPTION parameter); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_System_GetParameterDescriptionByID(IntPtr system, PARAMETER_ID id, out PARAMETER_DESCRIPTION parameter); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_System_GetParameterByID (IntPtr system, PARAMETER_ID id, out float value, out float finalvalue); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_System_SetParameterByID (IntPtr system, PARAMETER_ID id, float value, bool ignoreseekspeed); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_System_SetParametersByIDs (IntPtr system, PARAMETER_ID[] ids, float[] values, int count, bool ignoreseekspeed); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_System_GetParameterByName (IntPtr system, byte[] name, out float value, out float finalvalue); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_System_SetParameterByName (IntPtr system, byte[] name, float value, bool ignoreseekspeed); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_System_LookupID (IntPtr system, byte[] path, out Guid id); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_System_LookupPath (IntPtr system, ref Guid id, IntPtr path, int size, out int retrieved); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_System_GetNumListeners (IntPtr system, out int numlisteners); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_System_SetNumListeners (IntPtr system, int numlisteners); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_System_GetListenerAttributes (IntPtr system, int listener, out ATTRIBUTES_3D attributes); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_System_SetListenerAttributes (IntPtr system, int listener, ref ATTRIBUTES_3D attributes); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_System_GetListenerWeight (IntPtr system, int listener, out float weight); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_System_SetListenerWeight (IntPtr system, int listener, float weight); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_System_LoadBankFile (IntPtr system, byte[] filename, LOAD_BANK_FLAGS flags, out IntPtr bank); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_System_LoadBankMemory (IntPtr system, IntPtr buffer, int length, LOAD_MEMORY_MODE mode, LOAD_BANK_FLAGS flags, out IntPtr bank); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_System_LoadBankCustom (IntPtr system, ref BANK_INFO info, LOAD_BANK_FLAGS flags, out IntPtr bank); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_System_UnloadAll (IntPtr system); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_System_FlushCommands (IntPtr system); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_System_FlushSampleLoading (IntPtr system); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_System_StartCommandCapture (IntPtr system, byte[] filename, COMMANDCAPTURE_FLAGS flags); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_System_StopCommandCapture (IntPtr system); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_System_LoadCommandReplay (IntPtr system, byte[] filename, COMMANDREPLAY_FLAGS flags, out IntPtr replay); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_System_GetBankCount (IntPtr system, out int count); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_System_GetBankList (IntPtr system, IntPtr[] array, int capacity, out int count); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_System_GetParameterDescriptionCount(IntPtr system, out int count); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_System_GetParameterDescriptionList(IntPtr system, [Out] PARAMETER_DESCRIPTION[] array, int capacity, out int count); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_System_GetCPUUsage (IntPtr system, out CPU_USAGE usage); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_System_GetBufferUsage (IntPtr system, out BUFFER_USAGE usage); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_System_ResetBufferUsage (IntPtr system); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_System_SetCallback (IntPtr system, SYSTEM_CALLBACK callback, SYSTEM_CALLBACK_TYPE callbackmask); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_System_GetUserData (IntPtr system, out IntPtr userdata); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_System_SetUserData (IntPtr system, IntPtr userdata); + #endregion + + #region wrapperinternal + + public IntPtr handle; + + public bool hasHandle() { return this.handle != IntPtr.Zero; } + public void clearHandle() { this.handle = IntPtr.Zero; } + + public bool isValid() + { + return hasHandle() && FMOD_Studio_System_IsValid(this.handle); + } + + #endregion + } + + public struct EventDescription + { + public RESULT getID(out Guid id) + { + return FMOD_Studio_EventDescription_GetID(this.handle, out id); + } + public RESULT getPath(out string path) + { + path = null; + + using (StringHelper.ThreadSafeEncoding encoder = StringHelper.GetFreeHelper()) + { + IntPtr stringMem = Marshal.AllocHGlobal(256); + int retrieved = 0; + RESULT result = FMOD_Studio_EventDescription_GetPath(this.handle, stringMem, 256, out retrieved); + + if (result == RESULT.ERR_TRUNCATED) + { + Marshal.FreeHGlobal(stringMem); + stringMem = Marshal.AllocHGlobal(retrieved); + result = FMOD_Studio_EventDescription_GetPath(this.handle, stringMem, retrieved, out retrieved); + } + + if (result == RESULT.OK) + { + path = encoder.stringFromNative(stringMem); + } + Marshal.FreeHGlobal(stringMem); + return result; + } + } + public RESULT getParameterDescriptionCount(out int count) + { + return FMOD_Studio_EventDescription_GetParameterDescriptionCount(this.handle, out count); + } + public RESULT getParameterDescriptionByIndex(int index, out PARAMETER_DESCRIPTION parameter) + { + return FMOD_Studio_EventDescription_GetParameterDescriptionByIndex(this.handle, index, out parameter); + } + public RESULT getParameterDescriptionByName(string name, out PARAMETER_DESCRIPTION parameter) + { + using (StringHelper.ThreadSafeEncoding encoder = StringHelper.GetFreeHelper()) + { + return FMOD_Studio_EventDescription_GetParameterDescriptionByName(this.handle, encoder.byteFromStringUTF8(name), out parameter); + } + } + public RESULT getParameterDescriptionByID(PARAMETER_ID id, out PARAMETER_DESCRIPTION parameter) + { + return FMOD_Studio_EventDescription_GetParameterDescriptionByID(this.handle, id, out parameter); + } + public RESULT getUserPropertyCount(out int count) + { + return FMOD_Studio_EventDescription_GetUserPropertyCount(this.handle, out count); + } + public RESULT getUserPropertyByIndex(int index, out USER_PROPERTY property) + { + return FMOD_Studio_EventDescription_GetUserPropertyByIndex(this.handle, index, out property); + } + public RESULT getUserProperty(string name, out USER_PROPERTY property) + { + using (StringHelper.ThreadSafeEncoding encoder = StringHelper.GetFreeHelper()) + { + return FMOD_Studio_EventDescription_GetUserProperty(this.handle, encoder.byteFromStringUTF8(name), out property); + } + } + public RESULT getLength(out int length) + { + return FMOD_Studio_EventDescription_GetLength(this.handle, out length); + } + public RESULT getMinimumDistance(out float distance) + { + return FMOD_Studio_EventDescription_GetMinimumDistance(this.handle, out distance); + } + public RESULT getMaximumDistance(out float distance) + { + return FMOD_Studio_EventDescription_GetMaximumDistance(this.handle, out distance); + } + public RESULT getSoundSize(out float size) + { + return FMOD_Studio_EventDescription_GetSoundSize(this.handle, out size); + } + public RESULT isSnapshot(out bool snapshot) + { + return FMOD_Studio_EventDescription_IsSnapshot(this.handle, out snapshot); + } + public RESULT isOneshot(out bool oneshot) + { + return FMOD_Studio_EventDescription_IsOneshot(this.handle, out oneshot); + } + public RESULT isStream(out bool isStream) + { + return FMOD_Studio_EventDescription_IsStream(this.handle, out isStream); + } + public RESULT is3D(out bool is3D) + { + return FMOD_Studio_EventDescription_Is3D(this.handle, out is3D); + } + public RESULT hasCue(out bool cue) + { + return FMOD_Studio_EventDescription_HasCue(this.handle, out cue); + } + + public RESULT createInstance(out EventInstance instance) + { + return FMOD_Studio_EventDescription_CreateInstance(this.handle, out instance.handle); + } + + public RESULT getInstanceCount(out int count) + { + return FMOD_Studio_EventDescription_GetInstanceCount(this.handle, out count); + } + public RESULT getInstanceList(out EventInstance[] array) + { + array = null; + + RESULT result; + int capacity; + result = FMOD_Studio_EventDescription_GetInstanceCount(this.handle, out capacity); + if (result != RESULT.OK) + { + return result; + } + if (capacity == 0) + { + array = new EventInstance[0]; + return result; + } + + IntPtr[] rawArray = new IntPtr[capacity]; + int actualCount; + result = FMOD_Studio_EventDescription_GetInstanceList(this.handle, rawArray, capacity, out actualCount); + if (result != RESULT.OK) + { + return result; + } + if (actualCount > capacity) // More items added since we queried just now? + { + actualCount = capacity; + } + array = new EventInstance[actualCount]; + for (int i = 0; i < actualCount; ++i) + { + array[i].handle = rawArray[i]; + } + return RESULT.OK; + } + + public RESULT loadSampleData() + { + return FMOD_Studio_EventDescription_LoadSampleData(this.handle); + } + + public RESULT unloadSampleData() + { + return FMOD_Studio_EventDescription_UnloadSampleData(this.handle); + } + + public RESULT getSampleLoadingState(out LOADING_STATE state) + { + return FMOD_Studio_EventDescription_GetSampleLoadingState(this.handle, out state); + } + + public RESULT releaseAllInstances() + { + return FMOD_Studio_EventDescription_ReleaseAllInstances(this.handle); + } + public RESULT setCallback(EVENT_CALLBACK callback, EVENT_CALLBACK_TYPE callbackmask = EVENT_CALLBACK_TYPE.ALL) + { + return FMOD_Studio_EventDescription_SetCallback(this.handle, callback, callbackmask); + } + + public RESULT getUserData(out IntPtr userdata) + { + return FMOD_Studio_EventDescription_GetUserData(this.handle, out userdata); + } + + public RESULT setUserData(IntPtr userdata) + { + return FMOD_Studio_EventDescription_SetUserData(this.handle, userdata); + } + + #region importfunctions + [DllImport(STUDIO_VERSION.dll)] + private static extern bool FMOD_Studio_EventDescription_IsValid (IntPtr eventdescription); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_EventDescription_GetID (IntPtr eventdescription, out Guid id); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_EventDescription_GetPath (IntPtr eventdescription, IntPtr path, int size, out int retrieved); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_EventDescription_GetParameterDescriptionCount(IntPtr eventdescription, out int count); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_EventDescription_GetParameterDescriptionByIndex(IntPtr eventdescription, int index, out PARAMETER_DESCRIPTION parameter); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_EventDescription_GetParameterDescriptionByName(IntPtr eventdescription, byte[] name, out PARAMETER_DESCRIPTION parameter); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_EventDescription_GetParameterDescriptionByID(IntPtr eventdescription, PARAMETER_ID id, out PARAMETER_DESCRIPTION parameter); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_EventDescription_GetUserPropertyCount (IntPtr eventdescription, out int count); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_EventDescription_GetUserPropertyByIndex(IntPtr eventdescription, int index, out USER_PROPERTY property); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_EventDescription_GetUserProperty (IntPtr eventdescription, byte[] name, out USER_PROPERTY property); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_EventDescription_GetLength (IntPtr eventdescription, out int length); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_EventDescription_GetMinimumDistance (IntPtr eventdescription, out float distance); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_EventDescription_GetMaximumDistance (IntPtr eventdescription, out float distance); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_EventDescription_GetSoundSize (IntPtr eventdescription, out float size); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_EventDescription_IsSnapshot (IntPtr eventdescription, out bool snapshot); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_EventDescription_IsOneshot (IntPtr eventdescription, out bool oneshot); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_EventDescription_IsStream (IntPtr eventdescription, out bool isStream); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_EventDescription_Is3D (IntPtr eventdescription, out bool is3D); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_EventDescription_HasCue (IntPtr eventdescription, out bool cue); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_EventDescription_CreateInstance (IntPtr eventdescription, out IntPtr instance); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_EventDescription_GetInstanceCount (IntPtr eventdescription, out int count); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_EventDescription_GetInstanceList (IntPtr eventdescription, IntPtr[] array, int capacity, out int count); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_EventDescription_LoadSampleData (IntPtr eventdescription); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_EventDescription_UnloadSampleData (IntPtr eventdescription); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_EventDescription_GetSampleLoadingState (IntPtr eventdescription, out LOADING_STATE state); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_EventDescription_ReleaseAllInstances (IntPtr eventdescription); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_EventDescription_SetCallback (IntPtr eventdescription, EVENT_CALLBACK callback, EVENT_CALLBACK_TYPE callbackmask); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_EventDescription_GetUserData (IntPtr eventdescription, out IntPtr userdata); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_EventDescription_SetUserData (IntPtr eventdescription, IntPtr userdata); + #endregion + #region wrapperinternal + + public IntPtr handle; + + public bool hasHandle() { return this.handle != IntPtr.Zero; } + public void clearHandle() { this.handle = IntPtr.Zero; } + + public bool isValid() + { + return hasHandle() && FMOD_Studio_EventDescription_IsValid(this.handle); + } + + #endregion + } + + public struct EventInstance + { + public RESULT getDescription(out EventDescription description) + { + return FMOD_Studio_EventInstance_GetDescription(this.handle, out description.handle); + } + public RESULT getVolume(out float volume) + { + float finalVolume; + return getVolume(out volume, out finalVolume); + } + public RESULT getVolume(out float volume, out float finalvolume) + { + return FMOD_Studio_EventInstance_GetVolume(this.handle, out volume, out finalvolume); + } + public RESULT setVolume(float volume) + { + return FMOD_Studio_EventInstance_SetVolume(this.handle, volume); + } + public RESULT getPitch(out float pitch) + { + float finalPitch; + return getPitch(out pitch, out finalPitch); + } + public RESULT getPitch(out float pitch, out float finalpitch) + { + return FMOD_Studio_EventInstance_GetPitch(this.handle, out pitch, out finalpitch); + } + public RESULT setPitch(float pitch) + { + return FMOD_Studio_EventInstance_SetPitch(this.handle, pitch); + } + public RESULT get3DAttributes(out ATTRIBUTES_3D attributes) + { + return FMOD_Studio_EventInstance_Get3DAttributes(this.handle, out attributes); + } + public RESULT set3DAttributes(ATTRIBUTES_3D attributes) + { + return FMOD_Studio_EventInstance_Set3DAttributes(this.handle, ref attributes); + } + public RESULT getListenerMask(out uint mask) + { + return FMOD_Studio_EventInstance_GetListenerMask(this.handle, out mask); + } + public RESULT setListenerMask(uint mask) + { + return FMOD_Studio_EventInstance_SetListenerMask(this.handle, mask); + } + public RESULT getProperty(EVENT_PROPERTY index, out float value) + { + return FMOD_Studio_EventInstance_GetProperty(this.handle, index, out value); + } + public RESULT setProperty(EVENT_PROPERTY index, float value) + { + return FMOD_Studio_EventInstance_SetProperty(this.handle, index, value); + } + public RESULT getReverbLevel(int index, out float level) + { + return FMOD_Studio_EventInstance_GetReverbLevel(this.handle, index, out level); + } + public RESULT setReverbLevel(int index, float level) + { + return FMOD_Studio_EventInstance_SetReverbLevel(this.handle, index, level); + } + public RESULT getPaused(out bool paused) + { + return FMOD_Studio_EventInstance_GetPaused(this.handle, out paused); + } + public RESULT setPaused(bool paused) + { + return FMOD_Studio_EventInstance_SetPaused(this.handle, paused); + } + public RESULT start() + { + return FMOD_Studio_EventInstance_Start(this.handle); + } + public RESULT stop(STOP_MODE mode) + { + return FMOD_Studio_EventInstance_Stop(this.handle, mode); + } + public RESULT getTimelinePosition(out int position) + { + return FMOD_Studio_EventInstance_GetTimelinePosition(this.handle, out position); + } + public RESULT setTimelinePosition(int position) + { + return FMOD_Studio_EventInstance_SetTimelinePosition(this.handle, position); + } + public RESULT getPlaybackState(out PLAYBACK_STATE state) + { + return FMOD_Studio_EventInstance_GetPlaybackState(this.handle, out state); + } + public RESULT getChannelGroup(out FMOD.ChannelGroup group) + { + return FMOD_Studio_EventInstance_GetChannelGroup(this.handle, out group.handle); + } + public RESULT release() + { + return FMOD_Studio_EventInstance_Release(this.handle); + } + public RESULT isVirtual(out bool virtualstate) + { + return FMOD_Studio_EventInstance_IsVirtual(this.handle, out virtualstate); + } + public RESULT getParameterByID(PARAMETER_ID id, out float value) + { + float finalvalue; + return getParameterByID(id, out value, out finalvalue); + } + public RESULT getParameterByID(PARAMETER_ID id, out float value, out float finalvalue) + { + return FMOD_Studio_EventInstance_GetParameterByID(this.handle, id, out value, out finalvalue); + } + public RESULT setParameterByID(PARAMETER_ID id, float value, bool ignoreseekspeed = false) + { + return FMOD_Studio_EventInstance_SetParameterByID(this.handle, id, value, ignoreseekspeed); + } + public RESULT setParametersByIDs(PARAMETER_ID[] ids, float[] values, int count, bool ignoreseekspeed = false) + { + return FMOD_Studio_EventInstance_SetParametersByIDs(this.handle, ids, values, count, ignoreseekspeed); + } + public RESULT getParameterByName(string name, out float value) + { + float finalValue; + return getParameterByName(name, out value, out finalValue); + } + public RESULT getParameterByName(string name, out float value, out float finalvalue) + { + using (StringHelper.ThreadSafeEncoding encoder = StringHelper.GetFreeHelper()) + { + return FMOD_Studio_EventInstance_GetParameterByName(this.handle, encoder.byteFromStringUTF8(name), out value, out finalvalue); + } + } + public RESULT setParameterByName(string name, float value, bool ignoreseekspeed = false) + { + using (StringHelper.ThreadSafeEncoding encoder = StringHelper.GetFreeHelper()) + { + return FMOD_Studio_EventInstance_SetParameterByName(this.handle, encoder.byteFromStringUTF8(name), value, ignoreseekspeed); + } + } + public RESULT triggerCue() + { + return FMOD_Studio_EventInstance_TriggerCue(this.handle); + } + public RESULT setCallback(EVENT_CALLBACK callback, EVENT_CALLBACK_TYPE callbackmask = EVENT_CALLBACK_TYPE.ALL) + { + return FMOD_Studio_EventInstance_SetCallback(this.handle, callback, callbackmask); + } + public RESULT getUserData(out IntPtr userdata) + { + return FMOD_Studio_EventInstance_GetUserData(this.handle, out userdata); + } + public RESULT setUserData(IntPtr userdata) + { + return FMOD_Studio_EventInstance_SetUserData(this.handle, userdata); + } + + #region importfunctions + [DllImport(STUDIO_VERSION.dll)] + private static extern bool FMOD_Studio_EventInstance_IsValid (IntPtr _event); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_EventInstance_GetDescription (IntPtr _event, out IntPtr description); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_EventInstance_GetVolume (IntPtr _event, out float volume, out float finalvolume); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_EventInstance_SetVolume (IntPtr _event, float volume); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_EventInstance_GetPitch (IntPtr _event, out float pitch, out float finalpitch); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_EventInstance_SetPitch (IntPtr _event, float pitch); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_EventInstance_Get3DAttributes (IntPtr _event, out ATTRIBUTES_3D attributes); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_EventInstance_Set3DAttributes (IntPtr _event, ref ATTRIBUTES_3D attributes); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_EventInstance_GetListenerMask (IntPtr _event, out uint mask); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_EventInstance_SetListenerMask (IntPtr _event, uint mask); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_EventInstance_GetProperty (IntPtr _event, EVENT_PROPERTY index, out float value); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_EventInstance_SetProperty (IntPtr _event, EVENT_PROPERTY index, float value); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_EventInstance_GetReverbLevel (IntPtr _event, int index, out float level); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_EventInstance_SetReverbLevel (IntPtr _event, int index, float level); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_EventInstance_GetPaused (IntPtr _event, out bool paused); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_EventInstance_SetPaused (IntPtr _event, bool paused); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_EventInstance_Start (IntPtr _event); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_EventInstance_Stop (IntPtr _event, STOP_MODE mode); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_EventInstance_GetTimelinePosition (IntPtr _event, out int position); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_EventInstance_SetTimelinePosition (IntPtr _event, int position); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_EventInstance_GetPlaybackState (IntPtr _event, out PLAYBACK_STATE state); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_EventInstance_GetChannelGroup (IntPtr _event, out IntPtr group); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_EventInstance_Release (IntPtr _event); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_EventInstance_IsVirtual (IntPtr _event, out bool virtualstate); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_EventInstance_GetParameterByName (IntPtr _event, byte[] name, out float value, out float finalvalue); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_EventInstance_SetParameterByName (IntPtr _event, byte[] name, float value, bool ignoreseekspeed); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_EventInstance_GetParameterByID (IntPtr _event, PARAMETER_ID id, out float value, out float finalvalue); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_EventInstance_SetParameterByID (IntPtr _event, PARAMETER_ID id, float value, bool ignoreseekspeed); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_EventInstance_SetParametersByIDs (IntPtr _event, PARAMETER_ID[] ids, float[] values, int count, bool ignoreseekspeed); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_EventInstance_TriggerCue (IntPtr _event); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_EventInstance_SetCallback (IntPtr _event, EVENT_CALLBACK callback, EVENT_CALLBACK_TYPE callbackmask); + [DllImport (STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_EventInstance_GetUserData (IntPtr _event, out IntPtr userdata); + [DllImport (STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_EventInstance_SetUserData (IntPtr _event, IntPtr userdata); + #endregion + + #region wrapperinternal + + public IntPtr handle; + + public bool hasHandle() { return this.handle != IntPtr.Zero; } + public void clearHandle() { this.handle = IntPtr.Zero; } + + public bool isValid() + { + return hasHandle() && FMOD_Studio_EventInstance_IsValid(this.handle); + } + + #endregion + } + + public struct Bus + { + public RESULT getID(out Guid id) + { + return FMOD_Studio_Bus_GetID(this.handle, out id); + } + public RESULT getPath(out string path) + { + path = null; + + using (StringHelper.ThreadSafeEncoding encoder = StringHelper.GetFreeHelper()) + { + IntPtr stringMem = Marshal.AllocHGlobal(256); + int retrieved = 0; + RESULT result = FMOD_Studio_Bus_GetPath(this.handle, stringMem, 256, out retrieved); + + if (result == RESULT.ERR_TRUNCATED) + { + Marshal.FreeHGlobal(stringMem); + stringMem = Marshal.AllocHGlobal(retrieved); + result = FMOD_Studio_Bus_GetPath(this.handle, stringMem, retrieved, out retrieved); + } + + if (result == RESULT.OK) + { + path = encoder.stringFromNative(stringMem); + } + Marshal.FreeHGlobal(stringMem); + return result; + } + + } + public RESULT getVolume(out float volume) + { + float finalVolume; + return getVolume(out volume, out finalVolume); + } + public RESULT getVolume(out float volume, out float finalvolume) + { + return FMOD_Studio_Bus_GetVolume(this.handle, out volume, out finalvolume); + } + public RESULT setVolume(float volume) + { + return FMOD_Studio_Bus_SetVolume(this.handle, volume); + } + public RESULT getPaused(out bool paused) + { + return FMOD_Studio_Bus_GetPaused(this.handle, out paused); + } + public RESULT setPaused(bool paused) + { + return FMOD_Studio_Bus_SetPaused(this.handle, paused); + } + public RESULT getMute(out bool mute) + { + return FMOD_Studio_Bus_GetMute(this.handle, out mute); + } + public RESULT setMute(bool mute) + { + return FMOD_Studio_Bus_SetMute(this.handle, mute); + } + public RESULT stopAllEvents(STOP_MODE mode) + { + return FMOD_Studio_Bus_StopAllEvents(this.handle, mode); + } + public RESULT lockChannelGroup() + { + return FMOD_Studio_Bus_LockChannelGroup(this.handle); + } + public RESULT unlockChannelGroup() + { + return FMOD_Studio_Bus_UnlockChannelGroup(this.handle); + } + public RESULT getChannelGroup(out FMOD.ChannelGroup group) + { + return FMOD_Studio_Bus_GetChannelGroup(this.handle, out group.handle); + } + + #region importfunctions + [DllImport(STUDIO_VERSION.dll)] + private static extern bool FMOD_Studio_Bus_IsValid (IntPtr bus); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_Bus_GetID (IntPtr bus, out Guid id); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_Bus_GetPath (IntPtr bus, IntPtr path, int size, out int retrieved); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_Bus_GetVolume (IntPtr bus, out float volume, out float finalvolume); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_Bus_SetVolume (IntPtr bus, float volume); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_Bus_GetPaused (IntPtr bus, out bool paused); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_Bus_SetPaused (IntPtr bus, bool paused); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_Bus_GetMute (IntPtr bus, out bool mute); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_Bus_SetMute (IntPtr bus, bool mute); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_Bus_StopAllEvents (IntPtr bus, STOP_MODE mode); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_Bus_LockChannelGroup (IntPtr bus); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_Bus_UnlockChannelGroup (IntPtr bus); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_Bus_GetChannelGroup (IntPtr bus, out IntPtr group); + #endregion + + #region wrapperinternal + + public IntPtr handle; + + public bool hasHandle() { return this.handle != IntPtr.Zero; } + public void clearHandle() { this.handle = IntPtr.Zero; } + + public bool isValid() + { + return hasHandle() && FMOD_Studio_Bus_IsValid(this.handle); + } + + #endregion + } + + public struct VCA + { + public RESULT getID(out Guid id) + { + return FMOD_Studio_VCA_GetID(this.handle, out id); + } + public RESULT getPath(out string path) + { + path = null; + + using (StringHelper.ThreadSafeEncoding encoder = StringHelper.GetFreeHelper()) + { + IntPtr stringMem = Marshal.AllocHGlobal(256); + int retrieved = 0; + RESULT result = FMOD_Studio_VCA_GetPath(this.handle, stringMem, 256, out retrieved); + + if (result == RESULT.ERR_TRUNCATED) + { + Marshal.FreeHGlobal(stringMem); + stringMem = Marshal.AllocHGlobal(retrieved); + result = FMOD_Studio_VCA_GetPath(this.handle, stringMem, retrieved, out retrieved); + } + + if (result == RESULT.OK) + { + path = encoder.stringFromNative(stringMem); + } + Marshal.FreeHGlobal(stringMem); + return result; + } + } + public RESULT getVolume(out float volume) + { + float finalVolume; + return getVolume(out volume, out finalVolume); + } + public RESULT getVolume(out float volume, out float finalvolume) + { + return FMOD_Studio_VCA_GetVolume(this.handle, out volume, out finalvolume); + } + public RESULT setVolume(float volume) + { + return FMOD_Studio_VCA_SetVolume(this.handle, volume); + } + + #region importfunctions + [DllImport(STUDIO_VERSION.dll)] + private static extern bool FMOD_Studio_VCA_IsValid (IntPtr vca); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_VCA_GetID (IntPtr vca, out Guid id); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_VCA_GetPath (IntPtr vca, IntPtr path, int size, out int retrieved); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_VCA_GetVolume (IntPtr vca, out float volume, out float finalvolume); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_VCA_SetVolume (IntPtr vca, float volume); + #endregion + + #region wrapperinternal + + public IntPtr handle; + + public bool hasHandle() { return this.handle != IntPtr.Zero; } + public void clearHandle() { this.handle = IntPtr.Zero; } + + public bool isValid() + { + return hasHandle() && FMOD_Studio_VCA_IsValid(this.handle); + } + + #endregion + } + + public struct Bank + { + // Property access + + public RESULT getID(out Guid id) + { + return FMOD_Studio_Bank_GetID(this.handle, out id); + } + public RESULT getPath(out string path) + { + path = null; + + using (StringHelper.ThreadSafeEncoding encoder = StringHelper.GetFreeHelper()) + { + IntPtr stringMem = Marshal.AllocHGlobal(256); + int retrieved = 0; + RESULT result = FMOD_Studio_Bank_GetPath(this.handle, stringMem, 256, out retrieved); + + if (result == RESULT.ERR_TRUNCATED) + { + Marshal.FreeHGlobal(stringMem); + stringMem = Marshal.AllocHGlobal(retrieved); + result = FMOD_Studio_Bank_GetPath(this.handle, stringMem, retrieved, out retrieved); + } + + if (result == RESULT.OK) + { + path = encoder.stringFromNative(stringMem); + } + Marshal.FreeHGlobal(stringMem); + return result; + } + } + public RESULT unload() + { + return FMOD_Studio_Bank_Unload(this.handle); + } + public RESULT loadSampleData() + { + return FMOD_Studio_Bank_LoadSampleData(this.handle); + } + public RESULT unloadSampleData() + { + return FMOD_Studio_Bank_UnloadSampleData(this.handle); + } + public RESULT getLoadingState(out LOADING_STATE state) + { + return FMOD_Studio_Bank_GetLoadingState(this.handle, out state); + } + public RESULT getSampleLoadingState(out LOADING_STATE state) + { + return FMOD_Studio_Bank_GetSampleLoadingState(this.handle, out state); + } + + // Enumeration + public RESULT getStringCount(out int count) + { + return FMOD_Studio_Bank_GetStringCount(this.handle, out count); + } + public RESULT getStringInfo(int index, out Guid id, out string path) + { + path = null; + id = Guid.Empty; + + using (StringHelper.ThreadSafeEncoding encoder = StringHelper.GetFreeHelper()) + { + IntPtr stringMem = Marshal.AllocHGlobal(256); + int retrieved = 0; + RESULT result = FMOD_Studio_Bank_GetStringInfo(this.handle, index, out id, stringMem, 256, out retrieved); + + if (result == RESULT.ERR_TRUNCATED) + { + Marshal.FreeHGlobal(stringMem); + stringMem = Marshal.AllocHGlobal(retrieved); + result = FMOD_Studio_Bank_GetStringInfo(this.handle, index, out id, stringMem, retrieved, out retrieved); + } + + if (result == RESULT.OK) + { + path = encoder.stringFromNative(stringMem); + } + Marshal.FreeHGlobal(stringMem); + return result; + } + } + + public RESULT getEventCount(out int count) + { + return FMOD_Studio_Bank_GetEventCount(this.handle, out count); + } + public RESULT getEventList(out EventDescription[] array) + { + array = null; + + RESULT result; + int capacity; + result = FMOD_Studio_Bank_GetEventCount(this.handle, out capacity); + if (result != RESULT.OK) + { + return result; + } + if (capacity == 0) + { + array = new EventDescription[0]; + return result; + } + + IntPtr[] rawArray = new IntPtr[capacity]; + int actualCount; + result = FMOD_Studio_Bank_GetEventList(this.handle, rawArray, capacity, out actualCount); + if (result != RESULT.OK) + { + return result; + } + if (actualCount > capacity) // More items added since we queried just now? + { + actualCount = capacity; + } + array = new EventDescription[actualCount]; + for (int i = 0; i < actualCount; ++i) + { + array[i].handle = rawArray[i]; + } + return RESULT.OK; + } + public RESULT getBusCount(out int count) + { + return FMOD_Studio_Bank_GetBusCount(this.handle, out count); + } + public RESULT getBusList(out Bus[] array) + { + array = null; + + RESULT result; + int capacity; + result = FMOD_Studio_Bank_GetBusCount(this.handle, out capacity); + if (result != RESULT.OK) + { + return result; + } + if (capacity == 0) + { + array = new Bus[0]; + return result; + } + + IntPtr[] rawArray = new IntPtr[capacity]; + int actualCount; + result = FMOD_Studio_Bank_GetBusList(this.handle, rawArray, capacity, out actualCount); + if (result != RESULT.OK) + { + return result; + } + if (actualCount > capacity) // More items added since we queried just now? + { + actualCount = capacity; + } + array = new Bus[actualCount]; + for (int i = 0; i < actualCount; ++i) + { + array[i].handle = rawArray[i]; + } + return RESULT.OK; + } + public RESULT getVCACount(out int count) + { + return FMOD_Studio_Bank_GetVCACount(this.handle, out count); + } + public RESULT getVCAList(out VCA[] array) + { + array = null; + + RESULT result; + int capacity; + result = FMOD_Studio_Bank_GetVCACount(this.handle, out capacity); + if (result != RESULT.OK) + { + return result; + } + if (capacity == 0) + { + array = new VCA[0]; + return result; + } + + IntPtr[] rawArray = new IntPtr[capacity]; + int actualCount; + result = FMOD_Studio_Bank_GetVCAList(this.handle, rawArray, capacity, out actualCount); + if (result != RESULT.OK) + { + return result; + } + if (actualCount > capacity) // More items added since we queried just now? + { + actualCount = capacity; + } + array = new VCA[actualCount]; + for (int i = 0; i < actualCount; ++i) + { + array[i].handle = rawArray[i]; + } + return RESULT.OK; + } + + public RESULT getUserData(out IntPtr userdata) + { + return FMOD_Studio_Bank_GetUserData(this.handle, out userdata); + } + + public RESULT setUserData(IntPtr userdata) + { + return FMOD_Studio_Bank_SetUserData(this.handle, userdata); + } + + #region importfunctions + [DllImport(STUDIO_VERSION.dll)] + private static extern bool FMOD_Studio_Bank_IsValid (IntPtr bank); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_Bank_GetID (IntPtr bank, out Guid id); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_Bank_GetPath (IntPtr bank, IntPtr path, int size, out int retrieved); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_Bank_Unload (IntPtr bank); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_Bank_LoadSampleData (IntPtr bank); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_Bank_UnloadSampleData (IntPtr bank); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_Bank_GetLoadingState (IntPtr bank, out LOADING_STATE state); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_Bank_GetSampleLoadingState (IntPtr bank, out LOADING_STATE state); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_Bank_GetStringCount (IntPtr bank, out int count); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_Bank_GetStringInfo (IntPtr bank, int index, out Guid id, IntPtr path, int size, out int retrieved); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_Bank_GetEventCount (IntPtr bank, out int count); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_Bank_GetEventList (IntPtr bank, IntPtr[] array, int capacity, out int count); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_Bank_GetBusCount (IntPtr bank, out int count); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_Bank_GetBusList (IntPtr bank, IntPtr[] array, int capacity, out int count); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_Bank_GetVCACount (IntPtr bank, out int count); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_Bank_GetVCAList (IntPtr bank, IntPtr[] array, int capacity, out int count); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_Bank_GetUserData (IntPtr bank, out IntPtr userdata); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_Bank_SetUserData (IntPtr bank, IntPtr userdata); + #endregion + + #region wrapperinternal + + public IntPtr handle; + + public bool hasHandle() { return this.handle != IntPtr.Zero; } + public void clearHandle() { this.handle = IntPtr.Zero; } + + public bool isValid() + { + return hasHandle() && FMOD_Studio_Bank_IsValid(this.handle); + } + + #endregion + } + + public struct CommandReplay + { + // Information query + public RESULT getSystem(out System system) + { + return FMOD_Studio_CommandReplay_GetSystem(this.handle, out system.handle); + } + + public RESULT getLength(out float length) + { + return FMOD_Studio_CommandReplay_GetLength(this.handle, out length); + } + public RESULT getCommandCount(out int count) + { + return FMOD_Studio_CommandReplay_GetCommandCount(this.handle, out count); + } + public RESULT getCommandInfo(int commandIndex, out COMMAND_INFO info) + { + return FMOD_Studio_CommandReplay_GetCommandInfo(this.handle, commandIndex, out info); + } + + public RESULT getCommandString(int commandIndex, out string buffer) + { + buffer = null; + using (StringHelper.ThreadSafeEncoding encoder = StringHelper.GetFreeHelper()) + { + int stringLength = 256; + IntPtr stringMem = Marshal.AllocHGlobal(256); + RESULT result = FMOD_Studio_CommandReplay_GetCommandString(this.handle, commandIndex, stringMem, stringLength); + + while (result == RESULT.ERR_TRUNCATED) + { + Marshal.FreeHGlobal(stringMem); + stringLength *= 2; + stringMem = Marshal.AllocHGlobal(stringLength); + result = FMOD_Studio_CommandReplay_GetCommandString(this.handle, commandIndex, stringMem, stringLength); + } + + if (result == RESULT.OK) + { + buffer = encoder.stringFromNative(stringMem); + } + Marshal.FreeHGlobal(stringMem); + return result; + } + } + public RESULT getCommandAtTime(float time, out int commandIndex) + { + return FMOD_Studio_CommandReplay_GetCommandAtTime(this.handle, time, out commandIndex); + } + // Playback + public RESULT setBankPath(string bankPath) + { + using (StringHelper.ThreadSafeEncoding encoder = StringHelper.GetFreeHelper()) + { + return FMOD_Studio_CommandReplay_SetBankPath(this.handle, encoder.byteFromStringUTF8(bankPath)); + } + } + public RESULT start() + { + return FMOD_Studio_CommandReplay_Start(this.handle); + } + public RESULT stop() + { + return FMOD_Studio_CommandReplay_Stop(this.handle); + } + public RESULT seekToTime(float time) + { + return FMOD_Studio_CommandReplay_SeekToTime(this.handle, time); + } + public RESULT seekToCommand(int commandIndex) + { + return FMOD_Studio_CommandReplay_SeekToCommand(this.handle, commandIndex); + } + public RESULT getPaused(out bool paused) + { + return FMOD_Studio_CommandReplay_GetPaused(this.handle, out paused); + } + public RESULT setPaused(bool paused) + { + return FMOD_Studio_CommandReplay_SetPaused(this.handle, paused); + } + public RESULT getPlaybackState(out PLAYBACK_STATE state) + { + return FMOD_Studio_CommandReplay_GetPlaybackState(this.handle, out state); + } + public RESULT getCurrentCommand(out int commandIndex, out float currentTime) + { + return FMOD_Studio_CommandReplay_GetCurrentCommand(this.handle, out commandIndex, out currentTime); + } + // Release + public RESULT release() + { + return FMOD_Studio_CommandReplay_Release(this.handle); + } + // Callbacks + public RESULT setFrameCallback(COMMANDREPLAY_FRAME_CALLBACK callback) + { + return FMOD_Studio_CommandReplay_SetFrameCallback(this.handle, callback); + } + public RESULT setLoadBankCallback(COMMANDREPLAY_LOAD_BANK_CALLBACK callback) + { + return FMOD_Studio_CommandReplay_SetLoadBankCallback(this.handle, callback); + } + public RESULT setCreateInstanceCallback(COMMANDREPLAY_CREATE_INSTANCE_CALLBACK callback) + { + return FMOD_Studio_CommandReplay_SetCreateInstanceCallback(this.handle, callback); + } + public RESULT getUserData(out IntPtr userdata) + { + return FMOD_Studio_CommandReplay_GetUserData(this.handle, out userdata); + } + public RESULT setUserData(IntPtr userdata) + { + return FMOD_Studio_CommandReplay_SetUserData(this.handle, userdata); + } + + #region importfunctions + [DllImport(STUDIO_VERSION.dll)] + private static extern bool FMOD_Studio_CommandReplay_IsValid (IntPtr replay); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_CommandReplay_GetSystem (IntPtr replay, out IntPtr system); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_CommandReplay_GetLength (IntPtr replay, out float length); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_CommandReplay_GetCommandCount (IntPtr replay, out int count); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_CommandReplay_GetCommandInfo (IntPtr replay, int commandindex, out COMMAND_INFO info); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_CommandReplay_GetCommandString (IntPtr replay, int commandIndex, IntPtr buffer, int length); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_CommandReplay_GetCommandAtTime (IntPtr replay, float time, out int commandIndex); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_CommandReplay_SetBankPath (IntPtr replay, byte[] bankPath); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_CommandReplay_Start (IntPtr replay); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_CommandReplay_Stop (IntPtr replay); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_CommandReplay_SeekToTime (IntPtr replay, float time); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_CommandReplay_SeekToCommand (IntPtr replay, int commandIndex); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_CommandReplay_GetPaused (IntPtr replay, out bool paused); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_CommandReplay_SetPaused (IntPtr replay, bool paused); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_CommandReplay_GetPlaybackState (IntPtr replay, out PLAYBACK_STATE state); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_CommandReplay_GetCurrentCommand (IntPtr replay, out int commandIndex, out float currentTime); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_CommandReplay_Release (IntPtr replay); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_CommandReplay_SetFrameCallback (IntPtr replay, COMMANDREPLAY_FRAME_CALLBACK callback); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_CommandReplay_SetLoadBankCallback (IntPtr replay, COMMANDREPLAY_LOAD_BANK_CALLBACK callback); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_CommandReplay_SetCreateInstanceCallback(IntPtr replay, COMMANDREPLAY_CREATE_INSTANCE_CALLBACK callback); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_CommandReplay_GetUserData (IntPtr replay, out IntPtr userdata); + [DllImport(STUDIO_VERSION.dll)] + private static extern RESULT FMOD_Studio_CommandReplay_SetUserData (IntPtr replay, IntPtr userdata); + #endregion + + #region wrapperinternal + + public IntPtr handle; + + public bool hasHandle() { return this.handle != IntPtr.Zero; } + public void clearHandle() { this.handle = IntPtr.Zero; } + + public bool isValid() + { + return hasHandle() && FMOD_Studio_CommandReplay_IsValid(this.handle); + } + + #endregion + } +} // FMOD diff --git a/Assets/Plugins/FMOD/src/Runtime/wrapper/fmod_studio.cs.meta b/Assets/Plugins/FMOD/src/Runtime/wrapper/fmod_studio.cs.meta new file mode 100755 index 0000000..a6aac50 --- /dev/null +++ b/Assets/Plugins/FMOD/src/Runtime/wrapper/fmod_studio.cs.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: ae7eb0b6a2bff364b9c1fae52173e74c +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scenes/MainScene.unity b/Assets/Scenes/MainScene.unity index 3ecefd0..e547c91 100644 --- a/Assets/Scenes/MainScene.unity +++ b/Assets/Scenes/MainScene.unity @@ -668,6 +668,7 @@ GameObject: - component: {fileID: 519420032} - component: {fileID: 519420031} - component: {fileID: 519420029} + - component: {fileID: 519420030} m_Layer: 0 m_Name: Main Camera m_TagString: MainCamera @@ -683,6 +684,19 @@ AudioListener: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 519420028} m_Enabled: 1 +--- !u!114 &519420030 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 519420028} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 86c6556701af9e04380698b89f691b6e, type: 3} + m_Name: + m_EditorClassIdentifier: + ListenerNumber: 0 --- !u!20 &519420031 Camera: m_ObjectHideFlags: 0 @@ -2154,6 +2168,7 @@ GameObject: - component: {fileID: 2011638741} - component: {fileID: 2011638740} - component: {fileID: 2011638739} + - component: {fileID: 2011638743} m_Layer: 0 m_Name: Player m_TagString: Untagged @@ -2320,7 +2335,33 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: attackKill: 1 + idleSfx: event:/sfx_skate_roll + attackSfx: event:/sfx_hit_people + enemySfx: event:/sfx_shouts_male animator: {fileID: 0} +--- !u!114 &2011638743 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2011638735} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 9a6610d2e704f1648819acc8d7460285, type: 3} + m_Name: + m_EditorClassIdentifier: + Event: event:/music_gameplay + PlayEvent: 1 + StopEvent: 0 + CollisionTag: + AllowFadeout: 1 + TriggerOnce: 0 + Preload: 0 + Params: [] + OverrideAttenuation: 0 + OverrideMinDistance: 0 + OverrideMaxDistance: 0 --- !u!1 &2056561468 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/PlayerController.cs b/Assets/Scripts/PlayerController.cs index 71d3438..f069cd4 100644 --- a/Assets/Scripts/PlayerController.cs +++ b/Assets/Scripts/PlayerController.cs @@ -10,14 +10,57 @@ public class PlayerController : MonoBehaviour public bool attackKill = true; protected HitBox attackHitBox; + + [FMODUnity.EventRef] + public string idleSfx; + [FMODUnity.EventRef] + public string attackSfx; + + [FMODUnity.EventRef] + public string enemySfx; public Animator animator; + public delegate void RewardAction(int amount); public event RewardAction OnKillEnemy; protected int rewardsAmount = 0; + + protected FMOD.Studio.EventInstance idleSound; + protected FMOD.Studio.EventInstance attackSound; + + protected FMOD.Studio.EventInstance enemySound; + + + void Start() { + + if (attackSfx != null) + { + attackSound = FMODUnity.RuntimeManager.CreateInstance(attackSfx); + } + + if (enemySfx != null) + { + enemySound = FMODUnity.RuntimeManager.CreateInstance(enemySfx); + } + + if (idleSfx != null) + { + idleSound = FMODUnity.RuntimeManager.CreateInstance(idleSfx); + + idleSound.set3DAttributes(FMODUnity.RuntimeUtils.To3DAttributes(gameObject)); + idleSound.start(); + } + + } + + void OnDestroy() + { + idleSound.release(); + attackSound.release(); + } void Awake() { attackHitBox = GetComponentInChildren(); @@ -51,8 +94,12 @@ virtual public void Attack() if (animator != null) { animator.Play("Base Layer.PLAYER_ATTACK"); + } + attackSound.set3DAttributes(FMODUnity.RuntimeUtils.To3DAttributes(gameObject)); + attackSound.start(); + if (attackHitBox != null) { attackHitBox.Enable(); @@ -73,6 +120,13 @@ virtual public void Damage(Enemy enemy) // Needs review this implementation // Destroy(enemy.gameObject); + //Plays sound + + enemySound.set3DAttributes(FMODUnity.RuntimeUtils.To3DAttributes(enemy.gameObject)); + enemySound.start(); + enemySound.release(); + + enemy.gameObject.SetActive(false); if(OnKillEnemy != null) { diff --git a/Assets/StreamingAssets.meta b/Assets/StreamingAssets.meta new file mode 100644 index 0000000..7de1e24 --- /dev/null +++ b/Assets/StreamingAssets.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: f72d13f0956bf4051a5e9cda289ff79a +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/StreamingAssets/Master.strings.bank.meta b/Assets/StreamingAssets/Master.strings.bank.meta new file mode 100644 index 0000000..409cbc1 --- /dev/null +++ b/Assets/StreamingAssets/Master.strings.bank.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 3239159b566b14a97bb9d2a364223fb1 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/FMODProject b/FMODProject new file mode 160000 index 0000000..7ff95c2 --- /dev/null +++ b/FMODProject @@ -0,0 +1 @@ +Subproject commit 7ff95c2d3147a3660538f20141a42d45e8f40620 diff --git a/Images/Death.Hawaii.Screenshot.1.jpg b/Images/Death.Hawaii.Screenshot.1.jpg new file mode 100644 index 0000000..80422ec Binary files /dev/null and b/Images/Death.Hawaii.Screenshot.1.jpg differ diff --git a/Images/Death.Hawaii.Screenshot.2.jpg b/Images/Death.Hawaii.Screenshot.2.jpg new file mode 100644 index 0000000..ac68f5c Binary files /dev/null and b/Images/Death.Hawaii.Screenshot.2.jpg differ diff --git a/ProjectSettings/GraphicsSettings.asset b/ProjectSettings/GraphicsSettings.asset index 81d1ebf..ab4d074 100644 --- a/ProjectSettings/GraphicsSettings.asset +++ b/ProjectSettings/GraphicsSettings.asset @@ -33,7 +33,6 @@ GraphicsSettings: - {fileID: 10770, guid: 0000000000000000f000000000000000, type: 0} - {fileID: 16000, guid: 0000000000000000f000000000000000, type: 0} - {fileID: 16001, guid: 0000000000000000f000000000000000, type: 0} - - {fileID: 16003, guid: 0000000000000000f000000000000000, type: 0} - {fileID: 17000, guid: 0000000000000000f000000000000000, type: 0} m_PreloadedShaders: [] m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000, diff --git a/README.md b/README.md new file mode 100644 index 0000000..d095390 --- /dev/null +++ b/README.md @@ -0,0 +1,32 @@ +# Death Hawaii: Unity Project + +![death-hawaii-screenshot-1](./Images/Death.Hawaii.Screenshot.1.jpg) +![death-hawaii-screenshot-2](./Images/Death.Hawaii.Screenshot.2.jpg) + +This is a game, where you control a Death/Reaper that want collect souls to exchange by money and go to the Hawaii :) + +This game was made with **Unity 2019** during [Ludum Dare 44](https://ldjam.com/events/ludum-dare/44) Game Jam, just in a weekend! + +Link: [[Ludum Dare 44] Death Hawaii](https://ldjam.com/events/ludum-dare/44/death-hawaii) + +## Versions + +- Unity Editor: [`2019.1.0f2`](https://store.unity.com/download?ref=personal) + +## Getting Started + +1. Clone this repository with all git submodules: + + ```bash + git clone --recurse-submodules + ``` + > **Obs:** Verify if the `.wav` files were downloaded in `FMODProject/Assets` folder +2. Or run the `setup.sh` file (or `setup.bat`, if you are using Windows). +3. Open **Unity Editor** and open this project folder. +4. Make sure that `FMODStudioSettings` points to `FMODProject/Death Hawaii.fspro` file. + + > See: [Pointing to a FMOD Studio project file](https://www.fmod.com/resources/documentation-unity?version=2.0&page=user-guide.html#pointing-to-a-fmod-studio-project-file) + +5. Play the game and enjoy it! :) + + diff --git a/setup.bat b/setup.bat new file mode 100644 index 0000000..d550158 --- /dev/null +++ b/setup.bat @@ -0,0 +1 @@ +git pull origin --recurse-submodules \ No newline at end of file diff --git a/setup.sh b/setup.sh new file mode 100644 index 0000000..d550158 --- /dev/null +++ b/setup.sh @@ -0,0 +1 @@ +git pull origin --recurse-submodules \ No newline at end of file