├── .gitattributes ├── .gitignore ├── LICENSE.txt ├── PingPongTutorial.sln ├── PingPongTutorial ├── PingPongTutorial.ico ├── PingPongTutorial.rc ├── PingPongTutorial.vcxproj ├── PingPongTutorial.vcxproj.filters ├── inc │ ├── 3rd-party │ │ ├── fmod.h │ │ ├── fmod.hpp │ │ ├── fmod_codec.h │ │ ├── fmod_common.h │ │ ├── fmod_dsp.h │ │ ├── fmod_dsp_effects.h │ │ ├── fmod_errors.h │ │ └── fmod_output.h │ ├── Defines.h │ ├── Globals.h │ ├── Message.h │ ├── Sound.h │ ├── game │ │ ├── Ball.h │ │ ├── Bat.h │ │ ├── BatController.h │ │ └── GameObject.h │ ├── ui │ │ ├── Application.h │ │ ├── Button.h │ │ └── Interface.h │ └── utils │ │ ├── Image.h │ │ └── Random.h ├── lib │ ├── fmod.dll │ └── fmod_vc.lib ├── res │ ├── Image.png │ ├── bounce.wav │ └── score.wav ├── resource.h └── src │ ├── Globals.cpp │ ├── Main.cpp │ ├── Message.cpp │ ├── Sound.cpp │ ├── game │ ├── AiBatController.cpp │ ├── Ball.cpp │ ├── Bat.cpp │ ├── GameObject.cpp │ └── PlayerBatController.cpp │ ├── ui │ ├── Application.cpp │ ├── Button.cpp │ ├── GameInterface.cpp │ └── MainInterface.cpp │ └── utils │ ├── Image.cpp │ └── Random.cpp └── README.md /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | #*.jpg binary 44 | #*.png binary 45 | #*.gif binary 46 | 47 | ############################################################################### 48 | # diff behavior for common document formats 49 | # 50 | # Convert binary document formats to text before diffing them. This feature 51 | # is only available from the command line. Turn it on by uncommenting the 52 | # entries below. 53 | ############################################################################### 54 | #*.doc diff=astextplain 55 | #*.DOC diff=astextplain 56 | #*.docx diff=astextplain 57 | #*.DOCX diff=astextplain 58 | #*.dot diff=astextplain 59 | #*.DOT diff=astextplain 60 | #*.pdf diff=astextplain 61 | #*.PDF diff=astextplain 62 | #*.rtf diff=astextplain 63 | #*.RTF diff=astextplain 64 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | ## 4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 5 | 6 | # User-specific files 7 | *.rsuser 8 | *.suo 9 | *.user 10 | *.userosscache 11 | *.sln.docstates 12 | 13 | # User-specific files (MonoDevelop/Xamarin Studio) 14 | *.userprefs 15 | 16 | # Mono auto generated files 17 | mono_crash.* 18 | 19 | # Build results 20 | [Dd]ebug/ 21 | [Dd]ebugPublic/ 22 | [Rr]elease/ 23 | [Rr]eleases/ 24 | x64/ 25 | x86/ 26 | [Ww][Ii][Nn]32/ 27 | [Aa][Rr][Mm]/ 28 | [Aa][Rr][Mm]64/ 29 | bld/ 30 | [Bb]in/ 31 | [Oo]bj/ 32 | [Oo]ut/ 33 | [Ll]og/ 34 | [Ll]ogs/ 35 | 36 | # Visual Studio 2015/2017 cache/options directory 37 | .vs/ 38 | # Uncomment if you have tasks that create the project's static files in wwwroot 39 | #wwwroot/ 40 | 41 | # Visual Studio 2017 auto generated files 42 | Generated\ Files/ 43 | 44 | # MSTest test Results 45 | [Tt]est[Rr]esult*/ 46 | [Bb]uild[Ll]og.* 47 | 48 | # NUnit 49 | *.VisualState.xml 50 | TestResult.xml 51 | nunit-*.xml 52 | 53 | # Build Results of an ATL Project 54 | [Dd]ebugPS/ 55 | [Rr]eleasePS/ 56 | dlldata.c 57 | 58 | # Benchmark Results 59 | BenchmarkDotNet.Artifacts/ 60 | 61 | # .NET Core 62 | project.lock.json 63 | project.fragment.lock.json 64 | artifacts/ 65 | 66 | # ASP.NET Scaffolding 67 | ScaffoldingReadMe.txt 68 | 69 | # StyleCop 70 | StyleCopReport.xml 71 | 72 | # Files built by Visual Studio 73 | *_i.c 74 | *_p.c 75 | *_h.h 76 | *.ilk 77 | *.meta 78 | *.obj 79 | *.iobj 80 | *.pch 81 | *.pdb 82 | *.ipdb 83 | *.pgc 84 | *.pgd 85 | *.rsp 86 | *.sbr 87 | *.tlb 88 | *.tli 89 | *.tlh 90 | *.tmp 91 | *.tmp_proj 92 | *_wpftmp.csproj 93 | *.log 94 | *.vspscc 95 | *.vssscc 96 | .builds 97 | *.pidb 98 | *.svclog 99 | *.scc 100 | 101 | # Chutzpah Test files 102 | _Chutzpah* 103 | 104 | # Visual C++ cache files 105 | ipch/ 106 | *.aps 107 | *.ncb 108 | *.opendb 109 | *.opensdf 110 | *.sdf 111 | *.cachefile 112 | *.VC.db 113 | *.VC.VC.opendb 114 | 115 | # Visual Studio profiler 116 | *.psess 117 | *.vsp 118 | *.vspx 119 | *.sap 120 | 121 | # Visual Studio Trace Files 122 | *.e2e 123 | 124 | # TFS 2012 Local Workspace 125 | $tf/ 126 | 127 | # Guidance Automation Toolkit 128 | *.gpState 129 | 130 | # ReSharper is a .NET coding add-in 131 | _ReSharper*/ 132 | *.[Rr]e[Ss]harper 133 | *.DotSettings.user 134 | 135 | # TeamCity is a build add-in 136 | _TeamCity* 137 | 138 | # DotCover is a Code Coverage Tool 139 | *.dotCover 140 | 141 | # AxoCover is a Code Coverage Tool 142 | .axoCover/* 143 | !.axoCover/settings.json 144 | 145 | # Coverlet is a free, cross platform Code Coverage Tool 146 | coverage*.json 147 | coverage*.xml 148 | coverage*.info 149 | 150 | # Visual Studio code coverage results 151 | *.coverage 152 | *.coveragexml 153 | 154 | # NCrunch 155 | _NCrunch_* 156 | .*crunch*.local.xml 157 | nCrunchTemp_* 158 | 159 | # MightyMoose 160 | *.mm.* 161 | AutoTest.Net/ 162 | 163 | # Web workbench (sass) 164 | .sass-cache/ 165 | 166 | # Installshield output folder 167 | [Ee]xpress/ 168 | 169 | # DocProject is a documentation generator add-in 170 | DocProject/buildhelp/ 171 | DocProject/Help/*.HxT 172 | DocProject/Help/*.HxC 173 | DocProject/Help/*.hhc 174 | DocProject/Help/*.hhk 175 | DocProject/Help/*.hhp 176 | DocProject/Help/Html2 177 | DocProject/Help/html 178 | 179 | # Click-Once directory 180 | publish/ 181 | 182 | # Publish Web Output 183 | *.[Pp]ublish.xml 184 | *.azurePubxml 185 | # Note: Comment the next line if you want to checkin your web deploy settings, 186 | # but database connection strings (with potential passwords) will be unencrypted 187 | *.pubxml 188 | *.publishproj 189 | 190 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 191 | # checkin your Azure Web App publish settings, but sensitive information contained 192 | # in these scripts will be unencrypted 193 | PublishScripts/ 194 | 195 | # NuGet Packages 196 | *.nupkg 197 | # NuGet Symbol Packages 198 | *.snupkg 199 | # The packages folder can be ignored because of Package Restore 200 | **/[Pp]ackages/* 201 | # except build/, which is used as an MSBuild target. 202 | !**/[Pp]ackages/build/ 203 | # Uncomment if necessary however generally it will be regenerated when needed 204 | #!**/[Pp]ackages/repositories.config 205 | # NuGet v3's project.json files produces more ignorable files 206 | *.nuget.props 207 | *.nuget.targets 208 | 209 | # Microsoft Azure Build Output 210 | csx/ 211 | *.build.csdef 212 | 213 | # Microsoft Azure Emulator 214 | ecf/ 215 | rcf/ 216 | 217 | # Windows Store app package directories and files 218 | AppPackages/ 219 | BundleArtifacts/ 220 | Package.StoreAssociation.xml 221 | _pkginfo.txt 222 | *.appx 223 | *.appxbundle 224 | *.appxupload 225 | 226 | # Visual Studio cache files 227 | # files ending in .cache can be ignored 228 | *.[Cc]ache 229 | # but keep track of directories ending in .cache 230 | !?*.[Cc]ache/ 231 | 232 | # Others 233 | ClientBin/ 234 | ~$* 235 | *~ 236 | *.dbmdl 237 | *.dbproj.schemaview 238 | *.jfm 239 | *.pfx 240 | *.publishsettings 241 | orleans.codegen.cs 242 | 243 | # Including strong name files can present a security risk 244 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 245 | #*.snk 246 | 247 | # Since there are multiple workflows, uncomment next line to ignore bower_components 248 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 249 | #bower_components/ 250 | 251 | # RIA/Silverlight projects 252 | Generated_Code/ 253 | 254 | # Backup & report files from converting an old project file 255 | # to a newer Visual Studio version. Backup files are not needed, 256 | # because we have git ;-) 257 | _UpgradeReport_Files/ 258 | Backup*/ 259 | UpgradeLog*.XML 260 | UpgradeLog*.htm 261 | ServiceFabricBackup/ 262 | *.rptproj.bak 263 | 264 | # SQL Server files 265 | *.mdf 266 | *.ldf 267 | *.ndf 268 | 269 | # Business Intelligence projects 270 | *.rdl.data 271 | *.bim.layout 272 | *.bim_*.settings 273 | *.rptproj.rsuser 274 | *- [Bb]ackup.rdl 275 | *- [Bb]ackup ([0-9]).rdl 276 | *- [Bb]ackup ([0-9][0-9]).rdl 277 | 278 | # Microsoft Fakes 279 | FakesAssemblies/ 280 | 281 | # GhostDoc plugin setting file 282 | *.GhostDoc.xml 283 | 284 | # Node.js Tools for Visual Studio 285 | .ntvs_analysis.dat 286 | node_modules/ 287 | 288 | # Visual Studio 6 build log 289 | *.plg 290 | 291 | # Visual Studio 6 workspace options file 292 | *.opt 293 | 294 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 295 | *.vbw 296 | 297 | # Visual Studio LightSwitch build output 298 | **/*.HTMLClient/GeneratedArtifacts 299 | **/*.DesktopClient/GeneratedArtifacts 300 | **/*.DesktopClient/ModelManifest.xml 301 | **/*.Server/GeneratedArtifacts 302 | **/*.Server/ModelManifest.xml 303 | _Pvt_Extensions 304 | 305 | # Paket dependency manager 306 | .paket/paket.exe 307 | paket-files/ 308 | 309 | # FAKE - F# Make 310 | .fake/ 311 | 312 | # CodeRush personal settings 313 | .cr/personal 314 | 315 | # Python Tools for Visual Studio (PTVS) 316 | __pycache__/ 317 | *.pyc 318 | 319 | # Cake - Uncomment if you are using it 320 | # tools/** 321 | # !tools/packages.config 322 | 323 | # Tabs Studio 324 | *.tss 325 | 326 | # Telerik's JustMock configuration file 327 | *.jmconfig 328 | 329 | # BizTalk build output 330 | *.btp.cs 331 | *.btm.cs 332 | *.odx.cs 333 | *.xsd.cs 334 | 335 | # OpenCover UI analysis results 336 | OpenCover/ 337 | 338 | # Azure Stream Analytics local run output 339 | ASALocalRun/ 340 | 341 | # MSBuild Binary and Structured Log 342 | *.binlog 343 | 344 | # NVidia Nsight GPU debugger configuration file 345 | *.nvuser 346 | 347 | # MFractors (Xamarin productivity tool) working folder 348 | .mfractor/ 349 | 350 | # Local History for Visual Studio 351 | .localhistory/ 352 | 353 | # BeatPulse healthcheck temp database 354 | healthchecksdb 355 | 356 | # Backup folder for Package Reference Convert tool in Visual Studio 2017 357 | MigrationBackup/ 358 | 359 | # Ionide (cross platform F# VS Code tools) working folder 360 | .ionide/ 361 | 362 | # Fody - auto-generated XML schema 363 | FodyWeavers.xsd -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 Tony Skywalker 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /PingPongTutorial.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.6.33829.357 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PingPongTutorial", "PingPongTutorial\PingPongTutorial.vcxproj", "{067C44B3-C876-482E-9630-1A55A7F90FB7}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|x64 = Debug|x64 11 | Debug|x86 = Debug|x86 12 | Release|x64 = Release|x64 13 | Release|x86 = Release|x86 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {067C44B3-C876-482E-9630-1A55A7F90FB7}.Debug|x64.ActiveCfg = Debug|x64 17 | {067C44B3-C876-482E-9630-1A55A7F90FB7}.Debug|x64.Build.0 = Debug|x64 18 | {067C44B3-C876-482E-9630-1A55A7F90FB7}.Debug|x86.ActiveCfg = Debug|Win32 19 | {067C44B3-C876-482E-9630-1A55A7F90FB7}.Debug|x86.Build.0 = Debug|Win32 20 | {067C44B3-C876-482E-9630-1A55A7F90FB7}.Release|x64.ActiveCfg = Release|x64 21 | {067C44B3-C876-482E-9630-1A55A7F90FB7}.Release|x64.Build.0 = Release|x64 22 | {067C44B3-C876-482E-9630-1A55A7F90FB7}.Release|x86.ActiveCfg = Release|Win32 23 | {067C44B3-C876-482E-9630-1A55A7F90FB7}.Release|x86.Build.0 = Release|Win32 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | GlobalSection(ExtensibilityGlobals) = postSolution 29 | SolutionGuid = {98489856-A537-4773-A3F3-238AB93D93B2} 30 | EndGlobalSection 31 | EndGlobal 32 | -------------------------------------------------------------------------------- /PingPongTutorial/PingPongTutorial.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lord-Turmoil/PingPongTutorial/d5d842c2a47e72ea22d847c3340eca22bfd12c45/PingPongTutorial/PingPongTutorial.ico -------------------------------------------------------------------------------- /PingPongTutorial/PingPongTutorial.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lord-Turmoil/PingPongTutorial/d5d842c2a47e72ea22d847c3340eca22bfd12c45/PingPongTutorial/PingPongTutorial.rc -------------------------------------------------------------------------------- /PingPongTutorial/PingPongTutorial.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | Debug 14 | x64 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 16.0 62 | Win32Proj 63 | {067c44b3-c876-482e-9630-1a55a7f90fb7} 64 | PingPongTutorial 65 | 10.0 66 | 67 | 68 | 69 | Application 70 | true 71 | v143 72 | Unicode 73 | 74 | 75 | Application 76 | false 77 | v143 78 | true 79 | Unicode 80 | 81 | 82 | Application 83 | true 84 | v143 85 | Unicode 86 | 87 | 88 | Application 89 | false 90 | v143 91 | true 92 | Unicode 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | $(SolutionDir)dist\$(Configuration)\ 114 | $(SolutionDir)int\$(Configuration)\ 115 | 116 | 117 | $(SolutionDir)dist\$(Configuration)\ 118 | $(SolutionDir)int\$(Configuration)\ 119 | 120 | 121 | 122 | Level3 123 | true 124 | WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) 125 | true 126 | 127 | 128 | Windows 129 | true 130 | 131 | 132 | 133 | 134 | Level3 135 | true 136 | true 137 | true 138 | WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) 139 | true 140 | 141 | 142 | Windows 143 | true 144 | true 145 | true 146 | 147 | 148 | 149 | 150 | Level3 151 | true 152 | _DEBUG;_WINDOWS;%(PreprocessorDefinitions) 153 | true 154 | 155 | 156 | Windows 157 | true 158 | 159 | 160 | xcopy /e /y "$(ProjectDir)res\" "$(SolutionDir)dist\$(Configuration)\res\" 161 | xcopy /y "$(ProjectDir)lib\fmod.dll" "$(SolutionDir)dist\$(Configuration)\" 162 | 163 | 164 | 165 | 166 | Level3 167 | true 168 | true 169 | true 170 | NDEBUG;_WINDOWS;%(PreprocessorDefinitions) 171 | true 172 | 173 | 174 | Windows 175 | true 176 | true 177 | true 178 | 179 | 180 | xcopy /e /y "$(ProjectDir)res\" "$(SolutionDir)dist\$(Configuration)\res\" 181 | xcopy /y "$(ProjectDir)lib\fmod.dll" "$(SolutionDir)dist\$(Configuration)\" 182 | 183 | 184 | 185 | 186 | 187 | -------------------------------------------------------------------------------- /PingPongTutorial/PingPongTutorial.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | Source Files 23 | 24 | 25 | Source Files 26 | 27 | 28 | Source Files 29 | 30 | 31 | Source Files 32 | 33 | 34 | Source Files 35 | 36 | 37 | Source Files 38 | 39 | 40 | Source Files 41 | 42 | 43 | Source Files 44 | 45 | 46 | Source Files 47 | 48 | 49 | Source Files 50 | 51 | 52 | Source Files 53 | 54 | 55 | Source Files 56 | 57 | 58 | Source Files 59 | 60 | 61 | Source Files 62 | 63 | 64 | Source Files 65 | 66 | 67 | 68 | 69 | Header Files 70 | 71 | 72 | Header Files 73 | 74 | 75 | Header Files 76 | 77 | 78 | Header Files 79 | 80 | 81 | Header Files 82 | 83 | 84 | Header Files 85 | 86 | 87 | Header Files 88 | 89 | 90 | Header Files 91 | 92 | 93 | Header Files 94 | 95 | 96 | Header Files 97 | 98 | 99 | Header Files 100 | 101 | 102 | Header Files 103 | 104 | 105 | Header Files 106 | 107 | 108 | 109 | 110 | Resource Files 111 | 112 | 113 | 114 | 115 | Resource Files 116 | 117 | 118 | -------------------------------------------------------------------------------- /PingPongTutorial/inc/3rd-party/fmod.hpp: -------------------------------------------------------------------------------- 1 | /* ======================================================================================== */ 2 | /* FMOD Core API - C++ header file. */ 3 | /* Copyright (c), Firelight Technologies Pty, Ltd. 2004-2023. */ 4 | /* */ 5 | /* Use this header in conjunction with fmod_common.h (which contains all the constants / */ 6 | /* callbacks) to develop using the C++ language. */ 7 | /* */ 8 | /* For more detail visit: */ 9 | /* https://fmod.com/docs/2.02/api/core-api.html */ 10 | /* ======================================================================================== */ 11 | #ifndef _FMOD_HPP 12 | #define _FMOD_HPP 13 | 14 | #include "fmod_common.h" 15 | #include "fmod.h" 16 | 17 | /* 18 | FMOD Namespace 19 | */ 20 | namespace FMOD 21 | { 22 | class System; 23 | class Sound; 24 | class ChannelControl; 25 | class Channel; 26 | class ChannelGroup; 27 | class SoundGroup; 28 | class DSP; 29 | class DSPConnection; 30 | class Geometry; 31 | class Reverb3D; 32 | 33 | /* 34 | FMOD global system functions (optional). 35 | */ 36 | inline FMOD_RESULT Memory_Initialize (void *poolmem, int poollen, FMOD_MEMORY_ALLOC_CALLBACK useralloc, FMOD_MEMORY_REALLOC_CALLBACK userrealloc, FMOD_MEMORY_FREE_CALLBACK userfree, FMOD_MEMORY_TYPE memtypeflags = FMOD_MEMORY_ALL) { return FMOD_Memory_Initialize(poolmem, poollen, useralloc, userrealloc, userfree, memtypeflags); } 37 | inline FMOD_RESULT Memory_GetStats (int *currentalloced, int *maxalloced, bool blocking = true) { return FMOD_Memory_GetStats(currentalloced, maxalloced, blocking); } 38 | inline FMOD_RESULT Debug_Initialize (FMOD_DEBUG_FLAGS flags, FMOD_DEBUG_MODE mode = FMOD_DEBUG_MODE_TTY, FMOD_DEBUG_CALLBACK callback = 0, const char *filename = 0) { return FMOD_Debug_Initialize(flags, mode, callback, filename); } 39 | inline FMOD_RESULT File_SetDiskBusy (int busy) { return FMOD_File_SetDiskBusy(busy); } 40 | inline FMOD_RESULT File_GetDiskBusy (int *busy) { return FMOD_File_GetDiskBusy(busy); } 41 | inline FMOD_RESULT Thread_SetAttributes (FMOD_THREAD_TYPE type, FMOD_THREAD_AFFINITY affinity = FMOD_THREAD_AFFINITY_GROUP_DEFAULT, FMOD_THREAD_PRIORITY priority = FMOD_THREAD_PRIORITY_DEFAULT, FMOD_THREAD_STACK_SIZE stacksize = FMOD_THREAD_STACK_SIZE_DEFAULT) { return FMOD_Thread_SetAttributes(type, affinity, priority, stacksize); } 42 | 43 | /* 44 | FMOD System factory functions. 45 | */ 46 | inline FMOD_RESULT System_Create (System **system, unsigned int headerversion = FMOD_VERSION) { return FMOD_System_Create((FMOD_SYSTEM **)system, headerversion); } 47 | 48 | /* 49 | 'System' API 50 | */ 51 | class System 52 | { 53 | private: 54 | 55 | // Constructor made private so user cannot statically instance a System class. System_Create must be used. 56 | System(); 57 | System(const System &); 58 | 59 | public: 60 | 61 | FMOD_RESULT F_API release (); 62 | 63 | // Setup functions. 64 | FMOD_RESULT F_API setOutput (FMOD_OUTPUTTYPE output); 65 | FMOD_RESULT F_API getOutput (FMOD_OUTPUTTYPE *output); 66 | FMOD_RESULT F_API getNumDrivers (int *numdrivers); 67 | FMOD_RESULT F_API getDriverInfo (int id, char *name, int namelen, FMOD_GUID *guid, int *systemrate, FMOD_SPEAKERMODE *speakermode, int *speakermodechannels); 68 | FMOD_RESULT F_API setDriver (int driver); 69 | FMOD_RESULT F_API getDriver (int *driver); 70 | FMOD_RESULT F_API setSoftwareChannels (int numsoftwarechannels); 71 | FMOD_RESULT F_API getSoftwareChannels (int *numsoftwarechannels); 72 | FMOD_RESULT F_API setSoftwareFormat (int samplerate, FMOD_SPEAKERMODE speakermode, int numrawspeakers); 73 | FMOD_RESULT F_API getSoftwareFormat (int *samplerate, FMOD_SPEAKERMODE *speakermode, int *numrawspeakers); 74 | FMOD_RESULT F_API setDSPBufferSize (unsigned int bufferlength, int numbuffers); 75 | FMOD_RESULT F_API getDSPBufferSize (unsigned int *bufferlength, int *numbuffers); 76 | FMOD_RESULT F_API setFileSystem (FMOD_FILE_OPEN_CALLBACK useropen, FMOD_FILE_CLOSE_CALLBACK userclose, FMOD_FILE_READ_CALLBACK userread, FMOD_FILE_SEEK_CALLBACK userseek, FMOD_FILE_ASYNCREAD_CALLBACK userasyncread, FMOD_FILE_ASYNCCANCEL_CALLBACK userasynccancel, int blockalign); 77 | FMOD_RESULT F_API attachFileSystem (FMOD_FILE_OPEN_CALLBACK useropen, FMOD_FILE_CLOSE_CALLBACK userclose, FMOD_FILE_READ_CALLBACK userread, FMOD_FILE_SEEK_CALLBACK userseek); 78 | FMOD_RESULT F_API setAdvancedSettings (FMOD_ADVANCEDSETTINGS *settings); 79 | FMOD_RESULT F_API getAdvancedSettings (FMOD_ADVANCEDSETTINGS *settings); 80 | FMOD_RESULT F_API setCallback (FMOD_SYSTEM_CALLBACK callback, FMOD_SYSTEM_CALLBACK_TYPE callbackmask = FMOD_SYSTEM_CALLBACK_ALL); 81 | 82 | // Plug-in support. 83 | FMOD_RESULT F_API setPluginPath (const char *path); 84 | FMOD_RESULT F_API loadPlugin (const char *filename, unsigned int *handle, unsigned int priority = 0); 85 | FMOD_RESULT F_API unloadPlugin (unsigned int handle); 86 | FMOD_RESULT F_API getNumNestedPlugins (unsigned int handle, int *count); 87 | FMOD_RESULT F_API getNestedPlugin (unsigned int handle, int index, unsigned int *nestedhandle); 88 | FMOD_RESULT F_API getNumPlugins (FMOD_PLUGINTYPE plugintype, int *numplugins); 89 | FMOD_RESULT F_API getPluginHandle (FMOD_PLUGINTYPE plugintype, int index, unsigned int *handle); 90 | FMOD_RESULT F_API getPluginInfo (unsigned int handle, FMOD_PLUGINTYPE *plugintype, char *name, int namelen, unsigned int *version); 91 | FMOD_RESULT F_API setOutputByPlugin (unsigned int handle); 92 | FMOD_RESULT F_API getOutputByPlugin (unsigned int *handle); 93 | FMOD_RESULT F_API createDSPByPlugin (unsigned int handle, DSP **dsp); 94 | FMOD_RESULT F_API getDSPInfoByPlugin (unsigned int handle, const FMOD_DSP_DESCRIPTION **description); 95 | FMOD_RESULT F_API registerCodec (FMOD_CODEC_DESCRIPTION *description, unsigned int *handle, unsigned int priority = 0); 96 | FMOD_RESULT F_API registerDSP (const FMOD_DSP_DESCRIPTION *description, unsigned int *handle); 97 | FMOD_RESULT F_API registerOutput (const FMOD_OUTPUT_DESCRIPTION *description, unsigned int *handle); 98 | 99 | // Init/Close. 100 | FMOD_RESULT F_API init (int maxchannels, FMOD_INITFLAGS flags, void *extradriverdata); 101 | FMOD_RESULT F_API close (); 102 | 103 | // General post-init system functions. 104 | FMOD_RESULT F_API update (); /* IMPORTANT! CALL THIS ONCE PER FRAME! */ 105 | 106 | FMOD_RESULT F_API setSpeakerPosition (FMOD_SPEAKER speaker, float x, float y, bool active); 107 | FMOD_RESULT F_API getSpeakerPosition (FMOD_SPEAKER speaker, float *x, float *y, bool *active); 108 | FMOD_RESULT F_API setStreamBufferSize (unsigned int filebuffersize, FMOD_TIMEUNIT filebuffersizetype); 109 | FMOD_RESULT F_API getStreamBufferSize (unsigned int *filebuffersize, FMOD_TIMEUNIT *filebuffersizetype); 110 | FMOD_RESULT F_API set3DSettings (float dopplerscale, float distancefactor, float rolloffscale); 111 | FMOD_RESULT F_API get3DSettings (float *dopplerscale, float *distancefactor, float *rolloffscale); 112 | FMOD_RESULT F_API set3DNumListeners (int numlisteners); 113 | FMOD_RESULT F_API get3DNumListeners (int *numlisteners); 114 | FMOD_RESULT F_API set3DListenerAttributes (int listener, const FMOD_VECTOR *pos, const FMOD_VECTOR *vel, const FMOD_VECTOR *forward, const FMOD_VECTOR *up); 115 | FMOD_RESULT F_API get3DListenerAttributes (int listener, FMOD_VECTOR *pos, FMOD_VECTOR *vel, FMOD_VECTOR *forward, FMOD_VECTOR *up); 116 | FMOD_RESULT F_API set3DRolloffCallback (FMOD_3D_ROLLOFF_CALLBACK callback); 117 | FMOD_RESULT F_API mixerSuspend (); 118 | FMOD_RESULT F_API mixerResume (); 119 | FMOD_RESULT F_API getDefaultMixMatrix (FMOD_SPEAKERMODE sourcespeakermode, FMOD_SPEAKERMODE targetspeakermode, float *matrix, int matrixhop); 120 | FMOD_RESULT F_API getSpeakerModeChannels (FMOD_SPEAKERMODE mode, int *channels); 121 | 122 | // System information functions. 123 | FMOD_RESULT F_API getVersion (unsigned int *version); 124 | FMOD_RESULT F_API getOutputHandle (void **handle); 125 | FMOD_RESULT F_API getChannelsPlaying (int *channels, int *realchannels = 0); 126 | FMOD_RESULT F_API getCPUUsage (FMOD_CPU_USAGE *usage); 127 | FMOD_RESULT F_API getFileUsage (long long *sampleBytesRead, long long *streamBytesRead, long long *otherBytesRead); 128 | 129 | // Sound/DSP/Channel/FX creation and retrieval. 130 | FMOD_RESULT F_API createSound (const char *name_or_data, FMOD_MODE mode, FMOD_CREATESOUNDEXINFO *exinfo, Sound **sound); 131 | FMOD_RESULT F_API createStream (const char *name_or_data, FMOD_MODE mode, FMOD_CREATESOUNDEXINFO *exinfo, Sound **sound); 132 | FMOD_RESULT F_API createDSP (const FMOD_DSP_DESCRIPTION *description, DSP **dsp); 133 | FMOD_RESULT F_API createDSPByType (FMOD_DSP_TYPE type, DSP **dsp); 134 | FMOD_RESULT F_API createChannelGroup (const char *name, ChannelGroup **channelgroup); 135 | FMOD_RESULT F_API createSoundGroup (const char *name, SoundGroup **soundgroup); 136 | FMOD_RESULT F_API createReverb3D (Reverb3D **reverb); 137 | 138 | FMOD_RESULT F_API playSound (Sound *sound, ChannelGroup *channelgroup, bool paused, Channel **channel); 139 | FMOD_RESULT F_API playDSP (DSP *dsp, ChannelGroup *channelgroup, bool paused, Channel **channel); 140 | FMOD_RESULT F_API getChannel (int channelid, Channel **channel); 141 | FMOD_RESULT F_API getDSPInfoByType (FMOD_DSP_TYPE type, const FMOD_DSP_DESCRIPTION **description); 142 | FMOD_RESULT F_API getMasterChannelGroup (ChannelGroup **channelgroup); 143 | FMOD_RESULT F_API getMasterSoundGroup (SoundGroup **soundgroup); 144 | 145 | // Routing to ports. 146 | FMOD_RESULT F_API attachChannelGroupToPort (FMOD_PORT_TYPE portType, FMOD_PORT_INDEX portIndex, ChannelGroup *channelgroup, bool passThru = false); 147 | FMOD_RESULT F_API detachChannelGroupFromPort (ChannelGroup *channelgroup); 148 | 149 | // Reverb API. 150 | FMOD_RESULT F_API setReverbProperties (int instance, const FMOD_REVERB_PROPERTIES *prop); 151 | FMOD_RESULT F_API getReverbProperties (int instance, FMOD_REVERB_PROPERTIES *prop); 152 | 153 | // System level DSP functionality. 154 | FMOD_RESULT F_API lockDSP (); 155 | FMOD_RESULT F_API unlockDSP (); 156 | 157 | // Recording API. 158 | FMOD_RESULT F_API getRecordNumDrivers (int *numdrivers, int *numconnected); 159 | FMOD_RESULT F_API getRecordDriverInfo (int id, char *name, int namelen, FMOD_GUID *guid, int *systemrate, FMOD_SPEAKERMODE *speakermode, int *speakermodechannels, FMOD_DRIVER_STATE *state); 160 | FMOD_RESULT F_API getRecordPosition (int id, unsigned int *position); 161 | FMOD_RESULT F_API recordStart (int id, Sound *sound, bool loop); 162 | FMOD_RESULT F_API recordStop (int id); 163 | FMOD_RESULT F_API isRecording (int id, bool *recording); 164 | 165 | // Geometry API. 166 | FMOD_RESULT F_API createGeometry (int maxpolygons, int maxvertices, Geometry **geometry); 167 | FMOD_RESULT F_API setGeometrySettings (float maxworldsize); 168 | FMOD_RESULT F_API getGeometrySettings (float *maxworldsize); 169 | FMOD_RESULT F_API loadGeometry (const void *data, int datasize, Geometry **geometry); 170 | FMOD_RESULT F_API getGeometryOcclusion (const FMOD_VECTOR *listener, const FMOD_VECTOR *source, float *direct, float *reverb); 171 | 172 | // Network functions. 173 | FMOD_RESULT F_API setNetworkProxy (const char *proxy); 174 | FMOD_RESULT F_API getNetworkProxy (char *proxy, int proxylen); 175 | FMOD_RESULT F_API setNetworkTimeout (int timeout); 176 | FMOD_RESULT F_API getNetworkTimeout (int *timeout); 177 | 178 | // Userdata set/get. 179 | FMOD_RESULT F_API setUserData (void *userdata); 180 | FMOD_RESULT F_API getUserData (void **userdata); 181 | }; 182 | 183 | /* 184 | 'Sound' API 185 | */ 186 | class Sound 187 | { 188 | private: 189 | 190 | // Constructor made private so user cannot statically instance a Sound class. Appropriate Sound creation or retrieval function must be used. 191 | Sound(); 192 | Sound(const Sound &); 193 | 194 | public: 195 | 196 | FMOD_RESULT F_API release (); 197 | FMOD_RESULT F_API getSystemObject (System **system); 198 | 199 | // Standard sound manipulation functions. 200 | FMOD_RESULT F_API lock (unsigned int offset, unsigned int length, void **ptr1, void **ptr2, unsigned int *len1, unsigned int *len2); 201 | FMOD_RESULT F_API unlock (void *ptr1, void *ptr2, unsigned int len1, unsigned int len2); 202 | FMOD_RESULT F_API setDefaults (float frequency, int priority); 203 | FMOD_RESULT F_API getDefaults (float *frequency, int *priority); 204 | FMOD_RESULT F_API set3DMinMaxDistance (float min, float max); 205 | FMOD_RESULT F_API get3DMinMaxDistance (float *min, float *max); 206 | FMOD_RESULT F_API set3DConeSettings (float insideconeangle, float outsideconeangle, float outsidevolume); 207 | FMOD_RESULT F_API get3DConeSettings (float *insideconeangle, float *outsideconeangle, float *outsidevolume); 208 | FMOD_RESULT F_API set3DCustomRolloff (FMOD_VECTOR *points, int numpoints); 209 | FMOD_RESULT F_API get3DCustomRolloff (FMOD_VECTOR **points, int *numpoints); 210 | FMOD_RESULT F_API getSubSound (int index, Sound **subsound); 211 | FMOD_RESULT F_API getSubSoundParent (Sound **parentsound); 212 | FMOD_RESULT F_API getName (char *name, int namelen); 213 | FMOD_RESULT F_API getLength (unsigned int *length, FMOD_TIMEUNIT lengthtype); 214 | FMOD_RESULT F_API getFormat (FMOD_SOUND_TYPE *type, FMOD_SOUND_FORMAT *format, int *channels, int *bits); 215 | FMOD_RESULT F_API getNumSubSounds (int *numsubsounds); 216 | FMOD_RESULT F_API getNumTags (int *numtags, int *numtagsupdated); 217 | FMOD_RESULT F_API getTag (const char *name, int index, FMOD_TAG *tag); 218 | FMOD_RESULT F_API getOpenState (FMOD_OPENSTATE *openstate, unsigned int *percentbuffered, bool *starving, bool *diskbusy); 219 | FMOD_RESULT F_API readData (void *buffer, unsigned int length, unsigned int *read); 220 | FMOD_RESULT F_API seekData (unsigned int pcm); 221 | 222 | FMOD_RESULT F_API setSoundGroup (SoundGroup *soundgroup); 223 | FMOD_RESULT F_API getSoundGroup (SoundGroup **soundgroup); 224 | 225 | // Synchronization point API. These points can come from markers embedded in wav files, and can also generate channel callbacks. 226 | FMOD_RESULT F_API getNumSyncPoints (int *numsyncpoints); 227 | FMOD_RESULT F_API getSyncPoint (int index, FMOD_SYNCPOINT **point); 228 | FMOD_RESULT F_API getSyncPointInfo (FMOD_SYNCPOINT *point, char *name, int namelen, unsigned int *offset, FMOD_TIMEUNIT offsettype); 229 | FMOD_RESULT F_API addSyncPoint (unsigned int offset, FMOD_TIMEUNIT offsettype, const char *name, FMOD_SYNCPOINT **point); 230 | FMOD_RESULT F_API deleteSyncPoint (FMOD_SYNCPOINT *point); 231 | 232 | // Functions also in Channel class but here they are the 'default' to save having to change it in Channel all the time. 233 | FMOD_RESULT F_API setMode (FMOD_MODE mode); 234 | FMOD_RESULT F_API getMode (FMOD_MODE *mode); 235 | FMOD_RESULT F_API setLoopCount (int loopcount); 236 | FMOD_RESULT F_API getLoopCount (int *loopcount); 237 | FMOD_RESULT F_API setLoopPoints (unsigned int loopstart, FMOD_TIMEUNIT loopstarttype, unsigned int loopend, FMOD_TIMEUNIT loopendtype); 238 | FMOD_RESULT F_API getLoopPoints (unsigned int *loopstart, FMOD_TIMEUNIT loopstarttype, unsigned int *loopend, FMOD_TIMEUNIT loopendtype); 239 | 240 | // For MOD/S3M/XM/IT/MID sequenced formats only. 241 | FMOD_RESULT F_API getMusicNumChannels (int *numchannels); 242 | FMOD_RESULT F_API setMusicChannelVolume (int channel, float volume); 243 | FMOD_RESULT F_API getMusicChannelVolume (int channel, float *volume); 244 | FMOD_RESULT F_API setMusicSpeed (float speed); 245 | FMOD_RESULT F_API getMusicSpeed (float *speed); 246 | 247 | // Userdata set/get. 248 | FMOD_RESULT F_API setUserData (void *userdata); 249 | FMOD_RESULT F_API getUserData (void **userdata); 250 | }; 251 | 252 | 253 | /* 254 | 'ChannelControl API'. This is a base class for Channel and ChannelGroup so they can share the same functionality. This cannot be used or instansiated explicitly. 255 | */ 256 | class ChannelControl 257 | { 258 | private: 259 | 260 | // Constructor made private so user cannot statically instance a Control class. 261 | ChannelControl(); 262 | ChannelControl(const ChannelControl &); 263 | 264 | public: 265 | 266 | FMOD_RESULT F_API getSystemObject (System **system); 267 | 268 | // General control functionality for Channels and ChannelGroups. 269 | FMOD_RESULT F_API stop (); 270 | FMOD_RESULT F_API setPaused (bool paused); 271 | FMOD_RESULT F_API getPaused (bool *paused); 272 | FMOD_RESULT F_API setVolume (float volume); 273 | FMOD_RESULT F_API getVolume (float *volume); 274 | FMOD_RESULT F_API setVolumeRamp (bool ramp); 275 | FMOD_RESULT F_API getVolumeRamp (bool *ramp); 276 | FMOD_RESULT F_API getAudibility (float *audibility); 277 | FMOD_RESULT F_API setPitch (float pitch); 278 | FMOD_RESULT F_API getPitch (float *pitch); 279 | FMOD_RESULT F_API setMute (bool mute); 280 | FMOD_RESULT F_API getMute (bool *mute); 281 | FMOD_RESULT F_API setReverbProperties (int instance, float wet); 282 | FMOD_RESULT F_API getReverbProperties (int instance, float *wet); 283 | FMOD_RESULT F_API setLowPassGain (float gain); 284 | FMOD_RESULT F_API getLowPassGain (float *gain); 285 | FMOD_RESULT F_API setMode (FMOD_MODE mode); 286 | FMOD_RESULT F_API getMode (FMOD_MODE *mode); 287 | FMOD_RESULT F_API setCallback (FMOD_CHANNELCONTROL_CALLBACK callback); 288 | FMOD_RESULT F_API isPlaying (bool *isplaying); 289 | 290 | // Panning and level adjustment. 291 | // Note all 'set' functions alter a final matrix, this is why the only get function is getMixMatrix, to avoid other get functions returning incorrect/obsolete values. 292 | FMOD_RESULT F_API setPan (float pan); 293 | FMOD_RESULT F_API setMixLevelsOutput (float frontleft, float frontright, float center, float lfe, float surroundleft, float surroundright, float backleft, float backright); 294 | FMOD_RESULT F_API setMixLevelsInput (float *levels, int numlevels); 295 | FMOD_RESULT F_API setMixMatrix (float *matrix, int outchannels, int inchannels, int inchannel_hop = 0); 296 | FMOD_RESULT F_API getMixMatrix (float *matrix, int *outchannels, int *inchannels, int inchannel_hop = 0); 297 | 298 | // Clock based functionality. 299 | FMOD_RESULT F_API getDSPClock (unsigned long long *dspclock, unsigned long long *parentclock); 300 | FMOD_RESULT F_API setDelay (unsigned long long dspclock_start, unsigned long long dspclock_end, bool stopchannels = true); 301 | FMOD_RESULT F_API getDelay (unsigned long long *dspclock_start, unsigned long long *dspclock_end, bool *stopchannels = 0); 302 | FMOD_RESULT F_API addFadePoint (unsigned long long dspclock, float volume); 303 | FMOD_RESULT F_API setFadePointRamp (unsigned long long dspclock, float volume); 304 | FMOD_RESULT F_API removeFadePoints (unsigned long long dspclock_start, unsigned long long dspclock_end); 305 | FMOD_RESULT F_API getFadePoints (unsigned int *numpoints, unsigned long long *point_dspclock, float *point_volume); 306 | 307 | // DSP effects. 308 | FMOD_RESULT F_API getDSP (int index, DSP **dsp); 309 | FMOD_RESULT F_API addDSP (int index, DSP *dsp); 310 | FMOD_RESULT F_API removeDSP (DSP *dsp); 311 | FMOD_RESULT F_API getNumDSPs (int *numdsps); 312 | FMOD_RESULT F_API setDSPIndex (DSP *dsp, int index); 313 | FMOD_RESULT F_API getDSPIndex (DSP *dsp, int *index); 314 | 315 | // 3D functionality. 316 | FMOD_RESULT F_API set3DAttributes (const FMOD_VECTOR *pos, const FMOD_VECTOR *vel); 317 | FMOD_RESULT F_API get3DAttributes (FMOD_VECTOR *pos, FMOD_VECTOR *vel); 318 | FMOD_RESULT F_API set3DMinMaxDistance (float mindistance, float maxdistance); 319 | FMOD_RESULT F_API get3DMinMaxDistance (float *mindistance, float *maxdistance); 320 | FMOD_RESULT F_API set3DConeSettings (float insideconeangle, float outsideconeangle, float outsidevolume); 321 | FMOD_RESULT F_API get3DConeSettings (float *insideconeangle, float *outsideconeangle, float *outsidevolume); 322 | FMOD_RESULT F_API set3DConeOrientation (FMOD_VECTOR *orientation); 323 | FMOD_RESULT F_API get3DConeOrientation (FMOD_VECTOR *orientation); 324 | FMOD_RESULT F_API set3DCustomRolloff (FMOD_VECTOR *points, int numpoints); 325 | FMOD_RESULT F_API get3DCustomRolloff (FMOD_VECTOR **points, int *numpoints); 326 | FMOD_RESULT F_API set3DOcclusion (float directocclusion, float reverbocclusion); 327 | FMOD_RESULT F_API get3DOcclusion (float *directocclusion, float *reverbocclusion); 328 | FMOD_RESULT F_API set3DSpread (float angle); 329 | FMOD_RESULT F_API get3DSpread (float *angle); 330 | FMOD_RESULT F_API set3DLevel (float level); 331 | FMOD_RESULT F_API get3DLevel (float *level); 332 | FMOD_RESULT F_API set3DDopplerLevel (float level); 333 | FMOD_RESULT F_API get3DDopplerLevel (float *level); 334 | FMOD_RESULT F_API set3DDistanceFilter (bool custom, float customLevel, float centerFreq); 335 | FMOD_RESULT F_API get3DDistanceFilter (bool *custom, float *customLevel, float *centerFreq); 336 | 337 | // Userdata set/get. 338 | FMOD_RESULT F_API setUserData (void *userdata); 339 | FMOD_RESULT F_API getUserData (void **userdata); 340 | }; 341 | 342 | /* 343 | 'Channel' API. 344 | */ 345 | class Channel : public ChannelControl 346 | { 347 | private: 348 | 349 | // Constructor made private so user cannot statically instance a Channel class. Appropriate Channel creation or retrieval function must be used. 350 | Channel(); 351 | Channel(const Channel &); 352 | 353 | public: 354 | 355 | // Channel specific control functionality. 356 | FMOD_RESULT F_API setFrequency (float frequency); 357 | FMOD_RESULT F_API getFrequency (float *frequency); 358 | FMOD_RESULT F_API setPriority (int priority); 359 | FMOD_RESULT F_API getPriority (int *priority); 360 | FMOD_RESULT F_API setPosition (unsigned int position, FMOD_TIMEUNIT postype); 361 | FMOD_RESULT F_API getPosition (unsigned int *position, FMOD_TIMEUNIT postype); 362 | FMOD_RESULT F_API setChannelGroup (ChannelGroup *channelgroup); 363 | FMOD_RESULT F_API getChannelGroup (ChannelGroup **channelgroup); 364 | FMOD_RESULT F_API setLoopCount (int loopcount); 365 | FMOD_RESULT F_API getLoopCount (int *loopcount); 366 | FMOD_RESULT F_API setLoopPoints (unsigned int loopstart, FMOD_TIMEUNIT loopstarttype, unsigned int loopend, FMOD_TIMEUNIT loopendtype); 367 | FMOD_RESULT F_API getLoopPoints (unsigned int *loopstart, FMOD_TIMEUNIT loopstarttype, unsigned int *loopend, FMOD_TIMEUNIT loopendtype); 368 | 369 | // Information only functions. 370 | FMOD_RESULT F_API isVirtual (bool *isvirtual); 371 | FMOD_RESULT F_API getCurrentSound (Sound **sound); 372 | FMOD_RESULT F_API getIndex (int *index); 373 | }; 374 | 375 | /* 376 | 'ChannelGroup' API 377 | */ 378 | class ChannelGroup : public ChannelControl 379 | { 380 | private: 381 | 382 | // Constructor made private so user cannot statically instance a ChannelGroup class. Appropriate ChannelGroup creation or retrieval function must be used. 383 | ChannelGroup(); 384 | ChannelGroup(const ChannelGroup &); 385 | 386 | public: 387 | 388 | FMOD_RESULT F_API release (); 389 | 390 | // Nested channel groups. 391 | FMOD_RESULT F_API addGroup (ChannelGroup *group, bool propagatedspclock = true, DSPConnection **connection = 0); 392 | FMOD_RESULT F_API getNumGroups (int *numgroups); 393 | FMOD_RESULT F_API getGroup (int index, ChannelGroup **group); 394 | FMOD_RESULT F_API getParentGroup (ChannelGroup **group); 395 | 396 | // Information only functions. 397 | FMOD_RESULT F_API getName (char *name, int namelen); 398 | FMOD_RESULT F_API getNumChannels (int *numchannels); 399 | FMOD_RESULT F_API getChannel (int index, Channel **channel); 400 | }; 401 | 402 | /* 403 | 'SoundGroup' API 404 | */ 405 | class SoundGroup 406 | { 407 | private: 408 | 409 | // Constructor made private so user cannot statically instance a SoundGroup class. Appropriate SoundGroup creation or retrieval function must be used. 410 | SoundGroup(); 411 | SoundGroup(const SoundGroup &); 412 | 413 | public: 414 | 415 | FMOD_RESULT F_API release (); 416 | FMOD_RESULT F_API getSystemObject (System **system); 417 | 418 | // SoundGroup control functions. 419 | FMOD_RESULT F_API setMaxAudible (int maxaudible); 420 | FMOD_RESULT F_API getMaxAudible (int *maxaudible); 421 | FMOD_RESULT F_API setMaxAudibleBehavior (FMOD_SOUNDGROUP_BEHAVIOR behavior); 422 | FMOD_RESULT F_API getMaxAudibleBehavior (FMOD_SOUNDGROUP_BEHAVIOR *behavior); 423 | FMOD_RESULT F_API setMuteFadeSpeed (float speed); 424 | FMOD_RESULT F_API getMuteFadeSpeed (float *speed); 425 | FMOD_RESULT F_API setVolume (float volume); 426 | FMOD_RESULT F_API getVolume (float *volume); 427 | FMOD_RESULT F_API stop (); 428 | 429 | // Information only functions. 430 | FMOD_RESULT F_API getName (char *name, int namelen); 431 | FMOD_RESULT F_API getNumSounds (int *numsounds); 432 | FMOD_RESULT F_API getSound (int index, Sound **sound); 433 | FMOD_RESULT F_API getNumPlaying (int *numplaying); 434 | 435 | // Userdata set/get. 436 | FMOD_RESULT F_API setUserData (void *userdata); 437 | FMOD_RESULT F_API getUserData (void **userdata); 438 | }; 439 | 440 | /* 441 | 'DSP' API 442 | */ 443 | class DSP 444 | { 445 | private: 446 | 447 | // Constructor made private so user cannot statically instance a DSP class. Appropriate DSP creation or retrieval function must be used. 448 | DSP(); 449 | DSP(const DSP &); 450 | 451 | public: 452 | 453 | FMOD_RESULT F_API release (); 454 | FMOD_RESULT F_API getSystemObject (System **system); 455 | 456 | // Connection / disconnection / input and output enumeration. 457 | FMOD_RESULT F_API addInput (DSP *input, DSPConnection **connection = 0, FMOD_DSPCONNECTION_TYPE type = FMOD_DSPCONNECTION_TYPE_STANDARD); 458 | FMOD_RESULT F_API disconnectFrom (DSP *target, DSPConnection *connection = 0); 459 | FMOD_RESULT F_API disconnectAll (bool inputs, bool outputs); 460 | FMOD_RESULT F_API getNumInputs (int *numinputs); 461 | FMOD_RESULT F_API getNumOutputs (int *numoutputs); 462 | FMOD_RESULT F_API getInput (int index, DSP **input, DSPConnection **inputconnection); 463 | FMOD_RESULT F_API getOutput (int index, DSP **output, DSPConnection **outputconnection); 464 | 465 | // DSP unit control. 466 | FMOD_RESULT F_API setActive (bool active); 467 | FMOD_RESULT F_API getActive (bool *active); 468 | FMOD_RESULT F_API setBypass (bool bypass); 469 | FMOD_RESULT F_API getBypass (bool *bypass); 470 | FMOD_RESULT F_API setWetDryMix (float prewet, float postwet, float dry); 471 | FMOD_RESULT F_API getWetDryMix (float *prewet, float *postwet, float *dry); 472 | FMOD_RESULT F_API setChannelFormat (FMOD_CHANNELMASK channelmask, int numchannels, FMOD_SPEAKERMODE source_speakermode); 473 | FMOD_RESULT F_API getChannelFormat (FMOD_CHANNELMASK *channelmask, int *numchannels, FMOD_SPEAKERMODE *source_speakermode); 474 | FMOD_RESULT F_API getOutputChannelFormat (FMOD_CHANNELMASK inmask, int inchannels, FMOD_SPEAKERMODE inspeakermode, FMOD_CHANNELMASK *outmask, int *outchannels, FMOD_SPEAKERMODE *outspeakermode); 475 | FMOD_RESULT F_API reset (); 476 | FMOD_RESULT F_API setCallback (FMOD_DSP_CALLBACK callback); 477 | 478 | // DSP parameter control. 479 | FMOD_RESULT F_API setParameterFloat (int index, float value); 480 | FMOD_RESULT F_API setParameterInt (int index, int value); 481 | FMOD_RESULT F_API setParameterBool (int index, bool value); 482 | FMOD_RESULT F_API setParameterData (int index, void *data, unsigned int length); 483 | FMOD_RESULT F_API getParameterFloat (int index, float *value, char *valuestr, int valuestrlen); 484 | FMOD_RESULT F_API getParameterInt (int index, int *value, char *valuestr, int valuestrlen); 485 | FMOD_RESULT F_API getParameterBool (int index, bool *value, char *valuestr, int valuestrlen); 486 | FMOD_RESULT F_API getParameterData (int index, void **data, unsigned int *length, char *valuestr, int valuestrlen); 487 | FMOD_RESULT F_API getNumParameters (int *numparams); 488 | FMOD_RESULT F_API getParameterInfo (int index, FMOD_DSP_PARAMETER_DESC **desc); 489 | FMOD_RESULT F_API getDataParameterIndex (int datatype, int *index); 490 | FMOD_RESULT F_API showConfigDialog (void *hwnd, bool show); 491 | 492 | // DSP attributes. 493 | FMOD_RESULT F_API getInfo (char *name, unsigned int *version, int *channels, int *configwidth, int *configheight); 494 | FMOD_RESULT F_API getType (FMOD_DSP_TYPE *type); 495 | FMOD_RESULT F_API getIdle (bool *idle); 496 | 497 | // Userdata set/get. 498 | FMOD_RESULT F_API setUserData (void *userdata); 499 | FMOD_RESULT F_API getUserData (void **userdata); 500 | 501 | // Metering. 502 | FMOD_RESULT F_API setMeteringEnabled (bool inputEnabled, bool outputEnabled); 503 | FMOD_RESULT F_API getMeteringEnabled (bool *inputEnabled, bool *outputEnabled); 504 | FMOD_RESULT F_API getMeteringInfo (FMOD_DSP_METERING_INFO *inputInfo, FMOD_DSP_METERING_INFO *outputInfo); 505 | FMOD_RESULT F_API getCPUUsage (unsigned int *exclusive, unsigned int *inclusive); 506 | }; 507 | 508 | 509 | /* 510 | 'DSPConnection' API 511 | */ 512 | class DSPConnection 513 | { 514 | private: 515 | 516 | // Constructor made private so user cannot statically instance a DSPConnection class. Appropriate DSPConnection creation or retrieval function must be used. 517 | DSPConnection(); 518 | DSPConnection(const DSPConnection &); 519 | 520 | public: 521 | 522 | FMOD_RESULT F_API getInput (DSP **input); 523 | FMOD_RESULT F_API getOutput (DSP **output); 524 | FMOD_RESULT F_API setMix (float volume); 525 | FMOD_RESULT F_API getMix (float *volume); 526 | FMOD_RESULT F_API setMixMatrix (float *matrix, int outchannels, int inchannels, int inchannel_hop = 0); 527 | FMOD_RESULT F_API getMixMatrix (float *matrix, int *outchannels, int *inchannels, int inchannel_hop = 0); 528 | FMOD_RESULT F_API getType (FMOD_DSPCONNECTION_TYPE *type); 529 | 530 | // Userdata set/get. 531 | FMOD_RESULT F_API setUserData (void *userdata); 532 | FMOD_RESULT F_API getUserData (void **userdata); 533 | }; 534 | 535 | 536 | /* 537 | 'Geometry' API 538 | */ 539 | class Geometry 540 | { 541 | private: 542 | 543 | // Constructor made private so user cannot statically instance a Geometry class. Appropriate Geometry creation or retrieval function must be used. 544 | Geometry(); 545 | Geometry(const Geometry &); 546 | 547 | public: 548 | 549 | FMOD_RESULT F_API release (); 550 | 551 | // Polygon manipulation. 552 | FMOD_RESULT F_API addPolygon (float directocclusion, float reverbocclusion, bool doublesided, int numvertices, const FMOD_VECTOR *vertices, int *polygonindex); 553 | FMOD_RESULT F_API getNumPolygons (int *numpolygons); 554 | FMOD_RESULT F_API getMaxPolygons (int *maxpolygons, int *maxvertices); 555 | FMOD_RESULT F_API getPolygonNumVertices (int index, int *numvertices); 556 | FMOD_RESULT F_API setPolygonVertex (int index, int vertexindex, const FMOD_VECTOR *vertex); 557 | FMOD_RESULT F_API getPolygonVertex (int index, int vertexindex, FMOD_VECTOR *vertex); 558 | FMOD_RESULT F_API setPolygonAttributes (int index, float directocclusion, float reverbocclusion, bool doublesided); 559 | FMOD_RESULT F_API getPolygonAttributes (int index, float *directocclusion, float *reverbocclusion, bool *doublesided); 560 | 561 | // Object manipulation. 562 | FMOD_RESULT F_API setActive (bool active); 563 | FMOD_RESULT F_API getActive (bool *active); 564 | FMOD_RESULT F_API setRotation (const FMOD_VECTOR *forward, const FMOD_VECTOR *up); 565 | FMOD_RESULT F_API getRotation (FMOD_VECTOR *forward, FMOD_VECTOR *up); 566 | FMOD_RESULT F_API setPosition (const FMOD_VECTOR *position); 567 | FMOD_RESULT F_API getPosition (FMOD_VECTOR *position); 568 | FMOD_RESULT F_API setScale (const FMOD_VECTOR *scale); 569 | FMOD_RESULT F_API getScale (FMOD_VECTOR *scale); 570 | FMOD_RESULT F_API save (void *data, int *datasize); 571 | 572 | // Userdata set/get. 573 | FMOD_RESULT F_API setUserData (void *userdata); 574 | FMOD_RESULT F_API getUserData (void **userdata); 575 | }; 576 | 577 | 578 | /* 579 | 'Reverb' API 580 | */ 581 | class Reverb3D 582 | { 583 | private: 584 | 585 | // Constructor made private so user cannot statically instance a Reverb3D class. Appropriate Reverb creation or retrieval function must be used. 586 | Reverb3D(); 587 | Reverb3D(const Reverb3D &); 588 | 589 | public: 590 | 591 | FMOD_RESULT F_API release (); 592 | 593 | // Reverb manipulation. 594 | FMOD_RESULT F_API set3DAttributes (const FMOD_VECTOR *position, float mindistance, float maxdistance); 595 | FMOD_RESULT F_API get3DAttributes (FMOD_VECTOR *position, float *mindistance,float *maxdistance); 596 | FMOD_RESULT F_API setProperties (const FMOD_REVERB_PROPERTIES *properties); 597 | FMOD_RESULT F_API getProperties (FMOD_REVERB_PROPERTIES *properties); 598 | FMOD_RESULT F_API setActive (bool active); 599 | FMOD_RESULT F_API getActive (bool *active); 600 | 601 | // Userdata set/get. 602 | FMOD_RESULT F_API setUserData (void *userdata); 603 | FMOD_RESULT F_API getUserData (void **userdata); 604 | }; 605 | } 606 | 607 | #endif 608 | -------------------------------------------------------------------------------- /PingPongTutorial/inc/3rd-party/fmod_codec.h: -------------------------------------------------------------------------------- 1 | /* ======================================================================================== */ 2 | /* FMOD Core API - Codec development header file. */ 3 | /* Copyright (c), Firelight Technologies Pty, Ltd. 2004-2023. */ 4 | /* */ 5 | /* Use this header if you are wanting to develop your own file format plugin to use with */ 6 | /* FMOD's codec system. With this header you can make your own fileformat plugin that FMOD */ 7 | /* can register and use. See the documentation and examples on how to make a working */ 8 | /* plugin. */ 9 | /* */ 10 | /* For more detail visit: */ 11 | /* https://fmod.com/docs/2.02/api/core-api.html */ 12 | /* ======================================================================================== */ 13 | #ifndef _FMOD_CODEC_H 14 | #define _FMOD_CODEC_H 15 | 16 | /* 17 | Codec types 18 | */ 19 | typedef struct FMOD_CODEC_STATE FMOD_CODEC_STATE; 20 | typedef struct FMOD_CODEC_WAVEFORMAT FMOD_CODEC_WAVEFORMAT; 21 | 22 | /* 23 | Codec constants 24 | */ 25 | #define FMOD_CODEC_PLUGIN_VERSION 1 26 | 27 | typedef int FMOD_CODEC_SEEK_METHOD; 28 | #define FMOD_CODEC_SEEK_METHOD_SET 0 29 | #define FMOD_CODEC_SEEK_METHOD_CURRENT 1 30 | #define FMOD_CODEC_SEEK_METHOD_END 2 31 | 32 | /* 33 | Codec callbacks 34 | */ 35 | typedef FMOD_RESULT (F_CALLBACK *FMOD_CODEC_OPEN_CALLBACK) (FMOD_CODEC_STATE *codec_state, FMOD_MODE usermode, FMOD_CREATESOUNDEXINFO *userexinfo); 36 | typedef FMOD_RESULT (F_CALLBACK *FMOD_CODEC_CLOSE_CALLBACK) (FMOD_CODEC_STATE *codec_state); 37 | typedef FMOD_RESULT (F_CALLBACK *FMOD_CODEC_READ_CALLBACK) (FMOD_CODEC_STATE *codec_state, void *buffer, unsigned int samples_in, unsigned int *samples_out); 38 | typedef FMOD_RESULT (F_CALLBACK *FMOD_CODEC_GETLENGTH_CALLBACK) (FMOD_CODEC_STATE *codec_state, unsigned int *length, FMOD_TIMEUNIT lengthtype); 39 | typedef FMOD_RESULT (F_CALLBACK *FMOD_CODEC_SETPOSITION_CALLBACK) (FMOD_CODEC_STATE *codec_state, int subsound, unsigned int position, FMOD_TIMEUNIT postype); 40 | typedef FMOD_RESULT (F_CALLBACK *FMOD_CODEC_GETPOSITION_CALLBACK) (FMOD_CODEC_STATE *codec_state, unsigned int *position, FMOD_TIMEUNIT postype); 41 | typedef FMOD_RESULT (F_CALLBACK *FMOD_CODEC_SOUNDCREATE_CALLBACK) (FMOD_CODEC_STATE *codec_state, int subsound, FMOD_SOUND *sound); 42 | typedef FMOD_RESULT (F_CALLBACK *FMOD_CODEC_GETWAVEFORMAT_CALLBACK)(FMOD_CODEC_STATE *codec_state, int index, FMOD_CODEC_WAVEFORMAT *waveformat); 43 | 44 | /* 45 | Codec functions 46 | */ 47 | typedef FMOD_RESULT (F_CALLBACK *FMOD_CODEC_METADATA_FUNC) (FMOD_CODEC_STATE *codec_state, FMOD_TAGTYPE tagtype, char *name, void *data, unsigned int datalen, FMOD_TAGDATATYPE datatype, int unique); 48 | typedef void * (F_CALLBACK *FMOD_CODEC_ALLOC_FUNC) (unsigned int size, unsigned int align, const char *file, int line); 49 | typedef void (F_CALLBACK *FMOD_CODEC_FREE_FUNC) (void *ptr, const char *file, int line); 50 | typedef void (F_CALLBACK *FMOD_CODEC_LOG_FUNC) (FMOD_DEBUG_FLAGS level, const char *file, int line, const char *function, const char *string, ...); 51 | 52 | typedef FMOD_RESULT (F_CALLBACK *FMOD_CODEC_FILE_READ_FUNC) (FMOD_CODEC_STATE *codec_state, void *buffer, unsigned int sizebytes, unsigned int *bytesread); 53 | typedef FMOD_RESULT (F_CALLBACK *FMOD_CODEC_FILE_SEEK_FUNC) (FMOD_CODEC_STATE *codec_state, unsigned int pos, FMOD_CODEC_SEEK_METHOD method); 54 | typedef FMOD_RESULT (F_CALLBACK *FMOD_CODEC_FILE_TELL_FUNC) (FMOD_CODEC_STATE *codec_state, unsigned int *pos); 55 | typedef FMOD_RESULT (F_CALLBACK *FMOD_CODEC_FILE_SIZE_FUNC) (FMOD_CODEC_STATE *codec_state, unsigned int *size); 56 | 57 | /* 58 | Codec structures 59 | */ 60 | typedef struct FMOD_CODEC_DESCRIPTION 61 | { 62 | unsigned int apiversion; 63 | const char *name; 64 | unsigned int version; 65 | int defaultasstream; 66 | FMOD_TIMEUNIT timeunits; 67 | FMOD_CODEC_OPEN_CALLBACK open; 68 | FMOD_CODEC_CLOSE_CALLBACK close; 69 | FMOD_CODEC_READ_CALLBACK read; 70 | FMOD_CODEC_GETLENGTH_CALLBACK getlength; 71 | FMOD_CODEC_SETPOSITION_CALLBACK setposition; 72 | FMOD_CODEC_GETPOSITION_CALLBACK getposition; 73 | FMOD_CODEC_SOUNDCREATE_CALLBACK soundcreate; 74 | FMOD_CODEC_GETWAVEFORMAT_CALLBACK getwaveformat; 75 | } FMOD_CODEC_DESCRIPTION; 76 | 77 | struct FMOD_CODEC_WAVEFORMAT 78 | { 79 | const char* name; 80 | FMOD_SOUND_FORMAT format; 81 | int channels; 82 | int frequency; 83 | unsigned int lengthbytes; 84 | unsigned int lengthpcm; 85 | unsigned int pcmblocksize; 86 | int loopstart; 87 | int loopend; 88 | FMOD_MODE mode; 89 | FMOD_CHANNELMASK channelmask; 90 | FMOD_CHANNELORDER channelorder; 91 | float peakvolume; 92 | }; 93 | 94 | typedef struct FMOD_CODEC_STATE_FUNCTIONS 95 | { 96 | FMOD_CODEC_METADATA_FUNC metadata; 97 | FMOD_CODEC_ALLOC_FUNC alloc; 98 | FMOD_CODEC_FREE_FUNC free; 99 | FMOD_CODEC_LOG_FUNC log; 100 | FMOD_CODEC_FILE_READ_FUNC read; 101 | FMOD_CODEC_FILE_SEEK_FUNC seek; 102 | FMOD_CODEC_FILE_TELL_FUNC tell; 103 | FMOD_CODEC_FILE_SIZE_FUNC size; 104 | } FMOD_CODEC_STATE_FUNCTIONS; 105 | 106 | struct FMOD_CODEC_STATE 107 | { 108 | void *plugindata; 109 | FMOD_CODEC_WAVEFORMAT *waveformat; 110 | FMOD_CODEC_STATE_FUNCTIONS *functions; 111 | int numsubsounds; 112 | }; 113 | 114 | /* 115 | Codec macros 116 | */ 117 | #define FMOD_CODEC_METADATA(_state, _tagtype, _name, _data, _datalen, _datatype, _unique) \ 118 | (_state)->functions->metadata(_state, _tagtype, _name, _data, _datalen, _datatype, _unique) 119 | #define FMOD_CODEC_ALLOC(_state, _size, _align) \ 120 | (_state)->functions->alloc(_size, _align, __FILE__, __LINE__) 121 | #define FMOD_CODEC_FREE(_state, _ptr) \ 122 | (_state)->functions->free(_ptr, __FILE__, __LINE__) 123 | #define FMOD_CODEC_LOG(_state, _level, _location, _format, ...) \ 124 | (_state)->functions->log(_level, __FILE__, __LINE__, _location, _format, __VA_ARGS__) 125 | #define FMOD_CODEC_FILE_READ(_state, _buffer, _sizebytes, _bytesread) \ 126 | (_state)->functions->read(_state, _buffer, _sizebytes, _bytesread) 127 | #define FMOD_CODEC_FILE_SEEK(_state, _pos, _method) \ 128 | (_state)->functions->seek(_state, _pos, _method) 129 | #define FMOD_CODEC_FILE_TELL(_state, _pos) \ 130 | (_state)->functions->tell(_state, _pos) 131 | #define FMOD_CODEC_FILE_SIZE(_state, _size) \ 132 | (_state)->functions->size(_state, _size) 133 | 134 | #endif 135 | 136 | 137 | -------------------------------------------------------------------------------- /PingPongTutorial/inc/3rd-party/fmod_common.h: -------------------------------------------------------------------------------- 1 | /* ======================================================================================== */ 2 | /* FMOD Core API - Common C/C++ header file. */ 3 | /* Copyright (c), Firelight Technologies Pty, Ltd. 2004-2023. */ 4 | /* */ 5 | /* This header is included by fmod.hpp (C++ interface) and fmod.h (C interface) */ 6 | /* */ 7 | /* For more detail visit: */ 8 | /* https://fmod.com/docs/2.02/api/core-api-common.html */ 9 | /* ======================================================================================== */ 10 | #ifndef _FMOD_COMMON_H 11 | #define _FMOD_COMMON_H 12 | 13 | /* 14 | Library import helpers 15 | */ 16 | #if defined(_WIN32) || defined(__CYGWIN__) 17 | #define F_CALL __stdcall 18 | #else 19 | #define F_CALL 20 | #endif 21 | 22 | #if defined(_WIN32) || defined(__CYGWIN__) || defined(__ORBIS__) || defined(F_USE_DECLSPEC) 23 | #define F_EXPORT __declspec(dllexport) 24 | #elif defined(__APPLE__) || defined(__ANDROID__) || defined(__linux__) || defined(F_USE_ATTRIBUTE) 25 | #define F_EXPORT __attribute__((visibility("default"))) 26 | #else 27 | #define F_EXPORT 28 | #endif 29 | 30 | #ifdef DLL_EXPORTS 31 | #define F_API F_EXPORT F_CALL 32 | #else 33 | #define F_API F_CALL 34 | #endif 35 | 36 | #define F_CALLBACK F_CALL 37 | 38 | /* 39 | FMOD core types 40 | */ 41 | typedef int FMOD_BOOL; 42 | typedef struct FMOD_SYSTEM FMOD_SYSTEM; 43 | typedef struct FMOD_SOUND FMOD_SOUND; 44 | typedef struct FMOD_CHANNELCONTROL FMOD_CHANNELCONTROL; 45 | typedef struct FMOD_CHANNEL FMOD_CHANNEL; 46 | typedef struct FMOD_CHANNELGROUP FMOD_CHANNELGROUP; 47 | typedef struct FMOD_SOUNDGROUP FMOD_SOUNDGROUP; 48 | typedef struct FMOD_REVERB3D FMOD_REVERB3D; 49 | typedef struct FMOD_DSP FMOD_DSP; 50 | typedef struct FMOD_DSPCONNECTION FMOD_DSPCONNECTION; 51 | typedef struct FMOD_POLYGON FMOD_POLYGON; 52 | typedef struct FMOD_GEOMETRY FMOD_GEOMETRY; 53 | typedef struct FMOD_SYNCPOINT FMOD_SYNCPOINT; 54 | typedef struct FMOD_ASYNCREADINFO FMOD_ASYNCREADINFO; 55 | 56 | /* 57 | FMOD constants 58 | */ 59 | #define FMOD_VERSION 0x00020216 /* 0xaaaabbcc -> aaaa = product version, bb = major version, cc = minor version.*/ 60 | 61 | typedef unsigned int FMOD_DEBUG_FLAGS; 62 | #define FMOD_DEBUG_LEVEL_NONE 0x00000000 63 | #define FMOD_DEBUG_LEVEL_ERROR 0x00000001 64 | #define FMOD_DEBUG_LEVEL_WARNING 0x00000002 65 | #define FMOD_DEBUG_LEVEL_LOG 0x00000004 66 | #define FMOD_DEBUG_TYPE_MEMORY 0x00000100 67 | #define FMOD_DEBUG_TYPE_FILE 0x00000200 68 | #define FMOD_DEBUG_TYPE_CODEC 0x00000400 69 | #define FMOD_DEBUG_TYPE_TRACE 0x00000800 70 | #define FMOD_DEBUG_DISPLAY_TIMESTAMPS 0x00010000 71 | #define FMOD_DEBUG_DISPLAY_LINENUMBERS 0x00020000 72 | #define FMOD_DEBUG_DISPLAY_THREAD 0x00040000 73 | 74 | typedef unsigned int FMOD_MEMORY_TYPE; 75 | #define FMOD_MEMORY_NORMAL 0x00000000 76 | #define FMOD_MEMORY_STREAM_FILE 0x00000001 77 | #define FMOD_MEMORY_STREAM_DECODE 0x00000002 78 | #define FMOD_MEMORY_SAMPLEDATA 0x00000004 79 | #define FMOD_MEMORY_DSP_BUFFER 0x00000008 80 | #define FMOD_MEMORY_PLUGIN 0x00000010 81 | #define FMOD_MEMORY_PERSISTENT 0x00200000 82 | #define FMOD_MEMORY_ALL 0xFFFFFFFF 83 | 84 | typedef unsigned int FMOD_INITFLAGS; 85 | #define FMOD_INIT_NORMAL 0x00000000 86 | #define FMOD_INIT_STREAM_FROM_UPDATE 0x00000001 87 | #define FMOD_INIT_MIX_FROM_UPDATE 0x00000002 88 | #define FMOD_INIT_3D_RIGHTHANDED 0x00000004 89 | #define FMOD_INIT_CLIP_OUTPUT 0x00000008 90 | #define FMOD_INIT_CHANNEL_LOWPASS 0x00000100 91 | #define FMOD_INIT_CHANNEL_DISTANCEFILTER 0x00000200 92 | #define FMOD_INIT_PROFILE_ENABLE 0x00010000 93 | #define FMOD_INIT_VOL0_BECOMES_VIRTUAL 0x00020000 94 | #define FMOD_INIT_GEOMETRY_USECLOSEST 0x00040000 95 | #define FMOD_INIT_PREFER_DOLBY_DOWNMIX 0x00080000 96 | #define FMOD_INIT_THREAD_UNSAFE 0x00100000 97 | #define FMOD_INIT_PROFILE_METER_ALL 0x00200000 98 | #define FMOD_INIT_MEMORY_TRACKING 0x00400000 99 | 100 | typedef unsigned int FMOD_DRIVER_STATE; 101 | #define FMOD_DRIVER_STATE_CONNECTED 0x00000001 102 | #define FMOD_DRIVER_STATE_DEFAULT 0x00000002 103 | 104 | typedef unsigned int FMOD_TIMEUNIT; 105 | #define FMOD_TIMEUNIT_MS 0x00000001 106 | #define FMOD_TIMEUNIT_PCM 0x00000002 107 | #define FMOD_TIMEUNIT_PCMBYTES 0x00000004 108 | #define FMOD_TIMEUNIT_RAWBYTES 0x00000008 109 | #define FMOD_TIMEUNIT_PCMFRACTION 0x00000010 110 | #define FMOD_TIMEUNIT_MODORDER 0x00000100 111 | #define FMOD_TIMEUNIT_MODROW 0x00000200 112 | #define FMOD_TIMEUNIT_MODPATTERN 0x00000400 113 | 114 | typedef unsigned int FMOD_SYSTEM_CALLBACK_TYPE; 115 | #define FMOD_SYSTEM_CALLBACK_DEVICELISTCHANGED 0x00000001 116 | #define FMOD_SYSTEM_CALLBACK_DEVICELOST 0x00000002 117 | #define FMOD_SYSTEM_CALLBACK_MEMORYALLOCATIONFAILED 0x00000004 118 | #define FMOD_SYSTEM_CALLBACK_THREADCREATED 0x00000008 119 | #define FMOD_SYSTEM_CALLBACK_BADDSPCONNECTION 0x00000010 120 | #define FMOD_SYSTEM_CALLBACK_PREMIX 0x00000020 121 | #define FMOD_SYSTEM_CALLBACK_POSTMIX 0x00000040 122 | #define FMOD_SYSTEM_CALLBACK_ERROR 0x00000080 123 | #define FMOD_SYSTEM_CALLBACK_MIDMIX 0x00000100 124 | #define FMOD_SYSTEM_CALLBACK_THREADDESTROYED 0x00000200 125 | #define FMOD_SYSTEM_CALLBACK_PREUPDATE 0x00000400 126 | #define FMOD_SYSTEM_CALLBACK_POSTUPDATE 0x00000800 127 | #define FMOD_SYSTEM_CALLBACK_RECORDLISTCHANGED 0x00001000 128 | #define FMOD_SYSTEM_CALLBACK_BUFFEREDNOMIX 0x00002000 129 | #define FMOD_SYSTEM_CALLBACK_DEVICEREINITIALIZE 0x00004000 130 | #define FMOD_SYSTEM_CALLBACK_OUTPUTUNDERRUN 0x00008000 131 | #define FMOD_SYSTEM_CALLBACK_RECORDPOSITIONCHANGED 0x00010000 132 | #define FMOD_SYSTEM_CALLBACK_ALL 0xFFFFFFFF 133 | 134 | typedef unsigned int FMOD_MODE; 135 | #define FMOD_DEFAULT 0x00000000 136 | #define FMOD_LOOP_OFF 0x00000001 137 | #define FMOD_LOOP_NORMAL 0x00000002 138 | #define FMOD_LOOP_BIDI 0x00000004 139 | #define FMOD_2D 0x00000008 140 | #define FMOD_3D 0x00000010 141 | #define FMOD_CREATESTREAM 0x00000080 142 | #define FMOD_CREATESAMPLE 0x00000100 143 | #define FMOD_CREATECOMPRESSEDSAMPLE 0x00000200 144 | #define FMOD_OPENUSER 0x00000400 145 | #define FMOD_OPENMEMORY 0x00000800 146 | #define FMOD_OPENMEMORY_POINT 0x10000000 147 | #define FMOD_OPENRAW 0x00001000 148 | #define FMOD_OPENONLY 0x00002000 149 | #define FMOD_ACCURATETIME 0x00004000 150 | #define FMOD_MPEGSEARCH 0x00008000 151 | #define FMOD_NONBLOCKING 0x00010000 152 | #define FMOD_UNIQUE 0x00020000 153 | #define FMOD_3D_HEADRELATIVE 0x00040000 154 | #define FMOD_3D_WORLDRELATIVE 0x00080000 155 | #define FMOD_3D_INVERSEROLLOFF 0x00100000 156 | #define FMOD_3D_LINEARROLLOFF 0x00200000 157 | #define FMOD_3D_LINEARSQUAREROLLOFF 0x00400000 158 | #define FMOD_3D_INVERSETAPEREDROLLOFF 0x00800000 159 | #define FMOD_3D_CUSTOMROLLOFF 0x04000000 160 | #define FMOD_3D_IGNOREGEOMETRY 0x40000000 161 | #define FMOD_IGNORETAGS 0x02000000 162 | #define FMOD_LOWMEM 0x08000000 163 | #define FMOD_VIRTUAL_PLAYFROMSTART 0x80000000 164 | 165 | typedef unsigned int FMOD_CHANNELMASK; 166 | #define FMOD_CHANNELMASK_FRONT_LEFT 0x00000001 167 | #define FMOD_CHANNELMASK_FRONT_RIGHT 0x00000002 168 | #define FMOD_CHANNELMASK_FRONT_CENTER 0x00000004 169 | #define FMOD_CHANNELMASK_LOW_FREQUENCY 0x00000008 170 | #define FMOD_CHANNELMASK_SURROUND_LEFT 0x00000010 171 | #define FMOD_CHANNELMASK_SURROUND_RIGHT 0x00000020 172 | #define FMOD_CHANNELMASK_BACK_LEFT 0x00000040 173 | #define FMOD_CHANNELMASK_BACK_RIGHT 0x00000080 174 | #define FMOD_CHANNELMASK_BACK_CENTER 0x00000100 175 | #define FMOD_CHANNELMASK_MONO (FMOD_CHANNELMASK_FRONT_LEFT) 176 | #define FMOD_CHANNELMASK_STEREO (FMOD_CHANNELMASK_FRONT_LEFT | FMOD_CHANNELMASK_FRONT_RIGHT) 177 | #define FMOD_CHANNELMASK_LRC (FMOD_CHANNELMASK_FRONT_LEFT | FMOD_CHANNELMASK_FRONT_RIGHT | FMOD_CHANNELMASK_FRONT_CENTER) 178 | #define FMOD_CHANNELMASK_QUAD (FMOD_CHANNELMASK_FRONT_LEFT | FMOD_CHANNELMASK_FRONT_RIGHT | FMOD_CHANNELMASK_SURROUND_LEFT | FMOD_CHANNELMASK_SURROUND_RIGHT) 179 | #define FMOD_CHANNELMASK_SURROUND (FMOD_CHANNELMASK_FRONT_LEFT | FMOD_CHANNELMASK_FRONT_RIGHT | FMOD_CHANNELMASK_FRONT_CENTER | FMOD_CHANNELMASK_SURROUND_LEFT | FMOD_CHANNELMASK_SURROUND_RIGHT) 180 | #define FMOD_CHANNELMASK_5POINT1 (FMOD_CHANNELMASK_FRONT_LEFT | FMOD_CHANNELMASK_FRONT_RIGHT | FMOD_CHANNELMASK_FRONT_CENTER | FMOD_CHANNELMASK_LOW_FREQUENCY | FMOD_CHANNELMASK_SURROUND_LEFT | FMOD_CHANNELMASK_SURROUND_RIGHT) 181 | #define FMOD_CHANNELMASK_5POINT1_REARS (FMOD_CHANNELMASK_FRONT_LEFT | FMOD_CHANNELMASK_FRONT_RIGHT | FMOD_CHANNELMASK_FRONT_CENTER | FMOD_CHANNELMASK_LOW_FREQUENCY | FMOD_CHANNELMASK_BACK_LEFT | FMOD_CHANNELMASK_BACK_RIGHT) 182 | #define FMOD_CHANNELMASK_7POINT0 (FMOD_CHANNELMASK_FRONT_LEFT | FMOD_CHANNELMASK_FRONT_RIGHT | FMOD_CHANNELMASK_FRONT_CENTER | FMOD_CHANNELMASK_SURROUND_LEFT | FMOD_CHANNELMASK_SURROUND_RIGHT | FMOD_CHANNELMASK_BACK_LEFT | FMOD_CHANNELMASK_BACK_RIGHT) 183 | #define FMOD_CHANNELMASK_7POINT1 (FMOD_CHANNELMASK_FRONT_LEFT | FMOD_CHANNELMASK_FRONT_RIGHT | FMOD_CHANNELMASK_FRONT_CENTER | FMOD_CHANNELMASK_LOW_FREQUENCY | FMOD_CHANNELMASK_SURROUND_LEFT | FMOD_CHANNELMASK_SURROUND_RIGHT | FMOD_CHANNELMASK_BACK_LEFT | FMOD_CHANNELMASK_BACK_RIGHT) 184 | 185 | typedef unsigned long long FMOD_PORT_INDEX; 186 | #define FMOD_PORT_INDEX_NONE 0xFFFFFFFFFFFFFFFF 187 | #define FMOD_PORT_INDEX_FLAG_VR_CONTROLLER 0x1000000000000000 188 | 189 | typedef int FMOD_THREAD_PRIORITY; 190 | /* Platform specific priority range */ 191 | #define FMOD_THREAD_PRIORITY_PLATFORM_MIN (-32 * 1024) 192 | #define FMOD_THREAD_PRIORITY_PLATFORM_MAX ( 32 * 1024) 193 | /* Platform agnostic priorities, maps internally to platform specific value */ 194 | #define FMOD_THREAD_PRIORITY_DEFAULT (FMOD_THREAD_PRIORITY_PLATFORM_MIN - 1) 195 | #define FMOD_THREAD_PRIORITY_LOW (FMOD_THREAD_PRIORITY_PLATFORM_MIN - 2) 196 | #define FMOD_THREAD_PRIORITY_MEDIUM (FMOD_THREAD_PRIORITY_PLATFORM_MIN - 3) 197 | #define FMOD_THREAD_PRIORITY_HIGH (FMOD_THREAD_PRIORITY_PLATFORM_MIN - 4) 198 | #define FMOD_THREAD_PRIORITY_VERY_HIGH (FMOD_THREAD_PRIORITY_PLATFORM_MIN - 5) 199 | #define FMOD_THREAD_PRIORITY_EXTREME (FMOD_THREAD_PRIORITY_PLATFORM_MIN - 6) 200 | #define FMOD_THREAD_PRIORITY_CRITICAL (FMOD_THREAD_PRIORITY_PLATFORM_MIN - 7) 201 | /* Thread defaults */ 202 | #define FMOD_THREAD_PRIORITY_MIXER FMOD_THREAD_PRIORITY_EXTREME 203 | #define FMOD_THREAD_PRIORITY_FEEDER FMOD_THREAD_PRIORITY_CRITICAL 204 | #define FMOD_THREAD_PRIORITY_STREAM FMOD_THREAD_PRIORITY_VERY_HIGH 205 | #define FMOD_THREAD_PRIORITY_FILE FMOD_THREAD_PRIORITY_HIGH 206 | #define FMOD_THREAD_PRIORITY_NONBLOCKING FMOD_THREAD_PRIORITY_HIGH 207 | #define FMOD_THREAD_PRIORITY_RECORD FMOD_THREAD_PRIORITY_HIGH 208 | #define FMOD_THREAD_PRIORITY_GEOMETRY FMOD_THREAD_PRIORITY_LOW 209 | #define FMOD_THREAD_PRIORITY_PROFILER FMOD_THREAD_PRIORITY_MEDIUM 210 | #define FMOD_THREAD_PRIORITY_STUDIO_UPDATE FMOD_THREAD_PRIORITY_MEDIUM 211 | #define FMOD_THREAD_PRIORITY_STUDIO_LOAD_BANK FMOD_THREAD_PRIORITY_MEDIUM 212 | #define FMOD_THREAD_PRIORITY_STUDIO_LOAD_SAMPLE FMOD_THREAD_PRIORITY_MEDIUM 213 | #define FMOD_THREAD_PRIORITY_CONVOLUTION1 FMOD_THREAD_PRIORITY_VERY_HIGH 214 | #define FMOD_THREAD_PRIORITY_CONVOLUTION2 FMOD_THREAD_PRIORITY_VERY_HIGH 215 | 216 | typedef unsigned int FMOD_THREAD_STACK_SIZE; 217 | #define FMOD_THREAD_STACK_SIZE_DEFAULT 0 218 | #define FMOD_THREAD_STACK_SIZE_MIXER (80 * 1024) 219 | #define FMOD_THREAD_STACK_SIZE_FEEDER (16 * 1024) 220 | #define FMOD_THREAD_STACK_SIZE_STREAM (96 * 1024) 221 | #define FMOD_THREAD_STACK_SIZE_FILE (64 * 1024) 222 | #define FMOD_THREAD_STACK_SIZE_NONBLOCKING (112 * 1024) 223 | #define FMOD_THREAD_STACK_SIZE_RECORD (16 * 1024) 224 | #define FMOD_THREAD_STACK_SIZE_GEOMETRY (48 * 1024) 225 | #define FMOD_THREAD_STACK_SIZE_PROFILER (128 * 1024) 226 | #define FMOD_THREAD_STACK_SIZE_STUDIO_UPDATE (96 * 1024) 227 | #define FMOD_THREAD_STACK_SIZE_STUDIO_LOAD_BANK (96 * 1024) 228 | #define FMOD_THREAD_STACK_SIZE_STUDIO_LOAD_SAMPLE (96 * 1024) 229 | #define FMOD_THREAD_STACK_SIZE_CONVOLUTION1 (16 * 1024) 230 | #define FMOD_THREAD_STACK_SIZE_CONVOLUTION2 (16 * 1024) 231 | 232 | typedef long long FMOD_THREAD_AFFINITY; 233 | /* Platform agnostic thread groupings */ 234 | #define FMOD_THREAD_AFFINITY_GROUP_DEFAULT 0x4000000000000000 235 | #define FMOD_THREAD_AFFINITY_GROUP_A 0x4000000000000001 236 | #define FMOD_THREAD_AFFINITY_GROUP_B 0x4000000000000002 237 | #define FMOD_THREAD_AFFINITY_GROUP_C 0x4000000000000003 238 | /* Thread defaults */ 239 | #define FMOD_THREAD_AFFINITY_MIXER FMOD_THREAD_AFFINITY_GROUP_A 240 | #define FMOD_THREAD_AFFINITY_FEEDER FMOD_THREAD_AFFINITY_GROUP_C 241 | #define FMOD_THREAD_AFFINITY_STREAM FMOD_THREAD_AFFINITY_GROUP_C 242 | #define FMOD_THREAD_AFFINITY_FILE FMOD_THREAD_AFFINITY_GROUP_C 243 | #define FMOD_THREAD_AFFINITY_NONBLOCKING FMOD_THREAD_AFFINITY_GROUP_C 244 | #define FMOD_THREAD_AFFINITY_RECORD FMOD_THREAD_AFFINITY_GROUP_C 245 | #define FMOD_THREAD_AFFINITY_GEOMETRY FMOD_THREAD_AFFINITY_GROUP_C 246 | #define FMOD_THREAD_AFFINITY_PROFILER FMOD_THREAD_AFFINITY_GROUP_C 247 | #define FMOD_THREAD_AFFINITY_STUDIO_UPDATE FMOD_THREAD_AFFINITY_GROUP_B 248 | #define FMOD_THREAD_AFFINITY_STUDIO_LOAD_BANK FMOD_THREAD_AFFINITY_GROUP_C 249 | #define FMOD_THREAD_AFFINITY_STUDIO_LOAD_SAMPLE FMOD_THREAD_AFFINITY_GROUP_C 250 | #define FMOD_THREAD_AFFINITY_CONVOLUTION1 FMOD_THREAD_AFFINITY_GROUP_C 251 | #define FMOD_THREAD_AFFINITY_CONVOLUTION2 FMOD_THREAD_AFFINITY_GROUP_C 252 | /* Core mask, valid up to 1 << 62 */ 253 | #define FMOD_THREAD_AFFINITY_CORE_ALL 0 254 | #define FMOD_THREAD_AFFINITY_CORE_0 (1 << 0) 255 | #define FMOD_THREAD_AFFINITY_CORE_1 (1 << 1) 256 | #define FMOD_THREAD_AFFINITY_CORE_2 (1 << 2) 257 | #define FMOD_THREAD_AFFINITY_CORE_3 (1 << 3) 258 | #define FMOD_THREAD_AFFINITY_CORE_4 (1 << 4) 259 | #define FMOD_THREAD_AFFINITY_CORE_5 (1 << 5) 260 | #define FMOD_THREAD_AFFINITY_CORE_6 (1 << 6) 261 | #define FMOD_THREAD_AFFINITY_CORE_7 (1 << 7) 262 | #define FMOD_THREAD_AFFINITY_CORE_8 (1 << 8) 263 | #define FMOD_THREAD_AFFINITY_CORE_9 (1 << 9) 264 | #define FMOD_THREAD_AFFINITY_CORE_10 (1 << 10) 265 | #define FMOD_THREAD_AFFINITY_CORE_11 (1 << 11) 266 | #define FMOD_THREAD_AFFINITY_CORE_12 (1 << 12) 267 | #define FMOD_THREAD_AFFINITY_CORE_13 (1 << 13) 268 | #define FMOD_THREAD_AFFINITY_CORE_14 (1 << 14) 269 | #define FMOD_THREAD_AFFINITY_CORE_15 (1 << 15) 270 | 271 | /* Preset for FMOD_REVERB_PROPERTIES */ 272 | #define FMOD_PRESET_OFF { 1000, 7, 11, 5000, 100, 100, 100, 250, 0, 20, 96, -80.0f } 273 | #define FMOD_PRESET_GENERIC { 1500, 7, 11, 5000, 83, 100, 100, 250, 0, 14500, 96, -8.0f } 274 | #define FMOD_PRESET_PADDEDCELL { 170, 1, 2, 5000, 10, 100, 100, 250, 0, 160, 84, -7.8f } 275 | #define FMOD_PRESET_ROOM { 400, 2, 3, 5000, 83, 100, 100, 250, 0, 6050, 88, -9.4f } 276 | #define FMOD_PRESET_BATHROOM { 1500, 7, 11, 5000, 54, 100, 60, 250, 0, 2900, 83, 0.5f } 277 | #define FMOD_PRESET_LIVINGROOM { 500, 3, 4, 5000, 10, 100, 100, 250, 0, 160, 58, -19.0f } 278 | #define FMOD_PRESET_STONEROOM { 2300, 12, 17, 5000, 64, 100, 100, 250, 0, 7800, 71, -8.5f } 279 | #define FMOD_PRESET_AUDITORIUM { 4300, 20, 30, 5000, 59, 100, 100, 250, 0, 5850, 64, -11.7f } 280 | #define FMOD_PRESET_CONCERTHALL { 3900, 20, 29, 5000, 70, 100, 100, 250, 0, 5650, 80, -9.8f } 281 | #define FMOD_PRESET_CAVE { 2900, 15, 22, 5000, 100, 100, 100, 250, 0, 20000, 59, -11.3f } 282 | #define FMOD_PRESET_ARENA { 7200, 20, 30, 5000, 33, 100, 100, 250, 0, 4500, 80, -9.6f } 283 | #define FMOD_PRESET_HANGAR { 10000, 20, 30, 5000, 23, 100, 100, 250, 0, 3400, 72, -7.4f } 284 | #define FMOD_PRESET_CARPETTEDHALLWAY { 300, 2, 30, 5000, 10, 100, 100, 250, 0, 500, 56, -24.0f } 285 | #define FMOD_PRESET_HALLWAY { 1500, 7, 11, 5000, 59, 100, 100, 250, 0, 7800, 87, -5.5f } 286 | #define FMOD_PRESET_STONECORRIDOR { 270, 13, 20, 5000, 79, 100, 100, 250, 0, 9000, 86, -6.0f } 287 | #define FMOD_PRESET_ALLEY { 1500, 7, 11, 5000, 86, 100, 100, 250, 0, 8300, 80, -9.8f } 288 | #define FMOD_PRESET_FOREST { 1500, 162, 88, 5000, 54, 79, 100, 250, 0, 760, 94, -12.3f } 289 | #define FMOD_PRESET_CITY { 1500, 7, 11, 5000, 67, 50, 100, 250, 0, 4050, 66, -26.0f } 290 | #define FMOD_PRESET_MOUNTAINS { 1500, 300, 100, 5000, 21, 27, 100, 250, 0, 1220, 82, -24.0f } 291 | #define FMOD_PRESET_QUARRY { 1500, 61, 25, 5000, 83, 100, 100, 250, 0, 3400, 100, -5.0f } 292 | #define FMOD_PRESET_PLAIN { 1500, 179, 100, 5000, 50, 21, 100, 250, 0, 1670, 65, -28.0f } 293 | #define FMOD_PRESET_PARKINGLOT { 1700, 8, 12, 5000, 100, 100, 100, 250, 0, 20000, 56, -19.5f } 294 | #define FMOD_PRESET_SEWERPIPE { 2800, 14, 21, 5000, 14, 80, 60, 250, 0, 3400, 66, 1.2f } 295 | #define FMOD_PRESET_UNDERWATER { 1500, 7, 11, 5000, 10, 100, 100, 250, 0, 500, 92, 7.0f } 296 | 297 | #define FMOD_MAX_CHANNEL_WIDTH 32 298 | #define FMOD_MAX_SYSTEMS 8 299 | #define FMOD_MAX_LISTENERS 8 300 | #define FMOD_REVERB_MAXINSTANCES 4 301 | 302 | typedef enum FMOD_THREAD_TYPE 303 | { 304 | FMOD_THREAD_TYPE_MIXER, 305 | FMOD_THREAD_TYPE_FEEDER, 306 | FMOD_THREAD_TYPE_STREAM, 307 | FMOD_THREAD_TYPE_FILE, 308 | FMOD_THREAD_TYPE_NONBLOCKING, 309 | FMOD_THREAD_TYPE_RECORD, 310 | FMOD_THREAD_TYPE_GEOMETRY, 311 | FMOD_THREAD_TYPE_PROFILER, 312 | FMOD_THREAD_TYPE_STUDIO_UPDATE, 313 | FMOD_THREAD_TYPE_STUDIO_LOAD_BANK, 314 | FMOD_THREAD_TYPE_STUDIO_LOAD_SAMPLE, 315 | FMOD_THREAD_TYPE_CONVOLUTION1, 316 | FMOD_THREAD_TYPE_CONVOLUTION2, 317 | 318 | FMOD_THREAD_TYPE_MAX, 319 | FMOD_THREAD_TYPE_FORCEINT = 65536 320 | } FMOD_THREAD_TYPE; 321 | 322 | typedef enum FMOD_RESULT 323 | { 324 | FMOD_OK, 325 | FMOD_ERR_BADCOMMAND, 326 | FMOD_ERR_CHANNEL_ALLOC, 327 | FMOD_ERR_CHANNEL_STOLEN, 328 | FMOD_ERR_DMA, 329 | FMOD_ERR_DSP_CONNECTION, 330 | FMOD_ERR_DSP_DONTPROCESS, 331 | FMOD_ERR_DSP_FORMAT, 332 | FMOD_ERR_DSP_INUSE, 333 | FMOD_ERR_DSP_NOTFOUND, 334 | FMOD_ERR_DSP_RESERVED, 335 | FMOD_ERR_DSP_SILENCE, 336 | FMOD_ERR_DSP_TYPE, 337 | FMOD_ERR_FILE_BAD, 338 | FMOD_ERR_FILE_COULDNOTSEEK, 339 | FMOD_ERR_FILE_DISKEJECTED, 340 | FMOD_ERR_FILE_EOF, 341 | FMOD_ERR_FILE_ENDOFDATA, 342 | FMOD_ERR_FILE_NOTFOUND, 343 | FMOD_ERR_FORMAT, 344 | FMOD_ERR_HEADER_MISMATCH, 345 | FMOD_ERR_HTTP, 346 | FMOD_ERR_HTTP_ACCESS, 347 | FMOD_ERR_HTTP_PROXY_AUTH, 348 | FMOD_ERR_HTTP_SERVER_ERROR, 349 | FMOD_ERR_HTTP_TIMEOUT, 350 | FMOD_ERR_INITIALIZATION, 351 | FMOD_ERR_INITIALIZED, 352 | FMOD_ERR_INTERNAL, 353 | FMOD_ERR_INVALID_FLOAT, 354 | FMOD_ERR_INVALID_HANDLE, 355 | FMOD_ERR_INVALID_PARAM, 356 | FMOD_ERR_INVALID_POSITION, 357 | FMOD_ERR_INVALID_SPEAKER, 358 | FMOD_ERR_INVALID_SYNCPOINT, 359 | FMOD_ERR_INVALID_THREAD, 360 | FMOD_ERR_INVALID_VECTOR, 361 | FMOD_ERR_MAXAUDIBLE, 362 | FMOD_ERR_MEMORY, 363 | FMOD_ERR_MEMORY_CANTPOINT, 364 | FMOD_ERR_NEEDS3D, 365 | FMOD_ERR_NEEDSHARDWARE, 366 | FMOD_ERR_NET_CONNECT, 367 | FMOD_ERR_NET_SOCKET_ERROR, 368 | FMOD_ERR_NET_URL, 369 | FMOD_ERR_NET_WOULD_BLOCK, 370 | FMOD_ERR_NOTREADY, 371 | FMOD_ERR_OUTPUT_ALLOCATED, 372 | FMOD_ERR_OUTPUT_CREATEBUFFER, 373 | FMOD_ERR_OUTPUT_DRIVERCALL, 374 | FMOD_ERR_OUTPUT_FORMAT, 375 | FMOD_ERR_OUTPUT_INIT, 376 | FMOD_ERR_OUTPUT_NODRIVERS, 377 | FMOD_ERR_PLUGIN, 378 | FMOD_ERR_PLUGIN_MISSING, 379 | FMOD_ERR_PLUGIN_RESOURCE, 380 | FMOD_ERR_PLUGIN_VERSION, 381 | FMOD_ERR_RECORD, 382 | FMOD_ERR_REVERB_CHANNELGROUP, 383 | FMOD_ERR_REVERB_INSTANCE, 384 | FMOD_ERR_SUBSOUNDS, 385 | FMOD_ERR_SUBSOUND_ALLOCATED, 386 | FMOD_ERR_SUBSOUND_CANTMOVE, 387 | FMOD_ERR_TAGNOTFOUND, 388 | FMOD_ERR_TOOMANYCHANNELS, 389 | FMOD_ERR_TRUNCATED, 390 | FMOD_ERR_UNIMPLEMENTED, 391 | FMOD_ERR_UNINITIALIZED, 392 | FMOD_ERR_UNSUPPORTED, 393 | FMOD_ERR_VERSION, 394 | FMOD_ERR_EVENT_ALREADY_LOADED, 395 | FMOD_ERR_EVENT_LIVEUPDATE_BUSY, 396 | FMOD_ERR_EVENT_LIVEUPDATE_MISMATCH, 397 | FMOD_ERR_EVENT_LIVEUPDATE_TIMEOUT, 398 | FMOD_ERR_EVENT_NOTFOUND, 399 | FMOD_ERR_STUDIO_UNINITIALIZED, 400 | FMOD_ERR_STUDIO_NOT_LOADED, 401 | FMOD_ERR_INVALID_STRING, 402 | FMOD_ERR_ALREADY_LOCKED, 403 | FMOD_ERR_NOT_LOCKED, 404 | FMOD_ERR_RECORD_DISCONNECTED, 405 | FMOD_ERR_TOOMANYSAMPLES, 406 | 407 | FMOD_RESULT_FORCEINT = 65536 408 | } FMOD_RESULT; 409 | 410 | typedef enum FMOD_CHANNELCONTROL_TYPE 411 | { 412 | FMOD_CHANNELCONTROL_CHANNEL, 413 | FMOD_CHANNELCONTROL_CHANNELGROUP, 414 | 415 | FMOD_CHANNELCONTROL_MAX, 416 | FMOD_CHANNELCONTROL_FORCEINT = 65536 417 | } FMOD_CHANNELCONTROL_TYPE; 418 | 419 | typedef enum FMOD_OUTPUTTYPE 420 | { 421 | FMOD_OUTPUTTYPE_AUTODETECT, 422 | FMOD_OUTPUTTYPE_UNKNOWN, 423 | FMOD_OUTPUTTYPE_NOSOUND, 424 | FMOD_OUTPUTTYPE_WAVWRITER, 425 | FMOD_OUTPUTTYPE_NOSOUND_NRT, 426 | FMOD_OUTPUTTYPE_WAVWRITER_NRT, 427 | FMOD_OUTPUTTYPE_WASAPI, 428 | FMOD_OUTPUTTYPE_ASIO, 429 | FMOD_OUTPUTTYPE_PULSEAUDIO, 430 | FMOD_OUTPUTTYPE_ALSA, 431 | FMOD_OUTPUTTYPE_COREAUDIO, 432 | FMOD_OUTPUTTYPE_AUDIOTRACK, 433 | FMOD_OUTPUTTYPE_OPENSL, 434 | FMOD_OUTPUTTYPE_AUDIOOUT, 435 | FMOD_OUTPUTTYPE_AUDIO3D, 436 | FMOD_OUTPUTTYPE_WEBAUDIO, 437 | FMOD_OUTPUTTYPE_NNAUDIO, 438 | FMOD_OUTPUTTYPE_WINSONIC, 439 | FMOD_OUTPUTTYPE_AAUDIO, 440 | FMOD_OUTPUTTYPE_AUDIOWORKLET, 441 | FMOD_OUTPUTTYPE_PHASE, 442 | 443 | FMOD_OUTPUTTYPE_MAX, 444 | FMOD_OUTPUTTYPE_FORCEINT = 65536 445 | } FMOD_OUTPUTTYPE; 446 | 447 | typedef enum FMOD_DEBUG_MODE 448 | { 449 | FMOD_DEBUG_MODE_TTY, 450 | FMOD_DEBUG_MODE_FILE, 451 | FMOD_DEBUG_MODE_CALLBACK, 452 | 453 | FMOD_DEBUG_MODE_FORCEINT = 65536 454 | } FMOD_DEBUG_MODE; 455 | 456 | typedef enum FMOD_SPEAKERMODE 457 | { 458 | FMOD_SPEAKERMODE_DEFAULT, 459 | FMOD_SPEAKERMODE_RAW, 460 | FMOD_SPEAKERMODE_MONO, 461 | FMOD_SPEAKERMODE_STEREO, 462 | FMOD_SPEAKERMODE_QUAD, 463 | FMOD_SPEAKERMODE_SURROUND, 464 | FMOD_SPEAKERMODE_5POINT1, 465 | FMOD_SPEAKERMODE_7POINT1, 466 | FMOD_SPEAKERMODE_7POINT1POINT4, 467 | 468 | FMOD_SPEAKERMODE_MAX, 469 | FMOD_SPEAKERMODE_FORCEINT = 65536 470 | } FMOD_SPEAKERMODE; 471 | 472 | typedef enum FMOD_SPEAKER 473 | { 474 | FMOD_SPEAKER_NONE = -1, 475 | FMOD_SPEAKER_FRONT_LEFT = 0, 476 | FMOD_SPEAKER_FRONT_RIGHT, 477 | FMOD_SPEAKER_FRONT_CENTER, 478 | FMOD_SPEAKER_LOW_FREQUENCY, 479 | FMOD_SPEAKER_SURROUND_LEFT, 480 | FMOD_SPEAKER_SURROUND_RIGHT, 481 | FMOD_SPEAKER_BACK_LEFT, 482 | FMOD_SPEAKER_BACK_RIGHT, 483 | FMOD_SPEAKER_TOP_FRONT_LEFT, 484 | FMOD_SPEAKER_TOP_FRONT_RIGHT, 485 | FMOD_SPEAKER_TOP_BACK_LEFT, 486 | FMOD_SPEAKER_TOP_BACK_RIGHT, 487 | 488 | FMOD_SPEAKER_MAX, 489 | FMOD_SPEAKER_FORCEINT = 65536 490 | } FMOD_SPEAKER; 491 | 492 | typedef enum FMOD_CHANNELORDER 493 | { 494 | FMOD_CHANNELORDER_DEFAULT, 495 | FMOD_CHANNELORDER_WAVEFORMAT, 496 | FMOD_CHANNELORDER_PROTOOLS, 497 | FMOD_CHANNELORDER_ALLMONO, 498 | FMOD_CHANNELORDER_ALLSTEREO, 499 | FMOD_CHANNELORDER_ALSA, 500 | 501 | FMOD_CHANNELORDER_MAX, 502 | FMOD_CHANNELORDER_FORCEINT = 65536 503 | } FMOD_CHANNELORDER; 504 | 505 | typedef enum FMOD_PLUGINTYPE 506 | { 507 | FMOD_PLUGINTYPE_OUTPUT, 508 | FMOD_PLUGINTYPE_CODEC, 509 | FMOD_PLUGINTYPE_DSP, 510 | 511 | FMOD_PLUGINTYPE_MAX, 512 | FMOD_PLUGINTYPE_FORCEINT = 65536 513 | } FMOD_PLUGINTYPE; 514 | 515 | typedef enum FMOD_SOUND_TYPE 516 | { 517 | FMOD_SOUND_TYPE_UNKNOWN, 518 | FMOD_SOUND_TYPE_AIFF, 519 | FMOD_SOUND_TYPE_ASF, 520 | FMOD_SOUND_TYPE_DLS, 521 | FMOD_SOUND_TYPE_FLAC, 522 | FMOD_SOUND_TYPE_FSB, 523 | FMOD_SOUND_TYPE_IT, 524 | FMOD_SOUND_TYPE_MIDI, 525 | FMOD_SOUND_TYPE_MOD, 526 | FMOD_SOUND_TYPE_MPEG, 527 | FMOD_SOUND_TYPE_OGGVORBIS, 528 | FMOD_SOUND_TYPE_PLAYLIST, 529 | FMOD_SOUND_TYPE_RAW, 530 | FMOD_SOUND_TYPE_S3M, 531 | FMOD_SOUND_TYPE_USER, 532 | FMOD_SOUND_TYPE_WAV, 533 | FMOD_SOUND_TYPE_XM, 534 | FMOD_SOUND_TYPE_XMA, 535 | FMOD_SOUND_TYPE_AUDIOQUEUE, 536 | FMOD_SOUND_TYPE_AT9, 537 | FMOD_SOUND_TYPE_VORBIS, 538 | FMOD_SOUND_TYPE_MEDIA_FOUNDATION, 539 | FMOD_SOUND_TYPE_MEDIACODEC, 540 | FMOD_SOUND_TYPE_FADPCM, 541 | FMOD_SOUND_TYPE_OPUS, 542 | 543 | FMOD_SOUND_TYPE_MAX, 544 | FMOD_SOUND_TYPE_FORCEINT = 65536 545 | } FMOD_SOUND_TYPE; 546 | 547 | typedef enum FMOD_SOUND_FORMAT 548 | { 549 | FMOD_SOUND_FORMAT_NONE, 550 | FMOD_SOUND_FORMAT_PCM8, 551 | FMOD_SOUND_FORMAT_PCM16, 552 | FMOD_SOUND_FORMAT_PCM24, 553 | FMOD_SOUND_FORMAT_PCM32, 554 | FMOD_SOUND_FORMAT_PCMFLOAT, 555 | FMOD_SOUND_FORMAT_BITSTREAM, 556 | 557 | FMOD_SOUND_FORMAT_MAX, 558 | FMOD_SOUND_FORMAT_FORCEINT = 65536 559 | } FMOD_SOUND_FORMAT; 560 | 561 | typedef enum FMOD_OPENSTATE 562 | { 563 | FMOD_OPENSTATE_READY, 564 | FMOD_OPENSTATE_LOADING, 565 | FMOD_OPENSTATE_ERROR, 566 | FMOD_OPENSTATE_CONNECTING, 567 | FMOD_OPENSTATE_BUFFERING, 568 | FMOD_OPENSTATE_SEEKING, 569 | FMOD_OPENSTATE_PLAYING, 570 | FMOD_OPENSTATE_SETPOSITION, 571 | 572 | FMOD_OPENSTATE_MAX, 573 | FMOD_OPENSTATE_FORCEINT = 65536 574 | } FMOD_OPENSTATE; 575 | 576 | typedef enum FMOD_SOUNDGROUP_BEHAVIOR 577 | { 578 | FMOD_SOUNDGROUP_BEHAVIOR_FAIL, 579 | FMOD_SOUNDGROUP_BEHAVIOR_MUTE, 580 | FMOD_SOUNDGROUP_BEHAVIOR_STEALLOWEST, 581 | 582 | FMOD_SOUNDGROUP_BEHAVIOR_MAX, 583 | FMOD_SOUNDGROUP_BEHAVIOR_FORCEINT = 65536 584 | } FMOD_SOUNDGROUP_BEHAVIOR; 585 | 586 | typedef enum FMOD_CHANNELCONTROL_CALLBACK_TYPE 587 | { 588 | FMOD_CHANNELCONTROL_CALLBACK_END, 589 | FMOD_CHANNELCONTROL_CALLBACK_VIRTUALVOICE, 590 | FMOD_CHANNELCONTROL_CALLBACK_SYNCPOINT, 591 | FMOD_CHANNELCONTROL_CALLBACK_OCCLUSION, 592 | 593 | FMOD_CHANNELCONTROL_CALLBACK_MAX, 594 | FMOD_CHANNELCONTROL_CALLBACK_FORCEINT = 65536 595 | } FMOD_CHANNELCONTROL_CALLBACK_TYPE; 596 | 597 | typedef enum FMOD_CHANNELCONTROL_DSP_INDEX 598 | { 599 | FMOD_CHANNELCONTROL_DSP_HEAD = -1, 600 | FMOD_CHANNELCONTROL_DSP_FADER = -2, 601 | FMOD_CHANNELCONTROL_DSP_TAIL = -3, 602 | 603 | FMOD_CHANNELCONTROL_DSP_FORCEINT = 65536 604 | } FMOD_CHANNELCONTROL_DSP_INDEX; 605 | 606 | typedef enum FMOD_ERRORCALLBACK_INSTANCETYPE 607 | { 608 | FMOD_ERRORCALLBACK_INSTANCETYPE_NONE, 609 | FMOD_ERRORCALLBACK_INSTANCETYPE_SYSTEM, 610 | FMOD_ERRORCALLBACK_INSTANCETYPE_CHANNEL, 611 | FMOD_ERRORCALLBACK_INSTANCETYPE_CHANNELGROUP, 612 | FMOD_ERRORCALLBACK_INSTANCETYPE_CHANNELCONTROL, 613 | FMOD_ERRORCALLBACK_INSTANCETYPE_SOUND, 614 | FMOD_ERRORCALLBACK_INSTANCETYPE_SOUNDGROUP, 615 | FMOD_ERRORCALLBACK_INSTANCETYPE_DSP, 616 | FMOD_ERRORCALLBACK_INSTANCETYPE_DSPCONNECTION, 617 | FMOD_ERRORCALLBACK_INSTANCETYPE_GEOMETRY, 618 | FMOD_ERRORCALLBACK_INSTANCETYPE_REVERB3D, 619 | FMOD_ERRORCALLBACK_INSTANCETYPE_STUDIO_SYSTEM, 620 | FMOD_ERRORCALLBACK_INSTANCETYPE_STUDIO_EVENTDESCRIPTION, 621 | FMOD_ERRORCALLBACK_INSTANCETYPE_STUDIO_EVENTINSTANCE, 622 | FMOD_ERRORCALLBACK_INSTANCETYPE_STUDIO_PARAMETERINSTANCE, 623 | FMOD_ERRORCALLBACK_INSTANCETYPE_STUDIO_BUS, 624 | FMOD_ERRORCALLBACK_INSTANCETYPE_STUDIO_VCA, 625 | FMOD_ERRORCALLBACK_INSTANCETYPE_STUDIO_BANK, 626 | FMOD_ERRORCALLBACK_INSTANCETYPE_STUDIO_COMMANDREPLAY, 627 | 628 | FMOD_ERRORCALLBACK_INSTANCETYPE_FORCEINT = 65536 629 | } FMOD_ERRORCALLBACK_INSTANCETYPE; 630 | 631 | typedef enum FMOD_DSP_RESAMPLER 632 | { 633 | FMOD_DSP_RESAMPLER_DEFAULT, 634 | FMOD_DSP_RESAMPLER_NOINTERP, 635 | FMOD_DSP_RESAMPLER_LINEAR, 636 | FMOD_DSP_RESAMPLER_CUBIC, 637 | FMOD_DSP_RESAMPLER_SPLINE, 638 | 639 | FMOD_DSP_RESAMPLER_MAX, 640 | FMOD_DSP_RESAMPLER_FORCEINT = 65536 641 | } FMOD_DSP_RESAMPLER; 642 | 643 | typedef enum FMOD_DSP_CALLBACK_TYPE 644 | { 645 | FMOD_DSP_CALLBACK_DATAPARAMETERRELEASE, 646 | 647 | FMOD_DSP_CALLBACK_MAX, 648 | FMOD_DSP_CALLBACK_FORCEINT = 65536 649 | } FMOD_DSP_CALLBACK_TYPE; 650 | 651 | typedef enum FMOD_DSPCONNECTION_TYPE 652 | { 653 | FMOD_DSPCONNECTION_TYPE_STANDARD, 654 | FMOD_DSPCONNECTION_TYPE_SIDECHAIN, 655 | FMOD_DSPCONNECTION_TYPE_SEND, 656 | FMOD_DSPCONNECTION_TYPE_SEND_SIDECHAIN, 657 | 658 | FMOD_DSPCONNECTION_TYPE_MAX, 659 | FMOD_DSPCONNECTION_TYPE_FORCEINT = 65536 660 | } FMOD_DSPCONNECTION_TYPE; 661 | 662 | typedef enum FMOD_TAGTYPE 663 | { 664 | FMOD_TAGTYPE_UNKNOWN, 665 | FMOD_TAGTYPE_ID3V1, 666 | FMOD_TAGTYPE_ID3V2, 667 | FMOD_TAGTYPE_VORBISCOMMENT, 668 | FMOD_TAGTYPE_SHOUTCAST, 669 | FMOD_TAGTYPE_ICECAST, 670 | FMOD_TAGTYPE_ASF, 671 | FMOD_TAGTYPE_MIDI, 672 | FMOD_TAGTYPE_PLAYLIST, 673 | FMOD_TAGTYPE_FMOD, 674 | FMOD_TAGTYPE_USER, 675 | 676 | FMOD_TAGTYPE_MAX, 677 | FMOD_TAGTYPE_FORCEINT = 65536 678 | } FMOD_TAGTYPE; 679 | 680 | typedef enum FMOD_TAGDATATYPE 681 | { 682 | FMOD_TAGDATATYPE_BINARY, 683 | FMOD_TAGDATATYPE_INT, 684 | FMOD_TAGDATATYPE_FLOAT, 685 | FMOD_TAGDATATYPE_STRING, 686 | FMOD_TAGDATATYPE_STRING_UTF16, 687 | FMOD_TAGDATATYPE_STRING_UTF16BE, 688 | FMOD_TAGDATATYPE_STRING_UTF8, 689 | 690 | FMOD_TAGDATATYPE_MAX, 691 | FMOD_TAGDATATYPE_FORCEINT = 65536 692 | } FMOD_TAGDATATYPE; 693 | 694 | typedef enum FMOD_PORT_TYPE 695 | { 696 | FMOD_PORT_TYPE_MUSIC, 697 | FMOD_PORT_TYPE_COPYRIGHT_MUSIC, 698 | FMOD_PORT_TYPE_VOICE, 699 | FMOD_PORT_TYPE_CONTROLLER, 700 | FMOD_PORT_TYPE_PERSONAL, 701 | FMOD_PORT_TYPE_VIBRATION, 702 | FMOD_PORT_TYPE_AUX, 703 | 704 | FMOD_PORT_TYPE_MAX, 705 | FMOD_PORT_TYPE_FORCEINT = 65536 706 | } FMOD_PORT_TYPE; 707 | 708 | /* 709 | FMOD callbacks 710 | */ 711 | typedef FMOD_RESULT (F_CALL *FMOD_DEBUG_CALLBACK) (FMOD_DEBUG_FLAGS flags, const char *file, int line, const char* func, const char* message); 712 | typedef FMOD_RESULT (F_CALL *FMOD_SYSTEM_CALLBACK) (FMOD_SYSTEM *system, FMOD_SYSTEM_CALLBACK_TYPE type, void *commanddata1, void* commanddata2, void *userdata); 713 | typedef FMOD_RESULT (F_CALL *FMOD_CHANNELCONTROL_CALLBACK) (FMOD_CHANNELCONTROL *channelcontrol, FMOD_CHANNELCONTROL_TYPE controltype, FMOD_CHANNELCONTROL_CALLBACK_TYPE callbacktype, void *commanddata1, void *commanddata2); 714 | typedef FMOD_RESULT (F_CALL *FMOD_DSP_CALLBACK) (FMOD_DSP *dsp, FMOD_DSP_CALLBACK_TYPE type, void *data); 715 | typedef FMOD_RESULT (F_CALL *FMOD_SOUND_NONBLOCK_CALLBACK) (FMOD_SOUND *sound, FMOD_RESULT result); 716 | typedef FMOD_RESULT (F_CALL *FMOD_SOUND_PCMREAD_CALLBACK) (FMOD_SOUND *sound, void *data, unsigned int datalen); 717 | typedef FMOD_RESULT (F_CALL *FMOD_SOUND_PCMSETPOS_CALLBACK) (FMOD_SOUND *sound, int subsound, unsigned int position, FMOD_TIMEUNIT postype); 718 | typedef FMOD_RESULT (F_CALL *FMOD_FILE_OPEN_CALLBACK) (const char *name, unsigned int *filesize, void **handle, void *userdata); 719 | typedef FMOD_RESULT (F_CALL *FMOD_FILE_CLOSE_CALLBACK) (void *handle, void *userdata); 720 | typedef FMOD_RESULT (F_CALL *FMOD_FILE_READ_CALLBACK) (void *handle, void *buffer, unsigned int sizebytes, unsigned int *bytesread, void *userdata); 721 | typedef FMOD_RESULT (F_CALL *FMOD_FILE_SEEK_CALLBACK) (void *handle, unsigned int pos, void *userdata); 722 | typedef FMOD_RESULT (F_CALL *FMOD_FILE_ASYNCREAD_CALLBACK) (FMOD_ASYNCREADINFO *info, void *userdata); 723 | typedef FMOD_RESULT (F_CALL *FMOD_FILE_ASYNCCANCEL_CALLBACK)(FMOD_ASYNCREADINFO *info, void *userdata); 724 | typedef void (F_CALL *FMOD_FILE_ASYNCDONE_FUNC) (FMOD_ASYNCREADINFO *info, FMOD_RESULT result); 725 | typedef void* (F_CALL *FMOD_MEMORY_ALLOC_CALLBACK) (unsigned int size, FMOD_MEMORY_TYPE type, const char *sourcestr); 726 | typedef void* (F_CALL *FMOD_MEMORY_REALLOC_CALLBACK) (void *ptr, unsigned int size, FMOD_MEMORY_TYPE type, const char *sourcestr); 727 | typedef void (F_CALL *FMOD_MEMORY_FREE_CALLBACK) (void *ptr, FMOD_MEMORY_TYPE type, const char *sourcestr); 728 | typedef float (F_CALL *FMOD_3D_ROLLOFF_CALLBACK) (FMOD_CHANNELCONTROL *channelcontrol, float distance); 729 | 730 | /* 731 | FMOD structs 732 | */ 733 | struct FMOD_ASYNCREADINFO 734 | { 735 | void *handle; 736 | unsigned int offset; 737 | unsigned int sizebytes; 738 | int priority; 739 | void *userdata; 740 | void *buffer; 741 | unsigned int bytesread; 742 | FMOD_FILE_ASYNCDONE_FUNC done; 743 | }; 744 | 745 | typedef struct FMOD_VECTOR 746 | { 747 | float x; 748 | float y; 749 | float z; 750 | } FMOD_VECTOR; 751 | 752 | typedef struct FMOD_3D_ATTRIBUTES 753 | { 754 | FMOD_VECTOR position; 755 | FMOD_VECTOR velocity; 756 | FMOD_VECTOR forward; 757 | FMOD_VECTOR up; 758 | } FMOD_3D_ATTRIBUTES; 759 | 760 | typedef struct FMOD_GUID 761 | { 762 | unsigned int Data1; 763 | unsigned short Data2; 764 | unsigned short Data3; 765 | unsigned char Data4[8]; 766 | } FMOD_GUID; 767 | 768 | typedef struct FMOD_PLUGINLIST 769 | { 770 | FMOD_PLUGINTYPE type; 771 | void *description; 772 | } FMOD_PLUGINLIST; 773 | 774 | typedef struct FMOD_ADVANCEDSETTINGS 775 | { 776 | int cbSize; 777 | int maxMPEGCodecs; 778 | int maxADPCMCodecs; 779 | int maxXMACodecs; 780 | int maxVorbisCodecs; 781 | int maxAT9Codecs; 782 | int maxFADPCMCodecs; 783 | int maxPCMCodecs; 784 | int ASIONumChannels; 785 | char **ASIOChannelList; 786 | FMOD_SPEAKER *ASIOSpeakerList; 787 | float vol0virtualvol; 788 | unsigned int defaultDecodeBufferSize; 789 | unsigned short profilePort; 790 | unsigned int geometryMaxFadeTime; 791 | float distanceFilterCenterFreq; 792 | int reverb3Dinstance; 793 | int DSPBufferPoolSize; 794 | FMOD_DSP_RESAMPLER resamplerMethod; 795 | unsigned int randomSeed; 796 | int maxConvolutionThreads; 797 | int maxOpusCodecs; 798 | } FMOD_ADVANCEDSETTINGS; 799 | 800 | typedef struct FMOD_TAG 801 | { 802 | FMOD_TAGTYPE type; 803 | FMOD_TAGDATATYPE datatype; 804 | char *name; 805 | void *data; 806 | unsigned int datalen; 807 | FMOD_BOOL updated; 808 | } FMOD_TAG; 809 | 810 | typedef struct FMOD_CREATESOUNDEXINFO 811 | { 812 | int cbsize; 813 | unsigned int length; 814 | unsigned int fileoffset; 815 | int numchannels; 816 | int defaultfrequency; 817 | FMOD_SOUND_FORMAT format; 818 | unsigned int decodebuffersize; 819 | int initialsubsound; 820 | int numsubsounds; 821 | int *inclusionlist; 822 | int inclusionlistnum; 823 | FMOD_SOUND_PCMREAD_CALLBACK pcmreadcallback; 824 | FMOD_SOUND_PCMSETPOS_CALLBACK pcmsetposcallback; 825 | FMOD_SOUND_NONBLOCK_CALLBACK nonblockcallback; 826 | const char *dlsname; 827 | const char *encryptionkey; 828 | int maxpolyphony; 829 | void *userdata; 830 | FMOD_SOUND_TYPE suggestedsoundtype; 831 | FMOD_FILE_OPEN_CALLBACK fileuseropen; 832 | FMOD_FILE_CLOSE_CALLBACK fileuserclose; 833 | FMOD_FILE_READ_CALLBACK fileuserread; 834 | FMOD_FILE_SEEK_CALLBACK fileuserseek; 835 | FMOD_FILE_ASYNCREAD_CALLBACK fileuserasyncread; 836 | FMOD_FILE_ASYNCCANCEL_CALLBACK fileuserasynccancel; 837 | void *fileuserdata; 838 | int filebuffersize; 839 | FMOD_CHANNELORDER channelorder; 840 | FMOD_SOUNDGROUP *initialsoundgroup; 841 | unsigned int initialseekposition; 842 | FMOD_TIMEUNIT initialseekpostype; 843 | int ignoresetfilesystem; 844 | unsigned int audioqueuepolicy; 845 | unsigned int minmidigranularity; 846 | int nonblockthreadid; 847 | FMOD_GUID *fsbguid; 848 | } FMOD_CREATESOUNDEXINFO; 849 | 850 | typedef struct FMOD_REVERB_PROPERTIES 851 | { 852 | float DecayTime; 853 | float EarlyDelay; 854 | float LateDelay; 855 | float HFReference; 856 | float HFDecayRatio; 857 | float Diffusion; 858 | float Density; 859 | float LowShelfFrequency; 860 | float LowShelfGain; 861 | float HighCut; 862 | float EarlyLateMix; 863 | float WetLevel; 864 | } FMOD_REVERB_PROPERTIES; 865 | 866 | typedef struct FMOD_ERRORCALLBACK_INFO 867 | { 868 | FMOD_RESULT result; 869 | FMOD_ERRORCALLBACK_INSTANCETYPE instancetype; 870 | void *instance; 871 | const char *functionname; 872 | const char *functionparams; 873 | } FMOD_ERRORCALLBACK_INFO; 874 | 875 | typedef struct FMOD_CPU_USAGE 876 | { 877 | float dsp; 878 | float stream; 879 | float geometry; 880 | float update; 881 | float convolution1; 882 | float convolution2; 883 | } FMOD_CPU_USAGE; 884 | 885 | typedef struct FMOD_DSP_DATA_PARAMETER_INFO 886 | { 887 | void *data; 888 | unsigned int length; 889 | int index; 890 | } FMOD_DSP_DATA_PARAMETER_INFO; 891 | 892 | /* 893 | FMOD optional headers for plugin development 894 | */ 895 | #include "fmod_codec.h" 896 | #include "fmod_dsp.h" 897 | #include "fmod_output.h" 898 | 899 | #endif 900 | -------------------------------------------------------------------------------- /PingPongTutorial/inc/3rd-party/fmod_dsp.h: -------------------------------------------------------------------------------- 1 | /* ======================================================================================== */ 2 | /* FMOD Core API - DSP header file. */ 3 | /* Copyright (c), Firelight Technologies Pty, Ltd. 2004-2023. */ 4 | /* */ 5 | /* Use this header if you are wanting to develop your own DSP plugin to use with FMODs */ 6 | /* dsp system. With this header you can make your own DSP plugin that FMOD can */ 7 | /* register and use. See the documentation and examples on how to make a working plugin. */ 8 | /* */ 9 | /* For more detail visit: */ 10 | /* https://fmod.com/docs/2.02/api/plugin-api-dsp.html */ 11 | /* =========================================================================================*/ 12 | #ifndef _FMOD_DSP_H 13 | #define _FMOD_DSP_H 14 | 15 | #include "fmod_dsp_effects.h" 16 | 17 | typedef struct FMOD_DSP_STATE FMOD_DSP_STATE; 18 | typedef struct FMOD_DSP_BUFFER_ARRAY FMOD_DSP_BUFFER_ARRAY; 19 | typedef struct FMOD_COMPLEX FMOD_COMPLEX; 20 | 21 | /* 22 | DSP Constants 23 | */ 24 | #define FMOD_PLUGIN_SDK_VERSION 110 25 | #define FMOD_DSP_GETPARAM_VALUESTR_LENGTH 32 26 | 27 | typedef enum 28 | { 29 | FMOD_DSP_PROCESS_PERFORM, 30 | FMOD_DSP_PROCESS_QUERY 31 | } FMOD_DSP_PROCESS_OPERATION; 32 | 33 | typedef enum FMOD_DSP_PAN_SURROUND_FLAGS 34 | { 35 | FMOD_DSP_PAN_SURROUND_DEFAULT = 0, 36 | FMOD_DSP_PAN_SURROUND_ROTATION_NOT_BIASED = 1, 37 | 38 | FMOD_DSP_PAN_SURROUND_FLAGS_FORCEINT = 65536 39 | } FMOD_DSP_PAN_SURROUND_FLAGS; 40 | 41 | typedef enum 42 | { 43 | FMOD_DSP_PARAMETER_TYPE_FLOAT, 44 | FMOD_DSP_PARAMETER_TYPE_INT, 45 | FMOD_DSP_PARAMETER_TYPE_BOOL, 46 | FMOD_DSP_PARAMETER_TYPE_DATA, 47 | 48 | FMOD_DSP_PARAMETER_TYPE_MAX, 49 | FMOD_DSP_PARAMETER_TYPE_FORCEINT = 65536 50 | } FMOD_DSP_PARAMETER_TYPE; 51 | 52 | typedef enum 53 | { 54 | FMOD_DSP_PARAMETER_FLOAT_MAPPING_TYPE_LINEAR, 55 | FMOD_DSP_PARAMETER_FLOAT_MAPPING_TYPE_AUTO, 56 | FMOD_DSP_PARAMETER_FLOAT_MAPPING_TYPE_PIECEWISE_LINEAR, 57 | 58 | FMOD_DSP_PARAMETER_FLOAT_MAPPING_TYPE_FORCEINT = 65536 59 | } FMOD_DSP_PARAMETER_FLOAT_MAPPING_TYPE; 60 | 61 | typedef enum 62 | { 63 | FMOD_DSP_PARAMETER_DATA_TYPE_USER = 0, 64 | FMOD_DSP_PARAMETER_DATA_TYPE_OVERALLGAIN = -1, 65 | FMOD_DSP_PARAMETER_DATA_TYPE_3DATTRIBUTES = -2, 66 | FMOD_DSP_PARAMETER_DATA_TYPE_SIDECHAIN = -3, 67 | FMOD_DSP_PARAMETER_DATA_TYPE_FFT = -4, 68 | FMOD_DSP_PARAMETER_DATA_TYPE_3DATTRIBUTES_MULTI = -5, 69 | FMOD_DSP_PARAMETER_DATA_TYPE_ATTENUATION_RANGE = -6, 70 | } FMOD_DSP_PARAMETER_DATA_TYPE; 71 | 72 | /* 73 | DSP Callbacks 74 | */ 75 | typedef FMOD_RESULT (F_CALL *FMOD_DSP_CREATE_CALLBACK) (FMOD_DSP_STATE *dsp_state); 76 | typedef FMOD_RESULT (F_CALL *FMOD_DSP_RELEASE_CALLBACK) (FMOD_DSP_STATE *dsp_state); 77 | typedef FMOD_RESULT (F_CALL *FMOD_DSP_RESET_CALLBACK) (FMOD_DSP_STATE *dsp_state); 78 | typedef FMOD_RESULT (F_CALL *FMOD_DSP_READ_CALLBACK) (FMOD_DSP_STATE *dsp_state, float *inbuffer, float *outbuffer, unsigned int length, int inchannels, int *outchannels); 79 | typedef FMOD_RESULT (F_CALL *FMOD_DSP_PROCESS_CALLBACK) (FMOD_DSP_STATE *dsp_state, unsigned int length, const FMOD_DSP_BUFFER_ARRAY *inbufferarray, FMOD_DSP_BUFFER_ARRAY *outbufferarray, FMOD_BOOL inputsidle, FMOD_DSP_PROCESS_OPERATION op); 80 | typedef FMOD_RESULT (F_CALL *FMOD_DSP_SETPOSITION_CALLBACK) (FMOD_DSP_STATE *dsp_state, unsigned int pos); 81 | typedef FMOD_RESULT (F_CALL *FMOD_DSP_SHOULDIPROCESS_CALLBACK) (FMOD_DSP_STATE *dsp_state, FMOD_BOOL inputsidle, unsigned int length, FMOD_CHANNELMASK inmask, int inchannels, FMOD_SPEAKERMODE speakermode); 82 | typedef FMOD_RESULT (F_CALL *FMOD_DSP_SETPARAM_FLOAT_CALLBACK) (FMOD_DSP_STATE *dsp_state, int index, float value); 83 | typedef FMOD_RESULT (F_CALL *FMOD_DSP_SETPARAM_INT_CALLBACK) (FMOD_DSP_STATE *dsp_state, int index, int value); 84 | typedef FMOD_RESULT (F_CALL *FMOD_DSP_SETPARAM_BOOL_CALLBACK) (FMOD_DSP_STATE *dsp_state, int index, FMOD_BOOL value); 85 | typedef FMOD_RESULT (F_CALL *FMOD_DSP_SETPARAM_DATA_CALLBACK) (FMOD_DSP_STATE *dsp_state, int index, void *data, unsigned int length); 86 | typedef FMOD_RESULT (F_CALL *FMOD_DSP_GETPARAM_FLOAT_CALLBACK) (FMOD_DSP_STATE *dsp_state, int index, float *value, char *valuestr); 87 | typedef FMOD_RESULT (F_CALL *FMOD_DSP_GETPARAM_INT_CALLBACK) (FMOD_DSP_STATE *dsp_state, int index, int *value, char *valuestr); 88 | typedef FMOD_RESULT (F_CALL *FMOD_DSP_GETPARAM_BOOL_CALLBACK) (FMOD_DSP_STATE *dsp_state, int index, FMOD_BOOL *value, char *valuestr); 89 | typedef FMOD_RESULT (F_CALL *FMOD_DSP_GETPARAM_DATA_CALLBACK) (FMOD_DSP_STATE *dsp_state, int index, void **data, unsigned int *length, char *valuestr); 90 | typedef FMOD_RESULT (F_CALL *FMOD_DSP_SYSTEM_REGISTER_CALLBACK) (FMOD_DSP_STATE *dsp_state); 91 | typedef FMOD_RESULT (F_CALL *FMOD_DSP_SYSTEM_DEREGISTER_CALLBACK) (FMOD_DSP_STATE *dsp_state); 92 | typedef FMOD_RESULT (F_CALL *FMOD_DSP_SYSTEM_MIX_CALLBACK) (FMOD_DSP_STATE *dsp_state, int stage); 93 | 94 | /* 95 | DSP Functions 96 | */ 97 | typedef void * (F_CALL *FMOD_DSP_ALLOC_FUNC) (unsigned int size, FMOD_MEMORY_TYPE type, const char *sourcestr); 98 | typedef void * (F_CALL *FMOD_DSP_REALLOC_FUNC) (void *ptr, unsigned int size, FMOD_MEMORY_TYPE type, const char *sourcestr); 99 | typedef void (F_CALL *FMOD_DSP_FREE_FUNC) (void *ptr, FMOD_MEMORY_TYPE type, const char *sourcestr); 100 | typedef void (F_CALL *FMOD_DSP_LOG_FUNC) (FMOD_DEBUG_FLAGS level, const char *file, int line, const char *function, const char *str, ...); 101 | typedef FMOD_RESULT (F_CALL *FMOD_DSP_GETSAMPLERATE_FUNC) (FMOD_DSP_STATE *dsp_state, int *rate); 102 | typedef FMOD_RESULT (F_CALL *FMOD_DSP_GETBLOCKSIZE_FUNC) (FMOD_DSP_STATE *dsp_state, unsigned int *blocksize); 103 | typedef FMOD_RESULT (F_CALL *FMOD_DSP_GETSPEAKERMODE_FUNC) (FMOD_DSP_STATE *dsp_state, FMOD_SPEAKERMODE *speakermode_mixer, FMOD_SPEAKERMODE *speakermode_output); 104 | typedef FMOD_RESULT (F_CALL *FMOD_DSP_GETCLOCK_FUNC) (FMOD_DSP_STATE *dsp_state, unsigned long long *clock, unsigned int *offset, unsigned int *length); 105 | typedef FMOD_RESULT (F_CALL *FMOD_DSP_GETLISTENERATTRIBUTES_FUNC) (FMOD_DSP_STATE *dsp_state, int *numlisteners, FMOD_3D_ATTRIBUTES *attributes); 106 | typedef FMOD_RESULT (F_CALL *FMOD_DSP_GETUSERDATA_FUNC) (FMOD_DSP_STATE *dsp_state, void **userdata); 107 | typedef FMOD_RESULT (F_CALL *FMOD_DSP_DFT_FFTREAL_FUNC) (FMOD_DSP_STATE *dsp_state, int size, const float *signal, FMOD_COMPLEX* dft, const float *window, int signalhop); 108 | typedef FMOD_RESULT (F_CALL *FMOD_DSP_DFT_IFFTREAL_FUNC) (FMOD_DSP_STATE *dsp_state, int size, const FMOD_COMPLEX *dft, float* signal, const float *window, int signalhop); 109 | typedef FMOD_RESULT (F_CALL *FMOD_DSP_PAN_SUMMONOMATRIX_FUNC) (FMOD_DSP_STATE *dsp_state, FMOD_SPEAKERMODE sourceSpeakerMode, float lowFrequencyGain, float overallGain, float *matrix); 110 | typedef FMOD_RESULT (F_CALL *FMOD_DSP_PAN_SUMSTEREOMATRIX_FUNC) (FMOD_DSP_STATE *dsp_state, FMOD_SPEAKERMODE sourceSpeakerMode, float pan, float lowFrequencyGain, float overallGain, int matrixHop, float *matrix); 111 | typedef FMOD_RESULT (F_CALL *FMOD_DSP_PAN_SUMSURROUNDMATRIX_FUNC) (FMOD_DSP_STATE *dsp_state, FMOD_SPEAKERMODE sourceSpeakerMode, FMOD_SPEAKERMODE targetSpeakerMode, float direction, float extent, float rotation, float lowFrequencyGain, float overallGain, int matrixHop, float *matrix, FMOD_DSP_PAN_SURROUND_FLAGS flags); 112 | typedef FMOD_RESULT (F_CALL *FMOD_DSP_PAN_SUMMONOTOSURROUNDMATRIX_FUNC) (FMOD_DSP_STATE *dsp_state, FMOD_SPEAKERMODE targetSpeakerMode, float direction, float extent, float lowFrequencyGain, float overallGain, int matrixHop, float *matrix); 113 | typedef FMOD_RESULT (F_CALL *FMOD_DSP_PAN_SUMSTEREOTOSURROUNDMATRIX_FUNC) (FMOD_DSP_STATE *dsp_state, FMOD_SPEAKERMODE targetSpeakerMode, float direction, float extent, float rotation, float lowFrequencyGain, float overallGain, int matrixHop, float *matrix); 114 | typedef FMOD_RESULT (F_CALL *FMOD_DSP_PAN_GETROLLOFFGAIN_FUNC) (FMOD_DSP_STATE *dsp_state, FMOD_DSP_PAN_3D_ROLLOFF_TYPE rolloff, float distance, float mindistance, float maxdistance, float *gain); 115 | 116 | /* 117 | DSP Structures 118 | */ 119 | struct FMOD_DSP_BUFFER_ARRAY 120 | { 121 | int numbuffers; 122 | int *buffernumchannels; 123 | FMOD_CHANNELMASK *bufferchannelmask; 124 | float **buffers; 125 | FMOD_SPEAKERMODE speakermode; 126 | }; 127 | 128 | struct FMOD_COMPLEX 129 | { 130 | float real; 131 | float imag; 132 | }; 133 | 134 | typedef struct FMOD_DSP_PARAMETER_FLOAT_MAPPING_PIECEWISE_LINEAR 135 | { 136 | int numpoints; 137 | float *pointparamvalues; 138 | float *pointpositions; 139 | } FMOD_DSP_PARAMETER_FLOAT_MAPPING_PIECEWISE_LINEAR; 140 | 141 | typedef struct FMOD_DSP_PARAMETER_FLOAT_MAPPING 142 | { 143 | FMOD_DSP_PARAMETER_FLOAT_MAPPING_TYPE type; 144 | FMOD_DSP_PARAMETER_FLOAT_MAPPING_PIECEWISE_LINEAR piecewiselinearmapping; 145 | } FMOD_DSP_PARAMETER_FLOAT_MAPPING; 146 | 147 | typedef struct FMOD_DSP_PARAMETER_DESC_FLOAT 148 | { 149 | float min; 150 | float max; 151 | float defaultval; 152 | FMOD_DSP_PARAMETER_FLOAT_MAPPING mapping; 153 | } FMOD_DSP_PARAMETER_DESC_FLOAT; 154 | 155 | typedef struct FMOD_DSP_PARAMETER_DESC_INT 156 | { 157 | int min; 158 | int max; 159 | int defaultval; 160 | FMOD_BOOL goestoinf; 161 | const char* const* valuenames; 162 | } FMOD_DSP_PARAMETER_DESC_INT; 163 | 164 | typedef struct FMOD_DSP_PARAMETER_DESC_BOOL 165 | { 166 | FMOD_BOOL defaultval; 167 | const char* const* valuenames; 168 | } FMOD_DSP_PARAMETER_DESC_BOOL; 169 | 170 | typedef struct FMOD_DSP_PARAMETER_DESC_DATA 171 | { 172 | int datatype; 173 | } FMOD_DSP_PARAMETER_DESC_DATA; 174 | 175 | typedef struct FMOD_DSP_PARAMETER_DESC 176 | { 177 | FMOD_DSP_PARAMETER_TYPE type; 178 | char name[16]; 179 | char label[16]; 180 | const char *description; 181 | 182 | union 183 | { 184 | FMOD_DSP_PARAMETER_DESC_FLOAT floatdesc; 185 | FMOD_DSP_PARAMETER_DESC_INT intdesc; 186 | FMOD_DSP_PARAMETER_DESC_BOOL booldesc; 187 | FMOD_DSP_PARAMETER_DESC_DATA datadesc; 188 | }; 189 | } FMOD_DSP_PARAMETER_DESC; 190 | 191 | typedef struct FMOD_DSP_PARAMETER_OVERALLGAIN 192 | { 193 | float linear_gain; 194 | float linear_gain_additive; 195 | } FMOD_DSP_PARAMETER_OVERALLGAIN; 196 | 197 | typedef struct FMOD_DSP_PARAMETER_3DATTRIBUTES 198 | { 199 | FMOD_3D_ATTRIBUTES relative; 200 | FMOD_3D_ATTRIBUTES absolute; 201 | } FMOD_DSP_PARAMETER_3DATTRIBUTES; 202 | 203 | typedef struct FMOD_DSP_PARAMETER_3DATTRIBUTES_MULTI 204 | { 205 | int numlisteners; 206 | FMOD_3D_ATTRIBUTES relative[FMOD_MAX_LISTENERS]; 207 | float weight[FMOD_MAX_LISTENERS]; 208 | FMOD_3D_ATTRIBUTES absolute; 209 | } FMOD_DSP_PARAMETER_3DATTRIBUTES_MULTI; 210 | 211 | typedef struct FMOD_DSP_PARAMETER_ATTENUATION_RANGE 212 | { 213 | float min; 214 | float max; 215 | } FMOD_DSP_PARAMETER_ATTENUATION_RANGE; 216 | 217 | typedef struct FMOD_DSP_PARAMETER_SIDECHAIN 218 | { 219 | FMOD_BOOL sidechainenable; 220 | } FMOD_DSP_PARAMETER_SIDECHAIN; 221 | 222 | typedef struct FMOD_DSP_PARAMETER_FFT 223 | { 224 | int length; 225 | int numchannels; 226 | float *spectrum[32]; 227 | } FMOD_DSP_PARAMETER_FFT; 228 | 229 | typedef struct FMOD_DSP_DESCRIPTION 230 | { 231 | unsigned int pluginsdkversion; 232 | char name[32]; 233 | unsigned int version; 234 | int numinputbuffers; 235 | int numoutputbuffers; 236 | FMOD_DSP_CREATE_CALLBACK create; 237 | FMOD_DSP_RELEASE_CALLBACK release; 238 | FMOD_DSP_RESET_CALLBACK reset; 239 | FMOD_DSP_READ_CALLBACK read; 240 | FMOD_DSP_PROCESS_CALLBACK process; 241 | FMOD_DSP_SETPOSITION_CALLBACK setposition; 242 | 243 | int numparameters; 244 | FMOD_DSP_PARAMETER_DESC **paramdesc; 245 | FMOD_DSP_SETPARAM_FLOAT_CALLBACK setparameterfloat; 246 | FMOD_DSP_SETPARAM_INT_CALLBACK setparameterint; 247 | FMOD_DSP_SETPARAM_BOOL_CALLBACK setparameterbool; 248 | FMOD_DSP_SETPARAM_DATA_CALLBACK setparameterdata; 249 | FMOD_DSP_GETPARAM_FLOAT_CALLBACK getparameterfloat; 250 | FMOD_DSP_GETPARAM_INT_CALLBACK getparameterint; 251 | FMOD_DSP_GETPARAM_BOOL_CALLBACK getparameterbool; 252 | FMOD_DSP_GETPARAM_DATA_CALLBACK getparameterdata; 253 | FMOD_DSP_SHOULDIPROCESS_CALLBACK shouldiprocess; 254 | void *userdata; 255 | 256 | FMOD_DSP_SYSTEM_REGISTER_CALLBACK sys_register; 257 | FMOD_DSP_SYSTEM_DEREGISTER_CALLBACK sys_deregister; 258 | FMOD_DSP_SYSTEM_MIX_CALLBACK sys_mix; 259 | 260 | } FMOD_DSP_DESCRIPTION; 261 | 262 | typedef struct FMOD_DSP_STATE_DFT_FUNCTIONS 263 | { 264 | FMOD_DSP_DFT_FFTREAL_FUNC fftreal; 265 | FMOD_DSP_DFT_IFFTREAL_FUNC inversefftreal; 266 | } FMOD_DSP_STATE_DFT_FUNCTIONS; 267 | 268 | typedef struct FMOD_DSP_STATE_PAN_FUNCTIONS 269 | { 270 | FMOD_DSP_PAN_SUMMONOMATRIX_FUNC summonomatrix; 271 | FMOD_DSP_PAN_SUMSTEREOMATRIX_FUNC sumstereomatrix; 272 | FMOD_DSP_PAN_SUMSURROUNDMATRIX_FUNC sumsurroundmatrix; 273 | FMOD_DSP_PAN_SUMMONOTOSURROUNDMATRIX_FUNC summonotosurroundmatrix; 274 | FMOD_DSP_PAN_SUMSTEREOTOSURROUNDMATRIX_FUNC sumstereotosurroundmatrix; 275 | FMOD_DSP_PAN_GETROLLOFFGAIN_FUNC getrolloffgain; 276 | } FMOD_DSP_STATE_PAN_FUNCTIONS; 277 | 278 | typedef struct FMOD_DSP_STATE_FUNCTIONS 279 | { 280 | FMOD_DSP_ALLOC_FUNC alloc; 281 | FMOD_DSP_REALLOC_FUNC realloc; 282 | FMOD_DSP_FREE_FUNC free; 283 | FMOD_DSP_GETSAMPLERATE_FUNC getsamplerate; 284 | FMOD_DSP_GETBLOCKSIZE_FUNC getblocksize; 285 | FMOD_DSP_STATE_DFT_FUNCTIONS *dft; 286 | FMOD_DSP_STATE_PAN_FUNCTIONS *pan; 287 | FMOD_DSP_GETSPEAKERMODE_FUNC getspeakermode; 288 | FMOD_DSP_GETCLOCK_FUNC getclock; 289 | FMOD_DSP_GETLISTENERATTRIBUTES_FUNC getlistenerattributes; 290 | FMOD_DSP_LOG_FUNC log; 291 | FMOD_DSP_GETUSERDATA_FUNC getuserdata; 292 | } FMOD_DSP_STATE_FUNCTIONS; 293 | 294 | struct FMOD_DSP_STATE 295 | { 296 | void *instance; 297 | void *plugindata; 298 | FMOD_CHANNELMASK channelmask; 299 | FMOD_SPEAKERMODE source_speakermode; 300 | float *sidechaindata; 301 | int sidechainchannels; 302 | FMOD_DSP_STATE_FUNCTIONS *functions; 303 | int systemobject; 304 | }; 305 | 306 | typedef struct FMOD_DSP_METERING_INFO 307 | { 308 | int numsamples; 309 | float peaklevel[32]; 310 | float rmslevel[32]; 311 | short numchannels; 312 | } FMOD_DSP_METERING_INFO; 313 | 314 | /* 315 | DSP Macros 316 | */ 317 | #define FMOD_DSP_INIT_PARAMDESC_FLOAT(_paramstruct, _name, _label, _description, _min, _max, _defaultval) \ 318 | memset(&(_paramstruct), 0, sizeof(_paramstruct)); \ 319 | (_paramstruct).type = FMOD_DSP_PARAMETER_TYPE_FLOAT; \ 320 | strncpy((_paramstruct).name, _name, 15); \ 321 | strncpy((_paramstruct).label, _label, 15); \ 322 | (_paramstruct).description = _description; \ 323 | (_paramstruct).floatdesc.min = _min; \ 324 | (_paramstruct).floatdesc.max = _max; \ 325 | (_paramstruct).floatdesc.defaultval = _defaultval; \ 326 | (_paramstruct).floatdesc.mapping.type = FMOD_DSP_PARAMETER_FLOAT_MAPPING_TYPE_AUTO; 327 | 328 | #define FMOD_DSP_INIT_PARAMDESC_FLOAT_WITH_MAPPING(_paramstruct, _name, _label, _description, _defaultval, _values, _positions); \ 329 | memset(&(_paramstruct), 0, sizeof(_paramstruct)); \ 330 | (_paramstruct).type = FMOD_DSP_PARAMETER_TYPE_FLOAT; \ 331 | strncpy((_paramstruct).name, _name , 15); \ 332 | strncpy((_paramstruct).label, _label, 15); \ 333 | (_paramstruct).description = _description; \ 334 | (_paramstruct).floatdesc.min = _values[0]; \ 335 | (_paramstruct).floatdesc.max = _values[sizeof(_values) / sizeof(float) - 1]; \ 336 | (_paramstruct).floatdesc.defaultval = _defaultval; \ 337 | (_paramstruct).floatdesc.mapping.type = FMOD_DSP_PARAMETER_FLOAT_MAPPING_TYPE_PIECEWISE_LINEAR; \ 338 | (_paramstruct).floatdesc.mapping.piecewiselinearmapping.numpoints = sizeof(_values) / sizeof(float); \ 339 | (_paramstruct).floatdesc.mapping.piecewiselinearmapping.pointparamvalues = _values; \ 340 | (_paramstruct).floatdesc.mapping.piecewiselinearmapping.pointpositions = _positions; 341 | 342 | #define FMOD_DSP_INIT_PARAMDESC_INT(_paramstruct, _name, _label, _description, _min, _max, _defaultval, _goestoinf, _valuenames) \ 343 | memset(&(_paramstruct), 0, sizeof(_paramstruct)); \ 344 | (_paramstruct).type = FMOD_DSP_PARAMETER_TYPE_INT; \ 345 | strncpy((_paramstruct).name, _name , 15); \ 346 | strncpy((_paramstruct).label, _label, 15); \ 347 | (_paramstruct).description = _description; \ 348 | (_paramstruct).intdesc.min = _min; \ 349 | (_paramstruct).intdesc.max = _max; \ 350 | (_paramstruct).intdesc.defaultval = _defaultval; \ 351 | (_paramstruct).intdesc.goestoinf = _goestoinf; \ 352 | (_paramstruct).intdesc.valuenames = _valuenames; 353 | 354 | #define FMOD_DSP_INIT_PARAMDESC_INT_ENUMERATED(_paramstruct, _name, _label, _description, _defaultval, _valuenames) \ 355 | memset(&(_paramstruct), 0, sizeof(_paramstruct)); \ 356 | (_paramstruct).type = FMOD_DSP_PARAMETER_TYPE_INT; \ 357 | strncpy((_paramstruct).name, _name , 15); \ 358 | strncpy((_paramstruct).label, _label, 15); \ 359 | (_paramstruct).description = _description; \ 360 | (_paramstruct).intdesc.min = 0; \ 361 | (_paramstruct).intdesc.max = sizeof(_valuenames) / sizeof(char*) - 1; \ 362 | (_paramstruct).intdesc.defaultval = _defaultval; \ 363 | (_paramstruct).intdesc.goestoinf = false; \ 364 | (_paramstruct).intdesc.valuenames = _valuenames; 365 | 366 | #define FMOD_DSP_INIT_PARAMDESC_BOOL(_paramstruct, _name, _label, _description, _defaultval, _valuenames) \ 367 | memset(&(_paramstruct), 0, sizeof(_paramstruct)); \ 368 | (_paramstruct).type = FMOD_DSP_PARAMETER_TYPE_BOOL; \ 369 | strncpy((_paramstruct).name, _name , 15); \ 370 | strncpy((_paramstruct).label, _label, 15); \ 371 | (_paramstruct).description = _description; \ 372 | (_paramstruct).booldesc.defaultval = _defaultval; \ 373 | (_paramstruct).booldesc.valuenames = _valuenames; 374 | 375 | #define FMOD_DSP_INIT_PARAMDESC_DATA(_paramstruct, _name, _label, _description, _datatype) \ 376 | memset(&(_paramstruct), 0, sizeof(_paramstruct)); \ 377 | (_paramstruct).type = FMOD_DSP_PARAMETER_TYPE_DATA; \ 378 | strncpy((_paramstruct).name, _name , 15); \ 379 | strncpy((_paramstruct).label, _label, 15); \ 380 | (_paramstruct).description = _description; \ 381 | (_paramstruct).datadesc.datatype = _datatype; 382 | 383 | #define FMOD_DSP_ALLOC(_state, _size) \ 384 | (_state)->functions->alloc(_size, FMOD_MEMORY_NORMAL, __FILE__) 385 | #define FMOD_DSP_REALLOC(_state, _ptr, _size) \ 386 | (_state)->functions->realloc(_ptr, _size, FMOD_MEMORY_NORMAL, __FILE__) 387 | #define FMOD_DSP_FREE(_state, _ptr) \ 388 | (_state)->functions->free(_ptr, FMOD_MEMORY_NORMAL, __FILE__) 389 | #define FMOD_DSP_LOG(_state, _level, _location, _format, ...) \ 390 | (_state)->functions->log(_level, __FILE__, __LINE__, _location, _format, __VA_ARGS__) 391 | #define FMOD_DSP_GETSAMPLERATE(_state, _rate) \ 392 | (_state)->functions->getsamplerate(_state, _rate) 393 | #define FMOD_DSP_GETBLOCKSIZE(_state, _blocksize) \ 394 | (_state)->functions->getblocksize(_state, _blocksize) 395 | #define FMOD_DSP_GETSPEAKERMODE(_state, _speakermodemix, _speakermodeout) \ 396 | (_state)->functions->getspeakermode(_state, _speakermodemix, _speakermodeout) 397 | #define FMOD_DSP_GETCLOCK(_state, _clock, _offset, _length) \ 398 | (_state)->functions->getclock(_state, _clock, _offset, _length) 399 | #define FMOD_DSP_GETLISTENERATTRIBUTES(_state, _numlisteners, _attributes) \ 400 | (_state)->functions->getlistenerattributes(_state, _numlisteners, _attributes) 401 | #define FMOD_DSP_GETUSERDATA(_state, _userdata) \ 402 | (_state)->functions->getuserdata(_state, _userdata) 403 | #define FMOD_DSP_DFT_FFTREAL(_state, _size, _signal, _dft, _window, _signalhop) \ 404 | (_state)->functions->dft->fftreal(_state, _size, _signal, _dft, _window, _signalhop) 405 | #define FMOD_DSP_DFT_IFFTREAL(_state, _size, _dft, _signal, _window, _signalhop) \ 406 | (_state)->functions->dft->inversefftreal(_state, _size, _dft, _signal, _window, _signalhop) 407 | #define FMOD_DSP_PAN_SUMMONOMATRIX(_state, _sourcespeakermode, _lowfrequencygain, _overallgain, _matrix) \ 408 | (_state)->functions->pan->summonomatrix(_state, _sourcespeakermode, _lowfrequencygain, _overallgain, _matrix) 409 | #define FMOD_DSP_PAN_SUMSTEREOMATRIX(_state, _sourcespeakermode, _pan, _lowfrequencygain, _overallgain, _matrixhop, _matrix) \ 410 | (_state)->functions->pan->sumstereomatrix(_state, _sourcespeakermode, _pan, _lowfrequencygain, _overallgain, _matrixhop, _matrix) 411 | #define FMOD_DSP_PAN_SUMSURROUNDMATRIX(_state, _sourcespeakermode, _targetspeakermode, _direction, _extent, _rotation, _lowfrequencygain, _overallgain, _matrixhop, _matrix, _flags) \ 412 | (_state)->functions->pan->sumsurroundmatrix(_state, _sourcespeakermode, _targetspeakermode, _direction, _extent, _rotation, _lowfrequencygain, _overallgain, _matrixhop, _matrix, _flags) 413 | #define FMOD_DSP_PAN_SUMMONOTOSURROUNDMATRIX(_state, _targetspeakermode, _direction, _extent, _lowfrequencygain, _overallgain, _matrixhop, _matrix) \ 414 | (_state)->functions->pan->summonotosurroundmatrix(_state, _targetspeakermode, _direction, _extent, _lowfrequencygain, _overallgain, _matrixhop, _matrix) 415 | #define FMOD_DSP_PAN_SUMSTEREOTOSURROUNDMATRIX(_state, _targetspeakermode, _direction, _extent, _rotation, _lowfrequencygain, _overallgain, matrixhop, _matrix) \ 416 | (_state)->functions->pan->sumstereotosurroundmatrix(_state, _targetspeakermode, _direction, _extent, _rotation, _lowfrequencygain, _overallgain, matrixhop, _matrix) 417 | #define FMOD_DSP_PAN_GETROLLOFFGAIN(_state, _rolloff, _distance, _mindistance, _maxdistance, _gain) \ 418 | (_state)->functions->pan->getrolloffgain(_state, _rolloff, _distance, _mindistance, _maxdistance, _gain) 419 | 420 | #endif 421 | 422 | -------------------------------------------------------------------------------- /PingPongTutorial/inc/3rd-party/fmod_dsp_effects.h: -------------------------------------------------------------------------------- 1 | /* ============================================================================================================= */ 2 | /* FMOD Core API - Built-in effects header file. */ 3 | /* Copyright (c), Firelight Technologies Pty, Ltd. 2004-2023. */ 4 | /* */ 5 | /* In this header you can find parameter structures for FMOD system registered DSP effects */ 6 | /* and generators. */ 7 | /* */ 8 | /* For more detail visit: */ 9 | /* https://fmod.com/docs/2.02/api/core-api-common-dsp-effects.html#fmod_dsp_type */ 10 | /* ============================================================================================================= */ 11 | 12 | #ifndef _FMOD_DSP_EFFECTS_H 13 | #define _FMOD_DSP_EFFECTS_H 14 | 15 | typedef enum 16 | { 17 | FMOD_DSP_TYPE_UNKNOWN, 18 | FMOD_DSP_TYPE_MIXER, 19 | FMOD_DSP_TYPE_OSCILLATOR, 20 | FMOD_DSP_TYPE_LOWPASS, 21 | FMOD_DSP_TYPE_ITLOWPASS, 22 | FMOD_DSP_TYPE_HIGHPASS, 23 | FMOD_DSP_TYPE_ECHO, 24 | FMOD_DSP_TYPE_FADER, 25 | FMOD_DSP_TYPE_FLANGE, 26 | FMOD_DSP_TYPE_DISTORTION, 27 | FMOD_DSP_TYPE_NORMALIZE, 28 | FMOD_DSP_TYPE_LIMITER, 29 | FMOD_DSP_TYPE_PARAMEQ, 30 | FMOD_DSP_TYPE_PITCHSHIFT, 31 | FMOD_DSP_TYPE_CHORUS, 32 | FMOD_DSP_TYPE_VSTPLUGIN, 33 | FMOD_DSP_TYPE_WINAMPPLUGIN, 34 | FMOD_DSP_TYPE_ITECHO, 35 | FMOD_DSP_TYPE_COMPRESSOR, 36 | FMOD_DSP_TYPE_SFXREVERB, 37 | FMOD_DSP_TYPE_LOWPASS_SIMPLE, 38 | FMOD_DSP_TYPE_DELAY, 39 | FMOD_DSP_TYPE_TREMOLO, 40 | FMOD_DSP_TYPE_LADSPAPLUGIN, 41 | FMOD_DSP_TYPE_SEND, 42 | FMOD_DSP_TYPE_RETURN, 43 | FMOD_DSP_TYPE_HIGHPASS_SIMPLE, 44 | FMOD_DSP_TYPE_PAN, 45 | FMOD_DSP_TYPE_THREE_EQ, 46 | FMOD_DSP_TYPE_FFT, 47 | FMOD_DSP_TYPE_LOUDNESS_METER, 48 | FMOD_DSP_TYPE_ENVELOPEFOLLOWER, 49 | FMOD_DSP_TYPE_CONVOLUTIONREVERB, 50 | FMOD_DSP_TYPE_CHANNELMIX, 51 | FMOD_DSP_TYPE_TRANSCEIVER, 52 | FMOD_DSP_TYPE_OBJECTPAN, 53 | FMOD_DSP_TYPE_MULTIBAND_EQ, 54 | 55 | FMOD_DSP_TYPE_MAX, 56 | FMOD_DSP_TYPE_FORCEINT = 65536 /* Makes sure this enum is signed 32bit. */ 57 | } FMOD_DSP_TYPE; 58 | 59 | /* 60 | =================================================================================================== 61 | 62 | FMOD built in effect parameters. 63 | Use DSP::setParameter with these enums for the 'index' parameter. 64 | 65 | =================================================================================================== 66 | */ 67 | 68 | typedef enum 69 | { 70 | FMOD_DSP_OSCILLATOR_TYPE, 71 | FMOD_DSP_OSCILLATOR_RATE 72 | } FMOD_DSP_OSCILLATOR; 73 | 74 | 75 | typedef enum 76 | { 77 | FMOD_DSP_LOWPASS_CUTOFF, 78 | FMOD_DSP_LOWPASS_RESONANCE 79 | } FMOD_DSP_LOWPASS; 80 | 81 | 82 | typedef enum 83 | { 84 | FMOD_DSP_ITLOWPASS_CUTOFF, 85 | FMOD_DSP_ITLOWPASS_RESONANCE 86 | } FMOD_DSP_ITLOWPASS; 87 | 88 | 89 | typedef enum 90 | { 91 | FMOD_DSP_HIGHPASS_CUTOFF, 92 | FMOD_DSP_HIGHPASS_RESONANCE 93 | } FMOD_DSP_HIGHPASS; 94 | 95 | 96 | typedef enum 97 | { 98 | FMOD_DSP_ECHO_DELAY, 99 | FMOD_DSP_ECHO_FEEDBACK, 100 | FMOD_DSP_ECHO_DRYLEVEL, 101 | FMOD_DSP_ECHO_WETLEVEL 102 | } FMOD_DSP_ECHO; 103 | 104 | 105 | typedef enum FMOD_DSP_FADER 106 | { 107 | FMOD_DSP_FADER_GAIN, 108 | FMOD_DSP_FADER_OVERALL_GAIN, 109 | } FMOD_DSP_FADER; 110 | 111 | 112 | typedef enum 113 | { 114 | FMOD_DSP_FLANGE_MIX, 115 | FMOD_DSP_FLANGE_DEPTH, 116 | FMOD_DSP_FLANGE_RATE 117 | } FMOD_DSP_FLANGE; 118 | 119 | 120 | typedef enum 121 | { 122 | FMOD_DSP_DISTORTION_LEVEL 123 | } FMOD_DSP_DISTORTION; 124 | 125 | 126 | typedef enum 127 | { 128 | FMOD_DSP_NORMALIZE_FADETIME, 129 | FMOD_DSP_NORMALIZE_THRESHOLD, 130 | FMOD_DSP_NORMALIZE_MAXAMP 131 | } FMOD_DSP_NORMALIZE; 132 | 133 | 134 | typedef enum 135 | { 136 | FMOD_DSP_LIMITER_RELEASETIME, 137 | FMOD_DSP_LIMITER_CEILING, 138 | FMOD_DSP_LIMITER_MAXIMIZERGAIN, 139 | FMOD_DSP_LIMITER_MODE, 140 | } FMOD_DSP_LIMITER; 141 | 142 | 143 | typedef enum 144 | { 145 | FMOD_DSP_PARAMEQ_CENTER, 146 | FMOD_DSP_PARAMEQ_BANDWIDTH, 147 | FMOD_DSP_PARAMEQ_GAIN 148 | } FMOD_DSP_PARAMEQ; 149 | 150 | 151 | typedef enum FMOD_DSP_MULTIBAND_EQ 152 | { 153 | FMOD_DSP_MULTIBAND_EQ_A_FILTER, 154 | FMOD_DSP_MULTIBAND_EQ_A_FREQUENCY, 155 | FMOD_DSP_MULTIBAND_EQ_A_Q, 156 | FMOD_DSP_MULTIBAND_EQ_A_GAIN, 157 | FMOD_DSP_MULTIBAND_EQ_B_FILTER, 158 | FMOD_DSP_MULTIBAND_EQ_B_FREQUENCY, 159 | FMOD_DSP_MULTIBAND_EQ_B_Q, 160 | FMOD_DSP_MULTIBAND_EQ_B_GAIN, 161 | FMOD_DSP_MULTIBAND_EQ_C_FILTER, 162 | FMOD_DSP_MULTIBAND_EQ_C_FREQUENCY, 163 | FMOD_DSP_MULTIBAND_EQ_C_Q, 164 | FMOD_DSP_MULTIBAND_EQ_C_GAIN, 165 | FMOD_DSP_MULTIBAND_EQ_D_FILTER, 166 | FMOD_DSP_MULTIBAND_EQ_D_FREQUENCY, 167 | FMOD_DSP_MULTIBAND_EQ_D_Q, 168 | FMOD_DSP_MULTIBAND_EQ_D_GAIN, 169 | FMOD_DSP_MULTIBAND_EQ_E_FILTER, 170 | FMOD_DSP_MULTIBAND_EQ_E_FREQUENCY, 171 | FMOD_DSP_MULTIBAND_EQ_E_Q, 172 | FMOD_DSP_MULTIBAND_EQ_E_GAIN, 173 | } FMOD_DSP_MULTIBAND_EQ; 174 | 175 | 176 | typedef enum FMOD_DSP_MULTIBAND_EQ_FILTER_TYPE 177 | { 178 | FMOD_DSP_MULTIBAND_EQ_FILTER_DISABLED, 179 | FMOD_DSP_MULTIBAND_EQ_FILTER_LOWPASS_12DB, 180 | FMOD_DSP_MULTIBAND_EQ_FILTER_LOWPASS_24DB, 181 | FMOD_DSP_MULTIBAND_EQ_FILTER_LOWPASS_48DB, 182 | FMOD_DSP_MULTIBAND_EQ_FILTER_HIGHPASS_12DB, 183 | FMOD_DSP_MULTIBAND_EQ_FILTER_HIGHPASS_24DB, 184 | FMOD_DSP_MULTIBAND_EQ_FILTER_HIGHPASS_48DB, 185 | FMOD_DSP_MULTIBAND_EQ_FILTER_LOWSHELF, 186 | FMOD_DSP_MULTIBAND_EQ_FILTER_HIGHSHELF, 187 | FMOD_DSP_MULTIBAND_EQ_FILTER_PEAKING, 188 | FMOD_DSP_MULTIBAND_EQ_FILTER_BANDPASS, 189 | FMOD_DSP_MULTIBAND_EQ_FILTER_NOTCH, 190 | FMOD_DSP_MULTIBAND_EQ_FILTER_ALLPASS, 191 | } FMOD_DSP_MULTIBAND_EQ_FILTER_TYPE; 192 | 193 | 194 | typedef enum 195 | { 196 | FMOD_DSP_PITCHSHIFT_PITCH, 197 | FMOD_DSP_PITCHSHIFT_FFTSIZE, 198 | FMOD_DSP_PITCHSHIFT_OVERLAP, 199 | FMOD_DSP_PITCHSHIFT_MAXCHANNELS 200 | } FMOD_DSP_PITCHSHIFT; 201 | 202 | 203 | typedef enum 204 | { 205 | FMOD_DSP_CHORUS_MIX, 206 | FMOD_DSP_CHORUS_RATE, 207 | FMOD_DSP_CHORUS_DEPTH, 208 | } FMOD_DSP_CHORUS; 209 | 210 | 211 | typedef enum 212 | { 213 | FMOD_DSP_ITECHO_WETDRYMIX, 214 | FMOD_DSP_ITECHO_FEEDBACK, 215 | FMOD_DSP_ITECHO_LEFTDELAY, 216 | FMOD_DSP_ITECHO_RIGHTDELAY, 217 | FMOD_DSP_ITECHO_PANDELAY 218 | } FMOD_DSP_ITECHO; 219 | 220 | typedef enum 221 | { 222 | FMOD_DSP_COMPRESSOR_THRESHOLD, 223 | FMOD_DSP_COMPRESSOR_RATIO, 224 | FMOD_DSP_COMPRESSOR_ATTACK, 225 | FMOD_DSP_COMPRESSOR_RELEASE, 226 | FMOD_DSP_COMPRESSOR_GAINMAKEUP, 227 | FMOD_DSP_COMPRESSOR_USESIDECHAIN, 228 | FMOD_DSP_COMPRESSOR_LINKED 229 | } FMOD_DSP_COMPRESSOR; 230 | 231 | typedef enum 232 | { 233 | FMOD_DSP_SFXREVERB_DECAYTIME, 234 | FMOD_DSP_SFXREVERB_EARLYDELAY, 235 | FMOD_DSP_SFXREVERB_LATEDELAY, 236 | FMOD_DSP_SFXREVERB_HFREFERENCE, 237 | FMOD_DSP_SFXREVERB_HFDECAYRATIO, 238 | FMOD_DSP_SFXREVERB_DIFFUSION, 239 | FMOD_DSP_SFXREVERB_DENSITY, 240 | FMOD_DSP_SFXREVERB_LOWSHELFFREQUENCY, 241 | FMOD_DSP_SFXREVERB_LOWSHELFGAIN, 242 | FMOD_DSP_SFXREVERB_HIGHCUT, 243 | FMOD_DSP_SFXREVERB_EARLYLATEMIX, 244 | FMOD_DSP_SFXREVERB_WETLEVEL, 245 | FMOD_DSP_SFXREVERB_DRYLEVEL 246 | } FMOD_DSP_SFXREVERB; 247 | 248 | typedef enum 249 | { 250 | FMOD_DSP_LOWPASS_SIMPLE_CUTOFF 251 | } FMOD_DSP_LOWPASS_SIMPLE; 252 | 253 | 254 | typedef enum 255 | { 256 | FMOD_DSP_DELAY_CH0, 257 | FMOD_DSP_DELAY_CH1, 258 | FMOD_DSP_DELAY_CH2, 259 | FMOD_DSP_DELAY_CH3, 260 | FMOD_DSP_DELAY_CH4, 261 | FMOD_DSP_DELAY_CH5, 262 | FMOD_DSP_DELAY_CH6, 263 | FMOD_DSP_DELAY_CH7, 264 | FMOD_DSP_DELAY_CH8, 265 | FMOD_DSP_DELAY_CH9, 266 | FMOD_DSP_DELAY_CH10, 267 | FMOD_DSP_DELAY_CH11, 268 | FMOD_DSP_DELAY_CH12, 269 | FMOD_DSP_DELAY_CH13, 270 | FMOD_DSP_DELAY_CH14, 271 | FMOD_DSP_DELAY_CH15, 272 | FMOD_DSP_DELAY_MAXDELAY 273 | } FMOD_DSP_DELAY; 274 | 275 | 276 | typedef enum 277 | { 278 | FMOD_DSP_TREMOLO_FREQUENCY, 279 | FMOD_DSP_TREMOLO_DEPTH, 280 | FMOD_DSP_TREMOLO_SHAPE, 281 | FMOD_DSP_TREMOLO_SKEW, 282 | FMOD_DSP_TREMOLO_DUTY, 283 | FMOD_DSP_TREMOLO_SQUARE, 284 | FMOD_DSP_TREMOLO_PHASE, 285 | FMOD_DSP_TREMOLO_SPREAD 286 | } FMOD_DSP_TREMOLO; 287 | 288 | 289 | typedef enum 290 | { 291 | FMOD_DSP_SEND_RETURNID, 292 | FMOD_DSP_SEND_LEVEL, 293 | } FMOD_DSP_SEND; 294 | 295 | 296 | typedef enum 297 | { 298 | FMOD_DSP_RETURN_ID, 299 | FMOD_DSP_RETURN_INPUT_SPEAKER_MODE 300 | } FMOD_DSP_RETURN; 301 | 302 | 303 | typedef enum 304 | { 305 | FMOD_DSP_HIGHPASS_SIMPLE_CUTOFF 306 | } FMOD_DSP_HIGHPASS_SIMPLE; 307 | 308 | 309 | typedef enum 310 | { 311 | FMOD_DSP_PAN_2D_STEREO_MODE_DISTRIBUTED, 312 | FMOD_DSP_PAN_2D_STEREO_MODE_DISCRETE 313 | } FMOD_DSP_PAN_2D_STEREO_MODE_TYPE; 314 | 315 | 316 | typedef enum 317 | { 318 | FMOD_DSP_PAN_MODE_MONO, 319 | FMOD_DSP_PAN_MODE_STEREO, 320 | FMOD_DSP_PAN_MODE_SURROUND 321 | } FMOD_DSP_PAN_MODE_TYPE; 322 | 323 | 324 | typedef enum 325 | { 326 | FMOD_DSP_PAN_3D_ROLLOFF_LINEARSQUARED, 327 | FMOD_DSP_PAN_3D_ROLLOFF_LINEAR, 328 | FMOD_DSP_PAN_3D_ROLLOFF_INVERSE, 329 | FMOD_DSP_PAN_3D_ROLLOFF_INVERSETAPERED, 330 | FMOD_DSP_PAN_3D_ROLLOFF_CUSTOM 331 | } FMOD_DSP_PAN_3D_ROLLOFF_TYPE; 332 | 333 | 334 | typedef enum 335 | { 336 | FMOD_DSP_PAN_3D_EXTENT_MODE_AUTO, 337 | FMOD_DSP_PAN_3D_EXTENT_MODE_USER, 338 | FMOD_DSP_PAN_3D_EXTENT_MODE_OFF 339 | } FMOD_DSP_PAN_3D_EXTENT_MODE_TYPE; 340 | 341 | 342 | typedef enum 343 | { 344 | FMOD_DSP_PAN_MODE, 345 | FMOD_DSP_PAN_2D_STEREO_POSITION, 346 | FMOD_DSP_PAN_2D_DIRECTION, 347 | FMOD_DSP_PAN_2D_EXTENT, 348 | FMOD_DSP_PAN_2D_ROTATION, 349 | FMOD_DSP_PAN_2D_LFE_LEVEL, 350 | FMOD_DSP_PAN_2D_STEREO_MODE, 351 | FMOD_DSP_PAN_2D_STEREO_SEPARATION, 352 | FMOD_DSP_PAN_2D_STEREO_AXIS, 353 | FMOD_DSP_PAN_ENABLED_SPEAKERS, 354 | FMOD_DSP_PAN_3D_POSITION, 355 | FMOD_DSP_PAN_3D_ROLLOFF, 356 | FMOD_DSP_PAN_3D_MIN_DISTANCE, 357 | FMOD_DSP_PAN_3D_MAX_DISTANCE, 358 | FMOD_DSP_PAN_3D_EXTENT_MODE, 359 | FMOD_DSP_PAN_3D_SOUND_SIZE, 360 | FMOD_DSP_PAN_3D_MIN_EXTENT, 361 | FMOD_DSP_PAN_3D_PAN_BLEND, 362 | FMOD_DSP_PAN_LFE_UPMIX_ENABLED, 363 | FMOD_DSP_PAN_OVERALL_GAIN, 364 | FMOD_DSP_PAN_SURROUND_SPEAKER_MODE, 365 | FMOD_DSP_PAN_2D_HEIGHT_BLEND, 366 | FMOD_DSP_PAN_ATTENUATION_RANGE, 367 | FMOD_DSP_PAN_OVERRIDE_RANGE 368 | } FMOD_DSP_PAN; 369 | 370 | 371 | typedef enum 372 | { 373 | FMOD_DSP_THREE_EQ_CROSSOVERSLOPE_12DB, 374 | FMOD_DSP_THREE_EQ_CROSSOVERSLOPE_24DB, 375 | FMOD_DSP_THREE_EQ_CROSSOVERSLOPE_48DB 376 | } FMOD_DSP_THREE_EQ_CROSSOVERSLOPE_TYPE; 377 | 378 | 379 | typedef enum 380 | { 381 | FMOD_DSP_THREE_EQ_LOWGAIN, 382 | FMOD_DSP_THREE_EQ_MIDGAIN, 383 | FMOD_DSP_THREE_EQ_HIGHGAIN, 384 | FMOD_DSP_THREE_EQ_LOWCROSSOVER, 385 | FMOD_DSP_THREE_EQ_HIGHCROSSOVER, 386 | FMOD_DSP_THREE_EQ_CROSSOVERSLOPE 387 | } FMOD_DSP_THREE_EQ; 388 | 389 | 390 | typedef enum 391 | { 392 | FMOD_DSP_FFT_WINDOW_RECT, 393 | FMOD_DSP_FFT_WINDOW_TRIANGLE, 394 | FMOD_DSP_FFT_WINDOW_HAMMING, 395 | FMOD_DSP_FFT_WINDOW_HANNING, 396 | FMOD_DSP_FFT_WINDOW_BLACKMAN, 397 | FMOD_DSP_FFT_WINDOW_BLACKMANHARRIS 398 | } FMOD_DSP_FFT_WINDOW; 399 | 400 | 401 | typedef enum 402 | { 403 | FMOD_DSP_FFT_WINDOWSIZE, 404 | FMOD_DSP_FFT_WINDOWTYPE, 405 | FMOD_DSP_FFT_SPECTRUMDATA, 406 | FMOD_DSP_FFT_DOMINANT_FREQ 407 | } FMOD_DSP_FFT; 408 | 409 | #define FMOD_DSP_LOUDNESS_METER_HISTOGRAM_SAMPLES 66 410 | 411 | typedef enum 412 | { 413 | FMOD_DSP_LOUDNESS_METER_STATE, 414 | FMOD_DSP_LOUDNESS_METER_WEIGHTING, 415 | FMOD_DSP_LOUDNESS_METER_INFO 416 | } FMOD_DSP_LOUDNESS_METER; 417 | 418 | 419 | typedef enum 420 | { 421 | FMOD_DSP_LOUDNESS_METER_STATE_RESET_INTEGRATED = -3, 422 | FMOD_DSP_LOUDNESS_METER_STATE_RESET_MAXPEAK = -2, 423 | FMOD_DSP_LOUDNESS_METER_STATE_RESET_ALL = -1, 424 | FMOD_DSP_LOUDNESS_METER_STATE_PAUSED = 0, 425 | FMOD_DSP_LOUDNESS_METER_STATE_ANALYZING = 1 426 | } FMOD_DSP_LOUDNESS_METER_STATE_TYPE; 427 | 428 | typedef struct FMOD_DSP_LOUDNESS_METER_INFO_TYPE 429 | { 430 | float momentaryloudness; 431 | float shorttermloudness; 432 | float integratedloudness; 433 | float loudness10thpercentile; 434 | float loudness95thpercentile; 435 | float loudnesshistogram[FMOD_DSP_LOUDNESS_METER_HISTOGRAM_SAMPLES]; 436 | float maxtruepeak; 437 | float maxmomentaryloudness; 438 | } FMOD_DSP_LOUDNESS_METER_INFO_TYPE; 439 | 440 | typedef struct FMOD_DSP_LOUDNESS_METER_WEIGHTING_TYPE 441 | { 442 | float channelweight[32]; 443 | } FMOD_DSP_LOUDNESS_METER_WEIGHTING_TYPE; 444 | 445 | 446 | typedef enum 447 | { 448 | FMOD_DSP_ENVELOPEFOLLOWER_ATTACK, 449 | FMOD_DSP_ENVELOPEFOLLOWER_RELEASE, 450 | FMOD_DSP_ENVELOPEFOLLOWER_ENVELOPE, 451 | FMOD_DSP_ENVELOPEFOLLOWER_USESIDECHAIN 452 | } FMOD_DSP_ENVELOPEFOLLOWER; 453 | 454 | typedef enum 455 | { 456 | FMOD_DSP_CONVOLUTION_REVERB_PARAM_IR, 457 | FMOD_DSP_CONVOLUTION_REVERB_PARAM_WET, 458 | FMOD_DSP_CONVOLUTION_REVERB_PARAM_DRY, 459 | FMOD_DSP_CONVOLUTION_REVERB_PARAM_LINKED 460 | } FMOD_DSP_CONVOLUTION_REVERB; 461 | 462 | typedef enum 463 | { 464 | FMOD_DSP_CHANNELMIX_OUTPUT_DEFAULT, 465 | FMOD_DSP_CHANNELMIX_OUTPUT_ALLMONO, 466 | FMOD_DSP_CHANNELMIX_OUTPUT_ALLSTEREO, 467 | FMOD_DSP_CHANNELMIX_OUTPUT_ALLQUAD, 468 | FMOD_DSP_CHANNELMIX_OUTPUT_ALL5POINT1, 469 | FMOD_DSP_CHANNELMIX_OUTPUT_ALL7POINT1, 470 | FMOD_DSP_CHANNELMIX_OUTPUT_ALLLFE, 471 | FMOD_DSP_CHANNELMIX_OUTPUT_ALL7POINT1POINT4 472 | } FMOD_DSP_CHANNELMIX_OUTPUT; 473 | 474 | typedef enum 475 | { 476 | FMOD_DSP_CHANNELMIX_OUTPUTGROUPING, 477 | FMOD_DSP_CHANNELMIX_GAIN_CH0, 478 | FMOD_DSP_CHANNELMIX_GAIN_CH1, 479 | FMOD_DSP_CHANNELMIX_GAIN_CH2, 480 | FMOD_DSP_CHANNELMIX_GAIN_CH3, 481 | FMOD_DSP_CHANNELMIX_GAIN_CH4, 482 | FMOD_DSP_CHANNELMIX_GAIN_CH5, 483 | FMOD_DSP_CHANNELMIX_GAIN_CH6, 484 | FMOD_DSP_CHANNELMIX_GAIN_CH7, 485 | FMOD_DSP_CHANNELMIX_GAIN_CH8, 486 | FMOD_DSP_CHANNELMIX_GAIN_CH9, 487 | FMOD_DSP_CHANNELMIX_GAIN_CH10, 488 | FMOD_DSP_CHANNELMIX_GAIN_CH11, 489 | FMOD_DSP_CHANNELMIX_GAIN_CH12, 490 | FMOD_DSP_CHANNELMIX_GAIN_CH13, 491 | FMOD_DSP_CHANNELMIX_GAIN_CH14, 492 | FMOD_DSP_CHANNELMIX_GAIN_CH15, 493 | FMOD_DSP_CHANNELMIX_GAIN_CH16, 494 | FMOD_DSP_CHANNELMIX_GAIN_CH17, 495 | FMOD_DSP_CHANNELMIX_GAIN_CH18, 496 | FMOD_DSP_CHANNELMIX_GAIN_CH19, 497 | FMOD_DSP_CHANNELMIX_GAIN_CH20, 498 | FMOD_DSP_CHANNELMIX_GAIN_CH21, 499 | FMOD_DSP_CHANNELMIX_GAIN_CH22, 500 | FMOD_DSP_CHANNELMIX_GAIN_CH23, 501 | FMOD_DSP_CHANNELMIX_GAIN_CH24, 502 | FMOD_DSP_CHANNELMIX_GAIN_CH25, 503 | FMOD_DSP_CHANNELMIX_GAIN_CH26, 504 | FMOD_DSP_CHANNELMIX_GAIN_CH27, 505 | FMOD_DSP_CHANNELMIX_GAIN_CH28, 506 | FMOD_DSP_CHANNELMIX_GAIN_CH29, 507 | FMOD_DSP_CHANNELMIX_GAIN_CH30, 508 | FMOD_DSP_CHANNELMIX_GAIN_CH31, 509 | FMOD_DSP_CHANNELMIX_OUTPUT_CH0, 510 | FMOD_DSP_CHANNELMIX_OUTPUT_CH1, 511 | FMOD_DSP_CHANNELMIX_OUTPUT_CH2, 512 | FMOD_DSP_CHANNELMIX_OUTPUT_CH3, 513 | FMOD_DSP_CHANNELMIX_OUTPUT_CH4, 514 | FMOD_DSP_CHANNELMIX_OUTPUT_CH5, 515 | FMOD_DSP_CHANNELMIX_OUTPUT_CH6, 516 | FMOD_DSP_CHANNELMIX_OUTPUT_CH7, 517 | FMOD_DSP_CHANNELMIX_OUTPUT_CH8, 518 | FMOD_DSP_CHANNELMIX_OUTPUT_CH9, 519 | FMOD_DSP_CHANNELMIX_OUTPUT_CH10, 520 | FMOD_DSP_CHANNELMIX_OUTPUT_CH11, 521 | FMOD_DSP_CHANNELMIX_OUTPUT_CH12, 522 | FMOD_DSP_CHANNELMIX_OUTPUT_CH13, 523 | FMOD_DSP_CHANNELMIX_OUTPUT_CH14, 524 | FMOD_DSP_CHANNELMIX_OUTPUT_CH15, 525 | FMOD_DSP_CHANNELMIX_OUTPUT_CH16, 526 | FMOD_DSP_CHANNELMIX_OUTPUT_CH17, 527 | FMOD_DSP_CHANNELMIX_OUTPUT_CH18, 528 | FMOD_DSP_CHANNELMIX_OUTPUT_CH19, 529 | FMOD_DSP_CHANNELMIX_OUTPUT_CH20, 530 | FMOD_DSP_CHANNELMIX_OUTPUT_CH21, 531 | FMOD_DSP_CHANNELMIX_OUTPUT_CH22, 532 | FMOD_DSP_CHANNELMIX_OUTPUT_CH23, 533 | FMOD_DSP_CHANNELMIX_OUTPUT_CH24, 534 | FMOD_DSP_CHANNELMIX_OUTPUT_CH25, 535 | FMOD_DSP_CHANNELMIX_OUTPUT_CH26, 536 | FMOD_DSP_CHANNELMIX_OUTPUT_CH27, 537 | FMOD_DSP_CHANNELMIX_OUTPUT_CH28, 538 | FMOD_DSP_CHANNELMIX_OUTPUT_CH29, 539 | FMOD_DSP_CHANNELMIX_OUTPUT_CH30, 540 | FMOD_DSP_CHANNELMIX_OUTPUT_CH31 541 | } FMOD_DSP_CHANNELMIX; 542 | 543 | typedef enum 544 | { 545 | FMOD_DSP_TRANSCEIVER_SPEAKERMODE_AUTO = -1, 546 | FMOD_DSP_TRANSCEIVER_SPEAKERMODE_MONO = 0, 547 | FMOD_DSP_TRANSCEIVER_SPEAKERMODE_STEREO, 548 | FMOD_DSP_TRANSCEIVER_SPEAKERMODE_SURROUND, 549 | } FMOD_DSP_TRANSCEIVER_SPEAKERMODE; 550 | 551 | 552 | typedef enum 553 | { 554 | FMOD_DSP_TRANSCEIVER_TRANSMIT, 555 | FMOD_DSP_TRANSCEIVER_GAIN, 556 | FMOD_DSP_TRANSCEIVER_CHANNEL, 557 | FMOD_DSP_TRANSCEIVER_TRANSMITSPEAKERMODE 558 | } FMOD_DSP_TRANSCEIVER; 559 | 560 | 561 | typedef enum 562 | { 563 | FMOD_DSP_OBJECTPAN_3D_POSITION, 564 | FMOD_DSP_OBJECTPAN_3D_ROLLOFF, 565 | FMOD_DSP_OBJECTPAN_3D_MIN_DISTANCE, 566 | FMOD_DSP_OBJECTPAN_3D_MAX_DISTANCE, 567 | FMOD_DSP_OBJECTPAN_3D_EXTENT_MODE, 568 | FMOD_DSP_OBJECTPAN_3D_SOUND_SIZE, 569 | FMOD_DSP_OBJECTPAN_3D_MIN_EXTENT, 570 | FMOD_DSP_OBJECTPAN_OVERALL_GAIN, 571 | FMOD_DSP_OBJECTPAN_OUTPUTGAIN, 572 | FMOD_DSP_OBJECTPAN_ATTENUATION_RANGE, 573 | FMOD_DSP_OBJECTPAN_OVERRIDE_RANGE 574 | } FMOD_DSP_OBJECTPAN; 575 | 576 | #endif 577 | 578 | -------------------------------------------------------------------------------- /PingPongTutorial/inc/3rd-party/fmod_errors.h: -------------------------------------------------------------------------------- 1 | /* ============================================================================================== */ 2 | /* FMOD Core / Studio API - Error string header file. */ 3 | /* Copyright (c), Firelight Technologies Pty, Ltd. 2004-2023. */ 4 | /* */ 5 | /* Use this header if you want to store or display a string version / english explanation */ 6 | /* of the FMOD error codes. */ 7 | /* */ 8 | /* For more detail visit: */ 9 | /* https://fmod.com/docs/2.02/api/core-api-common.html#fmod_result */ 10 | /* =============================================================================================== */ 11 | #ifndef _FMOD_ERRORS_H 12 | #define _FMOD_ERRORS_H 13 | 14 | #include "fmod.h" 15 | 16 | #ifdef __GNUC__ 17 | static const char *FMOD_ErrorString(FMOD_RESULT errcode) __attribute__((unused)); 18 | #endif 19 | 20 | static const char *FMOD_ErrorString(FMOD_RESULT errcode) 21 | { 22 | switch (errcode) 23 | { 24 | case FMOD_OK: return "No errors."; 25 | case FMOD_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)."; 26 | case FMOD_ERR_CHANNEL_ALLOC: return "Error trying to allocate a channel."; 27 | case FMOD_ERR_CHANNEL_STOLEN: return "The specified channel has been reused to play another sound."; 28 | case FMOD_ERR_DMA: return "DMA Failure. See debug output for more information."; 29 | case FMOD_ERR_DSP_CONNECTION: return "DSP connection error. Connection possibly caused a cyclic dependency or connected dsps with incompatible buffer counts."; 30 | case FMOD_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."; 31 | case FMOD_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."; 32 | case FMOD_ERR_DSP_INUSE: return "DSP is already in the mixer's DSP network. It must be removed before being reinserted or released."; 33 | case FMOD_ERR_DSP_NOTFOUND: return "DSP connection error. Couldn't find the DSP unit specified."; 34 | case FMOD_ERR_DSP_RESERVED: return "DSP operation error. Cannot perform operation on this DSP as it is reserved by the system."; 35 | case FMOD_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."; 36 | case FMOD_ERR_DSP_TYPE: return "DSP operation cannot be performed on a DSP of this type."; 37 | case FMOD_ERR_FILE_BAD: return "Error loading file."; 38 | case FMOD_ERR_FILE_COULDNOTSEEK: return "Couldn't perform seek operation. This is a limitation of the medium (ie netstreams) or the file format."; 39 | case FMOD_ERR_FILE_DISKEJECTED: return "Media was ejected while reading."; 40 | case FMOD_ERR_FILE_EOF: return "End of file unexpectedly reached while trying to read essential data (truncated?)."; 41 | case FMOD_ERR_FILE_ENDOFDATA: return "End of current chunk reached while trying to read data."; 42 | case FMOD_ERR_FILE_NOTFOUND: return "File not found."; 43 | case FMOD_ERR_FORMAT: return "Unsupported file or audio format."; 44 | case FMOD_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."; 45 | case FMOD_ERR_HTTP: return "A HTTP error occurred. This is a catch-all for HTTP errors not listed elsewhere."; 46 | case FMOD_ERR_HTTP_ACCESS: return "The specified resource requires authentication or is forbidden."; 47 | case FMOD_ERR_HTTP_PROXY_AUTH: return "Proxy authentication is required to access the specified resource."; 48 | case FMOD_ERR_HTTP_SERVER_ERROR: return "A HTTP server error occurred."; 49 | case FMOD_ERR_HTTP_TIMEOUT: return "The HTTP request timed out."; 50 | case FMOD_ERR_INITIALIZATION: return "FMOD was not initialized correctly to support this function."; 51 | case FMOD_ERR_INITIALIZED: return "Cannot call this command after System::init."; 52 | case FMOD_ERR_INTERNAL: return "An error occurred that wasn't supposed to. Contact support."; 53 | case FMOD_ERR_INVALID_FLOAT: return "Value passed in was a NaN, Inf or denormalized float."; 54 | case FMOD_ERR_INVALID_HANDLE: return "An invalid object handle was used."; 55 | case FMOD_ERR_INVALID_PARAM: return "An invalid parameter was passed to this function."; 56 | case FMOD_ERR_INVALID_POSITION: return "An invalid seek position was passed to this function."; 57 | case FMOD_ERR_INVALID_SPEAKER: return "An invalid speaker was passed to this function based on the current speaker mode."; 58 | case FMOD_ERR_INVALID_SYNCPOINT: return "The syncpoint did not come from this sound handle."; 59 | case FMOD_ERR_INVALID_THREAD: return "Tried to call a function on a thread that is not supported."; 60 | case FMOD_ERR_INVALID_VECTOR: return "The vectors passed in are not unit length, or perpendicular."; 61 | case FMOD_ERR_MAXAUDIBLE: return "Reached maximum audible playback count for this sound's soundgroup."; 62 | case FMOD_ERR_MEMORY: return "Not enough memory or resources."; 63 | case FMOD_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."; 64 | case FMOD_ERR_NEEDS3D: return "Tried to call a command on a 2d sound when the command was meant for 3d sound."; 65 | case FMOD_ERR_NEEDSHARDWARE: return "Tried to use a feature that requires hardware support."; 66 | case FMOD_ERR_NET_CONNECT: return "Couldn't connect to the specified host."; 67 | case FMOD_ERR_NET_SOCKET_ERROR: return "A socket error occurred. This is a catch-all for socket-related errors not listed elsewhere."; 68 | case FMOD_ERR_NET_URL: return "The specified URL couldn't be resolved."; 69 | case FMOD_ERR_NET_WOULD_BLOCK: return "Operation on a non-blocking socket could not complete immediately."; 70 | case FMOD_ERR_NOTREADY: return "Operation could not be performed because specified sound/DSP connection is not ready."; 71 | case FMOD_ERR_OUTPUT_ALLOCATED: return "Error initializing output device, but more specifically, the output device is already in use and cannot be reused."; 72 | case FMOD_ERR_OUTPUT_CREATEBUFFER: return "Error creating hardware sound buffer."; 73 | case FMOD_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."; 74 | case FMOD_ERR_OUTPUT_FORMAT: return "Soundcard does not support the specified format."; 75 | case FMOD_ERR_OUTPUT_INIT: return "Error initializing output device."; 76 | case FMOD_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."; 77 | case FMOD_ERR_PLUGIN: return "An unspecified error has been returned from a plugin."; 78 | case FMOD_ERR_PLUGIN_MISSING: return "A requested output, dsp unit type or codec was not available."; 79 | case FMOD_ERR_PLUGIN_RESOURCE: return "A resource that the plugin requires cannot be allocated or found. (ie the DLS file for MIDI playback)"; 80 | case FMOD_ERR_PLUGIN_VERSION: return "A plugin was built with an unsupported SDK version."; 81 | case FMOD_ERR_RECORD: return "An error occurred trying to initialize the recording device."; 82 | case FMOD_ERR_REVERB_CHANNELGROUP: return "Reverb properties cannot be set on this channel because a parent channelgroup owns the reverb connection."; 83 | case FMOD_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."; 84 | case FMOD_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."; 85 | case FMOD_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."; 86 | case FMOD_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."; 87 | case FMOD_ERR_TAGNOTFOUND: return "The specified tag could not be found or there are no tags."; 88 | case FMOD_ERR_TOOMANYCHANNELS: return "The sound created exceeds the allowable input channel count. This can be increased using the 'maxinputchannels' parameter in System::setSoftwareFormat."; 89 | case FMOD_ERR_TRUNCATED: return "The retrieved string is too long to fit in the supplied buffer and has been truncated."; 90 | case FMOD_ERR_UNIMPLEMENTED: return "Something in FMOD hasn't been implemented when it should be! contact support!"; 91 | case FMOD_ERR_UNINITIALIZED: return "This command failed because System::init or System::setDriver was not called."; 92 | case FMOD_ERR_UNSUPPORTED: return "A command issued was not supported by this object. Possibly a plugin without certain callbacks specified."; 93 | case FMOD_ERR_VERSION: return "The version number of this file format is not supported."; 94 | case FMOD_ERR_EVENT_ALREADY_LOADED: return "The specified bank has already been loaded."; 95 | case FMOD_ERR_EVENT_LIVEUPDATE_BUSY: return "The live update connection failed due to the game already being connected."; 96 | case FMOD_ERR_EVENT_LIVEUPDATE_MISMATCH: return "The live update connection failed due to the game data being out of sync with the tool."; 97 | case FMOD_ERR_EVENT_LIVEUPDATE_TIMEOUT: return "The live update connection timed out."; 98 | case FMOD_ERR_EVENT_NOTFOUND: return "The requested event, parameter, bus or vca could not be found."; 99 | case FMOD_ERR_STUDIO_UNINITIALIZED: return "The Studio::System object is not yet initialized."; 100 | case FMOD_ERR_STUDIO_NOT_LOADED: return "The specified resource is not loaded, so it can't be unloaded."; 101 | case FMOD_ERR_INVALID_STRING: return "An invalid string was passed to this function."; 102 | case FMOD_ERR_ALREADY_LOCKED: return "The specified resource is already locked."; 103 | case FMOD_ERR_NOT_LOCKED: return "The specified resource is not locked, so it can't be unlocked."; 104 | case FMOD_ERR_RECORD_DISCONNECTED: return "The specified recording driver has been disconnected."; 105 | case FMOD_ERR_TOOMANYSAMPLES: return "The length provided exceeds the allowable limit."; 106 | default : return "Unknown error."; 107 | }; 108 | } 109 | 110 | #endif 111 | -------------------------------------------------------------------------------- /PingPongTutorial/inc/3rd-party/fmod_output.h: -------------------------------------------------------------------------------- 1 | /* ======================================================================================== */ 2 | /* FMOD Core API - output development header file. */ 3 | /* Copyright (c), Firelight Technologies Pty, Ltd. 2004-2023. */ 4 | /* */ 5 | /* Use this header if you are wanting to develop your own output plugin to use with */ 6 | /* FMOD's output system. With this header you can make your own output plugin that FMOD */ 7 | /* can register and use. See the documentation and examples on how to make a working */ 8 | /* plugin. */ 9 | /* */ 10 | /* For more detail visit: */ 11 | /* https://fmod.com/docs/2.02/api/plugin-api-output.html */ 12 | /* ======================================================================================== */ 13 | #ifndef _FMOD_OUTPUT_H 14 | #define _FMOD_OUTPUT_H 15 | 16 | typedef struct FMOD_OUTPUT_STATE FMOD_OUTPUT_STATE; 17 | typedef struct FMOD_OUTPUT_OBJECT3DINFO FMOD_OUTPUT_OBJECT3DINFO; 18 | 19 | /* 20 | Output constants 21 | */ 22 | #define FMOD_OUTPUT_PLUGIN_VERSION 5 23 | 24 | typedef unsigned int FMOD_OUTPUT_METHOD; 25 | #define FMOD_OUTPUT_METHOD_MIX_DIRECT 0 26 | #define FMOD_OUTPUT_METHOD_MIX_BUFFERED 1 27 | 28 | /* 29 | Output callbacks 30 | */ 31 | typedef FMOD_RESULT (F_CALL *FMOD_OUTPUT_GETNUMDRIVERS_CALLBACK) (FMOD_OUTPUT_STATE *output_state, int *numdrivers); 32 | typedef FMOD_RESULT (F_CALL *FMOD_OUTPUT_GETDRIVERINFO_CALLBACK) (FMOD_OUTPUT_STATE *output_state, int id, char *name, int namelen, FMOD_GUID *guid, int *systemrate, FMOD_SPEAKERMODE *speakermode, int *speakermodechannels); 33 | typedef FMOD_RESULT (F_CALL *FMOD_OUTPUT_INIT_CALLBACK) (FMOD_OUTPUT_STATE *output_state, int selecteddriver, FMOD_INITFLAGS flags, int *outputrate, FMOD_SPEAKERMODE *speakermode, int *speakermodechannels, FMOD_SOUND_FORMAT *outputformat, int dspbufferlength, int *dspnumbuffers, int *dspnumadditionalbuffers, void *extradriverdata); 34 | typedef FMOD_RESULT (F_CALL *FMOD_OUTPUT_START_CALLBACK) (FMOD_OUTPUT_STATE *output_state); 35 | typedef FMOD_RESULT (F_CALL *FMOD_OUTPUT_STOP_CALLBACK) (FMOD_OUTPUT_STATE *output_state); 36 | typedef FMOD_RESULT (F_CALL *FMOD_OUTPUT_CLOSE_CALLBACK) (FMOD_OUTPUT_STATE *output_state); 37 | typedef FMOD_RESULT (F_CALL *FMOD_OUTPUT_UPDATE_CALLBACK) (FMOD_OUTPUT_STATE *output_state); 38 | typedef FMOD_RESULT (F_CALL *FMOD_OUTPUT_GETHANDLE_CALLBACK) (FMOD_OUTPUT_STATE *output_state, void **handle); 39 | typedef FMOD_RESULT (F_CALL *FMOD_OUTPUT_MIXER_CALLBACK) (FMOD_OUTPUT_STATE *output_state); 40 | typedef FMOD_RESULT (F_CALL *FMOD_OUTPUT_OBJECT3DGETINFO_CALLBACK) (FMOD_OUTPUT_STATE *output_state, int *maxhardwareobjects); 41 | typedef FMOD_RESULT (F_CALL *FMOD_OUTPUT_OBJECT3DALLOC_CALLBACK) (FMOD_OUTPUT_STATE *output_state, void **object3d); 42 | typedef FMOD_RESULT (F_CALL *FMOD_OUTPUT_OBJECT3DFREE_CALLBACK) (FMOD_OUTPUT_STATE *output_state, void *object3d); 43 | typedef FMOD_RESULT (F_CALL *FMOD_OUTPUT_OBJECT3DUPDATE_CALLBACK) (FMOD_OUTPUT_STATE *output_state, void *object3d, const FMOD_OUTPUT_OBJECT3DINFO *info); 44 | typedef FMOD_RESULT (F_CALL *FMOD_OUTPUT_OPENPORT_CALLBACK) (FMOD_OUTPUT_STATE *output_state, FMOD_PORT_TYPE portType, FMOD_PORT_INDEX portIndex, int *portId, int *portRate, int *portChannels, FMOD_SOUND_FORMAT *portFormat); 45 | typedef FMOD_RESULT (F_CALL *FMOD_OUTPUT_CLOSEPORT_CALLBACK) (FMOD_OUTPUT_STATE *output_state, int portId); 46 | typedef FMOD_RESULT (F_CALL *FMOD_OUTPUT_DEVICELISTCHANGED_CALLBACK)(FMOD_OUTPUT_STATE *output_state); 47 | 48 | /* 49 | Output functions 50 | */ 51 | typedef FMOD_RESULT (F_CALL *FMOD_OUTPUT_READFROMMIXER_FUNC) (FMOD_OUTPUT_STATE *output_state, void *buffer, unsigned int length); 52 | typedef FMOD_RESULT (F_CALL *FMOD_OUTPUT_COPYPORT_FUNC) (FMOD_OUTPUT_STATE *output_state, int portId, void *buffer, unsigned int length); 53 | typedef FMOD_RESULT (F_CALL *FMOD_OUTPUT_REQUESTRESET_FUNC) (FMOD_OUTPUT_STATE *output_state); 54 | typedef void * (F_CALL *FMOD_OUTPUT_ALLOC_FUNC) (unsigned int size, unsigned int align, const char *file, int line); 55 | typedef void (F_CALL *FMOD_OUTPUT_FREE_FUNC) (void *ptr, const char *file, int line); 56 | typedef void (F_CALL *FMOD_OUTPUT_LOG_FUNC) (FMOD_DEBUG_FLAGS level, const char *file, int line, const char *function, const char *string, ...); 57 | 58 | /* 59 | Output structures 60 | */ 61 | typedef struct FMOD_OUTPUT_DESCRIPTION 62 | { 63 | unsigned int apiversion; 64 | const char *name; 65 | unsigned int version; 66 | FMOD_OUTPUT_METHOD method; 67 | FMOD_OUTPUT_GETNUMDRIVERS_CALLBACK getnumdrivers; 68 | FMOD_OUTPUT_GETDRIVERINFO_CALLBACK getdriverinfo; 69 | FMOD_OUTPUT_INIT_CALLBACK init; 70 | FMOD_OUTPUT_START_CALLBACK start; 71 | FMOD_OUTPUT_STOP_CALLBACK stop; 72 | FMOD_OUTPUT_CLOSE_CALLBACK close; 73 | FMOD_OUTPUT_UPDATE_CALLBACK update; 74 | FMOD_OUTPUT_GETHANDLE_CALLBACK gethandle; 75 | FMOD_OUTPUT_MIXER_CALLBACK mixer; 76 | FMOD_OUTPUT_OBJECT3DGETINFO_CALLBACK object3dgetinfo; 77 | FMOD_OUTPUT_OBJECT3DALLOC_CALLBACK object3dalloc; 78 | FMOD_OUTPUT_OBJECT3DFREE_CALLBACK object3dfree; 79 | FMOD_OUTPUT_OBJECT3DUPDATE_CALLBACK object3dupdate; 80 | FMOD_OUTPUT_OPENPORT_CALLBACK openport; 81 | FMOD_OUTPUT_CLOSEPORT_CALLBACK closeport; 82 | FMOD_OUTPUT_DEVICELISTCHANGED_CALLBACK devicelistchanged; 83 | } FMOD_OUTPUT_DESCRIPTION; 84 | 85 | struct FMOD_OUTPUT_STATE 86 | { 87 | void *plugindata; 88 | FMOD_OUTPUT_READFROMMIXER_FUNC readfrommixer; 89 | FMOD_OUTPUT_ALLOC_FUNC alloc; 90 | FMOD_OUTPUT_FREE_FUNC free; 91 | FMOD_OUTPUT_LOG_FUNC log; 92 | FMOD_OUTPUT_COPYPORT_FUNC copyport; 93 | FMOD_OUTPUT_REQUESTRESET_FUNC requestreset; 94 | }; 95 | 96 | struct FMOD_OUTPUT_OBJECT3DINFO 97 | { 98 | float *buffer; 99 | unsigned int bufferlength; 100 | FMOD_VECTOR position; 101 | float gain; 102 | float spread; 103 | float priority; 104 | }; 105 | 106 | /* 107 | Output macros 108 | */ 109 | #define FMOD_OUTPUT_READFROMMIXER(_state, _buffer, _length) \ 110 | (_state)->readfrommixer(_state, _buffer, _length) 111 | #define FMOD_OUTPUT_ALLOC(_state, _size, _align) \ 112 | (_state)->alloc(_size, _align, __FILE__, __LINE__) 113 | #define FMOD_OUTPUT_FREE(_state, _ptr) \ 114 | (_state)->free(_ptr, __FILE__, __LINE__) 115 | #define FMOD_OUTPUT_LOG(_state, _level, _location, _format, ...) \ 116 | (_state)->log(_level, __FILE__, __LINE__, _location, _format, ##__VA_ARGS__) 117 | #define FMOD_OUTPUT_COPYPORT(_state, _id, _buffer, _length) \ 118 | (_state)->copyport(_state, _id, _buffer, _length) 119 | #define FMOD_OUTPUT_REQUESTRESET(_state) \ 120 | (_state)->requestreset(_state) 121 | 122 | #endif /* _FMOD_OUTPUT_H */ 123 | -------------------------------------------------------------------------------- /PingPongTutorial/inc/Defines.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018 - 2023 Tony's Studio. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | #pragma once 5 | 6 | #ifndef _DEFINES_H_ 7 | #define _DEFINES_H_ 8 | 9 | #include 10 | 11 | struct Vector 12 | { 13 | double x; 14 | double y; 15 | 16 | Vector() : x(0.0), y(0.0) 17 | { 18 | } 19 | 20 | Vector(double _x, double _y) : x(_x), y(_y) 21 | { 22 | } 23 | 24 | bool operator==(const Vector& obj) const 25 | { 26 | return x == obj.x && y == obj.y; 27 | } 28 | 29 | bool operator!=(const Vector& obj) const 30 | { 31 | return !(*this == obj); 32 | } 33 | 34 | Vector operator+(const Vector& obj) const 35 | { 36 | return {x + obj.x, y + obj.y}; 37 | } 38 | 39 | Vector operator-(const Vector& obj) const 40 | { 41 | return {x + obj.x, y + obj.y}; 42 | } 43 | 44 | Vector operator-() const 45 | { 46 | return {-x, -y}; 47 | } 48 | 49 | friend Vector operator*(const Vector& lhs, double rhs) 50 | { 51 | return {lhs.x * rhs, lhs.y * rhs}; 52 | } 53 | 54 | friend Vector operator*(double lhs, const Vector& rhs) 55 | { 56 | return rhs * lhs; 57 | } 58 | 59 | friend Vector operator/(const Vector& lhs, double rhs) 60 | { 61 | return {lhs.x / rhs, lhs.y / rhs}; 62 | } 63 | 64 | friend Vector operator/(double lhs, const Vector& rhs) 65 | { 66 | return rhs / lhs; 67 | } 68 | }; 69 | 70 | using Coordinate = Vector; 71 | 72 | 73 | struct Rect 74 | { 75 | union 76 | { 77 | Coordinate pos; 78 | 79 | struct 80 | { 81 | double x; 82 | double y; 83 | }; 84 | }; 85 | 86 | double width; 87 | double height; 88 | 89 | Rect() : x(0.0), y(0.0), width(0.0), height(0.0) 90 | { 91 | } 92 | 93 | Rect(double _x, double _y, double _width, double _height) 94 | : x(_x), y(_y), width(_width), height(_height) 95 | { 96 | } 97 | 98 | Coordinate GetCenter() const 99 | { 100 | return {x + width * 0.5, y + height * 0.5}; 101 | } 102 | 103 | Coordinate Intersect(const Rect& rect) const 104 | { 105 | Coordinate overlap; 106 | if (this->x < rect.x) 107 | { 108 | overlap.x = this->x + this->width - rect.x; 109 | } 110 | else 111 | { 112 | overlap.x = rect.x + rect.width - this->x; 113 | } 114 | if (this->y < rect.y) 115 | { 116 | overlap.y = this->y + this->height - rect.y; 117 | } 118 | else 119 | { 120 | overlap.y = rect.y + rect.height - this->y; 121 | } 122 | return overlap; 123 | } 124 | 125 | bool Contains(const Coordinate& coord) const 126 | { 127 | return ((x < coord.x && coord.x < x + width) && (y < coord.y && coord.y < y + height)); 128 | } 129 | 130 | RECT ToEasyXRect() const 131 | { 132 | return { 133 | static_cast(x), static_cast(y), static_cast(x + width), static_cast(y + height) 134 | }; 135 | } 136 | }; 137 | 138 | #endif 139 | -------------------------------------------------------------------------------- /PingPongTutorial/inc/Globals.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018 - 2023 Tony's Studio. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | #pragma once 5 | 6 | #ifndef _GLOBALS_H_ 7 | #define _GLOBALS_H_ 8 | 9 | #include 10 | #include "Sound.h" 11 | 12 | class Application; 13 | Application* GetApplication(); 14 | 15 | extern bool isRunning; 16 | 17 | const int SINGLE_PLAYER = 0; 18 | const int DOUBLE_PLAYER = 1; 19 | 20 | extern int gameMode; 21 | 22 | // image resource 23 | extern IMAGE batImage; 24 | extern IMAGE ballImage; 25 | 26 | // sound resource 27 | extern FmodSound bounceSound; 28 | extern FmodSound scoreSound; 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /PingPongTutorial/inc/Message.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018 - 2023 Tony's Studio. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | #pragma once 5 | 6 | #ifndef _MESSAGE_H_ 7 | #define _MESSAGE_H_ 8 | 9 | #include "Defines.h" 10 | 11 | struct MouseMessage 12 | { 13 | union 14 | { 15 | Coordinate pos; 16 | 17 | struct 18 | { 19 | double x; 20 | double y; 21 | }; 22 | }; 23 | 24 | bool isDown; 25 | bool isUp; 26 | 27 | MouseMessage() 28 | { 29 | } 30 | }; 31 | 32 | void PeekMouseMessage(); 33 | 34 | bool IsKeyDown(int key); 35 | MouseMessage* GetMouseMessage(); 36 | 37 | // extended virtual key scan code 38 | #define VK_A 0x41 39 | #define VK_B 0x42 40 | #define VK_C 0x43 41 | #define VK_D 0x44 42 | #define VK_E 0x45 43 | #define VK_F 0x46 44 | #define VK_G 0x47 45 | #define VK_H 0x48 46 | #define VK_I 0x49 47 | #define VK_J 0x4A 48 | #define VK_K 0x4B 49 | #define VK_L 0x4C 50 | #define VK_M 0x4D 51 | #define VK_N 0x4E 52 | #define VK_O 0x4F 53 | #define VK_P 0x50 54 | #define VK_Q 0x51 55 | #define VK_R 0x52 56 | #define VK_S 0x53 57 | #define VK_T 0x54 58 | #define VK_U 0x55 59 | #define VK_V 0x56 60 | #define VK_W 0x57 61 | #define VK_X 0x58 62 | #define VK_Y 0x59 63 | #define VK_Z 0x5A 64 | 65 | #endif 66 | -------------------------------------------------------------------------------- /PingPongTutorial/inc/Sound.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018 - 2023 Tony's Studio. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | #pragma once 5 | 6 | #ifndef _SOUND_H_ 7 | #define _SOUND_H_ 8 | 9 | #include "3rd-party/fmod.hpp" 10 | 11 | struct FmodSound 12 | { 13 | FMOD::Sound* snd; 14 | FMOD::Channel* chl; 15 | 16 | FmodSound() : snd(nullptr), chl(nullptr) 17 | { 18 | } 19 | 20 | ~FmodSound() 21 | { 22 | if (snd) 23 | { 24 | snd->release(); 25 | } 26 | } 27 | }; 28 | 29 | void InitFmodSystem(); 30 | void UpdateFmodSystem(); 31 | void CloseFmodSystem(); 32 | 33 | void LoadFmodSound(FmodSound* pSound, const char* filename); 34 | void PlayFmodSound(FmodSound* pSound, bool share = false); 35 | 36 | #pragma comment(lib, "lib/fmod_vc.lib") 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /PingPongTutorial/inc/game/Ball.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018 - 2023 Tony's Studio. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | #pragma once 5 | 6 | #ifndef _BALL_H_ 7 | #define _BALL_H_ 8 | 9 | #include "../Defines.h" 10 | #include "GameObject.h" 11 | 12 | class Ball : public GameObject 13 | { 14 | protected: 15 | double _speed; 16 | Vector _velocity; 17 | 18 | public: 19 | Ball(double speed); 20 | 21 | // direction should be 1 or -1 22 | void Serve(double direction); 23 | void Stop(); 24 | void Move(); 25 | 26 | void Bounce(const Rect& rect); 27 | void Attach(const Rect& rect, bool isLeft); 28 | 29 | void Draw() override; 30 | }; 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /PingPongTutorial/inc/game/Bat.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018 - 2023 Tony's Studio. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | #pragma once 5 | 6 | #ifndef _BAT_H_ 7 | #define _BAT_H_ 8 | 9 | #include "GameObject.h" 10 | 11 | class Bat : public GameObject 12 | { 13 | protected: 14 | double _minY; 15 | double _maxY; 16 | 17 | public: 18 | Bat(double minY, double maxY); 19 | 20 | void MoveUp(double deltaY); 21 | void MoveDown(double deltaY); 22 | 23 | void Draw() override; 24 | }; 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /PingPongTutorial/inc/game/BatController.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018 - 2023 Tony's Studio. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | #pragma once 5 | 6 | #ifndef _BAT_CONTROLLER_H_ 7 | #define _BAT_CONTROLLER_H_ 8 | 9 | #include 10 | 11 | class Bat; 12 | 13 | class BatController 14 | { 15 | private: 16 | std::wstring _name; 17 | 18 | protected: 19 | Bat* _bat; 20 | double _speed; 21 | 22 | public: 23 | BatController(const std::wstring& name, Bat* bat, double speed) 24 | : _name(name), _bat(bat), _speed(speed) 25 | { 26 | } 27 | 28 | virtual ~BatController() 29 | { 30 | } 31 | 32 | const std::wstring& Name() const { return _name; } 33 | virtual const wchar_t* GetTips() const { return L"None"; } 34 | 35 | virtual void Update() = 0; 36 | }; 37 | 38 | 39 | class PlayerBatController final : public BatController 40 | { 41 | private: 42 | int _downKey; 43 | int _upKey; 44 | 45 | public: 46 | PlayerBatController(const std::wstring& name, Bat* bat, double speed, int downKey, int upKey); 47 | 48 | void Update() override; 49 | const wchar_t* GetTips() const override; 50 | }; 51 | 52 | 53 | class Ball; 54 | 55 | class AiBatController final : public BatController 56 | { 57 | private: 58 | Ball* _ball; 59 | 60 | public: 61 | AiBatController(const std::wstring& name, Bat* bat, double speed, Ball* ball); 62 | 63 | void Update() override; 64 | const wchar_t* GetTips() const override; 65 | }; 66 | 67 | #endif 68 | -------------------------------------------------------------------------------- /PingPongTutorial/inc/game/GameObject.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018 - 2023 Tony's Studio. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | #pragma once 5 | 6 | #ifndef _GAME_OBJECT_H_ 7 | #define _GAME_OBJECT_H_ 8 | 9 | #include "../Defines.h" 10 | 11 | class GameObject 12 | { 13 | protected: 14 | Coordinate _pos; 15 | double _width; 16 | double _height; 17 | 18 | public: 19 | GameObject(double width = 0.0, double height = 0.0); 20 | virtual ~GameObject() = default; 21 | 22 | GameObject* SetCoordinate(const Coordinate& coord); 23 | GameObject* SetX(double x); 24 | GameObject* SetY(double y); 25 | GameObject* SetWidth(double width); 26 | GameObject* SetHeight(double height); 27 | 28 | Coordinate GetCoordinate() const; 29 | double GetX() const; 30 | double GetY() const; 31 | double GetWidth() const; 32 | double GetHeight() const; 33 | 34 | Rect GetBorder() const; 35 | virtual void Draw() = 0; 36 | }; 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /PingPongTutorial/inc/ui/Application.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018 - 2023 Tony's Studio. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | #pragma once 5 | 6 | #ifndef _APPLICATION_H_ 7 | #define _APPLICATION_H_ 8 | #include 9 | #include 10 | 11 | class Interface; 12 | 13 | class Application final 14 | { 15 | private: 16 | std::unordered_map _interfaces; 17 | Interface* _currentInterface; 18 | Interface* _nextInterface; 19 | 20 | public: 21 | Application(); 22 | ~Application(); 23 | 24 | Application* RegisterInterface(Interface* intf); 25 | 26 | // Set to target interface immediately 27 | void SetInterface(const std::wstring& name); 28 | 29 | // Set to target interface after current update 30 | void ChangeInterface(const std::wstring& name); 31 | 32 | void Update(); 33 | void Draw(); 34 | }; 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /PingPongTutorial/inc/ui/Button.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018 - 2023 Tony's Studio. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | #pragma once 5 | 6 | #ifndef _BUTTON_H_ 7 | #define _BUTTON_H_ 8 | 9 | #include 10 | #include 11 | #include "../Defines.h" 12 | 13 | enum ButtonState 14 | { 15 | BUTTON_UP = 0, 16 | BUTTON_HOVER, 17 | BUTTON_DOWN, 18 | BUTTON_STATE_NUM 19 | }; 20 | 21 | class Button 22 | { 23 | private: 24 | Rect _range; 25 | 26 | ButtonState _state; 27 | COLORREF _color[BUTTON_STATE_NUM]; 28 | 29 | std::wstring _text; 30 | 31 | void (*_onClick)(void); 32 | 33 | public: 34 | Button(const Rect& range, const std::wstring& text); 35 | virtual ~Button() = default; 36 | 37 | Button* SetUpStyle(COLORREF color); 38 | Button* SetHoverStyle(COLORREF color); 39 | Button* SetDownStyle(COLORREF color); 40 | Button* SetText(const std::wstring& text); 41 | Button* SetOnClick(void (*onClick)(void)); 42 | 43 | virtual void Update(); 44 | virtual void Draw(); 45 | }; 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /PingPongTutorial/inc/ui/Interface.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018 - 2023 Tony's Studio. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | #pragma once 5 | 6 | #ifndef _INTERFACE_H_ 7 | #define _INTERFACE_H_ 8 | 9 | #include 10 | #include 11 | #include "Button.h" 12 | 13 | class Interface 14 | { 15 | private: 16 | std::wstring _name; 17 | 18 | public: 19 | Interface(const std::wstring& name) : _name(name) 20 | { 21 | } 22 | 23 | virtual ~Interface() 24 | { 25 | } 26 | 27 | const std::wstring& Name() const { return _name; } 28 | 29 | virtual void OnEnter() 30 | { 31 | } 32 | 33 | virtual void OnExit() 34 | { 35 | } 36 | 37 | virtual void Update() 38 | { 39 | } 40 | 41 | virtual void Draw() 42 | { 43 | } 44 | }; 45 | 46 | 47 | class MainInterface : public Interface 48 | { 49 | private: 50 | Button* _pOnePlayerButton; 51 | Button* _pTwoPlayerButton; 52 | Button* _pExitButton; 53 | 54 | public: 55 | MainInterface(); 56 | ~MainInterface() override; 57 | 58 | void Update() override; 59 | void Draw() override; 60 | 61 | private: 62 | static void _OnClickOnePlayerButton(); 63 | static void _OnClickTwoPlayerButton(); 64 | static void _OnClickExitButton(); 65 | }; 66 | 67 | 68 | class Bat; 69 | class BatController; 70 | class Ball; 71 | 72 | class GameInterface : public Interface 73 | { 74 | private: 75 | std::shared_ptr _bats[2]; 76 | std::shared_ptr _controllers[2]; 77 | std::shared_ptr _ball; 78 | 79 | int _scores[2]; 80 | 81 | int _turn; 82 | bool _started; 83 | 84 | public: 85 | GameInterface(); 86 | ~GameInterface() override; 87 | 88 | void OnEnter() override; 89 | void OnExit() override; 90 | void Update() override; 91 | void Draw() override; 92 | }; 93 | 94 | #endif 95 | -------------------------------------------------------------------------------- /PingPongTutorial/inc/utils/Image.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018 - 2023 Tony's Studio. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | #pragma once 5 | 6 | #ifndef _IMAGE_H_ 7 | #define _IMAGE_H_ 8 | 9 | #include 10 | 11 | void LoadImageResource(IMAGE* pDstImage, const wchar_t* filename); 12 | void LoadImageResource(IMAGE* pDstImage, const wchar_t* filename, int srcX, int srcY, int srcWidth, int srcHeight); 13 | 14 | void PutAlphaImage(int x, int y, IMAGE* pSrcImage); 15 | void PutAlphaImage(IMAGE* pDstImage, int x, int y, IMAGE* pSrcImage); 16 | 17 | // Parse R, G, B in a color. 18 | #define PA(color) (((color) & 0xFF000000) >> 24) 19 | #define PB(color) (((color) & 0x00FF0000) >> 16) 20 | #define PG(color) (((color) & 0x0000FF00) >> 8) 21 | #define PR(color) (((color) & 0x000000FF)) 22 | 23 | /******************************************************************** 24 | ** Get the "alpha-ed" color. 25 | ** s: Color of the source image. 26 | ** d: Color of the destination image. 27 | ** a: Alpha value. 28 | */ 29 | #define ARGB(s, d, a) RGB((PR(s) * a + PR(d) * (255 - a)) >> 8, (PG(s) * a + PG(d) * (255 - a)) >> 8, (PB(s) * a + PB(d) * (255 - a)) >> 8) 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /PingPongTutorial/inc/utils/Random.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018 - 2023 Tony's Studio. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | #pragma once 5 | 6 | #ifndef _RANDOM_H_ 7 | #define _RANDOM_H_ 8 | 9 | void SetRandomSeed(); 10 | 11 | // get random number in [0.0, 1.0] 12 | double Random(); 13 | double Random(double upper); 14 | double Random(double lower, double upper); 15 | 16 | int Random(int upper); 17 | int Random(int lower, int upper); 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /PingPongTutorial/lib/fmod.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lord-Turmoil/PingPongTutorial/d5d842c2a47e72ea22d847c3340eca22bfd12c45/PingPongTutorial/lib/fmod.dll -------------------------------------------------------------------------------- /PingPongTutorial/lib/fmod_vc.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lord-Turmoil/PingPongTutorial/d5d842c2a47e72ea22d847c3340eca22bfd12c45/PingPongTutorial/lib/fmod_vc.lib -------------------------------------------------------------------------------- /PingPongTutorial/res/Image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lord-Turmoil/PingPongTutorial/d5d842c2a47e72ea22d847c3340eca22bfd12c45/PingPongTutorial/res/Image.png -------------------------------------------------------------------------------- /PingPongTutorial/res/bounce.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lord-Turmoil/PingPongTutorial/d5d842c2a47e72ea22d847c3340eca22bfd12c45/PingPongTutorial/res/bounce.wav -------------------------------------------------------------------------------- /PingPongTutorial/res/score.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lord-Turmoil/PingPongTutorial/d5d842c2a47e72ea22d847c3340eca22bfd12c45/PingPongTutorial/res/score.wav -------------------------------------------------------------------------------- /PingPongTutorial/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by PingPongTutorial.rc 4 | // 5 | #define IDI_ICON1 101 6 | 7 | // Next default values for new objects 8 | // 9 | #ifdef APSTUDIO_INVOKED 10 | #ifndef APSTUDIO_READONLY_SYMBOLS 11 | #define _APS_NEXT_RESOURCE_VALUE 102 12 | #define _APS_NEXT_COMMAND_VALUE 40001 13 | #define _APS_NEXT_CONTROL_VALUE 1001 14 | #define _APS_NEXT_SYMED_VALUE 101 15 | #endif 16 | #endif 17 | -------------------------------------------------------------------------------- /PingPongTutorial/src/Globals.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018 - 2023 Tony's Studio. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | #include "../inc/Globals.h" 5 | 6 | #include "../inc/ui/Application.h" 7 | 8 | static Application application; 9 | 10 | Application* GetApplication() 11 | { 12 | return &application; 13 | } 14 | 15 | bool isRunning = true; 16 | 17 | int gameMode = 0; 18 | 19 | // image resource 20 | IMAGE batImage; 21 | IMAGE ballImage; 22 | 23 | // sound resource 24 | FmodSound bounceSound; 25 | FmodSound scoreSound; 26 | -------------------------------------------------------------------------------- /PingPongTutorial/src/Main.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018 - 2023 Tony's Studio. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | #include 5 | #include 6 | #include "../inc/Message.h" 7 | #include "../inc/Globals.h" 8 | #include "../inc/ui/Application.h" 9 | #include "../inc/ui/Interface.h" 10 | #include "../inc/utils/Image.h" 11 | #include "../inc/Sound.h" 12 | #include "../inc/utils/Random.h" 13 | 14 | void Init(); 15 | void ClearUp(); 16 | 17 | int APIENTRY WinMain( 18 | _In_ HINSTANCE hInstance, 19 | _In_opt_ HINSTANCE hPrevInstance, 20 | _In_ LPSTR lpCmdLine, 21 | _In_ int nShowCmd) 22 | { 23 | // initialization 24 | Init(); 25 | 26 | Application* app = GetApplication(); 27 | while (isRunning) 28 | { 29 | cleardevice(); 30 | 31 | // process input 32 | PeekMouseMessage(); 33 | 34 | // update game 35 | app->Update(); 36 | UpdateFmodSystem(); 37 | 38 | // draw 39 | app->Draw(); 40 | FlushBatchDraw(); 41 | 42 | Sleep(15); 43 | } 44 | 45 | ClearUp(); 46 | 47 | return 0; 48 | } 49 | 50 | void Init() 51 | { 52 | SetRandomSeed(); 53 | 54 | // init graph 55 | initgraph(1000, 560); 56 | setbkcolor(WHITE); 57 | settextcolor(BLACK); 58 | 59 | // init sound 60 | InitFmodSystem(); 61 | 62 | // load image resource 63 | LoadImageResource(&batImage, L"res/Image.png", 0, 0, 20, 100); 64 | LoadImageResource(&ballImage, L"res/Image.png", 20, 0, 10, 10); 65 | 66 | // load sound resource 67 | LoadFmodSound(&bounceSound, "res/bounce.wav"); 68 | LoadFmodSound(&scoreSound, "res/score.wav"); 69 | 70 | // init application 71 | Application* app = GetApplication(); 72 | app->RegisterInterface(new MainInterface()) 73 | ->RegisterInterface(new GameInterface()); 74 | 75 | BeginBatchDraw(); 76 | } 77 | 78 | void ClearUp() 79 | { 80 | CloseFmodSystem(); 81 | 82 | EndBatchDraw(); 83 | closegraph(); 84 | } 85 | -------------------------------------------------------------------------------- /PingPongTutorial/src/Message.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018 - 2023 Tony's Studio. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | #include 5 | #include "../inc/Message.h" 6 | 7 | static MouseMessage mouse; 8 | 9 | void PeekMouseMessage() 10 | { 11 | ExMessage msg; 12 | 13 | mouse.isUp = false; 14 | mouse.isDown = false; 15 | while (peekmessage(&msg, EX_MOUSE)) 16 | { 17 | if (msg.message == WM_MOUSEMOVE) 18 | { 19 | mouse.x = msg.x; 20 | mouse.y = msg.y; 21 | } 22 | else if (msg.message == WM_LBUTTONUP) 23 | { 24 | mouse.isUp = true; 25 | mouse.isDown = false; 26 | } 27 | else if (msg.message == WM_LBUTTONDOWN) 28 | { 29 | mouse.isUp = false; 30 | mouse.isDown = true; 31 | } 32 | } 33 | } 34 | 35 | bool IsKeyDown(int key) 36 | { 37 | return (GetAsyncKeyState(key) & 0x8000); 38 | } 39 | 40 | MouseMessage* GetMouseMessage() 41 | { 42 | return &mouse; 43 | } 44 | -------------------------------------------------------------------------------- /PingPongTutorial/src/Sound.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018 - 2023 Tony's Studio. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | #include "../inc/Sound.h" 5 | 6 | static FMOD::System* system = nullptr; 7 | static FMOD::Channel* sharedChannel = nullptr; 8 | 9 | void InitFmodSystem() 10 | { 11 | System_Create(&system); 12 | system->init(32l, FMOD_INIT_NORMAL, nullptr); 13 | } 14 | 15 | void UpdateFmodSystem() 16 | { 17 | if (system) 18 | { 19 | system->update(); 20 | } 21 | } 22 | 23 | void CloseFmodSystem() 24 | { 25 | if (system) 26 | { 27 | system->close(); 28 | system->release(); 29 | } 30 | } 31 | 32 | void LoadFmodSound(FmodSound* pSound, const char* filename) 33 | { 34 | system->createSound(filename, FMOD_DEFAULT, nullptr, &(pSound->snd)); 35 | } 36 | 37 | void PlayFmodSound(FmodSound* pSound, bool share) 38 | { 39 | if (share) 40 | { 41 | system->playSound(pSound->snd, nullptr, false, &sharedChannel); 42 | } 43 | else 44 | { 45 | bool isPlaying = false; 46 | if (pSound->chl) 47 | { 48 | pSound->chl->isPlaying(&isPlaying); 49 | } 50 | if (!isPlaying) 51 | { 52 | system->playSound(pSound->snd, nullptr, false, &(pSound->chl)); 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /PingPongTutorial/src/game/AiBatController.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018 - 2023 Tony's Studio. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | #include "../../inc/game/BatController.h" 5 | #include "../../inc/game/Ball.h" 6 | #include "../../inc/game/Bat.h" 7 | 8 | AiBatController::AiBatController(const std::wstring& name, Bat* bat, double speed, Ball* ball) 9 | : BatController(name, bat, speed), _ball(ball) 10 | { 11 | } 12 | 13 | void AiBatController::Update() 14 | { 15 | if (!_bat || !_ball) 16 | { 17 | return; 18 | } 19 | 20 | Coordinate batCenter = _bat->GetBorder().GetCenter(); 21 | Coordinate ballCenter = _ball->GetBorder().GetCenter(); 22 | 23 | double delta = ballCenter.y - batCenter.y; 24 | if (delta > 5.0) 25 | { 26 | _bat->MoveDown(_speed); 27 | } 28 | else if (delta < -5.0) 29 | { 30 | _bat->MoveUp(_speed); 31 | } 32 | } 33 | 34 | const wchar_t* AiBatController::GetTips() const 35 | { 36 | return L"Ai Player"; 37 | } 38 | -------------------------------------------------------------------------------- /PingPongTutorial/src/game/Ball.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018 - 2023 Tony's Studio. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | #include "../../inc/game/Ball.h" 5 | #include "../../inc/utils/Random.h" 6 | #include "../../inc/Globals.h" 7 | #include "../../inc/utils/Image.h" 8 | #include 9 | 10 | Ball::Ball(double speed) : _speed(speed) 11 | { 12 | _width = 10; 13 | _height = 10; 14 | } 15 | 16 | void Ball::Serve(double direction) 17 | { 18 | const double PI = 3.1415926; 19 | double radian = Random(-60, 60) * PI / 180.0; 20 | direction = direction / std::abs(direction); 21 | 22 | _velocity.x = _speed * std::cos(radian) * direction; 23 | _velocity.y = _speed * std::sin(radian); 24 | } 25 | 26 | void Ball::Stop() 27 | { 28 | _velocity.x = _velocity.y = 0.0; 29 | } 30 | 31 | void Ball::Move() 32 | { 33 | _pos.x += _velocity.x; 34 | _pos.y += _velocity.y; 35 | } 36 | 37 | void Ball::Bounce(const Rect& rect) 38 | { 39 | Rect box = GetBorder(); 40 | Coordinate overlap = box.Intersect(rect); 41 | if (overlap.x < 0.0 || overlap.y < 0.0) 42 | { 43 | return; 44 | } 45 | 46 | Coordinate ballCenter = box.GetCenter(); 47 | Coordinate rectCenter = rect.GetCenter(); 48 | if (overlap.x > overlap.y) 49 | { 50 | // bounce on y 51 | if (ballCenter.y < rectCenter.y) 52 | { 53 | // hit on top 54 | overlap.y = -overlap.y; 55 | } 56 | _velocity.y = -_velocity.y; 57 | overlap.x = 0.0; 58 | } 59 | else 60 | { 61 | // bounce on x 62 | if (ballCenter.x < rectCenter.x) 63 | { 64 | overlap.x = -overlap.x; 65 | } 66 | _velocity.x = -_velocity.x; 67 | overlap.y = 0.0; 68 | } 69 | 70 | _pos = _pos + overlap; 71 | 72 | PlayFmodSound(&bounceSound, true); 73 | } 74 | 75 | void Ball::Attach(const Rect& rect, bool isLeft) 76 | { 77 | Coordinate center = rect.GetCenter(); 78 | _pos = center; 79 | _pos.y -= _height * 0.5; 80 | if (isLeft) 81 | { 82 | _pos.x -= rect.width * 0.5 + _width; 83 | } 84 | else 85 | { 86 | _pos.x += rect.width * 0.5; 87 | } 88 | Stop(); 89 | } 90 | 91 | void Ball::Draw() 92 | { 93 | PutAlphaImage(static_cast(_pos.x), static_cast(_pos.y), &ballImage); 94 | } 95 | -------------------------------------------------------------------------------- /PingPongTutorial/src/game/Bat.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018 - 2023 Tony's Studio. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | #include "../../inc/game/Bat.h" 5 | #include "../../inc/Globals.h" 6 | #include "../../inc/utils/Image.h" 7 | 8 | Bat::Bat(double minY, double maxY) 9 | : _minY(minY), _maxY(maxY) 10 | { 11 | _width = 20; 12 | _height = 100; 13 | } 14 | 15 | void Bat::MoveUp(double deltaY) 16 | { 17 | if (deltaY > 0.0) 18 | { 19 | _pos.y -= deltaY; 20 | if (_pos.y < _minY) 21 | { 22 | _pos.y = _minY; 23 | } 24 | } 25 | } 26 | 27 | void Bat::MoveDown(double deltaY) 28 | { 29 | if (deltaY > 0.0) 30 | { 31 | _pos.y += deltaY; 32 | if (_pos.y > _maxY) 33 | { 34 | _pos.y = _maxY; 35 | } 36 | } 37 | } 38 | 39 | void Bat::Draw() 40 | { 41 | PutAlphaImage(static_cast(_pos.x), static_cast(_pos.y), &batImage); 42 | } 43 | -------------------------------------------------------------------------------- /PingPongTutorial/src/game/GameObject.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018 - 2023 Tony's Studio. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | #include "../../inc/game/GameObject.h" 5 | 6 | GameObject::GameObject(double width, double height) 7 | : _width(width), _height(height) 8 | { 9 | } 10 | 11 | GameObject* GameObject::SetCoordinate(const Coordinate& coord) 12 | { 13 | _pos = coord; 14 | return this; 15 | } 16 | 17 | GameObject* GameObject::SetX(double x) 18 | { 19 | _pos.x = x; 20 | return this; 21 | } 22 | 23 | GameObject* GameObject::SetY(double y) 24 | { 25 | _pos.y = y; 26 | return this; 27 | } 28 | 29 | GameObject* GameObject::SetWidth(double width) 30 | { 31 | _width = width; 32 | return this; 33 | } 34 | 35 | GameObject* GameObject::SetHeight(double height) 36 | { 37 | _height = height; 38 | return this; 39 | } 40 | 41 | Coordinate GameObject::GetCoordinate() const 42 | { 43 | return _pos; 44 | } 45 | 46 | double GameObject::GetX() const 47 | { 48 | return _pos.x; 49 | } 50 | 51 | double GameObject::GetY() const 52 | { 53 | return _pos.y; 54 | } 55 | 56 | double GameObject::GetWidth() const 57 | { 58 | return _width; 59 | } 60 | 61 | double GameObject::GetHeight() const 62 | { 63 | return _height; 64 | } 65 | 66 | Rect GameObject::GetBorder() const 67 | { 68 | return {_pos.x, _pos.y, _width, _height}; 69 | } 70 | -------------------------------------------------------------------------------- /PingPongTutorial/src/game/PlayerBatController.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018 - 2023 Tony's Studio. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | #include "../../inc/game/BatController.h" 5 | #include "../../inc/Message.h" 6 | #include "../../inc/game/Bat.h" 7 | 8 | PlayerBatController::PlayerBatController(const std::wstring& name, Bat* bat, double speed, int downKey, int upKey) 9 | : BatController(name, bat, speed), _downKey(downKey), _upKey(upKey) 10 | { 11 | } 12 | 13 | void PlayerBatController::Update() 14 | { 15 | if (!_bat) 16 | { 17 | return; 18 | } 19 | 20 | if (IsKeyDown(_downKey)) 21 | { 22 | _bat->MoveDown(_speed); 23 | } 24 | if (IsKeyDown(_upKey)) 25 | { 26 | _bat->MoveUp(_speed); 27 | } 28 | } 29 | 30 | const wchar_t* PlayerBatController::GetTips() const 31 | { 32 | return L"Human Player"; 33 | } 34 | -------------------------------------------------------------------------------- /PingPongTutorial/src/ui/Application.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018 - 2023 Tony's Studio. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | #include "../../inc/ui/Application.h" 5 | #include "../../inc/ui/Interface.h" 6 | 7 | Application::Application() 8 | : _currentInterface(nullptr), _nextInterface(nullptr) 9 | { 10 | } 11 | 12 | Application::~Application() 13 | { 14 | for (auto it : _interfaces) 15 | { 16 | delete it.second; 17 | } 18 | } 19 | 20 | Application* Application::RegisterInterface(Interface* intf) 21 | { 22 | _interfaces.emplace(intf->Name(), intf); 23 | if (!_currentInterface) 24 | { 25 | _currentInterface = intf; 26 | } 27 | return this; 28 | } 29 | 30 | // Set to target interface immediately 31 | void Application::SetInterface(const std::wstring& name) 32 | { 33 | auto it = _interfaces.find(name); 34 | if (it == _interfaces.end()) 35 | { 36 | return; 37 | } 38 | _currentInterface = it->second; 39 | _nextInterface = nullptr; 40 | } 41 | 42 | // Set to target interface after current update 43 | void Application::ChangeInterface(const std::wstring& name) 44 | { 45 | auto it = _interfaces.find(name); 46 | if (it == _interfaces.end()) 47 | { 48 | return; 49 | } 50 | _nextInterface = it->second; 51 | } 52 | 53 | void Application::Update() 54 | { 55 | if (_currentInterface) 56 | { 57 | _currentInterface->Update(); 58 | } 59 | 60 | if (_nextInterface && _nextInterface != _currentInterface) 61 | { 62 | _currentInterface->OnExit(); 63 | _nextInterface->OnEnter(); 64 | _currentInterface = _nextInterface; 65 | _nextInterface = nullptr; 66 | } 67 | } 68 | 69 | void Application::Draw() 70 | { 71 | if (_currentInterface) 72 | { 73 | _currentInterface->Draw(); 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /PingPongTutorial/src/ui/Button.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018 - 2023 Tony's Studio. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | #include "../../inc/ui/Button.h" 5 | #include "../../inc/Message.h" 6 | 7 | Button::Button(const Rect& range, const std::wstring& text) 8 | : _range(range), _text(text), _onClick(nullptr) 9 | { 10 | for (int i = 0; i < BUTTON_STATE_NUM; i++) 11 | { 12 | _color[i] = RED; 13 | } 14 | } 15 | 16 | Button* Button::SetUpStyle(COLORREF color) 17 | { 18 | _color[BUTTON_UP] = color; 19 | return this; 20 | } 21 | 22 | Button* Button::SetHoverStyle(COLORREF color) 23 | { 24 | _color[BUTTON_HOVER] = color; 25 | return this; 26 | } 27 | 28 | Button* Button::SetDownStyle(COLORREF color) 29 | { 30 | _color[BUTTON_DOWN] = color; 31 | return this; 32 | } 33 | 34 | Button* Button::SetText(const std::wstring& text) 35 | { 36 | _text = text; 37 | return this; 38 | } 39 | 40 | Button* Button::SetOnClick(void (*onClick)(void)) 41 | { 42 | _onClick = onClick; 43 | return this; 44 | } 45 | 46 | void Button::Update() 47 | { 48 | MouseMessage* msg = GetMouseMessage(); 49 | if (_range.Contains(msg->pos)) 50 | { 51 | if (msg->isDown) 52 | { 53 | _state = BUTTON_DOWN; 54 | } 55 | else if (msg->isUp) 56 | { 57 | if (_state == BUTTON_DOWN && _onClick) 58 | { 59 | _onClick(); 60 | } 61 | _state = BUTTON_UP; 62 | } 63 | else 64 | { 65 | if (_state != BUTTON_DOWN) 66 | { 67 | _state = BUTTON_HOVER; 68 | } 69 | } 70 | } 71 | else 72 | { 73 | _state = BUTTON_UP; 74 | } 75 | } 76 | 77 | void Button::Draw() 78 | { 79 | setlinestyle(PS_SOLID, 3); 80 | setlinecolor(_color[_state]); 81 | 82 | RECT rect = _range.ToEasyXRect(); 83 | 84 | rectangle(rect.left, rect.top, rect.right, rect.bottom); 85 | drawtext(_text.c_str(), &rect, DT_CENTER | DT_VCENTER | DT_SINGLELINE); 86 | } 87 | -------------------------------------------------------------------------------- /PingPongTutorial/src/ui/GameInterface.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018 - 2023 Tony's Studio. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | #include "../../inc/ui/Interface.h" 5 | #include "../../inc/Message.h" 6 | #include "../../inc/Globals.h" 7 | #include "../../inc/ui/Application.h" 8 | #include "../../inc/utils/Random.h" 9 | #include "../../inc/game/Bat.h" 10 | #include "../../inc/game/Ball.h" 11 | #include "../../inc/game/BatController.h" 12 | #include 13 | 14 | GameInterface::GameInterface() : Interface(L"Game") 15 | { 16 | _scores[0] = _scores[1] = 0; 17 | _turn = 0; 18 | } 19 | 20 | GameInterface::~GameInterface() 21 | { 22 | } 23 | 24 | void GameInterface::OnEnter() 25 | { 26 | // init bats 27 | _bats[0] = std::make_shared(70, 410); 28 | _bats[0]->SetX(250)->SetY(280); 29 | 30 | _bats[1] = std::make_shared(70, 410); 31 | _bats[1]->SetX(750)->SetY(280); 32 | 33 | // init ball 34 | _ball = std::make_shared(10.0); 35 | 36 | // init bat controllers 37 | if (gameMode == SINGLE_PLAYER) 38 | { 39 | _controllers[0] = std::make_shared( 40 | L"Player", _bats[0].get(), 5.0, VK_S, VK_W); 41 | _controllers[1] = std::make_shared( 42 | L"AI", _bats[1].get(), 3.0, _ball.get()); 43 | } 44 | else 45 | { 46 | _controllers[0] = std::make_shared( 47 | L"Player 1", _bats[0].get(), 5.0, VK_S, VK_W); 48 | _controllers[1] = std::make_shared( 49 | L"Player 2", _bats[1].get(), 5.0, VK_J, VK_I); 50 | } 51 | 52 | // init turn and score 53 | _turn = Random(0, 2); 54 | _scores[0] = _scores[1] = 0; 55 | 56 | // attach ball 57 | _ball->Attach(_bats[_turn]->GetBorder(), _turn); 58 | 59 | _started = false; 60 | } 61 | 62 | void GameInterface::OnExit() 63 | { 64 | } 65 | 66 | void GameInterface::Update() 67 | { 68 | if (IsKeyDown(VK_ESCAPE)) 69 | { 70 | GetApplication()->ChangeInterface(L"Main"); 71 | } 72 | 73 | _controllers[0]->Update(); 74 | _controllers[1]->Update(); 75 | 76 | bool newTurn = false; 77 | if (_started) 78 | { 79 | _ball->Move(); 80 | _ball->Bounce(_bats[0]->GetBorder()); 81 | _ball->Bounce(_bats[1]->GetBorder()); 82 | _ball->Bounce(Rect(50, -30, 1000, 100)); 83 | _ball->Bounce(Rect(50, 510, 1000, 100)); 84 | if (_ball->GetX() < 150.0) 85 | { 86 | _scores[1] += 1; 87 | newTurn = true; 88 | } 89 | else if (_ball->GetX() > 850.0) 90 | { 91 | _scores[0] += 1; 92 | newTurn = true; 93 | } 94 | } 95 | else 96 | { 97 | _ball->Attach(_bats[_turn]->GetBorder(), _turn); 98 | if (IsKeyDown(VK_SPACE)) 99 | { 100 | _ball->Serve(!_turn ? 1.0 : -1.0); 101 | _started = true; 102 | } 103 | } 104 | 105 | if (newTurn) 106 | { 107 | _turn = Random(0, 2); 108 | _started = false; 109 | PlayFmodSound(&scoreSound); 110 | } 111 | } 112 | 113 | void GameInterface::Draw() 114 | { 115 | // table 116 | setlinestyle(PS_SOLID, 2); 117 | setlinecolor(BLACK); 118 | rectangle(150, 70, 850, 510); 119 | line(500, 70, 500, 510); 120 | 121 | // player name 122 | setlinecolor(LIGHTCYAN); 123 | line(0, 50, 100, 50); 124 | line(900, 50, 1000, 50); 125 | LOGFONT style; 126 | gettextstyle(&style); 127 | settextstyle(22, 0, L"Consolas"); 128 | RECT rect0{ 0, 0, 100, 50 }; 129 | RECT rect1{ 900, 0, 1000, 50 }; 130 | drawtext(_controllers[0]->Name().c_str(), &rect0, DT_CENTER | DT_VCENTER | DT_SINGLELINE); 131 | drawtext(_controllers[1]->Name().c_str(), &rect1, DT_CENTER | DT_VCENTER | DT_SINGLELINE); 132 | 133 | // score 134 | wchar_t scoreText[128]; 135 | swprintf_s(scoreText, L"%d VS %d", _scores[0], _scores[1]); 136 | settextstyle(44, 0, L"Comic Sans MS"); 137 | RECT scoreRect{ 0, 0, 1000, 50 }; 138 | drawtext(scoreText, &scoreRect, DT_CENTER | DT_VCENTER | DT_SINGLELINE); 139 | 140 | // restore text style 141 | settextstyle(&style); 142 | 143 | _bats[0]->Draw(); 144 | _bats[1]->Draw(); 145 | _ball->Draw(); 146 | } 147 | -------------------------------------------------------------------------------- /PingPongTutorial/src/ui/MainInterface.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018 - 2023 Tony's Studio. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | #include "../../inc/ui/Interface.h" 5 | #include "../../inc/Globals.h" 6 | #include "../../inc/ui/Application.h" 7 | 8 | MainInterface::MainInterface() 9 | : Interface(L"Main") 10 | { 11 | _pOnePlayerButton = new Button(Rect(350, 280, 100, 60), L"1 Player"); 12 | _pOnePlayerButton->SetUpStyle(RED)->SetHoverStyle(YELLOW)->SetDownStyle(MAGENTA) 13 | ->SetOnClick(_OnClickOnePlayerButton); 14 | 15 | _pTwoPlayerButton = new Button(Rect(550, 280, 100, 60), L"2 Player"); 16 | _pTwoPlayerButton->SetUpStyle(RED)->SetHoverStyle(YELLOW)->SetDownStyle(MAGENTA) 17 | ->SetOnClick(_OnClickTwoPlayerButton); 18 | 19 | _pExitButton = new Button(Rect(900, 460, 60, 60), L"Exit"); 20 | _pExitButton->SetUpStyle(RED)->SetHoverStyle(YELLOW)->SetDownStyle(MAGENTA) 21 | ->SetOnClick(_OnClickExitButton); 22 | } 23 | 24 | MainInterface::~MainInterface() 25 | { 26 | delete _pOnePlayerButton; 27 | delete _pTwoPlayerButton; 28 | delete _pExitButton; 29 | } 30 | 31 | void MainInterface::Update() 32 | { 33 | _pOnePlayerButton->Update(); 34 | _pTwoPlayerButton->Update(); 35 | _pExitButton->Update(); 36 | } 37 | 38 | void MainInterface::Draw() 39 | { 40 | RECT rect{0, 0, 1000, 280}; 41 | 42 | LOGFONT style; 43 | gettextstyle(&style); 44 | settextstyle(100, 0, L"Consolas"); 45 | drawtext(L"Ping Pong", &rect, DT_CENTER | DT_VCENTER | DT_SINGLELINE); 46 | settextstyle(&style); 47 | 48 | _pOnePlayerButton->Draw(); 49 | _pTwoPlayerButton->Draw(); 50 | _pExitButton->Draw(); 51 | } 52 | 53 | void MainInterface::_OnClickOnePlayerButton() 54 | { 55 | gameMode = SINGLE_PLAYER; 56 | Application* app = GetApplication(); 57 | app->ChangeInterface(L"Game"); 58 | } 59 | 60 | void MainInterface::_OnClickTwoPlayerButton() 61 | { 62 | gameMode = DOUBLE_PLAYER; 63 | Application* app = GetApplication(); 64 | app->ChangeInterface(L"Game"); 65 | } 66 | 67 | void MainInterface::_OnClickExitButton() 68 | { 69 | isRunning = false; 70 | } 71 | -------------------------------------------------------------------------------- /PingPongTutorial/src/utils/Image.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018 - 2023 Tony's Studio. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | #include "../../inc/utils/Image.h" 5 | 6 | void LoadImageResource(IMAGE* pDstImage, const wchar_t* filename) 7 | { 8 | loadimage(pDstImage, filename); 9 | } 10 | 11 | void LoadImageResource(IMAGE* pDstImage, const wchar_t* filename, int srcX, int srcY, int srcWidth, int srcHeight) 12 | { 13 | IMAGE tempImage; 14 | 15 | loadimage(&tempImage, filename); 16 | SetWorkingImage(&tempImage); 17 | getimage(pDstImage, srcX, srcY, srcWidth, srcHeight); 18 | SetWorkingImage(); 19 | } 20 | 21 | void PutAlphaImage(int x, int y, IMAGE* pSrcImage) 22 | { 23 | PutAlphaImage(nullptr, x, y, pSrcImage); 24 | } 25 | 26 | void PutAlphaImage(IMAGE* pDstImage, int x, int y, IMAGE* pSrcImage) 27 | { 28 | DWORD* pDestBuffer = GetImageBuffer(pDstImage); 29 | const DWORD* pSrcBuffer = GetImageBuffer(pSrcImage); 30 | const int srcWidth = pSrcImage->getwidth(); 31 | const int srcHeight = pSrcImage->getheight(); 32 | const int destWidth = pDstImage ? pDstImage->getwidth() : getwidth(); 33 | const int destHeight = pDstImage ? pDstImage->getheight() : getheight(); 34 | 35 | int destX = x; 36 | int destY = y; 37 | 38 | if ((destX + srcWidth < 0) || (destY + srcHeight < 0) || (destX >= destWidth) || (destY >= destHeight)) 39 | { 40 | return; 41 | } 42 | 43 | const int width = min(destX + srcWidth, destWidth) - max(destX, 0); 44 | const int height = min(destY + srcHeight, destHeight) - max(destY, 0); 45 | if (destX < 0) 46 | { 47 | pSrcBuffer -= destX; 48 | destX = 0; 49 | } 50 | if (destY < 0) 51 | { 52 | pSrcBuffer -= destY * srcWidth; 53 | destY = 0; 54 | } 55 | pDestBuffer += destWidth * destY + destX; 56 | 57 | for (int i = 0; i < height; i++) 58 | { 59 | for (int j = 0; j < width; j++) 60 | { 61 | const int alpha = (pSrcBuffer[j] & 0xff000000) >> 24; 62 | pDestBuffer[j] = ARGB(pSrcBuffer[j], pDestBuffer[j], alpha); 63 | } 64 | 65 | pDestBuffer += destWidth; 66 | pSrcBuffer += srcWidth; 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /PingPongTutorial/src/utils/Random.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018 - 2023 Tony's Studio. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | #include "../../inc/utils/Random.h" 5 | 6 | #include 7 | #include 8 | 9 | void SetRandomSeed() 10 | { 11 | srand(static_cast(time(nullptr))); 12 | } 13 | 14 | // get random number in [0.0, 1.0] 15 | double Random() 16 | { 17 | return static_cast(rand()) / static_cast(RAND_MAX); 18 | } 19 | 20 | double Random(double upper) 21 | { 22 | return upper * Random(); 23 | } 24 | 25 | double Random(double lower, double upper) 26 | { 27 | return lower + (upper - lower) * Random(); 28 | } 29 | 30 | // [0, upper) 31 | int Random(int upper) 32 | { 33 | return rand() % upper; 34 | } 35 | 36 | // [lower, upper) 37 | int Random(int lower, int upper) 38 | { 39 | if (upper <= lower) 40 | { 41 | return lower; 42 | } 43 | return lower + rand() % (upper - lower); 44 | } 45 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # PingPong Tutorial 2 | 3 | > Copyright ©️ Tony's Studio 2023 4 | 5 | --- 6 | 7 | ## What is it? 8 | 9 | This is a demo project for the 2023 Summer Semester of BUAA School of Software. 10 | 11 | ## How to use it? 12 | 13 | Technically, you can just read the source code. 🤪 14 | 15 | I've written you a brief tutorial on game development, you can find the article here: 16 | 17 | - [Introduction to C++ Game Development](https://www.tonys-studio.top/2023/08/12/Introduction-to-C-Game-Development/) 18 | 19 | I've also uploaded a complete video series on BiliBili, you can watch them here: 20 | 21 | - [Introduction to C++ Game Development with EasyX](https://www.bilibili.com/video/BV1Wr4y1Z7aX/) 22 | 23 | ## What you'll learn? 24 | 25 | Basically, you'll learn: 26 | 27 | - How to create a Windows Desktop Application with [EasyX](https://easyx.cn/) 28 | - How to add sound into game using [FMOD](https://fmod.com/) 29 | 30 | You'll also learn: 31 | 32 | - How to create and manage multi-file C++ project in Visual Studio. 33 | - Some good designs in game structure. 34 | 35 | In addition, you'll learn: 36 | 37 | - How to customize program icon and properties. 38 | - How to create Installer with [Inno Setup](https://jrsoftware.org/isinfo.php) 39 | 40 | --- 41 | 42 | Have fun coding! 🥰 --------------------------------------------------------------------------------