public void drawEllipses(Scales scale) { clearEllipses(); String[] strScale = MusicMaster.getScale(scale); for (int j = 0; j < GraphicsChest.getChest().netytarWidth; j++) { for (int k = 0; k < GraphicsChest.getChest().netytarWidth; k++) { for (int i = 0; i < strScale.Length; i++) { string notainstringa = MusicMaster.getNote(netytarButtons[j, k].Note).ToString(); notainstringa = notainstringa.Remove(notainstringa.Length - 1); if (notainstringa.Equals(strScale[i])) { Ellipse ellipse = new Ellipse(); ellipse.StrokeThickness = ellipseStrokeDim; ellipse.Stroke = new SolidColorBrush(colorsEllipse[i]); ellipse.Width = netytarButtons[j, k].Width + ellipseStrokeSpacer * 2; ellipse.Height = netytarButtons[j, k].Height + ellipseStrokeSpacer * 2; Canvas.SetLeft(ellipse, Canvas.GetLeft(netytarButtons[j, k]) - ellipseStrokeSpacer + 0.4); Canvas.SetTop(ellipse, Canvas.GetTop(netytarButtons[j, k]) - ellipseStrokeSpacer + 0.2); Canvas.SetZIndex(ellipse, 2); drawnEllipses.Add(ellipse); } } } } foreach (Ellipse ellipse in drawnEllipses) { canvas.Children.Add(ellipse); } }
private void Window_KeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.S && !e.IsRepeat) { InstrumentChest.getChest().Instrument.processStartPlaying(); } if (e.Key == Key.M && !e.IsRepeat) { showCursor = !showCursor; if (!showCursor) { Cursor = Cursors.None; } else { Cursor = Cursors.Arrow; } } if (e.Key == Key.D && !e.IsRepeat) { GraphicsChest.getChest().NetytarDrawer.hold(); InstrumentChest.getChest().Instrument.processStartHold(); } }
public MainWindow() { try { InitializeComponent(); } catch (Exception ex) { } AddScaleListItems(); AudioChest.spawnChest(); InstrumentChest.getChest().Instrument = new FingeredInstrument(); InstrumentChest.getChest().NoteAndPlayListeners.Add(this); GraphicsChest.getChest().NetytarDrawer = new NetytarDrawer(this.scrlNetytar); GraphicsChest.getChest().NetytarDrawer.generateNetytar(); GraphicsChest.getChest().NetytarDrawer.drawLines(Scales.Cmaj, Colors.Red); GraphicsChest.getChest().NetytarDrawer.drawEllipses(Scales.Cmaj); GraphicsChest.getChest().WickiEyedenDrawer = new WickiEyedenDrawer(this.scrlWickiEyeden); GraphicsChest.getChest().WickiEyedenDrawer.generateWickiEyeden(); InstrumentChest.getChest().WickiEyedenPlayMode = new WickiEyedenPlayWithGaze(); GraphicsChest.getChest().RhythmFlasher = new RhythmFlasher(this.scrlNetytar, Colors.Bisque); // WpfEyeXChest.getChest().getBlinkProcessor().Listeners.Add(new ScaleBlinker("min", "maj")); WpfEyeXChest.getChest().getBlinkProcessor().Listeners.Add(new RepeatNoteWithDouble()); //WpfEyeXChest.getChest().getBlinkProcessor().Listeners.Add(new PauseWithOneEye(Eyes.Left)); lblBpm.Text = GraphicsChest.getChest().RhythmFlasher.Bpm.ToString(); }
public void generateWickiEyeden() { Buttons = new WickiEyedenButton[wickiEyedenHeight, 10]; canvas.Children.Clear(); int baseNote = GraphicsChest.getChest().netytarGenNote; int side = this.side; int halfSide = this.side / 2; bool isPairRow; int startRowPitch = pitchMax - 11; for (int row = 0; row < wickiEyedenHeight; row++) { #region Is row pair? if ((row + 1) % 2 != 0) { isPairRow = false; } else { isPairRow = true; } #endregion int buttonsNumber; int spacer; if (!isPairRow) { buttonsNumber = oddButtons; spacer = halfSide; startRowPitch -= 5; // Deducted from maths! } else { buttonsNumber = evenButtons; spacer = 0; startRowPitch -= 7; // Deducted from maths! } for (int col = 0; col < buttonsNumber; col++) { Point generator = new Point(wickiEyedenStart.X + spacer + (col * side), wickiEyedenStart.Y + (side * row)); // Button spawning Buttons[row, col] = new WickiEyedenButton(startRowPitch + (col * 2)); Buttons[row, col].Height = side; Buttons[row, col].Width = side; Canvas.SetLeft(Buttons[row, col], generator.X); Canvas.SetTop(Buttons[row, col], generator.Y); Panel.SetZIndex(Buttons[row, col], 0); canvas.Children.Add(Buttons[row, col]); } } // Center assignment GraphicsChest.getChest().WickiEyedenCenter = new Point(canvas.Width / 2, canvas.Height / 2); }
private void btnFlasher_Click(object sender, RoutedEventArgs e) { if (!GraphicsChest.getChest().RhythmFlasher.isStarted()) { GraphicsChest.getChest().RhythmFlasher.start(); } else { GraphicsChest.getChest().RhythmFlasher.stop(); } }
private void Window_KeyUp(object sender, KeyEventArgs e) { if (e.Key == Key.S) { InstrumentChest.getChest().Instrument.processStopPlaying(); } if (e.Key == Key.D) { GraphicsChest.getChest().NetytarDrawer.unHold(); InstrumentChest.getChest().Instrument.processStopHold(); } }
public WickiEyedenDrawer(ScrollViewer scrollViewer) { this.scrollViewer = scrollViewer; canvas = new Canvas(); canvas.VerticalAlignment = VerticalAlignment.Stretch; canvas.HorizontalAlignment = HorizontalAlignment.Stretch; canvas.Margin = new Thickness(0, 0, 0, 0); canvas.Width = wickiEyedenStart.X * 2 + side * 10; canvas.Height = wickiEyedenStart.Y * 2 + side * wickiEyedenHeight; scrollViewer.Content = canvas; GraphicsChest.getChest().WickiEyedenCenter = new Point(canvas.Width / 2, canvas.Height / 2); }
private void button_OnGaze(object sender, RoutedEventArgs e) { if (tempButton != null) { tempButton.Background = tempBrush; } if (((WickiEyedenButton)sender).GetHasGaze()) { tempButton = ((WickiEyedenButton)sender); tempBrush = tempButton.Background; tempButton.Background = selectedBrush; InstrumentChest.getChest().Instrument.setNote(tempButton.Pitch); GraphicsChest.getChest().WickiEyedenWatched = new Point(Canvas.GetLeft(tempButton), Canvas.GetTop(tempButton)); } }
public void activate() { WickiEyedenButton[,] buttons = GraphicsChest.getChest().WickiEyedenDrawer.Buttons; foreach (WickiEyedenButton button in buttons) { if (button != null) { #region Behavior Behavior.SetGazeAware(button, true); Behavior.SetGazeAwareDelay(button, WpfEyeXChest.getChest().GazeDelay); Behavior.AddHasGazeChangedHandler(button, button_OnGaze); #endregion } } }
public NetytarDrawer(ScrollViewer scrollViewer) { this.scrollViewer = scrollViewer; drawer = this; canvas = new Canvas(); canvas.VerticalAlignment = VerticalAlignment.Stretch; canvas.HorizontalAlignment = HorizontalAlignment.Stretch; canvas.Margin = new Thickness(0, 0, 0, 0); canvas.Width = GraphicsChest.getChest().netytarStart * 2 + (horizontalSpacer + 13) * (GraphicsChest.getChest().netytarWidth - 1); canvas.Height = GraphicsChest.getChest().netytarStart * 2 + (horizontalSpacer + 13) * (GraphicsChest.getChest().netytarHeight - 1); scrollViewer.Content = canvas; GraphicsChest.getChest().NetytarCenter = new Point(canvas.Width / 2, canvas.Height / 2); chordHolderDots = new ChordHolderDots(canvas, Colors.GhostWhite); }
private void lstScaleChanger_SelectionChanged(object sender, SelectionChangedEventArgs e) { string scaleString = ((ListBoxItem)lstScaleChanger.SelectedItem).Content.ToString(); Scales scale = (Scales)Enum.Parse(typeof(Scales), scaleString); Color color = Colors.Green; if (scaleString.EndsWith("maj")) { color = Colors.Red; } else if (scaleString.EndsWith("min")) { color = Colors.Blue; } GraphicsChest.getChest().NetytarDrawer.drawLines(scale, color); GraphicsChest.getChest().NetytarDrawer.drawEllipses(scale); }
public void netytarButton_OnGaze(NetytarButton sender, bool hasGaze) { if (hasGaze) { lastCheckedButton = checkedButton; checkedButton = sender; flashIndependentLine(); InstrumentChest.getChest().Instrument.setNote(checkedButton.Note); GraphicsChest.getChest().NetytarWatched = new Point(Canvas.GetLeft(checkedButton), Canvas.GetTop(checkedButton)); flashSpark(); if (isHold) { chordHolderDots.addDot(checkedButton); } } }
public void receive_rightClose() { GraphicsChest.getChest().NetytarDrawer.drawLines(MusicMaster.getScaleEnum(InstrumentChest.getChest().Instrument.getNote(), rightScaleCode), Colors.Red); GraphicsChest.getChest().NetytarDrawer.drawEllipses(MusicMaster.getScaleEnum(InstrumentChest.getChest().Instrument.getNote(), rightScaleCode)); }
public void receive_leftClose() { InstrumentChest.getChest().Instrument.setNote(InstrumentChest.getChest().Note); GraphicsChest.getChest().NetytarDrawer.flashSpark(); }
public void generateNetytar() { int baseNote = GraphicsChest.getChest().netytarGenNote; int halfSpacer = horizontalSpacer / 2; int spacer = horizontalSpacer; int firstSpacer = 0; bool isPairRow; for (int row = 0; row < GraphicsChest.getChest().netytarHeight; row++) { for (int col = 0; col < GraphicsChest.getChest().netytarWidth; col++) { #region Is row pair? if (row % 2 != 0) { isPairRow = false; } else { isPairRow = true; } #endregion #region Draw the button on canvas if (isPairRow) { firstSpacer = horizontalSpacer / 2; } else { firstSpacer = 0; } netytarButtons[row, col] = new NetytarButton(); netytarButtons[row, col].ToolTip = row.ToString() + " " + col.ToString(); int X = GraphicsChest.getChest().netytarStart + firstSpacer + col * horizontalSpacer; int Y = GraphicsChest.getChest().netytarStart + verticalSpacer * row; Canvas.SetLeft(netytarButtons[row, col], X); Canvas.SetTop(netytarButtons[row, col], Y); // OCCLUDER //netytarButtons[row, col].Occluder.Points = new PointCollection() { new Point(X - occluderOffset, Y + buttonWidth / 2), new Point(X + buttonWidth / 2 + 1, Y - occluderOffset), new Point(X + buttonWidth + occluderOffset + 1, Y + buttonWidth / 2), new Point(X + buttonWidth / 2 + 1, Y + buttonHeight + occluderOffset)}; netytarButtons[row, col].Occluder.Width = buttonWidth + occluderOffset * 2; netytarButtons[row, col].Occluder.Height = buttonHeight + occluderOffset * 2; Canvas.SetLeft(netytarButtons[row, col].Occluder, X - occluderOffset); Canvas.SetTop(netytarButtons[row, col].Occluder, Y - occluderOffset); Panel.SetZIndex(netytarButtons[row, col], 3); Panel.SetZIndex(netytarButtons[row, col].Occluder, 2000); canvas.Children.Add(netytarButtons[row, col]); canvas.Children.Add(netytarButtons[row, col].Occluder); netytarButtons[row, col].Width = buttonWidth; netytarButtons[row, col].Height = buttonHeight; #endregion #region Define note int calcNote = baseNote; calcNote += col * 2 + row * 2; if (isPairRow) { calcNote += 1; } netytarButtons[row, col].Note = calcNote; #endregion #region Behavior netytarButtons[row, col].setBehavior(); #endregion } } }
public void drawLines(Scales scale, Color color) { clearLines(); bool isPairRow; Point realCenter1; Point realCenter2; Brush brush; for (int row = 0; row < GraphicsChest.getChest().netytarHeight; row++) { for (int col = 0; col < GraphicsChest.getChest().netytarWidth; col++) { #region Is row pair? if (row % 2 != 0) { isPairRow = false; } else { isPairRow = true; } #endregion #region Draw horizontal lines if (col != 0) { if (MusicMaster.isInScale(netytarButtons[row, col].Note, scale) && MusicMaster.isInScale(netytarButtons[row, col - 1].Note, scale)) { brush = new SolidColorBrush(color); } else { brush = GraphicsChest.getChest().NotInScaleBrush; } realCenter1 = new Point(Canvas.GetLeft(netytarButtons[row, col]) + 0, Canvas.GetTop(netytarButtons[row, col]) + 6); realCenter2 = new Point(Canvas.GetLeft(netytarButtons[row, col - 1]) + 13, Canvas.GetTop(netytarButtons[row, col - 1]) + 6); Line myLine = new Line(); myLine.Stroke = brush; myLine.X1 = realCenter1.X; myLine.X2 = realCenter2.X; myLine.Y1 = realCenter1.Y; myLine.Y2 = realCenter2.Y; myLine.HorizontalAlignment = HorizontalAlignment.Left; myLine.VerticalAlignment = VerticalAlignment.Center; myLine.StrokeThickness = lineThickness; Panel.SetZIndex(myLine, 1); drawnLines.Add(myLine); netytarButtons[row, col - 1].L_p2 = myLine; netytarButtons[row, col].L_m2 = myLine; } #endregion #region Draw diagonal lines // Diagonale A: se riga pari p+1, se dispari p+3 if (row != 0) { if (MusicMaster.isInScale(netytarButtons[row, col].Note, scale) && MusicMaster.isInScale(netytarButtons[row - 1, col].Note, scale)) { brush = new SolidColorBrush(color); } else { brush = GraphicsChest.getChest().NotInScaleBrush; } if (isPairRow) { realCenter1 = new Point(Canvas.GetLeft(netytarButtons[row, col]) + 2, Canvas.GetTop(netytarButtons[row, col]) + 2); realCenter2 = new Point(Canvas.GetLeft(netytarButtons[row - 1, col]) + 11, Canvas.GetTop(netytarButtons[row - 1, col]) + 11); } else { realCenter1 = new Point(Canvas.GetLeft(netytarButtons[row, col]) + 11, Canvas.GetTop(netytarButtons[row, col]) + 2); realCenter2 = new Point(Canvas.GetLeft(netytarButtons[row - 1, col]) + 2, Canvas.GetTop(netytarButtons[row - 1, col]) + 11); } Line myLine = new Line(); myLine.Stroke = brush; myLine.X1 = realCenter1.X; myLine.X2 = realCenter2.X; myLine.Y1 = realCenter1.Y; myLine.Y2 = realCenter2.Y; myLine.HorizontalAlignment = HorizontalAlignment.Left; myLine.VerticalAlignment = VerticalAlignment.Center; myLine.StrokeThickness = lineThickness; Panel.SetZIndex(myLine, 1); drawnLines.Add(myLine); if (isPairRow) { netytarButtons[row - 1, col].L_p3 = myLine; netytarButtons[row, col].L_m3 = myLine; } else { netytarButtons[row - 1, col].L_p1 = myLine; netytarButtons[row, col].L_m1 = myLine; } // Diagonale B: se riga pari p+3, se dispari p+1 if (isPairRow) { if (col < GraphicsChest.getChest().netytarWidth - 1) { if (MusicMaster.isInScale(netytarButtons[row, col].Note, scale) && MusicMaster.isInScale(netytarButtons[row - 1, col + 1].Note, scale)) { brush = new SolidColorBrush(color); } else { brush = GraphicsChest.getChest().NotInScaleBrush; } realCenter1 = new Point(Canvas.GetLeft(netytarButtons[row, col]) + 11, Canvas.GetTop(netytarButtons[row, col]) + 2); realCenter2 = new Point(Canvas.GetLeft(netytarButtons[row - 1, col + 1]) + 2, Canvas.GetTop(netytarButtons[row - 1, col + 1]) + 11); Line diaLine = new Line(); diaLine.Stroke = brush; diaLine.X1 = realCenter1.X; diaLine.X2 = realCenter2.X; diaLine.Y1 = realCenter1.Y; diaLine.Y2 = realCenter2.Y; diaLine.HorizontalAlignment = HorizontalAlignment.Left; diaLine.VerticalAlignment = VerticalAlignment.Center; diaLine.StrokeThickness = lineThickness; Panel.SetZIndex(diaLine, 1); drawnLines.Add(diaLine); netytarButtons[row - 1, col + 1].L_p1 = diaLine; netytarButtons[row, col].L_m1 = diaLine; } } else { if (col > 0) { if (MusicMaster.isInScale(netytarButtons[row, col].Note, scale) && MusicMaster.isInScale(netytarButtons[row - 1, col - 1].Note, scale)) { brush = new SolidColorBrush(color); } else { brush = GraphicsChest.getChest().NotInScaleBrush; } realCenter1 = new Point(Canvas.GetLeft(netytarButtons[row, col]) + 2, Canvas.GetTop(netytarButtons[row, col]) + 2); realCenter2 = new Point(Canvas.GetLeft(netytarButtons[row - 1, col - 1]) + 11, Canvas.GetTop(netytarButtons[row - 1, col - 1]) + 11); Line diaLine = new Line(); diaLine.Stroke = brush; diaLine.X1 = realCenter1.X; diaLine.X2 = realCenter2.X; diaLine.Y1 = realCenter1.Y; diaLine.Y2 = realCenter2.Y; diaLine.HorizontalAlignment = HorizontalAlignment.Left; diaLine.VerticalAlignment = VerticalAlignment.Center; diaLine.StrokeThickness = lineThickness; Panel.SetZIndex(diaLine, 1); drawnLines.Add(diaLine); netytarButtons[row - 1, col - 1].L_p3 = diaLine; netytarButtons[row, col].L_m3 = diaLine; } } } #endregion } } foreach (Line line in drawnLines) { canvas.Children.Add(line); } }
private void btnBpmUp_Click(object sender, RoutedEventArgs e) { GraphicsChest.getChest().RhythmFlasher.Bpm++; lblBpm.Text = GraphicsChest.getChest().RhythmFlasher.Bpm.ToString(); }