Edit: if you check the docstring for the hook (C-hv org-after-todo-state-change-hook
RET) you'll see that the new state is available in the variable org-state
, so we can test for that:
(add-hook 'org-after-todo-state-change-hook 'my-org-after-todo-state-change)
(defun my-org-after-todo-state-change ()
(when (string-equal org-state "DONE")
(org-clock-out-if-current)
(play-sound-file "~/Library/Sounds/InkSoundStroke3.aif")))