Home Download Musics Developers
API Sources Tools File Format Technicals

api68.h

Go to the documentation of this file.
00001 
00011 #ifndef _API68_H_
00012 #define _API68_H_
00013 
00014 #ifdef __cplusplus
00015 extern "C" {
00016 #endif
00017 
00018 #include "file68/istream68.h"
00019 #include "file68/debugmsg68.h"
00020 #include "api68/conf68.h"
00021 
00096 typedef struct {
00097 
00101   unsigned int sampling_rate;
00102 
00106   void * (*alloc)(unsigned int); 
00107 
00111   void (*free)(void *);
00112 
00116   const char * user_path;
00117 
00121   const char * shared_path;
00122 
00126   const char * lmusic_path;
00127 
00131   const char * rmusic_path;
00132 
00134   debugmsg68_t debug;
00135 
00137   void * debug_cookie;
00138 
00140   int argc;
00141 
00143   char ** argv;
00144 
00145 } api68_init_t;
00146 
00147 
00154 typedef struct {
00155   int track;             
00156   int tracks;            
00157   const char * title;    
00158   const char * author;   
00159   const char * composer; 
00160   const char * replay;   
00161   const char * hwname;   
00162   char time[12];         
00164   struct {
00165     unsigned ym:1;        
00166     unsigned ste:1;       
00167     unsigned amiga:1;     
00168   } hw;
00169   unsigned int time_ms;   
00170   unsigned int start_ms;  
00171   unsigned int rate;      
00172   unsigned int addr;      
00173 } api68_music_info_t;
00174 
00176 typedef struct _api68_s api68_t;
00177 
00179 typedef void * api68_disk_t;
00180 
00185 #define API68_IDLE_BIT   1 
00186 #define API68_CHANGE_BIT 2 
00187 #define API68_LOOP_BIT   4 
00188 #define API68_END_BIT    5 
00190 #define API68_IDLE       (1<<API68_IDLE_BIT)   
00191 #define API68_CHANGE     (1<<API68_CHANGE_BIT) 
00192 #define API68_LOOP       (1<<API68_LOOP_BIT)   
00193 #define API68_END        (1<<API68_END_BIT)    
00195 #define API68_MIX_OK     0  
00196 #define API68_MIX_ERROR  -1 
00213 api68_t * api68_init(api68_init_t * init);
00214 
00221 void api68_shutdown(api68_t * api);
00222 
00231 unsigned int api68_sampling_rate(api68_t * api, unsigned int f);
00232 
00238 void api68_set_share(api68_t * api, const char * path);
00239 
00245 void api68_set_user(api68_t * api, const char * path);
00246 
00252 const char * api68_error(void);
00253 
00260 void api68_debug(const char * fmt, ...);
00261 
00283 int api68_process(api68_t * api, void * buf, int n);
00284 
00314 int api68_play(api68_t * api, int track, int loop);
00315 
00328 int api68_stop(api68_t * api);
00329 
00358 int api68_seek(api68_t * api, int time_ms, int * is_seeking);
00359 
00377 int api68_music_info(api68_t * api, api68_music_info_t * info, int track,
00378                      api68_disk_t disk);
00379 
00388 int api68_verify(istream_t * is);
00389 int api68_verify_file(const char * url);
00390 int api68_verify_mem(const void * buffer, int len);
00391 int api68_is_our_file(const char * url, const char *exts, int * is_remote);
00392 
00394 int api68_load(api68_t * api, istream_t * is);
00395 int api68_load_file(api68_t * api, const char * url);
00396 int api68_load_mem(api68_t * api, const void * buffer, int len);
00397 
00399 api68_disk_t api68_load_disk(istream_t * is);
00400 api68_disk_t api68_load_disk_file(const char * url);
00401 api68_disk_t api68_disk_load_mem(const void * buffer, int len);
00402 
00403 
00418 int api68_open(api68_t * api, api68_disk_t disk);
00419 
00426 void api68_close(api68_t * api);
00427 
00437 int api68_tracks(api68_t * api);
00438 
00450 int api68_config_load(api68_t * api);
00451 
00456 int api68_config_save(api68_t * api);
00457 
00466 int api68_config_idx(api68_t * api, const char * name);
00467 
00473 SC68config_type_t api68_config_get(api68_t * api,
00474                                    int * idx,
00475                                    const char ** name);
00476 
00483 SC68config_type_t api68_config_range(api68_t * api, int idx,
00484                                      int * min, int * max, int * def);
00485 
00486 
00492 SC68config_type_t api68_config_set(api68_t * api,
00493                                    int idx,
00494                                    const char * name,
00495                                    int v,
00496                                    const char * s);
00497 
00502 void api68_config_apply(api68_t * api);
00503 
00523 void * api68_alloc(unsigned int n);
00524 
00532 void api68_free(void * data);
00533 
00541 #ifdef __cplusplus
00542 }
00543 #endif
00544 
00545 #endif /* #ifndef _API68_H_ */