'Compute ReplayGain values for the requested album and its items.
:rtype: :class:`AlbumGain`'

def compute_album_gain(self, album):

    self._log.debug(u'Analysing    album    {0}', album)
    item = list(album.items())[0]
    audiofile = self.open_audio_file(item)
    rg = self.init_replaygain(audiofile, item)
    track_gains = []
    for item in album.items():
        audiofile = self.open_audio_file(item)
        (rg_track_gain, rg_track_peak) = self._title_gain(rg, audiofile)
        track_gains.append(Gain(gain=rg_track_gain, peak=rg_track_peak))
        self._log.debug(u'ReplayGain    for    track    {0}:    {1:.2f},    {2:.2f}', item, rg_track_gain, rg_track_peak)
    (rg_album_gain, rg_album_peak) = rg.album_gain()
    self._log.debug(u'ReplayGain    for    album    {0}:    {1:.2f},    {2:.2f}', album, rg_album_gain, rg_album_peak)
    return AlbumGain(Gain(gain=rg_album_gain, peak=rg_album_peak), track_gains=track_gains)
