Mercurial > audlegacy-plugins
diff src/wavpack/libwavpack.cxx @ 237:f0117679cd26 trunk
[svn] - a slightly better way of doing things here
author | nenolod |
---|---|
date | Tue, 07 Nov 2006 02:11:05 -0800 |
parents | 7b7660c9f31c |
children | a1ef3cf974c7 |
line wrap: on
line diff
--- 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();