protected override bool OnInitialize()
        {
            Int24 *data = Data;

            _name     = String.Format("ColorEnv{0}", _stage);
            _rawValue = data->Value;
            getValues();
            return(false);
        }
Beispiel #2
0
        protected override bool OnInitialize()
        {
            Int24 *data = Data;

            _name     = String.Format("CMD{0}", _stage);
            _rawValue = data->Value;
            getValues();

            if (_rawValue != 0)
            {
                Console.WriteLine("Shader" + Parent.Parent.Index + " - Struct" + Parent.Index + " - CMD" + _stage + "'s raw value is not 0! ");
            }
            return(false);
        }
Beispiel #3
0
        private unsafe void ProcessInt24Samples()
        {
            int num = this._messageSize / 6;

            if (this._iqBuffer == null || this._iqBuffer.Length != num)
            {
                this._iqBuffer = UnsafeBuffer.Create(num, sizeof(Complex));
            }
            Int24 *  ptr  = (Int24 *)(void *)this._messageBuffer;
            Complex *ptr2 = (Complex *)(void *)this._iqBuffer;

            for (int i = 0; i < num; i++)
            {
                Complex *intPtr = ptr2 + i;
                Int24 *  ptr3   = ptr;
                ptr          = ptr3 + 1;
                intPtr->Real = (float)(*ptr3) * 1.1920929E-07f;
                Complex *intPtr2 = ptr2 + i;
                ptr3          = ptr;
                ptr           = ptr3 + 1;
                intPtr2->Imag = (float)(*ptr3) * 1.1920929E-07f;
            }
            this.PushIQData(ptr2, num);
        }
Beispiel #4
0
 private unsafe void FillIQ(Complex *iqPtr, int length)
 {
     if (this._isPCM)
     {
         if (this._blockAlign == 6)
         {
             Int24 *ptr = (Int24 *)this._tempPtr;
             for (int i = 0; i < length; i++)
             {
                 Complex *intPtr  = iqPtr;
                 Int24 *  intPtr2 = ptr;
                 ptr          = intPtr2 + 1;
                 intPtr->Real = (float)(*intPtr2) * 1.1920929E-07f;
                 Complex *intPtr3 = iqPtr;
                 Int24 *  intPtr4 = ptr;
                 ptr           = intPtr4 + 1;
                 intPtr3->Imag = (float)(*intPtr4) * 1.1920929E-07f;
                 iqPtr++;
             }
         }
         else if (this._blockAlign == 4)
         {
             short *ptr2 = (short *)this._tempPtr;
             for (int j = 0; j < length; j++)
             {
                 Complex *intPtr5 = iqPtr;
                 short *  intPtr6 = ptr2;
                 ptr2          = intPtr6 + 1;
                 intPtr5->Real = (float)(*intPtr6) * 3.051851E-05f;
                 Complex *intPtr7 = iqPtr;
                 short *  intPtr8 = ptr2;
                 ptr2          = intPtr8 + 1;
                 intPtr7->Imag = (float)(*intPtr8) * 3.051851E-05f;
                 iqPtr++;
             }
         }
         else if (this._blockAlign == 2)
         {
             byte *ptr3 = this._tempPtr;
             for (int k = 0; k < length; k++)
             {
                 Complex *intPtr9  = iqPtr;
                 byte *   intPtr10 = ptr3;
                 ptr3          = intPtr10 + 1;
                 intPtr9->Real = (float)(*intPtr10 - 128) * 0.0078125f;
                 Complex *intPtr11 = iqPtr;
                 byte *   intPtr12 = ptr3;
                 ptr3           = intPtr12 + 1;
                 intPtr11->Imag = (float)(*intPtr12 - 128) * 0.0078125f;
                 iqPtr++;
             }
         }
     }
     else
     {
         float *ptr4 = (float *)this._tempPtr;
         for (int l = 0; l < length; l++)
         {
             Complex *intPtr13 = iqPtr;
             float *  intPtr14 = ptr4;
             ptr4           = intPtr14 + 1;
             intPtr13->Real = *intPtr14;
             Complex *intPtr15 = iqPtr;
             float *  intPtr16 = ptr4;
             ptr4           = intPtr16 + 1;
             intPtr15->Imag = *intPtr16;
             iqPtr++;
         }
     }
 }
