public SoundChannelViewModel(IntPtr owner, int deviceId, eSpeakerPan pan) : base(owner, deviceId, pan, 0) { this.PlayCommand = new RelayCommand(p => Play(), p => this.CanPlay); this.StopCommand = new RelayCommand(p => StopAndReset(), p => this.IsPlaying); this.PauseCommand = new RelayCommand(p => Stop(), p => this.IsPlaying); this.Timer = new System.Windows.Threading.DispatcherTimer(System.Windows.Threading.DispatcherPriority.Normal); this.Timer.Interval = new TimeSpan(0, 0, 1); this.Timer.Tick += OnTimer; this.Timer.IsEnabled = true; }
public SoundChannel(IntPtr owner, int devId, eSpeakerPan speakerPan, byte address) { _volume = MaxVolume; this.Address = address; this.SpeakerPan = speakerPan; this.DeviceId = devId; var devList = new DevicesCollection(); this.Device = new Device(devList[this.DeviceId].DriverGuid); this.Device.SetCooperativeLevel(owner, CooperativeLevel.Priority); }
public DSndManager(IntPtr owner, eSpeakerPan speakerPan) { m_Queue = new Queue <string>(); m_Thread = null; m_bWorking = false; _speakerPan = speakerPan; // Create Devices _devList = new DevicesCollection(); _devices = new Device[_devList.Count]; for (int i = 0; i < _devices.Length; i++) { _devices[i] = new Device(_devList[i].DriverGuid); _devices[i].SetCooperativeLevel(owner, CooperativeLevel.Priority); } _bufferDescription = new BufferDescription() { Flags = BufferDescriptionFlags.ControlVolume | BufferDescriptionFlags.ControlFrequency | BufferDescriptionFlags.ControlPan | BufferDescriptionFlags.GlobalFocus }; StartThread(); }