Thank you to anyone who has already donated - your generous donations helped make three months of treatment possible.
My brother Nate continues to fight stage IV Hodgkin's lymphoma. He's just 31, with a wife and baby girl. They have no active income (since he's been unable to return to work), no insurance, and cannot afford the treatment he needs. Nate and his family need your help. Please consider a donation, every dollar helps. Thanks.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
Index: apps/metadata/mpc.c =================================================================== --- apps/metadata/mpc.c +++ apps/metadata/mpc.c @@ -31,30 +31,51 @@ /* Needed for replay gain in sv8, please search MPC_OLD_GAIN_REF in libmusepack */ /* 64.82 * 100 */ -static int set_replaygain_sv7(, - bool album, - long value, - long used) +static int set_replaygain(, + bool album, + long gain, + long peak, + long used) { - long gain = (int16_t) ((value >> 16) & 0xffff); - long peak = (uint16_t) (value & 0xffff); - - /* Remark: mpc sv7 outputs peak as amplitude, not as dB. The following - * useage of peak is not correct and needs to be fixed. */ - /* We use a peak value of 0 to indicate a given gain type isn't used. */ if { /* Use the Xing TOC field to store ReplayGain strings for use in the * ID3 screen, since Musepack files shouldn't need to use it in any * other way. */ + + char* replaygain_string = id3->toc + used; + + if + { + id3->album_gain_string = replaygain_string; + } + else + { + id3->track_gain_string = replaygain_string; + } + used += parse_replaygain_int(album, gain * 512 / 100, peak << 9, - id3, id3->toc + used, sizeof(id3->toc) - used); + id3, replaygain_string, sizeof(id3->toc) - used); } return used; } +static int set_replaygain_sv7(, + bool album, + long value, + long used) +{ + long gain = (int16_t) ((value >> 16) & 0xffff); + long peak = (uint16_t) (value & 0xffff); + + /* Remark: mpc sv7 outputs peak as amplitude, not as dB. The following + * useage of peak is not correct and needs to be fixed. */ + + return set_replaygain(id3, album, gain, peak, used); +} + static int set_replaygain_sv8(, bool album, long gain, @@ -62,18 +83,7 @@ long used) { gain = (long)(SV8_TO_SV7_CONVERT_GAIN - ((gain*100)/256)); - - /* We use a peak value of 0 to indicate a given gain type isn't used. */ - if { - /* Use the Xing TOC field to store ReplayGain strings for use in the - * ID3 screen, since Musepack files shouldn't need to use it in any - * other way. - */ - used += parse_replaygain_int(album, gain * 512 / 100, peak << 9, - id3, id3->toc + used, sizeof(id3->toc) - used); - } - - return used; + return set_replaygain(id3, album, gain, peak, used); } static int sv8_get_size(uint8_t *buffer, int index, uint64_t *p_size) |