Пример #1
0
 public static void AudioSoundResume(object rawChannel, object rawResource, double volume, double pan)
 {
     SdlDotNet.Audio.Channel channel = (SdlDotNet.Audio.Channel)rawChannel;
     if (channel.IsPaused())
     {
         channel.Resume();
         AudioApplyVolumeAndPan(channel, volume, pan);
     }
 }
Пример #2
0
 public static int AudioSoundGetState(object rawChannel, object rawResource, int resourceId)
 {
     SdlDotNet.Audio.Channel channel = (SdlDotNet.Audio.Channel)rawChannel;
     if (channel.IsPlaying())
     {
         if (channel.IsPaused())
         {
             return(2);
         }
         return(1);
     }
     return(3);
 }
Пример #3
0
 public static object AudioSoundPlay(object rawRes, double volume, double pan)
 {
     SdlDotNet.Audio.Sound sfx = (SdlDotNet.Audio.Sound)rawRes;
     try
     {
         SdlDotNet.Audio.Channel channel = sfx.Play();
         AudioApplyVolumeAndPan(channel, volume, pan);
         return(channel);
     }
     catch (SdlDotNet.Core.SdlException)
     {
         return(null);
     }
 }
Пример #4
0
        public static void AudioSoundStop(object rawChannel, object rawResource, int resourceId, bool isActivelyPlaying, bool isHardStop)
        {
            SdlDotNet.Audio.Channel channel  = (SdlDotNet.Audio.Channel)rawChannel;
            SdlDotNet.Audio.Sound   resource = (SdlDotNet.Audio.Sound)rawResource;

            if (isHardStop)
            {
                channel.Stop();
            }
            else if (isActivelyPlaying)
            {
                channel.Pause();
            }
        }
Пример #5
0
        private void Init()
        {
            useSound = true;
            byte[] BeepData = new byte[Sharp8.Properties.Resources.beep.Length];
            Sharp8.Properties.Resources.beep.Read(BeepData, 0, (int)Sharp8.Properties.Resources.beep.Length);
            BeepSound = new SdlDotNet.Audio.Sound(BeepData);
            BeepChan  = BeepSound.Play(true);
            BeepChan.Pause();
            memory      = new MemoryHandler();
            registers   = new byte[0x10];
            RandGen     = new Random();
            surfaceOut  = Video.CreateRgbSurface(640, 320);
            PixelB      = Video.CreateRgbSurface(10, 10);
            PixelW      = Video.CreateRgbSurface(10, 10);
            SCHIPPixelB = Video.CreateRgbSurface(5, 5);
            SCHIPPixelW = Video.CreateRgbSurface(5, 5);
            PixelB.Fill(Color.Black);
            PixelW.Fill(Color.White);
            SCHIPPixelB.Fill(Color.Black);
            SCHIPPixelW.Fill(Color.White);
            ScreenData = new bool[128, 64];

            programStack = new Stack <ushort>(16);
        }
Пример #6
0
 private static void AudioApplyVolumeAndPan(SdlDotNet.Audio.Channel channel, double volume, double pan)
 {
     channel.Volume = (int)(255 * volume);
     // TODO: apply pan using channel.SetPanning(left, right);
 }