Exemple #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="Type"></param>
        /// <param name="ON"></param>
        public override void EnciendeLed(CORESIP_SndDevType Type, byte ON)
        {
            switch (Type)
            {
            case CORESIP_SndDevType.CORESIP_SND_LC_SPEAKER:
                if (_dev4_alt != null)
                {
                    _dev4_alt.SetGpio(4, ON);
                }
                break;

            case CORESIP_SndDevType.CORESIP_SND_RD_SPEAKER:
                if (_dev3_alr != null)
                {
                    _dev3_alr.SetGpio(4, ON);
                }
                break;

            case CORESIP_SndDevType.CORESIP_SND_HF_SPEAKER:
                if (_dev3_alr != null)
                {
                    _dev3_alr.SetGpio(5, ON);
                }
                break;

            default:
                _Logger.Error("SimCMediaHwManager.EnciendeLed. Tipo Altavoz No Soportado: {0}", Type);
                break;
            }
        }
        /// <summary>
        ///
        /// </summary>
        static public void LoadChannels()
        {
            int _nchannel = 0;

            _input_channels.Clear();
            _output_channels.Clear();

            AsioChannels.Init();
            foreach (String name in AsioChannels.InChannels)
            {
                /** Identificar el tipo por el nombre */
                CORESIP_SndDevType tipo = GetTipoIn(name);
                _input_channels[tipo] = _nchannel++;
                _Logger.Debug("Encontrado Canal de Audio. Entrada {0}: {1} = {2}", _nchannel, tipo, name);
            }

            _nchannel = 0;
            foreach (String name in AsioChannels.OutChannels)
            {
                /** Identificar el tipo por el nombre */
                CORESIP_SndDevType tipo = GetTipoOut(name); // _tipos[_index_tipos++];
                _output_channels[tipo] = _nchannel++;
                _Logger.Debug("Encontrado Canal de Audio. Salida {0}: {1} = {2}", _nchannel, tipo, name);
            }
        }
Exemple #3
0
        /// <summary>
        ///
        /// </summary>
        static public void LoadChannels()
        {
            int _nchannel = 0;

            _input_channels.Clear();
            _output_channels.Clear();

            AsioChannels.Init();
            foreach (String name in AsioChannels.InChannels)
            {
                CORESIP_SndDevType tipo = GetTipoIn(name);
                _input_channels[_nchannel++] = new DevData {
                    TipoDev = tipo, AsioName = name
                };
                _Logger.Info("Encontrado Canal de Audio. Entrada {0}: {1} = {2}", _nchannel, tipo, name);
            }

            _nchannel = 0;
            foreach (String name in AsioChannels.OutChannels)
            {
                /** Identificar el tipo por el nombre */
                CORESIP_SndDevType tipo = GetTipoOut(name); // _tipos[_index_tipos++];
                _output_channels[_nchannel++] = new DevData {
                    TipoDev = tipo, AsioName = name
                };
                _Logger.Info("Encontrado Canal de Audio. Salida {0}: {1} = {2} {3}", _nchannel, tipo, name, AsioChannels.SampleRate);
            }
        }
        /// <summary>
        /// AGL-REC.... (2)
        /// </summary>
        /// <param name="who"></param>
        /// <param name="rec"></param>
        internal void Rec(CORESIP_SndDevType who, bool rec)
        {
#if _AUDIOGENERIC_
            /** AGL.CMEDIA */
            ISndDevIO snd;
#else
            SndDev snd;
#endif

            if (LstDispositivos == null)
            {
                return;
            }

            // Poner la Salida de Grabación.
            if (LstDispositivos.TryGetValue(who, out snd))
#if _AUDIOGENERIC_
            { snd.SenGrabacion(rec); }
#else
            { snd.SetGpio(HwManager.OUT_GRABACION, rec ? HwManager.ON : HwManager.OFF); }
#endif
            // Gestión para añadir o quitar el dispositivo a la mezcla de grabacion.
            if (rec && NumRecordingByDevice[(int)who] == 0)
            {
                NumRecordingByDevice[(int)who] = 1;
                Top.Mixer.LinkRecord(who, rec);
            }
            else if (!rec && NumRecordingByDevice[(int)who] == 1)
            {
                NumRecordingByDevice[(int)who] = 0;
                Top.Mixer.LinkRecord(who, rec);
            }
        }
 /// <summary>
 ///
 /// </summary>
 /// <param name="tipo"></param>
 /// <returns></returns>
 static private int GetInputChannelFor(CORESIP_SndDevType tipo)
 {
     if (_input_channels.ContainsKey(tipo))
     {
         return(_input_channels[tipo]);
     }
     _Logger.Fatal("No encontrado AUDIO InputChannel para {0}", tipo);
     return(-1);
 }
        /// <summary>
        /// BIT 0/1/2.
        /// </summary>
        /// <param name="_data"></param>
        /// <returns></returns>
        private CORESIP_SndDevType HidType(byte _data)
        {
            int tipo = (_data >> 2) & 0x03; // (_data & 0x0C) >> 2;
            CORESIP_SndDevType _tipo = tipo == 0 ? CORESIP_SndDevType.CORESIP_SND_ALUMN_MHP :
                                       tipo == 1 ? CORESIP_SndDevType.CORESIP_SND_INSTRUCTOR_MHP :
                                       tipo == 2 ? CORESIP_SndDevType.CORESIP_SND_RD_SPEAKER :
                                       tipo == 3 ? CORESIP_SndDevType.CORESIP_SND_LC_SPEAKER : CORESIP_SndDevType.CORESIP_SND_UNKNOWN;

            _Logger.Debug("HidCMediaSndDev.HidType ({0})-->({1})-->({2})", _data, tipo, _tipo);
            return(_tipo);
        }
