Mercurial > otakunoraifu
comparison music2/koedec.cc @ 24:c9e218c2c3f1
Makes xclannad buildable without libvorbis
author | thib |
---|---|
date | Fri, 27 Feb 2009 16:02:32 +0000 |
parents | 422f3cb3614b |
children | 01aa5ddf7dc8 |
comparison
equal
deleted
inserted
replaced
23:f94d28dcf7bc | 24:c9e218c2c3f1 |
---|---|
84 static AvgKoeCache koe_cache; | 84 static AvgKoeCache koe_cache; |
85 | 85 |
86 AvgKoeInfo FindKoe(int file_number, int index) { | 86 AvgKoeInfo FindKoe(int file_number, int index) { |
87 return koe_cache.Find(file_number, index); | 87 return koe_cache.Find(file_number, index); |
88 }; | 88 }; |
89 #if HAVE_LIBVORBISFILE || HAVE_LIBVORBISIDEC | |
89 extern int ogg_get_rate(FILE*); | 90 extern int ogg_get_rate(FILE*); |
91 #endif | |
90 AvgKoeInfo AvgKoeCache::Find(int file_number, int index) { | 92 AvgKoeInfo AvgKoeCache::Find(int file_number, int index) { |
91 AvgKoeInfo info; | 93 AvgKoeInfo info; |
92 info.stream = 0; info.length = 0; info.offset = 0; | 94 info.stream = 0; info.length = 0; info.offset = 0; |
93 | 95 |
94 list<AvgKoeHead>::iterator it; | 96 list<AvgKoeHead>::iterator it; |
107 if (arcinfo == 0) { | 109 if (arcinfo == 0) { |
108 type = koe_ovk; | 110 type = koe_ovk; |
109 sprintf(fname, "z%04d.ovk", file_number); | 111 sprintf(fname, "z%04d.ovk", file_number); |
110 arcinfo = file_searcher.Find(FILESEARCH::KOE,fname,".ovk"); | 112 arcinfo = file_searcher.Find(FILESEARCH::KOE,fname,".ovk"); |
111 } | 113 } |
114 #if HAVE_LIBVORBISFILE || HAVE_LIBVORBISIDEC | |
112 if (arcinfo == 0) { | 115 if (arcinfo == 0) { |
113 DIRFILE* koedir = (DIRFILE*) file_searcher.MakeARCFILE((FILESEARCH::ARCTYPE)0, "koe"); | 116 DIRFILE* koedir = (DIRFILE*) file_searcher.MakeARCFILE((FILESEARCH::ARCTYPE)0, "koe"); |
114 sprintf(fname, "%04d", file_number); | 117 sprintf(fname, "%04d", file_number); |
115 koedir = new DIRFILE(koedir->SearchFile(fname)); | 118 koedir = new DIRFILE(koedir->SearchFile(fname)); |
116 sprintf(fname, "z%04d%05d.ogg", file_number, index); | 119 sprintf(fname, "z%04d%05d.ogg", file_number, index); |
125 fseek(stream, 0L, SEEK_CUR); | 128 fseek(stream, 0L, SEEK_CUR); |
126 info.type = koe_ogg; | 129 info.type = koe_ogg; |
127 info.stream = stream; | 130 info.stream = stream; |
128 return info; | 131 return info; |
129 } | 132 } |
133 #endif | |
130 if (arcinfo == 0) return info; | 134 if (arcinfo == 0) return info; |
131 FILE* stream = arcinfo->OpenFile(); | 135 FILE* stream = arcinfo->OpenFile(); |
132 delete arcinfo; | 136 delete arcinfo; |
133 if (stream == 0) return info; | 137 if (stream == 0) return info; |
134 cache.push_front(AvgKoeHead(stream, file_number, type)); | 138 cache.push_front(AvgKoeHead(stream, file_number, type)); |