changeset 2113:a94c5bee0225

SoundVolume options
author Ritor1
date Mon, 23 Dec 2013 00:48:53 +0600
parents 9d79b07dc237
children 68fbaf45ef66
files AudioPlayer.cpp AudioPlayer.h Game.cpp Player.cpp SaveLoad.cpp mm7_4.cpp
diffstat 6 files changed, 130 insertions(+), 105 deletions(-) [+]
line wrap: on
line diff
--- a/AudioPlayer.cpp	Sat Dec 21 23:33:36 2013 +0600
+++ b/AudioPlayer.cpp	Mon Dec 23 00:48:53 2013 +0600
@@ -45,15 +45,15 @@
 
 
 
-unsigned __int8 uSoundVolumeMultiplier = 4;
-unsigned __int8 uVoicesVolumeMultiplier = 4;
-unsigned __int8 uMusicVolimeMultiplier = 4;
+unsigned __int8 uSoundVolumeMultiplier;// = 4;
+unsigned __int8 uVoicesVolumeMultiplier;// = 4;
+unsigned __int8 uMusicVolimeMultiplier;// = 4;
 int bWalkSound; // idb
 
 std::array<float, 10> pSoundVolumeLevels = 
 {
-  0.0000000f, 0.1099999f, 0.2199999f, 0.3300000f, 0.4399999f,
- 0.5500000f, 0.6600000f, 0.7699999f, 0.8799999f, 0.9700000f     //changed 0.9900000f to 0.9700000f. for some reason it only works for values below this
+  0.0000000f, 0.4900000f, 0.5500000f, 0.6100000f, 0.6700000f,
+ 0.7000000f, 0.7600000f, 0.8200000f, 0.8800000f, 0.9700000f     //changed 0.9900000f to 0.9700000f. for some reason it only works for values below this
 };
 
 
@@ -81,15 +81,15 @@
   {
     for ( uint i = 1; i < pSoundList->sNumSounds; ++i )
     {
-      sprintf(pSoundName, "%s", pSounds[i].pSoundName);
-      pSoundDesc = &pSoundList->pSounds[i];
-      if ( pSoundList->pSounds[i].eType != SOUND_DESC_SYSTEM )
+      sprintf(pSoundName, "%s", pSL_Sounds[i].pSoundName);
+      pSoundDesc = &pSoundList->pSL_Sounds[i];
+      if ( pSoundList->pSL_Sounds[i].eType != SOUND_DESC_SYSTEM )
         continue;
-      sprintf(pSoundName, "%s", pSounds[i].pSoundName);
-      pSoundList->pSounds[i].pSoundData[0] = ::LoadSound(pSoundName, (SoundData *)-1, pSounds[i].uSoundID);
+      sprintf(pSoundName, "%s", pSL_Sounds[i].pSoundName);
+      pSoundList->pSL_Sounds[i].pSoundData[0] = ::LoadSound(pSoundName, (SoundData *)-1, pSL_Sounds[i].uSoundID);
       if ( !pAudioPlayer->b3DSoundInitialized )
         continue;
-      pSoundDesc = &pSoundList->pSounds[i];
+      pSoundDesc = &pSoundList->pSL_Sounds[i];
       if ( !(pSoundDesc->uFlags & SOUND_DESC_SWAP) || !pSoundDesc->pSoundData[0] )
         continue;
       pSoundData = pSoundDesc->pSoundData[0];
@@ -98,7 +98,7 @@
       pType = AIL_file_type(pSoundBytes, uSoundSize);
       if ( !pType )
       {
-        pSoundList->pSounds[i].bDecompressed = false;
+        pSoundList->pSL_Sounds[i].bDecompressed = false;
         pSoundList->UnloadSound(i, 1);
         continue;
       }
@@ -109,20 +109,20 @@
         {
           if ( AIL_WAV_info(pSoundBytes, &pInfo) && pInfo.uChannels != 2 )
           {
-            if ( !AIL_decompress_ADPCM(&pInfo, &pSoundList->pSounds[i].p3DSound, &v12) )
+            if ( !AIL_decompress_ADPCM(&pInfo, &pSoundList->pSL_Sounds[i].p3DSound, &v12) )
             {
-              pSoundList->pSounds[i].p3DSound = 0;
-              pSoundList->pSounds[i].bDecompressed = true;
+              pSoundList->pSL_Sounds[i].p3DSound = 0;
+              pSoundList->pSL_Sounds[i].bDecompressed = true;
             }
           }
           pSoundList->UnloadSound(i, 1);
           continue;
         }
-        pSoundList->pSounds[i].bDecompressed = false;
+        pSoundList->pSL_Sounds[i].bDecompressed = false;
         pSoundList->UnloadSound(i, 1);
         continue;
       }
-      pSoundList->pSounds[i].p3DSound = pSoundList->pSounds[i].pSoundData[0];
+      pSoundList->pSL_Sounds[i].p3DSound = pSoundList->pSL_Sounds[i].pSoundData[0];
       pSoundList->UnloadSound(i, 1);
     }
   }
