コード例 #1
0
ファイル: TestSettings.cs プロジェクト: riswey/TwinLogger
        public void IsFindingDevices()
        {
            Caio aio = new Caio();

            List <DEVICEID> devices = new List <DEVICEID>();

            string device_name = "Aio00";

            long     ret = 1;
            DEVICEID id1 = 0;
            string   full_device_name;

            for (int i = 0; i < 10; i++)
            {
                full_device_name = device_name + i;
                ret = aio.Init(full_device_name, out id1);
                if (ret == 0)
                {
                    devices.Add(id1);
                }
            }
            aio = null;

            Assert.IsTrue(devices.Count == 2);
        }
コード例 #2
0
ファイル: BasicPlayer.cs プロジェクト: TheDizzler/DJMixer
        /// <summary>
        /// Called from main form when selecting Wave Out device.
        /// </summary>
        /// <param name="waveOutDeviceNumber"></param>
        public void setWaveOut(int waveOutDeviceNumber)
        {
            deviceOutID = DEVICEID.WAVEOUT;
            WaveOut waveOut;


            if (deviceOut != null)
            {
                deviceOut.PlaybackStopped -= loadNextSong;
                if (deviceOut.PlaybackState == PlaybackState.Playing)
                {
                    Debug.WriteLine("wave out playing");
                    deviceOut.Pause();
                    waveOut = new WaveOut();
                    waveOut.DeviceNumber = waveOutDeviceNumber;
                    if (postVolumeMeter != null)
                    {
                        waveOut.Init(postVolumeMeter);
                    }
                    waveOut.Play();
                    changedDevice = false;
                }
                else
                {
                    Debug.WriteLine("wave out NOT playing");
                    waveOut = new WaveOut();
                    waveOut.DeviceNumber = waveOutDeviceNumber;
                    if (postVolumeMeter != null)
                    {
                        waveOut.Init(postVolumeMeter);
                    }
                    if (deviceOut.PlaybackState == PlaybackState.Paused)
                    {
                        changedDevice = true;
                    }
                }

                deviceOut.Dispose();
            }
            else
            {
                //Debug.WriteLine("device null");
                waveOut = new WaveOut();
                waveOut.DeviceNumber = waveOutDeviceNumber;
                changedDevice        = false;
            }

            waveOut.PlaybackStopped += loadNextSong;

            deviceOut = waveOut;
        }
コード例 #3
0
ファイル: BasicPlayer.cs プロジェクト: TheDizzler/DJMixer
        /// <summary>
        /// Called from main form when selecting Direct Sound device.
        /// </summary>
        /// <param name="guid"></param>
        public void setGUID(Guid guid)
        {
            deviceOutID = DEVICEID.DIRECTSOUND;

            DirectSoundOut directSoundOut;

            if (deviceOut != null)
            {
                deviceOut.PlaybackStopped -= loadNextSong;
                if (deviceOut.PlaybackState == PlaybackState.Playing)
                {
                    deviceOut.Pause();
                    directSoundOut = new DirectSoundOut(guid);
                    if (postVolumeMeter != null)
                    {
                        directSoundOut.Init(postVolumeMeter);
                    }
                    directSoundOut.Play();
                    changedDevice = false;
                }
                else
                {
                    directSoundOut = new DirectSoundOut(guid);
                    if (postVolumeMeter != null)
                    {
                        directSoundOut.Init(postVolumeMeter);
                    }
                    if (deviceOut.PlaybackState == PlaybackState.Paused)
                    {
                        changedDevice = true;
                    }
                }
                deviceOut.Dispose();
            }
            else
            {
                directSoundOut = new DirectSoundOut(guid);
                changedDevice  = false;
            }

            directSoundOut.PlaybackStopped += loadNextSong;

            deviceOut = directSoundOut;
        }
