Example #1
0
 public byte[] DoResampler(EngineInput Args)
 {
     byte[] data = new byte[0];
     if (!_isLegalPlugin)
     {
         return(data);
     }
     try {
         IntPtr hModule = LoadLibrary(DllPath);
         if (hModule == IntPtr.Zero)
         {
             _isLegalPlugin = false;
         }
         else
         {
             IntPtr m = GetProcAddress(hModule, "DoResampler");
             if (m != IntPtr.Zero)
             {
                 DoResamplerDelegate g      = (DoResamplerDelegate)Marshal.GetDelegateForFunctionPointer(m, typeof(DoResamplerDelegate));
                 EngineOutput        Output = Intptr2EngineOutput(g(Args));
                 data = Output.wavData;
             }
             FreeLibrary(hModule);
         }
     } catch {; }
     return(data);
 }
Example #2
0
        private void ProcessInput(EngineInput input)
        {
            Trace.TraceInformation($"ProcessInput(EngineInput.{input});");
            switch (input)
            {
            case EngineInput.DirectionUp:
            case EngineInput.DirectionUpRight:
            case EngineInput.DirectionRight:
            case EngineInput.DirectionDownRight:
            case EngineInput.DirectionDown:
            case EngineInput.DirectionDownLeft:
            case EngineInput.DirectionLeft:
            case EngineInput.DirectionUpLeft:
                Game.TryPlayerMove((Direction)((int)input - (int)EngineInput.DirectionUp));
                break;

            case EngineInput.DirectionCenter:
                Game.PlayerWait();
                break;

            case EngineInput.HaltEngine:
                Halt();
                break;
            }
        }
Example #3
0
        public string Google2016(EngineInput engineInput)
        {
            _googleScrapper = new GoogleService(engineInput);
            _scrapFacade    = new ScrapFacade(_googleScrapper);

            return(_scrapFacade.GetResult());
        }
Example #4
0
        public async Task UpdateViewAsync(Engine engine, EngineInput input, CancellationToken token)
        {
            // Re-sync the screen
            bool forceRefresh = await SyncScreenDimensionsAsync() || input == EngineInput.RefreshView;

            // Process input to re-center map
            switch (input)
            {
            case EngineInput.ModifiedDirectionUp:
            case EngineInput.ModifiedDirectionUpRight:
            case EngineInput.ModifiedDirectionRight:
            case EngineInput.ModifiedDirectionDownRight:
            case EngineInput.ModifiedDirectionDown:
            case EngineInput.ModifiedDirectionDownLeft:
            case EngineInput.ModifiedDirectionLeft:
            case EngineInput.ModifiedDirectionUpLeft:
                MoveMapCamera((Direction)((int)input - (int)EngineInput.ModifiedDirectionUp));
                break;

            case EngineInput.ModifiedDirectionCenter:
                CenterMapCamera(engine.Game.Player.X, engine.Game.Player.Y);
                break;
            }

            // Move camera to keep player on screen
            var playerBounds = MapWindow.Shift(MapCameraXOffset, MapCameraYOffset).ResizeFromCenter(-1);

            if (playerBounds.GetRectPart(engine.Game.Player.X, engine.Game.Player.Y) != RectPart.Inside)
            {
                // TODO: Centering on player is aggressive but fine for now, replace with smoother pan
                CenterMapCamera(engine.Game.Player.X, engine.Game.Player.Y);
            }

            if (forceRefresh)
            {
                await ClearScreenAsync();
            }

            foreach ((int screenX, int screenY) in GetScreenCoordinatesEnumerable())
            {
                T?oldTile = TileBuffer[screenX, screenY];
                T?newTile = null;

                if (MapWindow.Contains(screenX, screenY))
                {
                    // Get map tile
                    int mapX = screenX - MapWindow.X + MapCameraXOffset;
                    int mapY = screenY - MapWindow.Y + MapCameraYOffset;

                    newTile = engine.Game.WorldMap.Contains(mapX, mapY) ? GetMapTile(engine.Game.WorldMap[mapX, mapY], engine.Game.Creatures[mapX, mapY]?.Type) : null;
                }

                if (forceRefresh || (oldTile is not null && !oldTile.Equals(newTile)) || (newTile is not null && !newTile.Equals(oldTile)))
                {
                    TileBuffer[screenX, screenY] = newTile;
                    await DrawScreenTileAsync(screenX, screenY);
                }
            }
        }
