Photoacoustic based technique for measuring the magnetocaloric effect