SOUNDLCK.CPP 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. /*
  2. ** Command & Conquer Red Alert(tm)
  3. ** Copyright 2025 Electronic Arts Inc.
  4. **
  5. ** This program is free software: you can redistribute it and/or modify
  6. ** it under the terms of the GNU General Public License as published by
  7. ** the Free Software Foundation, either version 3 of the License, or
  8. ** (at your option) any later version.
  9. **
  10. ** This program is distributed in the hope that it will be useful,
  11. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ** GNU General Public License for more details.
  14. **
  15. ** You should have received a copy of the GNU General Public License
  16. ** along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. /***************************************************************************
  19. ** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S **
  20. ***************************************************************************
  21. * *
  22. * Project Name : Westwood 32 bit Library *
  23. * *
  24. * File Name : SOUNDLCK.CPP *
  25. * *
  26. * Programmer : Phil W. Gorrow *
  27. * *
  28. * Start Date : June 23, 1995 *
  29. * *
  30. * Last Update : June 23, 1995 [PWG] *
  31. * *
  32. *-------------------------------------------------------------------------*
  33. * Functions: *
  34. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  35. #ifndef _WIN32 // Denzil 6/2/98 Watcom 11.0 complains without this check
  36. #define _WIN32
  37. #endif // _WIN32
  38. #define WIN32
  39. #include <windows.h>
  40. #include <windowsx.h>
  41. #include <objbase.h>
  42. #include "dsound.h"
  43. #include <mem.h>
  44. #include "wwmem.h"
  45. #include "wwstd.h"
  46. #include "soundint.h"
  47. LockedDataType LockedData;
  48. /*=========================================================================*/
  49. /* The following PRIVATE functions are in this file: */
  50. /*=========================================================================*/
  51. /*= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =*/
  52. /***************************************************************************
  53. * INIT_LOCKED_DATA -- Initializes sound driver locked data *
  54. * *
  55. * INPUT: none *
  56. * *
  57. * OUTPUT: none *
  58. * *
  59. * HISTORY: *
  60. * 06/23/1995 PWG : Created. *
  61. *=========================================================================*/
  62. void Init_Locked_Data(void)
  63. {
  64. /*
  65. ** Initialize all of the data elements that need to be locked.
  66. */
  67. LockedData.DigiHandle = -1;
  68. LockedData.ServiceSomething = FALSE;
  69. LockedData.MagicNumber = 0xDEAF;
  70. LockedData.UncompBuffer = NULL;
  71. // LockedData.StreamBufferSize = (2*SECONDARY_BUFFER_SIZE)+128;
  72. LockedData.StreamBufferSize = (SECONDARY_BUFFER_SIZE/4)+128;
  73. LockedData.StreamBufferCount = 16;
  74. LockedData.SoundVolume = 255;
  75. LockedData.ScoreVolume = 255;
  76. LockedData._int = FALSE;
  77. #ifdef cuts
  78. /*
  79. ** Lock the sound specific c functions that will cause us problems if
  80. ** they are swapped out during an interrupt.
  81. */
  82. DPMI_Lock(&LockedData, 4096L);
  83. DPMI_Lock(Simple_Copy, 4096L);
  84. DPMI_Lock(Sample_Copy, 4096L);
  85. DPMI_Lock((void *)maintenance_callback, 4096L);
  86. DPMI_Lock((void *)DigiCallback, 4096L);
  87. DPMI_Lock((void *)HMI_TimerCallback, 4096L);
  88. DPMI_Lock(Audio_Add_Long_To_Pointer, 4096L);
  89. DPMI_Lock(DPMI_Unlock, 4096L);
  90. /*
  91. ** Lock the library functions that will cause us problems if they are
  92. ** swapped out during an interrupt.
  93. */
  94. DPMI_Lock(Mem_Copy, 4096L);
  95. DPMI_Lock(Audio_Mem_Set, 4096L);
  96. DPMI_Lock(__GETDS, 4096L);
  97. /*
  98. ** Finally lock the two assembly modules that need locking. This can
  99. ** be handled by calling the lock function that is local to thier module
  100. ** swapped out during an interrupt.
  101. */
  102. Decompress_Frame_Lock();
  103. sosCODEC_Lock();
  104. #endif //cuts
  105. }