sc68fordevelopers
2.2.1
|
00001 00011 #ifndef _API68_H_ 00012 #define _API68_H_ 00013 00014 #ifdef __cplusplus 00015 extern "C" { 00016 #endif 00017 00018 //#include "config.h" 00019 #include "file68/istream68.h" 00020 #include "file68/debugmsg68.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 00124 debugmsg68_t debug; 00125 00127 void * debug_cookie; 00128 00129 } api68_init_t; 00130 00131 00138 typedef struct { 00139 int track; 00140 int tracks; 00141 const char * title; 00142 const char * author; 00143 const char * composer; 00144 const char * replay; 00145 const char * hwname; 00146 char time[12]; 00148 struct { 00149 unsigned ym:1; 00150 unsigned ste:1; 00151 unsigned amiga:1; 00152 } hw; 00153 unsigned int time_ms; 00154 unsigned int start_ms; 00155 unsigned int rate; 00156 unsigned int addr; 00157 } api68_music_info_t; 00158 00160 typedef struct _api68_s api68_t; 00161 00163 typedef void * api68_disk_t; 00164 00169 #define API68_IDLE_BIT 1 00170 #define API68_CHANGE_BIT 2 00171 #define API68_LOOP_BIT 4 00172 #define API68_END_BIT 5 00174 #define API68_IDLE (1<<API68_IDLE_BIT) 00175 #define API68_CHANGE (1<<API68_CHANGE_BIT) 00176 #define API68_LOOP (1<<API68_LOOP_BIT) 00177 #define API68_END (1<<API68_END_BIT) 00179 #define API68_MIX_OK 0 00180 #define API68_MIX_ERROR -1 00197 api68_t * api68_init(api68_init_t * init); 00198 00205 void api68_shutdown(api68_t * api); 00206 00215 unsigned int api68_sampling_rate(api68_t * api, unsigned int f); 00216 00222 void api68_set_share(api68_t * api, const char * path); 00223 00229 void api68_set_user(api68_t * api, const char * path); 00230 00236 const char * api68_error(void); 00237 00244 void api68_debug(const char * fmt, ...); 00245 00267 int api68_process(api68_t * api, void * buf, int n); 00268 00291 int api68_play(api68_t * api, int track); 00292 00305 int api68_stop(api68_t * api); 00306 00331 int api68_seek(api68_t * api, int time_ms); 00332 00350 int api68_music_info(api68_t * api, api68_music_info_t * info, int track, 00351 api68_disk_t disk); 00352 00361 int api68_verify(istream_t * is); 00362 int api68_verify_file(const char * filename); 00363 int api68_verify_mem(const void * buffer, int len); 00364 00366 int api68_load(api68_t * api, istream_t * is); 00367 int api68_load_file(api68_t * api, const char * filename); 00368 int api68_load_mem(api68_t * api, const void * buffer, int len); 00369 00371 api68_disk_t api68_load_disk(istream_t * is); 00372 api68_disk_t api68_load_disk_file(const char * filename); 00373 api68_disk_t api68_disk_load_mem(const void * buffer, int len); 00374 00375 00390 int api68_open(api68_t * api, api68_disk_t disk); 00391 00398 void api68_close(api68_t * api); 00399 00409 int api68_tracks(api68_t * api); 00410 00422 int api68_config_load(api68_t * api); 00423 00428 int api68_config_save(api68_t * api); 00429 00438 int api68_config_id(api68_t * api, const char * name); 00439 00450 int api68_config_get(api68_t * api, int idx, int * v); 00451 00462 int api68_config_set(api68_t * api, int idx, int v); 00463 00468 void api68_config_apply(api68_t * api); 00469 00489 void * api68_alloc(unsigned int n); 00490 00498 void api68_free(void * data); 00499 00507 #ifdef __cplusplus 00508 } 00509 #endif 00510 00511 #endif /* #ifndef _API68_H_ */