Example #5
0
        public string Yahoo2016(EngineInput engineInput)
        {
            //_yahooScrapper = new GoogleService(engineInput);
            //_scrapFacade = new ScrapFacade(_yahooScrapper);

            //return _scrapFacade.GetResult();

            return("1, 10, 33");
        }
Example #6
0
        /// <summary>
        /// This method generates payslip of the employee
        /// </summary>
        /// <param name="">EngineInput object having details of employee salary</param>
        /// <returns>EngineOutput object having details of generated payslip</returns>
        public virtual EngineOutput GeneratePaySlip(EngineInput employeeSalaryDetail)
        {
            EngineOutput payslip = new EngineOutput();

            payslip.Name        = employeeSalaryDetail.FirstName + employeeSalaryDetail.LastName;
            payslip.PayPeriod   = employeeSalaryDetail.PayPeriod;
            payslip.GrossIncome = CalculateGrossIncome(employeeSalaryDetail.AnnualSalary);
            payslip.IncomeTax   = CalculateIncomeTax(employeeSalaryDetail.AnnualSalary);
            payslip.NetIncome   = CalculateNetIncome(payslip.GrossIncome, payslip.IncomeTax);
            payslip.Super       = CalculateSuper(payslip.GrossIncome, employeeSalaryDetail.SuperRate);

            return(payslip);
        }
Example #7
0
 public byte[] DoResampler(EngineInput Args, ILogger logger)
 {
     byte[] data = new byte[0];
     if (!_isLegalPlugin)
     {
         return(data);
     }
     if (DoResamplerMethod != null)
     {
         object inputarg = CopyObjectToNewType(Args, DoResamplerMethod.GetParameters()[0].ParameterType);
         object ret      = DoResamplerMethod.Invoke(null, new object[1] {
             inputarg
         });
         EngineOutput Out = (EngineOutput)CopyObjectToNewType(ret, typeof(EngineOutput));
         data = Out.wavData;
     }
     return(data);
 }
Example #8
0
        /// <summary>
        /// 参数初始化过程
        /// </summary>
        /// <returns></returns>
        public static EngineInput CreateInputModel()
        {
            EngineInput Input = new EngineInput();

            Input.inputWaveFile  = "";
            Input.NoteString     = "";
            Input.Velocity       = 100;
            Input.StrFlags       = "";
            Input.Offset         = 0;
            Input.RequiredLength = 0;
            Input.Consonant      = 0;
            Input.Cutoff         = 0;
            Input.Volume         = 100;
            Input.Modulation     = 0;
            Input.Tempo          = 120;
            Input.nPitchBend     = 0;
            Input.pitchBend      = new int[0];
            return(Input);
        }
Example #9
0
        /// <summary>
        /// 从RenderItem初始化过程
        /// </summary>
        /// <returns></returns>
        internal static EngineInput CreateInputModel(RenderItem renderItem, double Modulation)
        {
            EngineInput Ret = new EngineInput();

            Ret.inputWaveFile  = renderItem.RawFile;
            Ret.NoteString     = MusicMath.GetNoteString(renderItem.NoteNum);
            Ret.Velocity       = renderItem.Velocity;
            Ret.StrFlags       = renderItem.StrFlags;
            Ret.Offset         = renderItem.Oto.Offset;
            Ret.RequiredLength = renderItem.RequiredLength;
            Ret.Consonant      = renderItem.Oto.Consonant;
            Ret.Cutoff         = renderItem.Oto.Cutoff;
            Ret.Volume         = renderItem.Volume;
            Ret.Modulation     = Modulation;
            Ret.pitchBend      = renderItem.PitchData.ToArray();
            Ret.nPitchBend     = renderItem.PitchData.Count;
            Ret.Tempo          = renderItem.Tempo;
            return(Ret);
        }
Example #10
0
        /// <summary>
        /// 从RenderItem初始化过程
        /// </summary>
        /// <returns></returns>
        internal static EngineInput CreateInputModel(RenderItem renderItem, double Modulation)
        {
            EngineInput Ret = new EngineInput
            {
                inputWaveFile  = renderItem.SourceFile,
                NoteString     = MusicMath.GetNoteString(renderItem.NoteNum),
                Velocity       = renderItem.Velocity,
                StrFlags       = renderItem.StrFlags,
                Offset         = renderItem.Oto.Offset,
                RequiredLength = renderItem.RequiredLength,
                Consonant      = renderItem.Oto.Consonant,
                Cutoff         = renderItem.Oto.Cutoff,
                Volume         = renderItem.Volume,
                Modulation     = Modulation,
                pitchBend      = renderItem.PitchData.ToArray(),
                nPitchBend     = renderItem.PitchData.Count,
                Tempo          = renderItem.Tempo
            };

            return(Ret);
        }
