Home Download Musics Developers
API Sources Tools File Format Technicals

file68.h

Go to the documentation of this file.
00001 
00011 /* Copyright (C) 1998-2003 Benjamin Gerard */
00012 
00013 #ifndef _FILE68_H_
00014 #define _FILE68_H_
00015 
00016 #include "file68/istream68.h"
00017 
00018 #ifdef __cplusplus
00019 extern "C" {
00020 #endif
00021 
00033 #define SC68_IDSTR "SC68 Music-file / (c) (BeN)jamin Gerard / SasHipA-Dev  "
00034 
00041 #define SC68_IDSTR_V2 {'S','C','6','8', 0,2,255,0xa9, 0xDF,0xEB,0xD1,0}
00042 
00043 #define SC68_NOFILENAME "???"  
00044 #define SC68_LOADADDR   0x8000 
00045 #define SC68_MAX_TRACK  99     
00051 #define SC68_YM        1     
00052 #define SC68_STE       2     
00053 #define SC68_AMIGA     4     
00054 #define SC68_STECHOICE 8     
00059 typedef struct
00060 {
00061   char id[4];   
00062   char size[4]; 
00063 } chunk68_t;
00064 
00065 
00070 #define CH68_CHUNK     "SC"    
00072 #define CH68_BASE      "68"    
00073 #define CH68_FNAME     "FN"    
00074 #define CH68_DEFAULT   "DF"    
00076 #define CH68_MUSIC     "MU"    
00077 #define CH68_MNAME     "MN"    
00078 #define CH68_ANAME     "AN"    
00079 #define CH68_CNAME     "CN"    
00080 #define CH68_D0        "D0"    
00081 #define CH68_AT        "AT"    
00082 #define CH68_TIME      "TI"    
00083 #define CH68_FRAME     "FR"    
00084 #define CH68_FRQ       "FQ"    
00085 #define CH68_LOOP      "LP"    
00087 #define CH68_TYP       "TY"    
00088 #define CH68_IMG       "IM"    
00089 #define CH68_REPLAY    "RE"    
00091 #define CH68_MDATA     "DA"    
00093 #define CH68_EOF       "EF"    
00098 typedef union {
00099 
00100   struct {
00101     unsigned ym:1;        
00102     unsigned ste:1;       
00103     unsigned amiga:1;     
00104     unsigned stechoice:1; 
00105   } bit;
00107   unsigned all;
00108 } hwflags68_t;
00109 
00111 typedef struct
00112 {
00113 
00117   unsigned d0;          
00118   unsigned a0;          
00119   unsigned frq;         
00120   unsigned start_ms;    
00121   unsigned time_ms;     
00122   unsigned frames;      
00123   int loop;             
00124   int track;            
00126   hwflags68_t hwflags;  
00133   char * name;          
00134   char * author;        
00135   char * composer;      
00136   char * replay;        
00142   unsigned datasz;      
00143   char    *data;        
00146 } music68_t;
00147 
00148 
00159 typedef struct
00160 {
00164   int      default_six; 
00165   int      nb_six;      
00166   unsigned time_ms;     
00167   hwflags68_t hwflags;  
00168   char    *name;        
00174   music68_t mus[SC68_MAX_TRACK]; 
00175   char      data[1];             
00178 } disk68_t;
00179 
00184 extern const char SC68file_idstr[];
00185 
00190 extern const char SC68file_idstr_v2[12];
00191 
00212 int SC68file_verify(istream_t * is);
00213 
00218 int SC68file_verify_file(const char * fname);
00219 
00225 int SC68file_verify_mem(const void * buffer, int len);
00226 
00249 int SC68file_diskname(istream_t * is, char * dest, int max);
00250 
00258 int SC68file_is_our_file(const char * url,
00259                          const char * exts,
00260                          int * is_remote);
00261 
00285 disk68_t * SC68file_load(istream_t * is);
00286 
00291 disk68_t * SC68file_load_file(const char * fname);
00292 
00298 disk68_t * SC68file_load_mem(const void * buffer, int len);
00299 
00321 int SC68file_save(istream_t * os, const disk68_t * mb, int gzip);
00322 
00329 int SC68file_save_file(const char * fname, const disk68_t * mb, int gzip);
00330 
00338 int SC68file_save_mem(const char * buffer, int len, const disk68_t * mb,
00339                       int gzip);
00340 
00347 #ifdef __cplusplus
00348 }
00349 #endif
00350 
00351 #endif /* #ifndef _FILE68_H_ */