public override void Draw(GameTime gameTime, Audio.AnalyzedAudio data) { foreach (var snake in snakes) { snake.Move((float)rd.NextDouble()); // TODO: Change // TODO: Add the sound effects snake.Update((float)gameTime.TotalGameTime.TotalSeconds, AppShell.ColorPalette.Color1); } var View = Matrix.Identity; var Projection = Matrix.CreateOrthographic(AppShell.Width, AppShell.Height, -1.0f, 1.0f); basicEffect.View = View; basicEffect.Projection = Projection; foreach (EffectPass pass in basicEffect.CurrentTechnique.Passes) { pass.Apply(); foreach (var snake in snakes) { AppShell.GraphicsDevice.DrawUserPrimitives(PrimitiveType.LineStrip, snake.Vertices, 0, snake.Vertices.Length - 1, VertexPositionColor.VertexDeclaration); } } }
public override void Draw(GameTime gameTime, Audio.AnalyzedAudio data) { int widthOffset = AppShell.Width / 2 - 100; var centerList = lines.Count / 2; for (int i = 0; i < lines.Count; i++) { var x = (i * 40) - widthOffset; var diameter = (Math.Abs(centerList - i) - lines.Count) * 5; lines[i].UpdateLine(new Vector2(x, diameter), new Vector2(x, -diameter), 10, AppShell.ColorPalette.Color1); } var View = Matrix.Identity; var Projection = Matrix.CreateOrthographic(AppShell.Width, AppShell.Height, -1.0f, 1.0f); basicEffect.View = View; basicEffect.Projection = Projection; foreach (EffectPass pass in basicEffect.CurrentTechnique.Passes) { pass.Apply(); for (int i = 0; i < lines.Count; i++) { lines[i].Draw(AppShell.GraphicsDevice); } } }
public override void Draw(GameTime gameTime, Audio.AnalyzedAudio data) { int pointSamples = data.FFT.Length; if (vertices1 == null || vertices2 == null) // TODO: If change { vertices1 = new VertexPositionColor[pointSamples]; vertices2 = new VertexPositionColor[pointSamples]; } const double max = 2.0 * Math.PI; double step = max / (pointSamples - 1); int i = 0; for (double theta = 0.0; theta < max; theta += step, i++) { var currentPosition = new Vector3((float)(Radius * Math.Cos(theta)), (float)(Radius * Math.Sin(theta)), 0); var currentNormal = currentPosition - new Vector3((float)((Radius + 1) * Math.Cos(theta)), (float)((Radius + 1) * Math.Sin(theta)), 0); float fft = MathHelper.Clamp(data.FFT[i].X, Min, Max); vertices1[i].Position = currentPosition + (currentNormal * Scale * fft); vertices1[i].Color = AppShell.ColorPalette.Color3; float sfft = MathHelper.Clamp(data.SmoothFFT[i].X, Min, Max); vertices2[i].Position = currentPosition + (currentNormal * Scale * sfft); vertices2[i].Color = AppShell.ColorPalette.Color2; } var View = Matrix.Identity; var Projection = Matrix.CreateOrthographic(AppShell.Width, AppShell.Height, -1.0f, 1.0f); basicEffect.View = View; basicEffect.Projection = Projection; foreach (EffectPass pass in basicEffect.CurrentTechnique.Passes) { pass.Apply(); AppShell.GraphicsDevice.DrawUserPrimitives(PrimitiveType.LineStrip, vertices1, 0, vertices1.Length - 1, VertexPositionColor.VertexDeclaration); AppShell.GraphicsDevice.DrawUserPrimitives(PrimitiveType.LineStrip, vertices2, 0, vertices2.Length - 1, VertexPositionColor.VertexDeclaration); } }
public override void Draw(GameTime gameTime, Audio.AnalyzedAudio data) { var offset = new Vector3(0, AppShell.Height / 2, 0); foreach (var wave in waves) { var minSample = data.Samples[0].MinSample + 1.0f; var maxSample = data.Samples[0].MaxSample + 1.0f; // TODO: Add the sound effects switch (wave.Layer) { case WaveLayer.Layer1: break; case WaveLayer.Layer2: break; case WaveLayer.Layer3: break; } wave.Update((float)gameTime.TotalGameTime.TotalSeconds, offset, AppShell.Width, AppShell.ColorPalette.Color1); } var View = Matrix.Identity; var Projection = Matrix.CreateOrthographicOffCenter(0, AppShell.Width, AppShell.Height, 0, -1.0f, 1.0f); basicEffect.View = View; basicEffect.Projection = Projection; foreach (EffectPass pass in basicEffect.CurrentTechnique.Passes) { pass.Apply(); foreach (var wave in waves) { AppShell.GraphicsDevice.DrawUserPrimitives(PrimitiveType.LineStrip, wave.Vertices, 0, wave.Vertices.Length - 1, VertexPositionColor.VertexDeclaration); } } }
public override void Draw(GameTime gameTime, Audio.AnalyzedAudio data) { int pointSamples = data.FFT.Length; if (vertices1 == null || vertices2 == null) // TODO: If change { vertices1 = new VertexPositionColor[pointSamples]; vertices2 = new VertexPositionColor[pointSamples]; } float centerHeight = AppShell.Height / 2.0f; float sampleWidth = AppShell.Width / (float)pointSamples; for (int i = 0; i < pointSamples; i++) { float currentX = sampleWidth * i; float fft = MathHelper.Clamp(data.FFT[i].X, Min, Max) * Scale; vertices1[i].Position = new Vector3(currentX, centerHeight + fft, 0); vertices1[i].Color = AppShell.ColorPalette.Color3; float sfft = MathHelper.Clamp(data.SmoothFFT[i].X, Min, Max) * Scale; vertices2[i].Position = new Vector3(currentX, centerHeight + sfft, 0); vertices2[i].Color = AppShell.ColorPalette.Color2; } var View = Matrix.Identity; var Projection = Matrix.CreateOrthographicOffCenter(0, AppShell.Width, AppShell.Height, 0, -1.0f, 1.0f); basicEffect.View = View; basicEffect.Projection = Projection; foreach (EffectPass pass in basicEffect.CurrentTechnique.Passes) { pass.Apply(); AppShell.GraphicsDevice.DrawUserPrimitives(PrimitiveType.LineStrip, vertices1, 0, vertices1.Length - 1, VertexPositionColor.VertexDeclaration); AppShell.GraphicsDevice.DrawUserPrimitives(PrimitiveType.LineStrip, vertices2, 0, vertices2.Length - 1, VertexPositionColor.VertexDeclaration); } }
public abstract void Draw(Microsoft.Xna.Framework.GameTime gameTime, Audio.AnalyzedAudio data);