@@ -139,10 +139,10 @@
   uint       uSoundIdx = 0;
   SoundDesc *pSound = nullptr;
   for (uint i = 1; i < sNumSounds; ++i)
-    if (pSounds[i].uSoundID == a1)
+    if (pSL_Sounds[i].uSoundID == a1)
     {
       uSoundIdx = i;
-      pSound = &pSounds[i];
+      pSound = &pSL_Sounds[i];
       break;
     }
   if (!pSound)
@@ -233,7 +233,7 @@
     v25 = 44;
     while ( 1 )
     {
-      v10 = pSounds;
+      v10 = pSL_Sounds;
       v11 = &v10[v24 / 0x78];
       Args = &v10[v24 / 0x78];
       if ( a2 == v10[v24 / 0x78].uSoundID )
@@ -291,7 +291,7 @@
       v16 = a2;
     }
     result = v26;
-    pSounds->pSoundData[a6 + 30 * v26] = (SoundData *)lpBuffer;
+    pSL_Sounds->pSoundData[a6 + 30 * v26] = (SoundData *)lpBuffer;
     *pOutSoundSize = v16;
 
   return result;
@@ -307,13 +307,13 @@
   {
     for ( uint i = 0; i < (signed int)this->sNumSounds; ++i )
     {
-      result = this->pSounds;
+      result = this->pSL_Sounds;
       v5 = result[i].pSoundData[0];
       if ( v5 )
       {
         ReleaseSoundData(v5);
-        this->pSounds[i].pSoundData[0] = 0;
-        result = (SoundDesc *)((char *)&this->pSounds[i] + 40);
+        this->pSL_Sounds[i].pSoundData[0] = 0;
+        result = (SoundDesc *)((char *)&this->pSL_Sounds[i] + 40);
         *(int *)&result->pSoundName[0] &= 0xFFFFFFFEu;
       }
     }
@@ -326,14 +326,14 @@
 {
   for ( int i = 0; i < (signed int)this->sNumSounds; ++i )
   {
-    if ( this->pSounds[i].eType != SOUND_DESC_SYSTEM && (a2 || this->pSounds[i].eType != SOUND_DESC_LOCK) )
+    if ( this->pSL_Sounds[i].eType != SOUND_DESC_SYSTEM && (a2 || this->pSL_Sounds[i].eType != SOUND_DESC_LOCK) )
     {
-      if ( this->pSounds[i].pSoundData[0] )
+      if ( this->pSL_Sounds[i].pSoundData[0] )
       {
-        ReleaseSoundData(this->pSounds[i].pSoundData[0]);
-        this->pSounds[i].pSoundData[0] = 0;
+        ReleaseSoundData(this->pSL_Sounds[i].pSoundData[0]);
+        this->pSL_Sounds[i].pSoundData[0] = 0;
       }
-      this->pSounds[i].uFlags &= ~SOUND_DESC_SYSTEM;
+      this->pSL_Sounds[i].uFlags &= ~SOUND_DESC_SYSTEM;
     }
   }
 }
@@ -341,20 +341,20 @@
 //----- (004A9DCD) --------------------------------------------------------
 void SoundList::UnloadSound(unsigned int uSoundID, char a3)
 {
-  if ( pSounds[uSoundID].eType != SOUND_DESC_SYSTEM )
+  if ( pSL_Sounds[uSoundID].eType != SOUND_DESC_SYSTEM )
   {
-    if ( (pSounds[uSoundID].uFlags & SOUND_DESC_SWAP) && pSounds[uSoundID].p3DSound && a3 )
+    if ( (pSL_Sounds[uSoundID].uFlags & SOUND_DESC_SWAP) && pSL_Sounds[uSoundID].p3DSound && a3 )
     {
-      if ( pSounds[uSoundID].bDecompressed)
-        AIL_mem_free_lock(pSounds[uSoundID].p3DSound);
-      pSounds[uSoundID].p3DSound = 0;
-      pSounds[uSoundID].uFlags &= ~SOUND_DESC_SYSTEM;
+      if ( pSL_Sounds[uSoundID].bDecompressed)
+        AIL_mem_free_lock(pSL_Sounds[uSoundID].p3DSound);
+      pSL_Sounds[uSoundID].p3DSound = 0;
+      pSL_Sounds[uSoundID].uFlags &= ~SOUND_DESC_SYSTEM;
     }
-    if ( pSounds[uSoundID].pSoundData[0] )
+    if ( pSL_Sounds[uSoundID].pSoundData[0] )
     {
-      ReleaseSoundData(pSounds[uSoundID].pSoundData[0]);
-      pSounds[uSoundID].pSoundData[0] = NULL;
-      pSounds[uSoundID].uFlags &= ~SOUND_DESC_SYSTEM;
+      ReleaseSoundData(pSL_Sounds[uSoundID].pSoundData[0]);
+      pSL_Sounds[uSoundID].pSoundData[0] = NULL;
+      pSL_Sounds[uSoundID].uFlags &= ~SOUND_DESC_SYSTEM;
     }
   }
 }
@@ -370,7 +370,7 @@
     Error("Unable to save dsounds.bin!");
 
   fwrite(this, 4, 1, v2);
-  fwrite(this->pSounds, 0x78u, this->sNumSounds, v2);
+  fwrite(this->pSL_Sounds, 0x78u, this->sNumSounds, v2);
   fclose(v2);
 }
 