Example #11
0
        /// <summary>
        /// 参数初始化过程
        /// </summary>
        /// <returns></returns>
        public static EngineInput CreateInputModel()
        {
            EngineInput Input = new EngineInput
            {
                inputWaveFile  = string.Empty,
                NoteString     = string.Empty,
                Velocity       = 100,
                StrFlags       = string.Empty,
                Offset         = 0,
                RequiredLength = 0,
                Consonant      = 0,
                Cutoff         = 0,
                Volume         = 100,
                Modulation     = 0,
                Tempo          = 120,
                nPitchBend     = 0,
                pitchBend      = new int[0]
            };

            return(Input);
        }
Example #12
0
        public void PaySlip_NSWMYOB1()
        {
            var factory = new NSWFactory();
            BasePaySlipEngine payEngine = factory.GetPaySlipEngine();
            var input = new EngineInput()
            {
                FirstName    = "David",
                LastName     = "Rudd",
                AnnualSalary = 60050,
                SuperRate    = 9,
                PayPeriod    = "01 March - 31 March"
            };

            var paySlipOutput = payEngine.GeneratePaySlip(input);

            Assert.IsTrue(paySlipOutput.Name.Equals("David Rudd") &&
                          paySlipOutput.GrossIncome == 5004 &&
                          paySlipOutput.IncomeTax == 922 &&
                          paySlipOutput.NetIncome == 4082 &&
                          paySlipOutput.Super == 450);
        }
Example #13
0
        public void PaySlip_NSW_MYOB2()
        {
            var factory = new NSWFactory();
            BasePaySlipEngine payEngine = factory.GetPaySlipEngine();
            var input = new EngineInput()
            {
                FirstName    = "Ryan",
                LastName     = "Chen",
                AnnualSalary = 120000,
                SuperRate    = 10,
                PayPeriod    = "01 March - 31 March"
            };

            var paySlipOutput = payEngine.GeneratePaySlip(input);

            Assert.IsTrue(paySlipOutput.Name.Equals("Ryan Chen") &&
                          paySlipOutput.GrossIncome == 10000 &&
                          paySlipOutput.IncomeTax == 2669 &&
                          paySlipOutput.NetIncome == 7331 &&
                          paySlipOutput.Super == 1000);
        }
