fmod.inc 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. <?php
  2. //-----------------------------------------------------------------------------
  3. // Copyright (c) 2012 GarageGames, LLC
  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
  7. // deal in the Software without restriction, including without limitation the
  8. // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  9. // sell 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
  13. // all 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
  20. // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
  21. // IN THE SOFTWARE.
  22. //-----------------------------------------------------------------------------
  23. beginModule( 'fmod' );
  24. $allgood = true;
  25. // Additional includes
  26. switch( T3D_Generator::$platform )
  27. {
  28. case "win32":
  29. case "mac":
  30. //addLibIncludePath( 'fmod/inc' );
  31. // Look for the optional global from the project.conf.
  32. global $FMOD_SDK_PATH;
  33. if (!$FMOD_SDK_PATH)
  34. {
  35. // First look for an environment var.
  36. $FMOD_SDK_PATH = getenv( "TORQUE_FMOD_PATH" );
  37. if (strlen($FMOD_SDK_PATH) == 0 || !file_exists($FMOD_SDK_PATH))
  38. {
  39. // Check for another environment variable. There is no standard one for FMOD.
  40. $FMOD_SDK_PATH = getenv( "FMOD_SDK_PATH" );
  41. if (strlen($FMOD_SDK_PATH) == 0 || !file_exists($FMOD_SDK_PATH))
  42. {
  43. // No environment variables present so check the FMOD SDK install location
  44. $FMOD_SDK_PATH = getenv("ProgramFiles") . "/FMOD SoundSystem/FMOD Programmers API Windows";
  45. // Last channce... try the x86 default install path.
  46. if (!file_exists($FMOD_SDK_PATH))
  47. $FMOD_SDK_PATH = getenv("ProgramFiles(x86)") . "/FMOD SoundSystem/FMOD Programmers API Windows";
  48. }
  49. }
  50. // We need forward slashes for paths.
  51. $FMOD_SDK_PATH = str_replace( "\\", "/", $FMOD_SDK_PATH);
  52. // Remove trailing slashes.
  53. $FMOD_SDK_PATH = rtrim($FMOD_SDK_PATH, " /");
  54. }
  55. if (file_exists($FMOD_SDK_PATH))
  56. {
  57. addIncludePath( $FMOD_SDK_PATH . "/api/inc" );
  58. addIncludePath( $FMOD_SDK_PATH . "/fmoddesignerapi/api/inc" );
  59. // File Copy
  60. copyFileToProject( $FMOD_SDK_PATH . "/api/fmodex.dll", "/game/fmodex.dll" );
  61. copyFileToProject( $FMOD_SDK_PATH . "/fmoddesignerapi/api/fmod_event.dll", "/game/fmod_event.dll" );
  62. }
  63. else
  64. {
  65. echo "\n\n*** FMOD PATH NOT VALID \n\n";
  66. $allgood = false;
  67. }
  68. break;
  69. case "360":
  70. // Assume 32-bit system
  71. $FMOD_PATH = "C:/Program Files/FMOD SoundSystem/FMOD Programmers API Xbox 360/";
  72. // Ohnoes! Try 64-bit!
  73. if (!file_exists($FMOD_PATH))
  74. $FMOD_PATH = "C:/Program Files (x86)/FMOD SoundSystem/FMOD Programmers API Xbox 360/";
  75. if (!file_exists($FMOD_PATH))
  76. {
  77. $allgood = false;
  78. echo "\n\n FMOD integration failed to find Xbox360 installation!\n";
  79. echo " - FMOD_PATH is set to $FMOD_PATH\n\n";
  80. }
  81. else
  82. {
  83. echo "\n\nFMOD integration for Torque3D on the Xbox360\n";
  84. echo " - FMOD_PATH is set to $FMOD_PATH\n\n";
  85. // Fmod API
  86. addIncludePath($FMOD_PATH . 'api/inc');
  87. addProjectLibDir($FMOD_PATH . 'api/lib');
  88. // Fmod Designer API
  89. addIncludePath($FMOD_PATH . 'fmoddesignerapi/api/inc');
  90. addProjectLibDir($FMOD_PATH . 'fmoddesignerapi/api/lib');
  91. addProjectLibInput('fmodxbox360.lib');
  92. addProjectLibInput('xmahal.lib');
  93. addProjectLibInput('xmic.lib');
  94. // Prior to June 2009 XDK, FMOD requires xaudio.lib
  95. //addProjectLibInput('xaudio.lib');
  96. }
  97. break;
  98. }
  99. // Source
  100. if($allgood)
  101. addEngineSrcDir('sfx/fmod');
  102. endModule();
  103. ?>