コード例 #1
0
ファイル: Director.cs プロジェクト: mweechzing/Theory
 void Awake()
 {
     manager = new TheoryManager();
     FrequencyManager.GenerateFrequencies(12);
     clock = new MasterClock();
     synth = new Synthesizer();
 }
コード例 #2
0
        public void SetFrequencyFromOutside_DefaultConfig()
        {
            long             expectedFrequency = 438775000;
            long             gatheredFrequency = 0;
            FrequencyManager cut = new FrequencyManager();

            cut.RxFreqChanged += x => gatheredFrequency = x;
            cut.SetFreqFromOutside(expectedFrequency);
            Assert.AreEqual(expectedFrequency, gatheredFrequency);
        }
コード例 #3
0
        public List <FrequencyResultData> GenerateFrequencyTable(GadgetParameters gadgetParameters,
                                                                 IEnumerable <EwavDataFilterCondition> ewavDataFilters, List <EwavRule_Base> rules, string filterString = "")
        {
            if (gadgetParameters.UseAdvancedDataFilter)
            {
                dh = new DashboardHelper(gadgetParameters, filterString, rules);
                gadgetParameters.UseAdvancedDataFilter  = true;
                gadgetParameters.AdvancedDataFilterText = filterString;
            }
            else
            {
                dh = new DashboardHelper(gadgetParameters, ewavDataFilters, rules);
            }


            Dictionary <DataTable, List <DescriptiveStatistics> > dataTableDictionary;

            dataTableDictionary = dh.GenerateFrequencyTable(gadgetParameters, gadgetParameters.DatasourceName, gadgetParameters.TableName);


            Dictionary <List <EwavFrequencyControlDto>, List <DescriptiveStatistics> > dtoDictionary;

            dtoDictionary = FrequencyManager.ConvertDatatableToList(dataTableDictionary, gadgetParameters);

            List <FrequencyResultData> outputList = new List <FrequencyResultData>();

            foreach (KeyValuePair <List <EwavFrequencyControlDto>, List <DescriptiveStatistics> > khp in dtoDictionary)
            {
                List <EwavFrequencyControlDto> outFreqList = new List <EwavFrequencyControlDto>();
                List <DescriptiveStatistics>   outDscStat  = new List <DescriptiveStatistics>();

                foreach (EwavFrequencyControlDto freqDto in khp.Key)
                {
                    outFreqList.Add(freqDto);
                }
                foreach (DescriptiveStatistics descStat in khp.Value)
                {
                    outDscStat.Add(descStat);
                }

                var frequencyResultData = new FrequencyResultData()
                {
                    FrequencyControlDtoList   = outFreqList,
                    DescriptiveStatisticsList = outDscStat
                };
                outputList.Add(frequencyResultData);
            }

            return(outputList);
        }
コード例 #4
0
 private void Awake()
 {
     ins = this;
 }
コード例 #5
0
        public void _OpenAllConnections()
        {
            if (ActiveCanDriver == Consts.INTERFACE_RS232)
            {
                if (PortConnection.OpenPort())
                {
                    dic_CanChanels.Clear();
                    foreach (var entry in Globals.Vm_scis)
                    {
                        dic_CanChanels[entry.VM_UC_Main.NodeId] = 0;
                    }
                    Task.Factory.StartNew(() => {
                        int i = 0;
                        do
                        {
                            Globals.Vm_scis[0].HighFrequencyOn = true;
                            FrequencyManager.SendCCComand(vm_sci: Globals.Vm_scis[0]);
                            Thread.Sleep(5);
                        } while (!graphStarted && i < 500);//max 25 seconds
                    });
                }
            }
            else if (ActiveCanDriver == Consts.CAN_DRIVER_KVASER)
            {
                lock (LockCanIdsDic) {
                    hasChangeInNodesList = true;

                    Canlib.canInitializeLibrary();
                    foreach (var value in dic_CanChanels.Where(x => x.Value >= 0).Select(x => x.Value))
                    {
                        Canlib.canBusOff(value);
                        Canlib.canClose(value);
                    }
                    //lastOpenedChanel = 0;
                    dic_CanChanels.Clear();
                    foreach (var entry in Globals.Vm_scis.Where(entry => entry.VM_UC_Main != null))
                    {
                        dic_CanChanels[entry.VM_UC_Main.NodeId] = -1;
                    }
                    foreach (var key in dic_CanChanels.Select(x => x.Key).ToList())
                    {
                        int openedChanel = Canlib.canOpenChannel(lastOpenedChanel + 1, key);
                        if (openedChanel >= 0)
                        {
                            dic_CanChanels[key] = openedChanel;
                        }
                    }

                    foreach (var entry in dic_CanChanels.Where(x => x.Value >= 0))
                    {
                        Canlib.canSetBusParams(
                            handle: entry.Value,
                            freq: CANDesiredBitRate,
                            tseg2: 0,
                            tseg1: 0,
                            sjw: 0,
                            noSamp: 0,
                            syncmode: 0
                            );
                        Canlib.canBusOn(entry.Value);

                        //if (!setCanCardName() || !getCanBitRate()) {
                        //    CANStatus = Consts.BOOL_FAILED;
                        //    CANHandle = -1;
                        //}

                        //initialize the node
                        Canlib.canWrite(
                            handle: entry.Value,
                            id: 0,
                            msg: new byte[] { 1, (byte)entry.Key },
                            dlc: 2, //size of msg
                            flag: 2 //we have defined this as const
                            );
                    }
                }
                //get multiply value
                WriteToAll("AD", 0, true, true);

                //get ISR
                WriteToAll("AE", 0, true, true);
                graphStarted = false;
                //start Graph
                //todo fix for each nodeId
                Task.Factory.StartNew(() => {
                    int i = 0;
                    do
                    {
                        if (Globals.Vm_scis.Count > 0)
                        {
                            Globals.Vm_scis[0].HighFrequencyOn = true;
                            FrequencyManager.SendCCComand(1, vm_sci: Globals.Vm_scis[0]); // start graph plot with 6k frequency.
                            Thread.Sleep(5);
                        }
                        else
                        {
                            Debugger.Break();
                        }
                    } while (!graphStarted && i < 500 && Globals.Vm_scis.Count > 0);//max 25 seconds
                });
                //_can_status = RoundBoolLed.DISABLED;
            }
        }
コード例 #6
0
 public void Transpose(Scale managedScale, interval transVal, direction dir)
 {
     transposeOffset += (int)transVal;
     TransposeInPlace(managedScale, transVal, dir);
     FrequencyManager.AssignFrequencyKeys(managedScale, transposeOffset);
 }
コード例 #7
0
 public TheoryManager()
 {
     FrequencyManager.GenerateFrequencies(12);
     transposeOffset = baseNoteOffset;
     theory          = new Theory();
 }