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