@@ -385,12 +385,12 @@
   assert(sNumSounds);
   assert(!num_mm8_sounds);
 
-  pSounds = (SoundDesc *)malloc(sNumSounds * sizeof(SoundDesc));
-  memcpy(pSounds, (char *)data_mm7 + 4, num_mm7_sounds * sizeof(SoundDesc));
+  pSL_Sounds = (SoundDesc *)malloc(sNumSounds * sizeof(SoundDesc));
+  memcpy(pSL_Sounds, (char *)data_mm7 + 4, num_mm7_sounds * sizeof(SoundDesc));
   for (uint i = 0; i < num_mm6_sounds; ++i)
   {
     auto src = (SoundDesc_mm6 *)((char *)data_mm6 + 4) + i;
-    SoundDesc* dst = &pSounds[num_mm7_sounds + i];
+    SoundDesc* dst = &pSL_Sounds[num_mm7_sounds + i];
 
     memcpy(dst, src, sizeof(SoundDesc_mm6));
     dst->p3DSound = nullptr;
@@ -420,9 +420,9 @@
   FILE *File; // [sp+2F8h] [bp-4h]@1
   unsigned int Argsa; // [sp+304h] [bp+8h]@3
 
-  free(this->pSounds);
+  free(this->pSL_Sounds);
   v3 = 0;
-  this->pSounds = 0;
+  this->pSL_Sounds = 0;
   this->sNumSounds = 0;
   v4 = fopen(Args, "r");
   File = v4;
@@ -446,7 +446,7 @@
   }
   this->sNumSounds = v5;
   v6 = malloc(120 * v5);
-  this->pSounds = (SoundDesc *)v6;
+  this->pSL_Sounds = (SoundDesc *)v6;
   if ( v6 == (void *)v3 )
     Error("SoundListClass::load - Out of Memory!");
 
@@ -460,16 +460,16 @@
     memcpy(&v19, txt_file_frametable_parser(&Buf, &v18), sizeof(v19));
     if ( v19.uPropCount && *v19.pProperties[0] != 47 )
     {
-      sprintf(this->pSounds[this->sNumSounds].pSoundName, "%s", v19.pProperties[0]);
+      sprintf(this->pSL_Sounds[this->sNumSounds].pSoundName, "%s", v19.pProperties[0]);
       v9 = atoi(v19.pProperties[1]);
       v10 = v19.pProperties[2];
-      this->pSounds[this->sNumSounds].uSoundID = v9;
+      this->pSL_Sounds[this->sNumSounds].uSoundID = v9;
       if ( _stricmp(v10, "system") )
       {
         if ( _stricmp(v19.pProperties[2], "swap") )
         {
           v11 = _stricmp(v19.pProperties[2], "lock");
-          v12 = this->pSounds;
+          v12 = this->pSL_Sounds;
           v13 = v11 == 0;
           v14 = this->sNumSounds;
           if ( v13 )
@@ -478,13 +478,13 @@
             v12[v14].eType = SOUND_DESC_LEVEL;
         }
         else
-          this->pSounds[this->sNumSounds].eType = SOUND_DESC_SWAP;
+          this->pSL_Sounds[this->sNumSounds].eType = SOUND_DESC_SWAP;
       }
       else
-        this->pSounds[this->sNumSounds].eType = SOUND_DESC_SYSTEM;
+        this->pSL_Sounds[this->sNumSounds].eType = SOUND_DESC_SYSTEM;
       if ( v19.uPropCount >= 4 && !_stricmp(v19.pProperties[3], "3D") )
       {
-        v15 = (int)&this->pSounds[this->sNumSounds].uFlags;
+        v15 = (int)&this->pSL_Sounds[this->sNumSounds].uFlags;
         *(int *)v15 |= SOUND_DESC_SWAP;
       }
       ++this->sNumSounds;
@@ -560,7 +560,7 @@
 }
 
 //----- (004AA306) --------------------------------------------------------
