changeset 237:f0117679cd26 trunk

[svn] - a slightly better way of doing things here
author nenolod
date Tue, 07 Nov 2006 02:11:05 -0800
parents c9d1426fc948
children 74f307156fa5
files ChangeLog src/wavpack/libwavpack.cxx
diffstat 2 files changed, 28 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Tue Nov 07 02:01:22 2006 -0800
+++ b/ChangeLog	Tue Nov 07 02:11:05 2006 -0800
@@ -1,3 +1,11 @@
+2006-11-07 10:01:22 +0000  William Pitcock <nenolod@nenolod.net>
+  revision [486]
+  - detect filesize properly
+  
+  trunk/src/modplug/archive/arch_raw.cxx |    2 ++
+  1 file changed, 2 insertions(+)
+
+
 2006-11-07 09:56:59 +0000  William Pitcock <nenolod@nenolod.net>
   revision [484]
   - that should have been a 1
--- a/src/wavpack/libwavpack.cxx	Tue Nov 07 02:01:22 2006 -0800
+++ b/src/wavpack/libwavpack.cxx	Tue Nov 07 02:11:05 2006 -0800
@@ -193,6 +193,25 @@
             return false;
         }
 
+        return true;
+    }
+
+    bool attach_to_play(const char *filename)
+    {
+        wv_Input = vfs_fopen(filename, "rb");
+
+        char *corrFilename = g_strconcat(filename, "c", NULL);
+
+        wvc_Input = vfs_fopen(corrFilename, "rb");
+
+        g_free(corrFilename);
+
+        ctx = WavpackOpenFileInputEx(&reader, wv_Input, wvc_Input, error_buff, OPEN_TAGS | OPEN_WVC, 0);
+
+        if (ctx == NULL) {
+            return false;
+        }
+
         sample_rate = WavpackGetSampleRate(ctx);
         num_channels = WavpackGetNumChannels(ctx);
         input = (int32_t *)calloc(BUFFER_SIZE, num_channels * sizeof(int32_t));
@@ -297,7 +316,7 @@
     int i;
     WavpackDecoder d(&mod);
 
-    if (!d.attach(filename)) {
+    if (!d.attach_to_play(filename)) {
         printf("wavpack: Error opening file: \"%s\"\n", filename);
         killDecodeThread = true;
         return end_thread();