                 if let downState = keyDownState {
                     keyDown[i] = NSNumber(value: (downState as Bool))
                     if ((keyDownState) == true) {
-                        delegate?.pianoKeyDown(i)
+                        delegate?.pianoKeyDown(UInt8(i))
                         keyDown(i)
                     } else {
-                        delegate?.pianoKeyUp(i)
+                        delegate?.pianoKeyUp(UInt8(i))
                         keyUp(i)
                     }
                 }

    static let minNumberOfKeys = 12
    static let maxNumberOfKeys = 61
    
    weak var delegate:GLNPianoViewDelegate?
    var keyDown = NSMutableArray(capacity:maxNumberOfKeys)
    var keyRects = NSMutableArray(capacity:maxNumberOfKeys)
    var keyLayers = NSMutableArray(capacity:maxNumberOfKeys)

    var keyCornerRadius:CGFloat = 0
    var whiteKeyCount = 0
    
    public weak var delegate:GLNPianoViewDelegate?
    
    
    override public init(frame: CGRect) {
        super.init(frame: frame)
