summaryrefslogtreecommitdiff
path: root/apps/codecs/wavpack.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/codecs/wavpack.c')
-rw-r--r--apps/codecs/wavpack.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/apps/codecs/wavpack.c b/apps/codecs/wavpack.c
index 275f5f11e4..0da8a89027 100644
--- a/apps/codecs/wavpack.c
+++ b/apps/codecs/wavpack.c
@@ -47,7 +47,7 @@ enum codec_status codec_start(struct codec_api* api)
47{ 47{
48 WavpackContext *wpc; 48 WavpackContext *wpc;
49 char error [80]; 49 char error [80];
50 int bps, nchans; 50 int bps, nchans, sr_100;
51 51
52 /* Generic codec initialisation */ 52 /* Generic codec initialisation */
53 TEST_CODEC_API(api); 53 TEST_CODEC_API(api);
@@ -90,6 +90,7 @@ enum codec_status codec_start(struct codec_api* api)
90 90
91 bps = WavpackGetBytesPerSample (wpc); 91 bps = WavpackGetBytesPerSample (wpc);
92 nchans = WavpackGetReducedChannels (wpc); 92 nchans = WavpackGetReducedChannels (wpc);
93 sr_100 = ci->id3->frequency / 100;
93 94
94 ci->set_elapsed (0); 95 ci->set_elapsed (0);
95 96
@@ -99,7 +100,7 @@ enum codec_status codec_start(struct codec_api* api)
99 long nsamples; 100 long nsamples;
100 101
101 if (ci->seek_time && ci->taginfo_ready && ci->id3->length) { 102 if (ci->seek_time && ci->taginfo_ready && ci->id3->length) {
102 int curpos_ms = (WavpackGetSampleIndex (wpc) + 220) / 441 * 10; 103 int curpos_ms = WavpackGetSampleIndex (wpc) / sr_100 * 10;
103 int n, d, skip; 104 int n, d, skip;
104 105
105 if (ci->seek_time > curpos_ms) { 106 if (ci->seek_time > curpos_ms) {
@@ -121,7 +122,7 @@ enum codec_status codec_start(struct codec_api* api)
121 if (!wpc) 122 if (!wpc)
122 break; 123 break;
123 124
124 ci->set_elapsed ((int)((long long) WavpackGetSampleIndex (wpc) * 1000 / 44100)); 125 ci->set_elapsed (WavpackGetSampleIndex (wpc) / sr_100 * 10);
125 rb->yield (); 126 rb->yield ();
126 } 127 }
127 128
@@ -189,7 +190,7 @@ enum codec_status codec_start(struct codec_api* api)
189 while (!ci->audiobuffer_insert ((char *) temp_buffer, nsamples * 4)) 190 while (!ci->audiobuffer_insert ((char *) temp_buffer, nsamples * 4))
190 rb->yield (); 191 rb->yield ();
191 192
192 ci->set_elapsed ((WavpackGetSampleIndex (wpc) + 220) / 441 * 10); 193 ci->set_elapsed (WavpackGetSampleIndex (wpc) / sr_100 * 10);
193 } 194 }
194 195
195 if (ci->request_next_track()) 196 if (ci->request_next_track())