Beispiel #5
0
        protected internal override void OnRebuild(VoidPtr address, int length, bool force)
        {
            Int24 *val = (Int24 *)address;

            *val = new Int24(_rawValue);
        }
Beispiel #6
0
 private unsafe void FillIQ(Complex *iqPtr, int length)
 {
     if (this._isPCM)
     {
         if (this._blockAlign == 6)
         {
             Int24 *ptr = (Int24 *)this._tempPtr;
             for (int i = 0; i < length; i++)
             {
                 Complex *intPtr  = iqPtr;
                 Int24 *  intPtr2 = ptr;
                 ptr          = intPtr2 + 1;
                 intPtr->Real = (float)(*intPtr2) * 1.192093E-07f;
                 Complex *intPtr3 = iqPtr;
                 Int24 *  intPtr4 = ptr;
                 ptr           = intPtr4 + 1;
                 intPtr3->Imag = (float)(*intPtr4) * 1.192093E-07f;
                 iqPtr++;
             }
         }
         else if (this._blockAlign == 4)
         {
             short *ptr2 = (short *)this._tempPtr;
             for (int j = 0; j < length; j++)
             {
                 Complex *intPtr5 = iqPtr;
                 float *  lut     = WaveFile._lut16;
                 short *  intPtr6 = ptr2;
                 ptr2          = intPtr6 + 1;
                 intPtr5->Real = lut[*intPtr6 + 32768];
                 Complex *intPtr7 = iqPtr;
                 float *  lut2    = WaveFile._lut16;
                 short *  intPtr8 = ptr2;
                 ptr2          = intPtr8 + 1;
                 intPtr7->Imag = lut2[*intPtr8 + 32768];
                 iqPtr++;
             }
         }
         else if (this._blockAlign == 2)
         {
             byte *ptr3 = this._tempPtr;
             for (int k = 0; k < length; k++)
             {
                 Complex *intPtr9  = iqPtr;
                 float *  lutu     = WaveFile._lutu8;
                 byte *   intPtr10 = ptr3;
                 ptr3          = intPtr10 + 1;
                 intPtr9->Real = lutu[(int)(*intPtr10)];
                 Complex *intPtr11 = iqPtr;
                 float *  lutu2    = WaveFile._lutu8;
                 byte *   intPtr12 = ptr3;
                 ptr3           = intPtr12 + 1;
                 intPtr11->Imag = lutu2[(int)(*intPtr12)];
                 iqPtr++;
             }
         }
     }
     else
     {
         float *ptr4 = (float *)this._tempPtr;
         for (int l = 0; l < length; l++)
         {
             Complex *intPtr13 = iqPtr;
             float *  intPtr14 = ptr4;
             ptr4           = intPtr14 + 1;
             intPtr13->Real = *intPtr14;
             Complex *intPtr15 = iqPtr;
             float *  intPtr16 = ptr4;
             ptr4           = intPtr16 + 1;
             intPtr15->Imag = *intPtr16;
             iqPtr++;
         }
     }
 }
