This project is read-only.

Guitar class

Accepts input from a guitar controller.

This class hasn't been tested thoroughly, so some of these behaviors may be incorrect or vary based on the type of guitar you're using.


public Guitar(PlayerIndex playerIndex)
Creates a guitar object associated with the specified controller index.

Fields / Properties

public GamePadState State
Returns the controller state from the last call to Update.

public bool IsAlternateGuitar
Determines if this controller was detected as XNA's Guitar or AlternateGuitar controller type.

public GuitarStrumState Red
public GuitarStrumState Yellow
public GuitarStrumState Blue
public GuitarStrumState Orange
public GuitarStrumState Green
public GuitarStrumState StrumUp
public GuitarStrumState StrumDown
Determines the state of the fret buttons or the strum bar. Returns:
  • None, if the button or strum bar is not activated
  • Begin, if the user just pressed/strummed since last call to Update
  • Continuing, if the user has been pressing/strumming since before last call to Update
  • Ending, if the user just stopped pressing/strumming since last call to Update
public double RollAngle
Some guitars detect the roll position of the guitar.

public double Tilt
Returns the tilt amount for the guitar. For some guitars this is an analog value; for others it seems to be either -1, 0, or 1.

public double Whammy
Returns the amount the whammy bar is pressed, between 0 and 1.


public void Update()
Updates the state of the guitar controller.

Static Methods / Properties

public static GuitarCollection ActiveGuitars
Returns a list of active guitar attached. This value is updated by calling the Discover and Purge methods.

public static Guitar[] Discover()
Checks if any new guitars have been connected since last call and adds them to the ActiveGuitars collection. Returns an array of the Guitars that were added.

public static Guitar[] Purge()
Checks if any guitars have been disconnected since last call and removes them from the ActiveGuitars collection. Returns an array of the Guitars that were removed.

Last edited Jan 4, 2010 at 5:06 AM by dylanwolf, version 1


No comments yet.