示例#1
0
 public void Resume(int channel = -1)
 {
     if (channel == MusicChannel)
     {
         SDL_mixer.Mix_ResumeMusic();
     }
     else
     {
         SDL_mixer.Mix_Resume(channel);
     }
 }
示例#2
0
文件: SDLSounds.cs 项目: Jebeli/Tiles
        public override void Update(FPoint pos)
        {
            lastPos = pos;
            List <int> cleanup = new List <int>();

            foreach (var it in playback)
            {
                int      channel = it.Key;
                Playback play    = it.Value;
                if (play.Finished)
                {
                    cleanup.Add(channel);
                    continue;
                }
                if (play.Location.X == 0 && play.Location.Y == 0)
                {
                    continue;
                }
                float v = CalcDist(pos, play.Location) / soundFallOff;
                if (play.Loop)
                {
                    if (v < 1.0f && play.Paused)
                    {
                        SDL_mixer.Mix_Resume(channel);
                        play.Paused = false;
                    }
                    else if (v > 1.0f && !play.Paused)
                    {
                        SDL_mixer.Mix_Pause(channel);
                        play.Paused = true;
                        continue;
                    }
                }
                v = Math.Min(Math.Max(v, 0.0f), 1.0f);
                byte dist = (byte)(255.0f * v);
                SetChannelPosition(channel, 0, dist);
            }
            while (cleanup.Count > 0)
            {
                int channel = cleanup[0];
                cleanup.RemoveAt(0);
                if (playback.TryGetValue(channel, out Playback play))
                {
                    playback.Remove(channel);
                    if (channels.TryGetValue(play.VirtualChannel, out int vcit))
                    {
                        channels.Remove(play.VirtualChannel);
                    }
                }
            }
        }
示例#3
0
文件: SDLSounds.cs 项目: Jebeli/Tiles
 public override void ResumeAll()
 {
     SDL_mixer.Mix_Resume(-1);
     SDL_mixer.Mix_ResumeMusic();
 }