I recently have had trouble with the volume controls on my MacBook Pro when I switched audio outputs.
– For example, I would remove/add headphones, switch to/from Airplay audio devices, and I would lose the volume control from keyboard buttons.
– The volume scroll bar from the menu bar would work sometimes.

I have tried restarting and also resetting the PRAM or SMC. Those may have worked, but were time consuming tasks.

I finally found a solution that was quick and painless: restarting CoreAudio via the Terminal.

sudo killall coreaudio

Alternatively, you could also use these two commands to the same end.

sudo kextunload /System/Library/Extensions/AppleHDA.kext

sudo kextload /System/Library/Extensions/AppleHDA.kext

Of course, using sudo you will have to input your password.
CoreAudio will automatically restart, and for me, I was able control the volume again.

I haven’t test this while using Audio specific programs like ChucK or Max, so your results may vary.