Example #14
0
        public static ExcelPackage GeneratePaySlipsExcel(ExcelPackage package, string state)
        {
            try
            {
                int idxLastName = 1, idxFirstName = 0, idxAnnsualSalary = 2, idxSuperRate = 3, idxPayPeriod = 4;

                //Input
                bool           ifAllEmpty = true;
                ExcelWorksheet workSheet  = package.Workbook.Worksheets.First();

                //Output
                ExcelPackage excelExport     = new ExcelPackage();
                var          workSheetOutput = excelExport.Workbook.Worksheets.Add("PaySlips");
                workSheetOutput.TabColor         = System.Drawing.Color.Black;
                workSheetOutput.DefaultRowHeight = 12;
                int recordIndex = 1;

                //Header of output excel
                workSheetOutput.Row(recordIndex).Height = 20;
                workSheetOutput.Row(recordIndex).Style.HorizontalAlignment = ExcelHorizontalAlignment.Center;
                workSheetOutput.Row(recordIndex).Style.Font.Bold           = true;

                workSheetOutput.Cells[recordIndex, 1].Value = OutputExcelColumn.Name;
                workSheetOutput.Cells[recordIndex, 2].Value = OutputExcelColumn.GrossIncome;
                workSheetOutput.Cells[recordIndex, 3].Value = OutputExcelColumn.IncomeTax;
                workSheetOutput.Cells[recordIndex, 4].Value = OutputExcelColumn.NetIncome;
                workSheetOutput.Cells[recordIndex, 5].Value = OutputExcelColumn.Super;
                workSheetOutput.Cells[recordIndex, 6].Value = OutputExcelColumn.PayPeriod;

                // This loop will accept input excel even if order of columns is different
                for (int iCol = 1; iCol <= workSheet.Dimension.End.Column; iCol++)
                {
                    var colName = Convert.ToString(((object[, ])workSheet.Cells[1, 1, 1, workSheet.Dimension.End.Column].Value)[0, iCol - 1]);
                    switch (colName)
                    {
                    case InputExcelColumn.FirstName:
                        idxFirstName = iCol;
                        break;

                    case InputExcelColumn.LastName:
                        idxLastName = iCol;
                        break;

                    case InputExcelColumn.AnnualSalary:
                        idxAnnsualSalary = iCol;
                        break;

                    case InputExcelColumn.SuperRate:
                        idxSuperRate = iCol;
                        break;

                    case InputExcelColumn.PayPeriod:
                        idxPayPeriod = iCol;
                        break;
                    }
                }

                // Thread-safe collection to handle input data processing
                BlockingCollection <EngineInput> bag = new BlockingCollection <EngineInput>();

                // Blocking Consumer task - reaing records from collection and processing
                Task t2 = Task.Factory.StartNew(() =>
                {
                    PaySlipEngineFactory factory = null;
                    switch (state)
                    {
                    case States.NSW:
                        factory = new NSWFactory();
                        break;

                    case States.Victoria:
                        factory = new VictoriaFactory();
                        break;
                    }

                    EngineOutput paySlipOutput  = null;
                    BasePaySlipEngine payEngine = factory.GetPaySlipEngine();
                    EngineInput input           = null;

                    // Take() was called on a completed collection.
                    // Some other thread can call CompleteAdding after we pass the
                    // IsCompleted check but before we call Take.
                    // In this example, we can simply catch the exception since the
                    // loop will break on the next iteration.
                    while (!bag.IsCompleted)
                    {
                        recordIndex++; input = null;
                        try
                        {
                            input = bag.Take();
                        }
                        catch (InvalidOperationException) { break; }

                        if (input != null)
                        {
                            paySlipOutput = payEngine.GeneratePaySlip(input);

                            workSheetOutput.Cells[recordIndex, 1].Value = paySlipOutput.Name;
                            workSheetOutput.Cells[recordIndex, 2].Value = paySlipOutput.GrossIncome;
                            workSheetOutput.Cells[recordIndex, 3].Value = paySlipOutput.IncomeTax;
                            workSheetOutput.Cells[recordIndex, 4].Value = paySlipOutput.NetIncome;
                            workSheetOutput.Cells[recordIndex, 5].Value = paySlipOutput.Super;
                            workSheetOutput.Cells[recordIndex, 6].Value = paySlipOutput.PayPeriod;
                        }
                    }
                });

                // Blocking Producer task - reading records from excel sheet
                Task t1 = Task.Factory.StartNew(() =>
                {
                    EngineInput inputObj = null;
                    for (var rowNumber = 2; rowNumber <= workSheet.Dimension.End.Row; rowNumber++)
                    {
                        ifAllEmpty   = true;
                        decimal dVal = 0;
                        var row      = workSheet.Cells[rowNumber, 1, rowNumber, workSheet.Dimension.End.Column];
                        inputObj     = new EngineInput();

                        for (int iCol = 1; iCol <= workSheet.Dimension.End.Column; iCol++)
                        {
                            var value = Convert.ToString(((object[, ])row.Value)[0, iCol - 1]);

                            if (!string.IsNullOrEmpty(value))
                            {
                                ifAllEmpty = false;
                            }

                            if (iCol == idxFirstName)
                            {
                                inputObj.FirstName = value;
                            }
                            else if (iCol == idxLastName)
                            {
                                inputObj.LastName = value;
                            }
                            else if (iCol == idxAnnsualSalary)
                            {
                                inputObj.AnnualSalary = decimal.TryParse(value, out dVal) ? dVal : throw new System.InvalidCastException($"Annual Salary is not in correct format. Value: {value}");
                            }
                            else if (iCol == idxSuperRate)
                            {
                                inputObj.SuperRate = decimal.TryParse(value, out dVal) ? dVal : throw new System.InvalidCastException($"Super Rate is not in correct format. Value: {value}");
                            }
                            else if (iCol == idxPayPeriod)
                            {
                                inputObj.PayPeriod = value;
                            }
                        }

                        if (ifAllEmpty)
                        {
                            break;
                        }

                        bag.Add(inputObj);
                    }

                    // Let consumer know we are done.
                    bag.CompleteAdding();
                });

                // Wait till both producer and consumer finish their job
                Task main = Task.WhenAll(t1, t2);
                main.Wait();
                return(excelExport);
            }
            catch (Exception ex)
            {
                throw;
            }
        }
        /// <summary>
        /// 1. This method takes excel as input and state code.
        /// 2. The PaySlip factory creates the State specific payslip generator/engine depending on the State selected by user in UI
        /// 3. Producer/Consumer multithread design pattern is used.
        ///    Producer reads single record at a time and add records in thread-safe collection.
        ///    Consumer reads records from above collection and process them and adds to the excel worksheet object
        /// 4. Input excel can contain columns in any order.
        /// 5. Order/Format of columns in output excel sheet is fixed
        /// </summary>
        /// <param name="package"></param>
        /// <param name="state"></param>
        /// <returns></returns>
        public static ExcelPackage GeneratePaySlipsExcel(ExcelPackage package, string state)
        {
            int idxFirstName = 0, idxLastName = 1, idxAnnsualSalary = 2, idxSuperRate = 3, idxPayPeriod = 4;

            //Input
            ExcelWorksheet workSheet = package.Workbook.Worksheets.First();

            //Output
            ExcelPackage excelExport     = new ExcelPackage();
            var          workSheetOutput = excelExport.Workbook.Worksheets.Add("PaySlips");

            workSheetOutput.TabColor         = System.Drawing.Color.Black;
            workSheetOutput.DefaultRowHeight = 12;
            int recordIndex = 1;

            //Header of output excel
            workSheetOutput.Row(recordIndex).Height = 20;
            workSheetOutput.Row(recordIndex).Style.HorizontalAlignment = ExcelHorizontalAlignment.Center;
            workSheetOutput.Row(recordIndex).Style.Font.Bold           = true;

            workSheetOutput.Cells[recordIndex, 1].Value = OutputExcelColumn.Name;
            workSheetOutput.Cells[recordIndex, 2].Value = OutputExcelColumn.GrossIncome;
            workSheetOutput.Cells[recordIndex, 3].Value = OutputExcelColumn.IncomeTax;
            workSheetOutput.Cells[recordIndex, 4].Value = OutputExcelColumn.NetIncome;
            workSheetOutput.Cells[recordIndex, 5].Value = OutputExcelColumn.Super;
            workSheetOutput.Cells[recordIndex, 6].Value = OutputExcelColumn.PayPeriod;

            var maxColumnCount = workSheet.Dimension.End.Column;

            // This loop will accept input excel even if order of columns is different
            for (int iCol = 1; iCol <= maxColumnCount; iCol++)
            {
                var colName = Convert.ToString(((object[, ])workSheet.Cells[1, 1, 1, maxColumnCount].Value)[0, iCol - 1]);
                switch (colName)
                {
                case InputExcelColumn.FirstName:
                    idxFirstName = iCol;
                    break;

                case InputExcelColumn.LastName:
                    idxLastName = iCol;
                    break;

                case InputExcelColumn.AnnualSalary:
                    idxAnnsualSalary = iCol;
                    break;

                case InputExcelColumn.SuperRate:
                    idxSuperRate = iCol;
                    break;

                case InputExcelColumn.PayPeriod:
                    idxPayPeriod = iCol;
                    break;
                }
            }
            ;

            // Thread-safe collection to handle input data processing
            BlockingCollection <EngineInput> bag = new BlockingCollection <EngineInput>();

            // Blocking Consumer task - reaing records from collection and processing
            Task consumer = Task.Factory.StartNew(() =>
            {
                PaySlipEngineFactory factory = null;
                switch (state)
                {
                case States.NSW:
                    factory = new NSWFactory();
                    break;

                case States.Victoria:
                    factory = new VictoriaFactory();
                    break;

                default:
                    throw new InvalidOperationException("Unknown State.");
                }

                EngineOutput paySlipOutput  = null;
                BasePaySlipEngine payEngine = factory.GetPaySlipEngine();

                foreach (var input in bag.GetConsumingEnumerable())
                {
                    recordIndex++;
                    paySlipOutput = payEngine.GeneratePaySlip(input);

                    workSheetOutput.Cells[recordIndex, 1].Value = paySlipOutput.Name;
                    workSheetOutput.Cells[recordIndex, 2].Value = paySlipOutput.GrossIncome;
                    workSheetOutput.Cells[recordIndex, 3].Value = paySlipOutput.IncomeTax;
                    workSheetOutput.Cells[recordIndex, 4].Value = paySlipOutput.NetIncome;
                    workSheetOutput.Cells[recordIndex, 5].Value = paySlipOutput.Super;
                    workSheetOutput.Cells[recordIndex, 6].Value = paySlipOutput.PayPeriod;
                }
                ;
            });

            // Blocking Producer task - reading records from excel sheet
            Task producer = Task.Factory.StartNew(() =>
            {
                // Use ConcurrentQueue to enable safe enqueueing from multiple threads.
                var exceptions = new ConcurrentQueue <Exception>();
                Parallel.For(2, workSheet.Dimension.End.Row + 1, (rowNumber, loopState) =>
                {
                    try
                    {
                        var ifAllEmpty = true;

                        var row      = workSheet.Cells[rowNumber, 1, rowNumber, workSheet.Dimension.End.Column];
                        var inputObj = new EngineInput();

                        for (int iCol = 1; iCol <= workSheet.Dimension.End.Column; iCol++)
                        {
                            decimal dVal = 0;
                            var value    = Convert.ToString(((object[, ])row.Value)[0, iCol - 1]);

                            if (!string.IsNullOrEmpty(value))
                            {
                                ifAllEmpty = false;
                            }

                            if (iCol == idxFirstName)
                            {
                                inputObj.FirstName = value.Trim();
                            }
                            else if (iCol == idxLastName)
                            {
                                inputObj.LastName = value.Trim();
                            }
                            else if (iCol == idxAnnsualSalary)
                            {
                                inputObj.AnnualSalary = decimal.TryParse(value.Trim(), out dVal) ? dVal > 0 ? dVal : throw new System.InvalidCastException($"Annual Salary must be greater than 0. Value: {value}.") : throw new System.InvalidCastException($"Annual Salary is not in correct format. Value: {value}.");
                            }
                            else if (iCol == idxSuperRate)
                            {
                                inputObj.SuperRate = decimal.TryParse(value.Trim(), out dVal) ? (dVal >= 0 && dVal <= 50) ? dVal : throw new System.InvalidCastException($"Super rate should be in 0-50% range. Value: {value}.") : throw new System.InvalidCastException($"Super Rate is not in correct format. Value: {value}.");
                            }
                            else if (iCol == idxPayPeriod)
                            {
                                inputObj.PayPeriod = value.Trim();
                            }
                        }

                        if (ifAllEmpty)
                        {
                            loopState.Stop();
                        }

                        bag.Add(inputObj);
                    }
                    // Store the exception and continue with the loop.
                    catch (Exception e)
                    {
                        exceptions.Enqueue(e);
                        loopState.Stop();
                    }
                });

                // Throw the exceptions here after the loop completes.
                if (exceptions.Count > 0)
                {
                    throw new AggregateException(exceptions);
                }
                // Let consumer know we are done.
                bag.CompleteAdding();
            });

            // Wait till both producer and consumer finish their job
            producer.Wait();
            consumer.Wait();

            return(excelExport);
        }