-void AudioPlayer::PlaySound(SoundID eSoundID, signed int a3, unsigned int uNumRepeats, signed int source_x, signed int source_y, int a7, unsigned int uVolume, int sPlaybackRate)
+void AudioPlayer::PlaySound(SoundID eSoundID, signed int a3, unsigned int uNumRepeats, signed int source_x, signed int source_y, int a7, float uVolume, int sPlaybackRate)
 {
   int v12; // edi@13
   signed int v13; // ecx@17
@@ -629,7 +629,7 @@
 
   int sound_id = 0;
   for (uint i = 0; i < pSoundList->sNumSounds; ++i)
-    if (pSoundList->pSounds[i].uSoundID == eSoundID)
+    if (pSoundList->pSL_Sounds[i].uSoundID == eSoundID)
     {
       sound_id = i;
       break;
@@ -643,20 +643,20 @@
   assert(sound_id < pSoundList->sNumSounds);
   if ( !a7 )
   {
-    if ( !pSoundList->pSounds[sound_id].pSoundData[0] )
+    if ( !pSoundList->pSL_Sounds[sound_id].pSoundData[0] )
     {
-      if ( pSoundList->pSounds[sound_id].eType == SOUND_DESC_SWAP )
+      if ( pSoundList->pSL_Sounds[sound_id].eType == SOUND_DESC_SWAP )
         pSoundList->LoadSound(eSoundID, 0);
     }
   }
-  if ( !pSoundList->pSounds[sound_id].pSoundData[a7] )
+  if ( !pSoundList->pSL_Sounds[sound_id].pSoundData[a7] )
     return;
 
   int start_channel = 0,
       end_channel = 0;
   v62 = start_channel;
 
-  if (!b3DSoundInitialized || pSoundList->pSounds[sound_id].Is3D())
+  if (!b3DSoundInitialized || pSoundList->pSL_Sounds[sound_id].Is3D())
   {
     if (a3 == 0)  // generic sound like from UI
     {
@@ -677,7 +677,7 @@
         if ( AIL_sample_status(pMixerChannels[j].hSample) == AIL::Sample::Done )
         {
           AIL_init_sample(pMixerChannels[j].hSample);
-          char *p = (char *)pSoundList->pSounds[sound_id].pSoundData[a7];
+          char *p = (char *)pSoundList->pSL_Sounds[sound_id].pSoundData[a7];
           if (a7 == 0)  p = p + 4;//for RIFF
 		  if ( eSoundID == 75 )// Ritor1: include +7 for pSounds[20]
 			  p = p + 7;
@@ -714,12 +714,37 @@
     }
     else if (a3 == -1)  // exclusive sounds - can override
     {
-      if ( AIL_sample_status(pMixerChannels[13].hSample) == AIL::Sample::Done )
+      /*if ( AIL_sample_status(pMixerChannels[13].hSample) == AIL::Sample::Done )
       {
-        AIL_end_sample(pMixerChannels[13].hSample);
-        if ( pMixerChannels[13].uSourceTrackIdx )
-          FreeChannel(&pMixerChannels[13]);
-      }
+          AIL_end_sample(pMixerChannels[13].hSample);
+          if ( pMixerChannels[13].uSourceTrackIdx )
+            FreeChannel(&pMixerChannels[13]);
+      }*/
+      AIL_init_sample(pMixerChannels[13].hSample);
+      char *p = (char *)pSoundList->pSL_Sounds[sound_id].pSoundData[a7];
+      if (a7 == 0)
+        p = p + 4;//for RIFF
+	  if ( eSoundID == 75 )//  Ritor1: include +7 for pSounds[20]
+		  p = p + 7;
+       AIL_set_sample_file(pMixerChannels[13].hSample, p, -1);
+       if ( sample_volume == 10000 )
+         sample_volume = uMasterVolume;
+       if (uVolume)
+         sample_volume = uVolume;
+       AIL_set_sample_volume(pMixerChannels[13].hSample, sample_volume);
+       int object_type = PID_TYPE(a3),
+           object_id = PID_ID(a3);
+       if (uNumRepeats)
+         AIL_set_sample_loop_count(pMixerChannels[13].hSample, uNumRepeats - 1);
+       pMixerChannels[13].uSourceTrackIdx = sound_id;
+       pMixerChannels[13].source_pid = a3;
+       pMixerChannels[13].uSourceTrackID = eSoundID;
+       int rval = AIL_start_sample(pMixerChannels[13].hSample);//no sound chest close 
+       if ( sPlaybackRate )
+         AIL_set_sample_playback_rate(pMixerChannels[13].hSample, sPlaybackRate);
+       if (object_type == OBJECT_Player)
+         AIL_sample_ms_position(pMixerChannels[13].hSample, &sLastTrackLengthMS, 0);
+       return;
     }
     else if (a3 < 0)    // exclusive sounds - no override (close chest)
     {
@@ -740,7 +765,7 @@
         if ( AIL_sample_status(pMixerChannels[j].hSample) == AIL::Sample::Done )
         {
           AIL_init_sample(pMixerChannels[j].hSample);
-          char *p = (char *)pSoundList->pSounds[sound_id].pSoundData[a7];
+          char *p = (char *)pSoundList->pSL_Sounds[sound_id].pSoundData[a7];
           if (a7 == 0)  p = p + 4;//for RIFF
 		  if ( eSoundID == 75 )//  Ritor1: include +7 for pSounds[20]
 			  p = p + 7;
@@ -796,7 +821,7 @@
               if ( AIL_sample_status(pMixerChannels[j].hSample) == AIL::Sample::Done )
               {
                 AIL_init_sample(pMixerChannels[j].hSample);
-                AIL_set_sample_file(pMixerChannels[j].hSample, (char *)pSoundList->pSounds[sound_id].pSoundData[a7] + 4 * (a7 == 0), -1);
+                AIL_set_sample_file(pMixerChannels[j].hSample, (char *)pSoundList->pSL_Sounds[sound_id].pSoundData[a7] + 4 * (a7 == 0), -1);
                 if (uVolume)
                   sample_volume = uVolume;
                 AIL_set_sample_volume(pMixerChannels[j].hSample, sample_volume);
@@ -842,7 +867,7 @@
               if ( AIL_sample_status(pMixerChannels[j].hSample) == AIL::Sample::Done )
               {
                 AIL_init_sample(pMixerChannels[j].hSample);
-                AIL_set_sample_file(pMixerChannels[j].hSample, (char *)pSoundList->pSounds[sound_id].pSoundData[a7] + 4 * (a7 == 0), -1);
+                AIL_set_sample_file(pMixerChannels[j].hSample, (char *)pSoundList->pSL_Sounds[sound_id].pSoundData[a7] + 4 * (a7 == 0), -1);
                 if (uVolume)
                   sample_volume = uVolume;
                 AIL_set_sample_volume(pMixerChannels[j].hSample, sample_volume);
@@ -885,7 +910,7 @@
               if ( AIL_sample_status(pMixerChannels[j].hSample) == AIL::Sample::Done )
               {
                 AIL_init_sample(pMixerChannels[j].hSample);
-                AIL_set_sample_file(pMixerChannels[j].hSample, (char *)pSoundList->pSounds[sound_id].pSoundData[a7] + 4 * (a7 == 0), -1);
+                AIL_set_sample_file(pMixerChannels[j].hSample, (char *)pSoundList->pSL_Sounds[sound_id].pSoundData[a7] + 4 * (a7 == 0), -1);
                 if (uVolume)
                   sample_volume = uVolume;
                 AIL_set_sample_volume(pMixerChannels[j].hSample, sample_volume);
@@ -931,7 +956,7 @@
               if ( AIL_sample_status(pMixerChannels[j].hSample) == AIL::Sample::Done )
               {
                 AIL_init_sample(pMixerChannels[j].hSample);
-                AIL_set_sample_file(pMixerChannels[j].hSample, (char *)pSoundList->pSounds[sound_id].pSoundData[a7] + 4 * (a7 == 0), -1);
+                AIL_set_sample_file(pMixerChannels[j].hSample, (char *)pSoundList->pSL_Sounds[sound_id].pSoundData[a7] + 4 * (a7 == 0), -1);
                 if (uVolume)
                   sample_volume = uVolume;
                 AIL_set_sample_volume(pMixerChannels[j].hSample, sample_volume);
@@ -977,7 +1002,7 @@
               if ( AIL_sample_status(pMixerChannels[j].hSample) == AIL::Sample::Done )
               {
                 AIL_init_sample(pMixerChannels[j].hSample);
-                AIL_set_sample_file(pMixerChannels[j].hSample, (char *)pSoundList->pSounds[sound_id].pSoundData[a7] + 4 * (a7 == 0), -1);
+                AIL_set_sample_file(pMixerChannels[j].hSample, (char *)pSoundList->pSL_Sounds[sound_id].pSoundData[a7] + 4 * (a7 == 0), -1);
                 if (uVolume)
                   sample_volume = uVolume;
                 AIL_set_sample_volume(pMixerChannels[j].hSample, sample_volume);
@@ -1019,7 +1044,7 @@
               if ( AIL_sample_status(pMixerChannels[j].hSample) == AIL::Sample::Done )
               {
                 AIL_init_sample(pMixerChannels[j].hSample);
-                AIL_set_sample_file(pMixerChannels[j].hSample, (char *)pSoundList->pSounds[sound_id].pSoundData[a7] + 4 * (a7 == 0), -1);
+                AIL_set_sample_file(pMixerChannels[j].hSample, (char *)pSoundList->pSL_Sounds[sound_id].pSoundData[a7] + 4 * (a7 == 0), -1);
                 if (uVolume)
                   sample_volume = uVolume;
                 AIL_set_sample_volume(pMixerChannels[j].hSample, sample_volume);
@@ -1075,7 +1100,7 @@
         sample_volume = uMasterVolume;
 
       AIL_init_sample(pMixerChannels[v62].hSample);
-      AIL_set_sample_file(pMixerChannels[v62].hSample, (char *)pSoundList->pSounds[sound_id].pSoundData[a7] + 4 * (a7 == 0), -1);
+      AIL_set_sample_file(pMixerChannels[v62].hSample, (char *)pSoundList->pSL_Sounds[sound_id].pSoundData[a7] + 4 * (a7 == 0), -1);
       if (uVolume)
         sample_volume = uVolume;
       AIL_set_sample_volume(pMixerChannels[v62].hSample, sample_volume);
@@ -1327,11 +1352,11 @@
     v102 = v36;
   }
   //v39 = v89;
-  if ( pSoundList->pSounds[sound_id].p3DSound || (LOWORD(v40) = pSoundList->LoadSound(eSoundID, 0), v40) )
+  if ( pSoundList->pSL_Sounds[sound_id].p3DSound || (LOWORD(v40) = pSoundList->LoadSound(eSoundID, 0), v40) )
   {
     v41 = (char *)pAudioPlayer + 16 * v102;
     v42 = (int)(v41 + 20);
-    if ( AIL_set_3D_sample_file(*((int *)v41 + 5), *(void **)((char *)&pSoundList->pSounds->p3DSound + sound_id * sizeof(SoundDesc))) )
+    if ( AIL_set_3D_sample_file(*((int *)v41 + 5), *(void **)((char *)&pSoundList->pSL_Sounds->p3DSound + sound_id * sizeof(SoundDesc))) )
     {
       if ( uNumRepeats )
         v86 = uNumRepeats - 1;
@@ -2163,7 +2188,7 @@
       for ( uint i = 0; i < uNum3DSamples; ++i )
       {
         if ( (uStartChannel == -1 || i < uStartChannel || i > uEndChannel)
-            && p3DSamples[i].field_8 && pSoundList->pSounds[p3DSamples[i].field_8].eType != SOUND_DESC_SYSTEM)
+            && p3DSamples[i].field_8 && pSoundList->pSL_Sounds[p3DSamples[i].field_8].eType != SOUND_DESC_SYSTEM)
         {
           AIL_end_3D_sample(p3DSamples[i].hSample);
           _4ABF23(&p3DSamples[i]);
@@ -2176,7 +2201,7 @@
       for ( int i = 0; i < uMixerChannels; ++i )
       {
         if ( (uStartChannel == -1 || i < uStartChannel || i > uEndChannel)
-          && pSoundList->pSounds[pMixerChannels[i].uSourceTrackIdx].eType != SOUND_DESC_SYSTEM)//все, кроме системных звуков, отключаются
+          && pSoundList->pSL_Sounds[pMixerChannels[i].uSourceTrackIdx].eType != SOUND_DESC_SYSTEM)//все, кроме системных звуков, отключаются
         {
           AIL_end_sample(pMixerChannels[i].hSample);
           FreeChannel(&pMixerChannels[i]);
@@ -2495,14 +2520,14 @@
   int num_playing_channels; // [sp+4Ch] [bp-8h]@5
   //int v16; // [sp+50h] [bp-4h]@5
 
-  if (!pSoundList->pSounds)
+  if (!pSoundList->pSL_Sounds)
     return;
  
     //v4 = &pSoundList->pSounds[pChannel->uSourceTrackIdx];
-    if ( pSoundList->pSounds[pChannel->uSourceTrackIdx].eType == SOUND_DESC_SWAP)
+    if ( pSoundList->pSL_Sounds[pChannel->uSourceTrackIdx].eType == SOUND_DESC_SWAP)
     {
-      if ( pSoundList->pSounds[pChannel->uSourceTrackIdx].pSoundData[0] && 
-          !(pSoundList->pSounds[pChannel->uSourceTrackIdx].uFlags & SOUND_DESC_SYSTEM) )
+      if ( pSoundList->pSL_Sounds[pChannel->uSourceTrackIdx].pSoundData[0] && 
+          !(pSoundList->pSL_Sounds[pChannel->uSourceTrackIdx].uFlags & SOUND_DESC_SYSTEM) )
       {
         num_playing_channels = 0;
         num_same_sound_on_channels = 0;
@@ -2550,12 +2575,12 @@
   int v14; // [sp+4Ch] [bp-8h]@5
   int v15; // [sp+50h] [bp-4h]@5
 
-  if ( pSoundList->pSounds )
+  if ( pSoundList->pSL_Sounds )
   {
     //v4 = &pSoundList->pSounds[a2->field_8];
-    if ( pSoundList->pSounds[a2->field_8].eType == SOUND_DESC_SWAP)
+    if ( pSoundList->pSL_Sounds[a2->field_8].eType == SOUND_DESC_SWAP)
     {
-      if ( pSoundList->pSounds[a2->field_8].p3DSound && !(pSoundList->pSounds[a2->field_8].uFlags & SOUND_DESC_SYSTEM) )
+      if ( pSoundList->pSL_Sounds[a2->field_8].p3DSound && !(pSoundList->pSL_Sounds[a2->field_8].uFlags & SOUND_DESC_SYSTEM) )
       {
         v5 = this->uNum3DSamples == 0;
         v6 = this->uNum3DSamples < 0;
--- a/AudioPlayer.h	Sat Dec 21 23:33:36 2013 +0600
+++ b/AudioPlayer.h	Mon Dec 23 00:48:53 2013 +0600
@@ -165,7 +165,7 @@
   void SetMusicVolume(int vol);
   void SetMasterVolume(float fVolume);
   void _4AA258(int a2);
-  void PlaySound(SoundID eSoundID, signed int a3, unsigned int uNumRepeats, signed int a5, signed int a6, int a7, unsigned int uVolume, int sPlaybackRate);
+  void PlaySound(SoundID eSoundID, signed int a3, unsigned int uNumRepeats, signed int a5, signed int a6, int a7, float uVolume, int sPlaybackRate);
   void UpdateSounds();
   void StopChannels(int uStartChannel, int uEndChannel);
   void LoadAudioSnd();
@@ -281,7 +281,7 @@
 struct SoundList
 {
   inline SoundList():
-    sNumSounds(0), pSounds(nullptr), uTotalLoadedSoundSize(0)
+    sNumSounds(0), pSL_Sounds(nullptr), uTotalLoadedSoundSize(0)
   {}
 
   void Initialize();
@@ -295,7 +295,7 @@
   int FromFileTxt(const char *Args);
 
   signed int sNumSounds;
-  SoundDesc *pSounds;
+  SoundDesc *pSL_Sounds;
   unsigned int uTotalLoadedSoundSize;
 };
 #pragma pack(pop)
--- a/Game.cpp	Sat Dec 21 23:33:36 2013 +0600
+++ b/Game.cpp	Mon Dec 23 00:48:53 2013 +0600
@@ -1888,35 +1888,35 @@
         case UIMSG_ToggleTint:
           pRenderer->bTinting = pRenderer->bTinting == 0;
           continue;
-        case UIMSG_ChangeMusicVolume:
-          if ( uMessageParam == 4 )
+        case UIMSG_ChangeMusicVolume:  //громкость музыки
+          if ( uMessageParam == 4 )//кнопка понижения
           {
             --uMusicVolimeMultiplier;
             if ( (char)uMusicVolimeMultiplier < 1 )
               uMusicVolimeMultiplier = 0;
-            GUIWindow::Create(243, 0xD8u, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderLeft, (char *)1);
-            if ( uMusicVolimeMultiplier )
-              pAudioPlayer->PlaySound(SOUND_Bell, -1, 0, -1, 0, 0, pSoundVolumeLevels[(char)uMusicVolimeMultiplier] * 64.0f, 0);
-            pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[(char)uMusicVolimeMultiplier] * 64.0f);
+            GUIWindow::Create(243, 216, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderLeft, (char *)1);
+            //if ( uMusicVolimeMultiplier )
+              pAudioPlayer->PlaySound(SOUND_Bell, -1, 0, -1, 0, 0, pSoundVolumeLevels[uMusicVolimeMultiplier] * 128.0f, 0);
+            pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[uMusicVolimeMultiplier] * 128.0f);
             continue;
           }
-          if ( uMessageParam == 5 )
+          if ( uMessageParam == 5 )//кнопка повышения
           {
             ++uMusicVolimeMultiplier;
             if ( (char)uMusicVolimeMultiplier > 9 )
               uMusicVolimeMultiplier = 9;
-            GUIWindow::Create(435, 0xD8u, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderRight, (char *)1);
+            GUIWindow::Create(435, 216, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderRight, (char *)1);
             if ( uMusicVolimeMultiplier )
-              pAudioPlayer->PlaySound(SOUND_Bell, -1, 0, -1, 0, 0, pSoundVolumeLevels[(char)uMusicVolimeMultiplier] * 64.0f, 0);
-            pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[(char)uMusicVolimeMultiplier] * 64.0f);
+              pAudioPlayer->PlaySound(SOUND_Bell, -1, 0, -1, 0, 0, pSoundVolumeLevels[uMusicVolimeMultiplier] * 128.0f, 0);
+            pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[uMusicVolimeMultiplier] * 128.0f);
             continue;
           }
-          uMusicVolimeMultiplier = (pMouse->GetCursorPos(&v202)->x - 263) / 17;
+          uMusicVolimeMultiplier = (pMouse->GetCursorPos(&v202)->x - 263) / 17;//для задания громкости мышкой
           if ( (char)uMusicVolimeMultiplier > 9 )
             uMusicVolimeMultiplier = 9;
           if ( uMusicVolimeMultiplier )
-            pAudioPlayer->PlaySound(SOUND_Bell, -1, 0, -1, 0, 0, pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f, 0);
-          pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f);
+            pAudioPlayer->PlaySound(SOUND_Bell, -1, 0, -1, 0, 0, pSoundVolumeLevels[uMusicVolimeMultiplier] * 128.0f, 0);
+          pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[uMusicVolimeMultiplier] * 128.0f);
           continue;
         case UIMSG_ChangeSoundVolume:
           if ( uMessageParam == 4 )//reduce sound level button left
--- a/Player.cpp	Sat Dec 21 23:33:36 2013 +0600
+++ b/Player.cpp	Mon Dec 23 00:48:53 2013 +0600
@@ -579,11 +579,11 @@
       {
         for (int i = 0; i < pSoundList->sNumSounds; i++)
         {
-          if (pSoundList->pSounds[i].uSoundID == pickedSoundID)
+          if (pSoundList->pSL_Sounds[i].uSoundID == pickedSoundID)
             pSoundID = i;
         }
       }
-      if ( pSoundList->pSounds[pSoundID].pSoundData[0] )
+      if ( pSoundList->pSL_Sounds[pSoundID].pSoundData[0] )
         expressionDuration = (sLastTrackLengthMS << 7) / 1000;
     }
     PlayEmotion(expression, expressionDuration);
--- a/SaveLoad.cpp	Sat Dec 21 23:33:36 2013 +0600
+++ b/SaveLoad.cpp	Mon Dec 23 00:48:53 2013 +0600
@@ -76,14 +76,14 @@
     for (uint i = 0; i < 4; ++i)
     {
       for (uint j = 0; j < pSoundList->sNumSounds; ++j)
-        if (pSoundList->pSounds[j].uSoundID == 2 * (SoundSetAction[24][0] + 50 * pParty->pPlayers[i].uVoiceID) + 4998)
+        if (pSoundList->pSL_Sounds[j].uSoundID == 2 * (SoundSetAction[24][0] + 50 * pParty->pPlayers[i].uVoiceID) + 4998)
         {
           pSoundList->UnloadSound(j, 1);
           break;
         }
 
         for (uint j = 0; j < pSoundList->sNumSounds; ++j)
-        if (pSoundList->pSounds[j].uSoundID == 2 * (SoundSetAction[24][0] + 50 * pParty->pPlayers[i].uVoiceID) + 4999)
+        if (pSoundList->pSL_Sounds[j].uSoundID == 2 * (SoundSetAction[24][0] + 50 * pParty->pPlayers[i].uVoiceID) + 4999)
         {
           pSoundList->UnloadSound(j, 1);
           break;
--- a/mm7_4.cpp	Sat Dec 21 23:33:36 2013 +0600
+++ b/mm7_4.cpp	Mon Dec 23 00:48:53 2013 +0600
@@ -252,7 +252,7 @@
       }
       else
       {
-        v2 = (char *)&pSoundList->pSounds->uSoundID;
+        v2 = (char *)&pSoundList->pSL_Sounds->uSoundID;
         while ( *(int *)v2 != 2 * (SoundSetAction[24][0] + 50 * v0->uVoiceID) + 4998 )
         {
           ++v1;
@@ -271,7 +271,7 @@
       }
       else
       {
-        v5 = (char *)&pSoundList->pSounds->uSoundID;
+        v5 = (char *)&pSoundList->pSL_Sounds->uSoundID;
         while ( *(int *)v5 != 2 * (SoundSetAction[24][0] + 50 * v0->uVoiceID) + 4999 )
         {
           ++v4;