public function setVolume($volume)
    {
        $deferred = new Deferred();

        if ($volume > 100 || $volume < 0) {
            $deferred->reject(new \InvalidArgumentException("{$volume}% is not a valid option. The bitrate must be between 0% and 100%."));

            return $deferred->promise();
        }

        if ($this->speaking) {
            $deferred->reject(new \Exception('Cannot change volume while playing.'));

            return $deferred->promise();
        }

        $this->volume = $volume;

        $deferred->resolve();

        return $deferred->promise();
    }