From: Andre Noll Date: Sun, 6 Jul 2008 17:25:40 +0000 (+0200) Subject: Use an unused byte in struct afs_info to store the amplification value. X-Git-Tag: v0.3.3~52^2~12 X-Git-Url: http://git.tue.mpg.de/?a=commitdiff_plain;h=f1b7734b997352b8df737b8184af69ca91c1b7dd;p=paraslash.git Use an unused byte in struct afs_info to store the amplification value. --- diff --git a/afs.h b/afs.h index d01f0cfb..a596317f 100644 --- a/afs.h +++ b/afs.h @@ -24,6 +24,8 @@ struct afs_info { uint32_t lyrics_id; /** Mp3, ogg or aac. */ uint8_t audio_format_id; + /** Amplification value. */ + uint8_t amp; }; /** diff --git a/aft.c b/aft.c index 3d10ced2..8797bd86 100644 --- a/aft.c +++ b/aft.c @@ -142,8 +142,10 @@ enum afsi_offsets { AFSI_LYRICS_ID_OFFSET = 24, /** Storage position of the .audio_format_id field. */ AFSI_AUDIO_FORMAT_ID_OFFSET = 28, - /** 3 bytes reserved space for future usage. */ - AFSI_AUDIO_FORMAT_UNUSED_OFFSET = 29, + /** Storage position of the amplification field. */ + AFSI_AMP_OFFSET = 29, + /** 2 bytes reserved space for future usage. */ + AFSI_AUDIO_FORMAT_UNUSED_OFFSET = 30, /** On-disk storage space needed. */ AFSI_SIZE = 32 }; @@ -167,7 +169,8 @@ void save_afsi(struct afs_info *afsi, struct osl_object *obj) write_u32(buf + AFSI_LYRICS_ID_OFFSET, afsi->lyrics_id); write_u8(buf + AFSI_AUDIO_FORMAT_ID_OFFSET, afsi->audio_format_id); - memset(buf + AFSI_AUDIO_FORMAT_UNUSED_OFFSET, 0, 3); + write_u8(buf + AFSI_AMP_OFFSET, afsi->amp); + memset(buf + AFSI_AUDIO_FORMAT_UNUSED_OFFSET, 0, 2); } /** @@ -192,6 +195,7 @@ int load_afsi(struct afs_info *afsi, struct osl_object *obj) afsi->lyrics_id = read_u32(buf + AFSI_LYRICS_ID_OFFSET); afsi->audio_format_id = read_u8(buf + AFSI_AUDIO_FORMAT_ID_OFFSET); + afsi->amp = read_u8(buf + AFSI_AMP_OFFSET); return 1; }