예제 #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();
 }