Changeset 2:422f3cb3614b

Show
Ignore:
Timestamp:
08/01/08 21:17:15 (4 years ago)
Author:
thib
Branch:
default
convert_revision:
svn:d0a2da98-017c-47d2-8c43-22b54484806d/trunk@3
Message:
Enabled voice playing with "%04d/%04d%05d.ogg" format. Don't use a cache for this
Location:
music2
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • music2/koedec.cc

    r0 r2  
    3434#include"music.h" 
    3535#include"system/file.h" 
     36#include"system/file_impl.h" 
    3637 
    3738using namespace std; 
     
    8687        return koe_cache.Find(file_number, index); 
    8788}; 
    88  
     89extern int ogg_get_rate(FILE*); 
    8990AvgKoeInfo AvgKoeCache::Find(int file_number, int index) { 
    9091        AvgKoeInfo info; 
     
    109110                        arcinfo = file_searcher.Find(FILESEARCH::KOE,fname,".ovk"); 
    110111                } 
     112                if (arcinfo == 0) { 
     113                        DIRFILE* koedir = (DIRFILE*) file_searcher.MakeARCFILE((FILESEARCH::ARCTYPE)0, "koe"); 
     114                        sprintf(fname, "%04d", file_number); 
     115                        koedir = new DIRFILE(koedir->SearchFile(fname)); 
     116                        sprintf(fname, "z%04d%05d.ogg", file_number, index); 
     117                        arcinfo = koedir->Find(fname, ".ogg"); 
     118                        delete koedir; 
     119                         
     120                        if (arcinfo == 0) return info; 
     121                        FILE* stream = arcinfo->OpenFile(); 
     122                        info.rate = ogg_get_rate(stream); 
     123                        fseek(stream, 0L, SEEK_END); 
     124                        info.length = ftell(stream); 
     125                        fseek(stream, 0L, SEEK_CUR); 
     126                        info.type = koe_ogg; 
     127                        info.stream = stream; 
     128                        return info; 
     129                } 
    111130                if (arcinfo == 0) return info; 
    112131                FILE* stream = arcinfo->OpenFile(); 
     
    142161        type = from.type; 
    143162} 
     163 
    144164AvgKoeHead::AvgKoeHead(FILE* _s, int _file_number, KoeType _type) { 
    145165        char head[0x20]; 
  • music2/koedec_ogg.cc

    r0 r2  
    9999        return 0; 
    100100} 
     101int ogg_get_rate(FILE *stream) 
     102{ 
     103        OggVorbis_File vf; 
     104        ov_open(stream, &vf, NULL, 0); 
     105        return vf.vi->rate; 
     106} 
    101107 
    102108extern char* decode_koe_ogg(AvgKoeInfo info, int* dest_len) { 
  • music2/music.h

    r0 r2  
    1616#define DEFAULT_AUDIOBUF        4096 
    1717 
    18 enum KoeType { koe_unknown, koe_nwk, koe_ovk}; 
     18enum KoeType { koe_unknown, koe_nwk, koe_ovk, koe_ogg}; 
    1919typedef struct { 
    2020        FILE* stream;