コード例 #4
0
        internal bool SendAsync(DEVICEID destination,
                                byte[] eventCode   = null,
                                byte[] payload     = null,
                                BTCOMMANDTYPE type = BTCOMMANDTYPE.Normal,
                                BTWAITCOMMANDRESPONSETYPE sendRemark = BTWAITCOMMANDRESPONSETYPE.WAIT_BTAPIRESPONSE,
                                UInt32 cmdRemark    = 0xffffffff,
                                Action failCallback = null)
        {
            byte[] sendData;

            if (eventCode == null && payload == null)
            {
                sendData = new byte[8];

                sendData[6] = 0x00;
                sendData[7] = 0x00;
            }
            else
            {
                if (eventCode.Length > (255 - 8))
                {
                    return(false);
                }

                if (payload == null)
                {
                    sendData = new byte[8 + eventCode.Length];

                    Array.Copy(eventCode, 0, sendData, 8, eventCode.Length);

                    sendData[2] = (byte)eventCode.Length;
                }
                else
                {
                    if ((eventCode.Length + payload.Length) > (255 - 8))
                    {
                        return(false);
                    }

                    sendData = new byte[8 + eventCode.Length + payload.Length];

                    Array.Copy(eventCode, 0, sendData, 8, eventCode.Length);
                    Array.Copy(payload, 0, sendData, 8 + eventCode.Length, payload.Length);

                    sendData[2] = (byte)(eventCode.Length + payload.Length);
                }
            }

            sendData[0] = 0xa7;
            sendData[1] = 0xb3; // (byte)((connection == 0) ? 0xb3 : 0xe6);
            sendData[3] = (byte)destination;
            sendData[4] = 0x82;
            sendData[5] = 0x37;
            sendData[6] = 0x00;
            sendData[7] = 0x00;

            SENDBUFFER sendItem = new SENDBUFFER();

            sendItem.type             = type;
            sendItem.packetData       = sendData;
            sendItem.cmdRemark        = cmdRemark;
            sendItem.dataRemark       = sendRemark;
            sendItem.sendFailCallback = failCallback;

            _sendBuffer.Add(sendItem);
            BLERWEngineTimer();

            return(true);
        }
コード例 #5
0
ファイル: BasicPlayer.cs プロジェクト: TheDizzler/DJMixer
        /// <summary>
        /// Called from main form when selecting Direct Sound device.
        /// </summary>
        /// <param name="guid"></param>
        public void setGUID(Guid guid)
        {
            deviceOutID = DEVICEID.DIRECTSOUND;

            DirectSoundOut directSoundOut;

            if (deviceOut != null) {

                deviceOut.PlaybackStopped -= loadNextSong;
                if (deviceOut.PlaybackState == PlaybackState.Playing) {

                    deviceOut.Pause();
                    directSoundOut = new DirectSoundOut(guid);
                    if (postVolumeMeter != null)
                        directSoundOut.Init(postVolumeMeter);
                    directSoundOut.Play();
                    changedDevice = false;

                } else {

                    directSoundOut = new DirectSoundOut(guid);
                    if (postVolumeMeter != null)
                        directSoundOut.Init(postVolumeMeter);
                    if (deviceOut.PlaybackState == PlaybackState.Paused)
                        changedDevice = true;

                }
                deviceOut.Dispose();
            } else {
                directSoundOut = new DirectSoundOut(guid);
                changedDevice = false;

            }

            directSoundOut.PlaybackStopped += loadNextSong;

            deviceOut = directSoundOut;
        }
コード例 #6
0
ファイル: BasicPlayer.cs プロジェクト: TheDizzler/DJMixer
        /// <summary>
        /// Called from main form when selecting Wave Out device.
        /// </summary>
        /// <param name="waveOutDeviceNumber"></param>
        public void setWaveOut(int waveOutDeviceNumber)
        {
            deviceOutID = DEVICEID.WAVEOUT;
            WaveOut waveOut;

            if (deviceOut != null) {

                deviceOut.PlaybackStopped -= loadNextSong;
                if (deviceOut.PlaybackState == PlaybackState.Playing) {
                    Debug.WriteLine("wave out playing");
                    deviceOut.Pause();
                    waveOut = new WaveOut();
                    waveOut.DeviceNumber = waveOutDeviceNumber;
                    if (postVolumeMeter != null)
                        waveOut.Init(postVolumeMeter);
                    waveOut.Play();
                    changedDevice = false;

                } else {
                    Debug.WriteLine("wave out NOT playing");
                    waveOut = new WaveOut();
                    waveOut.DeviceNumber = waveOutDeviceNumber;
                    if (postVolumeMeter != null)
                        waveOut.Init(postVolumeMeter);
                    if (deviceOut.PlaybackState == PlaybackState.Paused)
                        changedDevice = true;

                }

                deviceOut.Dispose();
            } else {
                //Debug.WriteLine("device null");
                waveOut = new WaveOut();
                waveOut.DeviceNumber = waveOutDeviceNumber;
                changedDevice = false;
            }

            waveOut.PlaybackStopped += loadNextSong;

            deviceOut = waveOut;
        }