Exemple #7
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="tipo"></param>
 /// <param name="current"></param>
 /// <returns></returns>
 static public bool Supervisa(CORESIP_SndDevType tipo, bool current)
 {
     foreach (KeyValuePair <CORESIP_SndDevType, bool> par in Estado)
     {
         if (tipo == par.Key && current != par.Value)
         {
             Estado[tipo] = current;
             return(true);
         }
     }
     return(false);
 }
Exemple #8
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="tipo"></param>
        /// <returns></returns>
        static private int GetOutputChannelFor(CORESIP_SndDevType tipo)
        {
            foreach (KeyValuePair <int, DevData> par in _output_channels)
            {
                if (par.Value.TipoDev == tipo)
                {
                    return(par.Key);
                }
            }

            _Logger.Fatal("No encontrado AUDIO OutputChannel para {0}", tipo);
            return(-1);
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="_enabled"></param>
        /// <param name="tipo"></param>
        /// <returns></returns>
        static public int AddDevice(bool _enabled, CORESIP_SndDevType tipo, CMediaDevMode mode)
        {
            int _device = -1;

            if (_enabled)
            {
                int _channel_in  = mode != CMediaDevMode.Output ? GetInputChannelFor(tipo) : -1;
                int _channel_out = mode != CMediaDevMode.Input ? GetOutputChannelFor(tipo) : -1;

                _device = SipAgent.AddSndDevice(tipo, _channel_in, _channel_out);
                _Logger.Debug("Agregado Dispositivo de sonido ({0}) = {1:X}: IN:{2},OUT:{3}", tipo, _device, _channel_in, _channel_out);
            }
            return(_device);
        }
Exemple #10
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="_enabled"></param>
        /// <param name="tipo"></param>
        /// <returns></returns>
        static public int AddDevice(bool _enabled, CORESIP_SndDevType tipo)
        {
            int _device = -1;

            if (_enabled)
            {
                int _channel_in  = tipo == CORESIP_SndDevType.CORESIP_SND_INSTRUCTOR_MHP || tipo == CORESIP_SndDevType.CORESIP_SND_ALUMN_MHP ? GetInputChannelFor(tipo) : -1;
                int _channel_out = GetOutputChannelFor(tipo);

                _device = SipAgent.AddSndDevice(tipo, _channel_in, _channel_out);
                _Logger.Info("Agregado Dispositivo de sonido ({0}) = {1:X}: IN:{2},OUT:{3}", tipo, _device, _channel_in, _channel_out);
            }
            return(_device);
        }
Exemple #11
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="_enabled"></param>
 /// <param name="tipo"></param>
 /// <returns></returns>
 static public int AddDevice(bool _enabled, CORESIP_SndDevType tipo, CMediaDevMode mode)
 {
     return(-1);
 }