Example #16
0
 /// <summary>
 /// 参数初始化过程
 /// </summary>
 /// <returns></returns>
 public static EngineInput CreateInputModel()
 {
     EngineInput Input = new EngineInput();
     Input.inputWaveFile = "";
     Input.NoteString = "";
     Input.Velocity = 100;
     Input.StrFlags = "";
     Input.Offset = 0;
     Input.RequiredLength = 0;
     Input.Consonant = 0;
     Input.Cutoff = 0;
     Input.Volume = 100;
     Input.Modulation = 0;
     Input.Tempo = 120;
     Input.nPitchBend = 0;
     Input.pitchBend = new int[0];
     return Input;
 }
Example #17
0
 /// <summary>
 /// 从RenderItem初始化过程
 /// </summary>
 /// <returns></returns>
 internal static EngineInput CreateInputModel(RenderItem renderItem,double Modulation)
 {
     EngineInput Ret = new EngineInput();
     Ret.inputWaveFile = renderItem.RawFile;
     Ret.NoteString = MusicMath.GetNoteString(renderItem.NoteNum);
     Ret.Velocity = renderItem.Velocity;
     Ret.StrFlags = renderItem.StrFlags;
     Ret.Offset = renderItem.Oto.Offset;
     Ret.RequiredLength = renderItem.RequiredLength;
     Ret.Consonant = renderItem.Oto.Consonant;
     Ret.Cutoff = renderItem.Oto.Cutoff;
     Ret.Volume = renderItem.Volume;
     Ret.Modulation = Modulation;
     Ret.pitchBend = renderItem.PitchData.ToArray();
     Ret.nPitchBend = renderItem.PitchData.Count;
     Ret.Tempo =  renderItem.Tempo;
     return Ret;
 }
Example #18
0
 public GoogleService(EngineInput engineInput)
 {
     _keywords   = engineInput.Keywords;
     _url        = engineInput.URL;
     _maxResults = Properties.Settings.Default.maxResults;
 }