public TracingRenderer(ITracingAlgorithm algorithm, ISampleGenerator pixelSampleGenerator) { Ensure.That("algorithm", algorithm).IsNotNull(); _algorithm = algorithm; _pixelSampleGenerator = pixelSampleGenerator; }
public WavStream(ISampleGenerator generator) { _channels = generator.Channels; _rate = generator.Frequency; _gen = generator; _totalSamples = _gen.TotalSamples; //caching this InitWaveHeader(); }
public Sampler(ISampleGenerator sampler, ISampleDistributor mapper, int sampleCt, int setCt) { _sets = new List <Vector2[]>(setCt); _random = new Random(0); SampleCount = sampleCt; for (var i = 0; i < setCt; i++) { var samples = sampler.Sample(sampleCt); var mappedSamples = samples.Select(mapper.MapSample).ToArray(); _sets.Add(mappedSamples); } }
private void Initialize(ISampleGenerator <float> sampleGenerator, float center, float range) { _startTime = Time.time + startupDelayTime; _totalSampleCount = 0L; _totalTimeMicroseconds = 0L; _sampleGenerator = sampleGenerator; _scale = textureWidth / range; _offset = textureWidth * (1f / 2f - center / range); if (_samples == null || _samples.Length != textureWidth) { _samples = new int[textureWidth]; } else { for (int i = 0; i < _samples.Length; ++i) { _samples[i] = 0; } } if (_texture == null || _texture.width != textureWidth) { #if UNITY_WEBGL _texture = new Texture2D(textureWidth, 2, TextureFormat.RGBAFloat, false); #else _texture = new Texture2D(textureWidth, 2, TextureFormat.RFloat, false); #endif _texture.filterMode = FilterMode.Point; _texture.wrapMode = TextureWrapMode.Clamp; _pixels = new Color[textureWidth * 2]; image.texture = _texture; } else { for (int i = 0; i < _pixels.Length; ++i) { _pixels[i] = new Color(0f, 0f, 0f, 1f); } } _texture.SetPixels(_pixels); _texture.Apply(false, false); image.GetComponent <AspectRatioFitter>().aspectRatio = aspectRatio; }
public AccountController( UserManager userManager, SignInManager signInManager, IAuthenticationManager authenticationManager, ISampleGenerator sampleGenerator, IProjectRepository projectRepository, ITemplateRepository templateRepository ) { _userManager = userManager; _signInManager = signInManager; _authenticationManager = authenticationManager; _sampleGenerator = sampleGenerator; _projectRepository = projectRepository; _templateRepository = templateRepository; }
private ISampleGenerator[] InitSampleGenerators() { var sampleGenerators = new ISampleGenerator[_testSettings.TestCaseWrapper.TotalGenerators]; for (var i = 0; i < _testSettings.TestCaseWrapper.TotalGenerators; i++) { var type = Type.GetType(_testSettings.TestCaseWrapper.Generators[i]); if (type == null) { throw new ArgumentException( $"Parameter of generators has to be real class full name (using reflection), instead of {_testSettings.TestCaseWrapper.Generators[i]}", nameof(_testSettings.TestCaseWrapper.Generators) ); } var sampleGenerator = Activator.CreateInstance(type) as ISampleGenerator; sampleGenerators[i] = sampleGenerator; } return(sampleGenerators); }
public CenterBiasedSampleGenerator(ISampleGenerator underlyingGenerator, double bias) { _underlyingGenerator = underlyingGenerator; _bias = bias; }