Arduino and rotary encoder to change volume on my computer

I just wanted to know how i could change the volume on my computer using a rotary encoder.
I have some base code from the sunfounder super kit and a rotary encoder from them. How could i integrate a volume control into this.

#define clkPin 2
#define dtPin 3
#define swPin 4 //the number of the button

int encoderVal = 0;

void setup()
{
  pinMode(clkPin, INPUT);
  pinMode(dtPin, INPUT);
  pinMode(swPin, INPUT);
  digitalWrite(swPin, HIGH);
  Serial.begin(9600);
}

void loop()
{
  int change = getEncoderTurn();
  encoderVal = encoderVal + change;
  if(digitalRead(swPin) == LOW)
  {
    encoderVal = 0;
  }
  Serial.println(encoderVal);
}

int getEncoderTurn(void)
{
  static int oldA = HIGH;
  static int oldB = HIGH;
  int result = 0;
  int newA = digitalRead(clkPin);
  int newB = digitalRead(dtPin);
  if (newA != oldA || newB != oldB)
  {
    // something has changed
    if (oldA == HIGH && newA == LOW)
    {
      result = (oldB * 2 - 1);
    }
  }
  oldA = newA;
  oldB = newB;
  return result;
}

You will either need a program on the PC to read the serial data from your arduino and convert this to a volume level and pass to relevant API to adjust volume OR use something like the Leonardo that can be configured to look like a keyboard to the PC it is plugged into via USB and send the relevant media keycodes for volume up/down/mute.