Index: /dsfilters/dec_mpc/src/mpc_filter.cpp
===================================================================
--- /dsfilters/dec_mpc/src/mpc_filter.cpp	(revision 379)
+++ /dsfilters/dec_mpc/src/mpc_filter.cpp	(revision 380)
@@ -328,4 +328,10 @@
 	int	total_samples_decoded = 0;
 
+	// discontinuity after seek - reset scale factors
+	if (pSample->IsDiscontinuity() == NOERROR) {
+		mpc_decoder_reset_scf(demux->d, 0);
+	}
+
+
 	// now scan through the frames
 	int frame_cnt = 1 << stream_info.block_pwr;
@@ -483,5 +489,13 @@
 {
 	if (m_pInput->IsConnected()) {
-		if (gain) *gain = stream_info.gain_title / 256.0;
+		float g = 0;
+		if (stream_info.gain_title != 0) {
+			g = (64.82 - stream_info.gain_title / 256.0 );
+		}
+		if (stream_info.gain_album != 0) {
+			g = (64.82 - stream_info.gain_album / 256.0 );
+		}
+
+		if (gain) *gain = g;
 		return NOERROR;
 	} else {
Index: /dsfilters/demux_mpc/src/mpc_file.cpp
===================================================================
--- /dsfilters/demux_mpc/src/mpc_file.cpp	(revision 379)
+++ /dsfilters/demux_mpc/src/mpc_file.cpp	(revision 380)
@@ -8,4 +8,6 @@
 #include "stdafx.h"
 #include <math.h>
+
+#define OLD_GAIN_REF		64.82
 
 
@@ -164,8 +166,8 @@
 
 	b.NeedBits32();
-	gain_title_db = b.SGetBits(16) / 100.0;		// title gain
+	gain_title_db = ((int16)b.SGetBits(16)) / 100.0;		// title gain
 	int title_peak = b.UGetBits(16);
-	if (title_peak != 0) {
-		gain_title_peak_db = 20 * log10f((float)title_peak);		// title peak
+	if (title_peak != 0) {		
+		gain_title_peak_db = (title_peak / 32767.0);
 	} else {
 		gain_title_peak_db = 0;
@@ -173,19 +175,12 @@
 
 	b.NeedBits32();
-	gain_album_db = b.SGetBits(16) / 100.0;		// album gain
+	gain_album_db = ((int16)b.SGetBits(16)) / 100.0;		// album gain
 	int album_peak = b.UGetBits(16);
 	if (album_peak != 0) {
-		gain_album_peak_db = 20 * log10f((float)album_peak);		// album peak
+		gain_album_peak_db = (album_peak / 32767.0);
 	} else {
 		gain_album_peak_db = 0;
 	}
 
-	#define OLD_GAIN_REF		64.82
-	if (gain_title_db != 0) {
-		gain_title_db = OLD_GAIN_REF - gain_title_db;
-	}
-	if (gain_album_db != 0) {
-		gain_album_db = OLD_GAIN_REF - gain_album_db;
-	}
 
 	b.NeedBits32();
@@ -300,7 +295,16 @@
 	int16	val;
 	b.NeedBits();	val = b.SGetBits(16);	gain_title_db = val / 256.0;
-	b.NeedBits();	val = b.SGetBits(16);	gain_title_peak_db = val / 256.0;
+	b.NeedBits();	val = b.UGetBits(16);	gain_title_peak_db = val;
 	b.NeedBits();	val = b.SGetBits(16);	gain_album_db = val / 256.0;
-	b.NeedBits();	val = b.SGetBits(16);	gain_album_peak_db = val / 256.0;
+	b.NeedBits();	val = b.UGetBits(16);	gain_album_peak_db = val;
+
+	if (gain_title_db != 0) gain_title_db = OLD_GAIN_REF - gain_title_db;
+	if (gain_album_db != 0) gain_album_db = OLD_GAIN_REF - gain_album_db;
+	if (gain_title_peak_db != 0) {
+		gain_title_peak_db = pow((double)10.0, (double)(gain_title_peak_db / (20*256))) / (double)(1 << 15);
+	}
+	if (gain_album_peak_db != 0) {
+		gain_album_peak_db = pow((double)10.0, (double)(gain_album_peak_db / (20*256))) / (double)(1 << 15);
+	}
 
 	return 0;
@@ -480,8 +484,19 @@
 
 	int packet_num = seek_sample / (1152*audio_block_frames);
+
+	// we need to seek back a little to avoid artifacts
+	if (stream_version == 7) {
+		if (packet_num > 32) {
+			packet_num -= 32;
+		} else {
+			packet_num = 0;
+		}
+	}
+
 	int i = (packet_num >> (seek_pwr - block_pwr));
 	if (i >= seek_table_size) {
 		i = seek_table_size-1;
 	}
+
 
 	// seek to position
Index: /dsfilters/demux_mpc/src/mpc_prop.cpp
===================================================================
--- /dsfilters/demux_mpc/src/mpc_prop.cpp	(revision 379)
+++ /dsfilters/demux_mpc/src/mpc_prop.cpp	(revision 380)
@@ -140,21 +140,21 @@
 
 	// Gains
-	i.pszText = _T("Album gain");	i.iItem = 4;
+	i.pszText = _T("Title gain");	i.iItem = 4;
+	val.Format(_T("%3.2f dB"), info.gain_title_db);
+	item = ListView_InsertItem(ITEM(IDC_LIST_CONTENT), &i);
+	ListView_SetItemText(ITEM(IDC_LIST_CONTENT), item, 1, val.GetBuffer());
+
+	i.pszText = _T("Title peak");	i.iItem = 5;
+	val.Format(_T("%8.6f"), info.gain_title_peak_db);
+	item = ListView_InsertItem(ITEM(IDC_LIST_CONTENT), &i);
+	ListView_SetItemText(ITEM(IDC_LIST_CONTENT), item, 1, val.GetBuffer());
+
+	i.pszText = _T("Album gain");	i.iItem = 6;
 	val.Format(_T("%3.2f dB"), info.gain_album_db);
 	item = ListView_InsertItem(ITEM(IDC_LIST_CONTENT), &i);
 	ListView_SetItemText(ITEM(IDC_LIST_CONTENT), item, 1, val.GetBuffer());
 
-	i.pszText = _T("Album peak");	i.iItem = 5;
-	val.Format(_T("%3.2f dB"), info.gain_album_peak_db);
-	item = ListView_InsertItem(ITEM(IDC_LIST_CONTENT), &i);
-	ListView_SetItemText(ITEM(IDC_LIST_CONTENT), item, 1, val.GetBuffer());
-
-	i.pszText = _T("Title gain");	i.iItem = 6;
-	val.Format(_T("%3.2f dB"), info.gain_title_db);
-	item = ListView_InsertItem(ITEM(IDC_LIST_CONTENT), &i);
-	ListView_SetItemText(ITEM(IDC_LIST_CONTENT), item, 1, val.GetBuffer());
-
-	i.pszText = _T("Title peak");	i.iItem = 7;
-	val.Format(_T("%3.2f dB"), info.gain_title_peak_db);
+	i.pszText = _T("Album peak");	i.iItem = 7;
+	val.Format(_T("%8.6f"), info.gain_album_peak_db);
 	item = ListView_InsertItem(ITEM(IDC_LIST_CONTENT), &i);
 	ListView_SetItemText(ITEM(IDC_LIST_CONTENT), item, 1, val.GetBuffer());