Beispiel #7
0
        private unsafe static void extIOCallback(int count, int status, float iqOffs, IntPtr dataPtr)
        {
            if (count >= 0 && ExtIO._isHWStarted)
            {
                if (ExtIO._iqPtr != null)
                {
                    int length = ExtIO._iqBuffer.Length;
                    if (ExtIO._hwType == HWTypes.Aud16BInt || ExtIO._hwType == HWTypes.Sdr14)
                    {
                        short *ptr = (short *)(void *)dataPtr;
                        for (int i = 0; i < length; i++)
                        {
                            Complex *intPtr  = ExtIO._iqPtr + i;
                            short *  intPtr2 = ptr;
                            ptr          = intPtr2 + 1;
                            intPtr->Imag = (float)(*intPtr2) * 3.051851E-05f;
                            Complex *intPtr3 = ExtIO._iqPtr + i;
                            short *  intPtr4 = ptr;
                            ptr           = intPtr4 + 1;
                            intPtr3->Real = (float)(*intPtr4) * 3.051851E-05f;
                        }
                    }
                    else if (ExtIO._hwType == HWTypes.Aud24BInt)
                    {
                        Int24 *ptr2 = (Int24 *)(void *)dataPtr;
                        for (int j = 0; j < length; j++)
                        {
                            Complex *intPtr5 = ExtIO._iqPtr + j;
                            Int24 *  intPtr6 = ptr2;
                            ptr2          = intPtr6 + 1;
                            intPtr5->Imag = (float)(*intPtr6) * 1.1920929E-07f;
                            Complex *intPtr7 = ExtIO._iqPtr + j;
                            Int24 *  intPtr8 = ptr2;
                            ptr2          = intPtr8 + 1;
                            intPtr7->Real = (float)(*intPtr8) * 1.1920929E-07f;
                        }
                    }
                    else if (ExtIO._hwType == HWTypes.Aud32BInt)
                    {
                        int *ptr3 = (int *)(void *)dataPtr;
                        for (int k = 0; k < length; k++)
                        {
                            Complex *intPtr9  = ExtIO._iqPtr + k;
                            int *    intPtr10 = ptr3;
                            ptr3          = intPtr10 + 1;
                            intPtr9->Imag = (float)(*intPtr10) * 4.656613E-10f;
                            Complex *intPtr11 = ExtIO._iqPtr + k;
                            int *    intPtr12 = ptr3;
                            ptr3           = intPtr12 + 1;
                            intPtr11->Real = (float)(*intPtr12) * 4.656613E-10f;
                        }
                    }
                    else if (ExtIO._hwType == HWTypes.Aud32BFloat)
                    {
                        float *ptr4 = (float *)(void *)dataPtr;
                        for (int l = 0; l < length; l++)
                        {
                            Complex *intPtr13 = ExtIO._iqPtr + l;
                            float *  intPtr14 = ptr4;
                            ptr4           = intPtr14 + 1;
                            intPtr13->Imag = *intPtr14;
                            Complex *intPtr15 = ExtIO._iqPtr + l;
                            float *  intPtr16 = ptr4;
                            ptr4           = intPtr16 + 1;
                            intPtr15->Real = *intPtr16;
                        }
                    }
                    if (ExtIO.SamplesAvailable != null)
                    {
                        ExtIO.SamplesAvailable(null, ExtIO._iqPtr, length);
                    }
                }
            }
            else if (status > 0)
            {
                int num = 0;
                switch (status)
                {
                case 100:
                    ExtIO.logInfo("Status 100, SRChanged");
                    num = ExtIO.GetHWSR();
                    if (ExtIO.SampleRateChanged != null)
                    {
                        ExtIO.SampleRateChanged(num);
                    }
                    break;

                case 101:
                    ExtIO.logInfo("Status 101, LOFreqChanged");
                    num = ExtIO.GetHWLO();
                    if (ExtIO.LOFreqChanged != null && num > 0)
                    {
                        ExtIO.LOFreqChanged(num);
                    }
                    break;

                case 102:
                    ExtIO.logInfo("Status 102, ProhibitLO");
                    if (ExtIO.ProhibitLOChanged != null)
                    {
                        ExtIO.ProhibitLOChanged();
                    }
                    break;

                case 103:
                    ExtIO.logInfo("Status 103, LOChangeOK");
                    if (ExtIO.LOFreqChangedAccepted != null)
                    {
                        ExtIO.LOFreqChangedAccepted();
                    }
                    break;

                case 104:
                    ExtIO.logInfo("Status 104, LOChangedNoTune");
                    num = ExtIO.GetHWLO();
                    if (ExtIO.LOFreqChanged != null && num > 0)
                    {
                        ExtIO.LOFreqChanged(num);
                    }
                    break;

                case 105:
                    ExtIO.logInfo("Status 105, TuneChanged");
                    num = ExtIO.GetTune();
                    if (ExtIO.TuneFreqChanged != null && num > 0)
                    {
                        ExtIO.TuneFreqChanged(num);
                    }
                    break;

                case 106:
                    ExtIO.logInfo("Status 106, DemodChange");
                    break;

                case 107:
                    ExtIO.logInfo("Status 107, RsqStart");
                    break;

                case 108:
                    ExtIO.logInfo("Status 108, RsqStop");
                    break;

                case 109:
                    ExtIO.logInfo("FiltChange (109)");
                    break;

                default:
                    ExtIO.logInfo("Unknown status " + status.ToString() + " received from DLL.");
                    break;
                }
            }
        }