fmod.inc 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  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( 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. }
  60. else
  61. {
  62. echo "\n\n*** FMOD PATH NOT VALID \n\n";
  63. $allgood = false;
  64. }
  65. break;
  66. case "360":
  67. // Assume 32-bit system
  68. $FMOD_PATH = "C:/Program Files/FMOD SoundSystem/FMOD Programmers API Xbox 360/";
  69. // Ohnoes! Try 64-bit!
  70. if (!file_exists($FMOD_PATH))
  71. $FMOD_PATH = "C:/Program Files (x86)/FMOD SoundSystem/FMOD Programmers API Xbox 360/";
  72. if (!file_exists($FMOD_PATH))
  73. {
  74. $allgood = false;
  75. echo "\n\n FMOD integration failed to find Xbox360 installation!\n";
  76. echo " - FMOD_PATH is set to $FMOD_PATH\n\n";
  77. }
  78. else
  79. {
  80. echo "\n\nFMOD integration for Torque3D on the Xbox360\n";
  81. echo " - FMOD_PATH is set to $FMOD_PATH\n\n";
  82. // Fmod API
  83. addIncludePath($FMOD_PATH . 'api/inc');
  84. addProjectLibDir($FMOD_PATH . 'api/lib');
  85. // Fmod Designer API
  86. addIncludePath($FMOD_PATH . 'fmoddesignerapi/api/inc');
  87. addProjectLibDir($FMOD_PATH . 'fmoddesignerapi/api/lib');
  88. addProjectLibInput('fmodxbox360.lib');
  89. addProjectLibInput('xmahal.lib');
  90. addProjectLibInput('xmic.lib');
  91. // Prior to June 2009 XDK, FMOD requires xaudio.lib
  92. //addProjectLibInput('xaudio.lib');
  93. }
  94. break;
  95. }
  96. // Source
  97. if($allgood)
  98. addEngineSrcDir('sfx/fmod');
  99. endModule();
  100. ?>