sc68fordevelopers  2.2.1
api68.h
Go to the documentation of this file.
1 
11 #ifndef _API68_H_
12 #define _API68_H_
13 
14 #ifdef __cplusplus
15 extern "C" {
16 #endif
17 
18  //#include "config.h"
19 #include "file68/istream68.h"
20 #include "file68/debugmsg68.h"
21 
96 typedef struct {
97 
101  unsigned int sampling_rate;
102 
106  void * (*alloc)(unsigned int);
107 
111  void (*free)(void *);
112 
116  const char * user_path;
117 
121  const char * shared_path;
122 
125 
127  void * debug_cookie;
128 
129 } api68_init_t;
130 
131 
138 typedef struct {
139  int track;
140  int tracks;
141  const char * title;
142  const char * author;
143  const char * composer;
144  const char * replay;
145  const char * hwname;
146  char time[12];
148  struct {
149  unsigned ym:1;
150  unsigned ste:1;
151  unsigned amiga:1;
152  } hw;
153  unsigned int time_ms;
154  unsigned int start_ms;
155  unsigned int rate;
156  unsigned int addr;
158 
160 typedef struct _api68_s api68_t;
161 
163 typedef void * api68_disk_t;
164 
169 #define API68_IDLE_BIT 1
170 #define API68_CHANGE_BIT 2
171 #define API68_LOOP_BIT 4
172 #define API68_END_BIT 5
174 #define API68_IDLE (1<<API68_IDLE_BIT)
175 #define API68_CHANGE (1<<API68_CHANGE_BIT)
176 #define API68_LOOP (1<<API68_LOOP_BIT)
177 #define API68_END (1<<API68_END_BIT)
179 #define API68_MIX_OK 0
180 #define API68_MIX_ERROR -1
197 api68_t * api68_init(api68_init_t * init);
198 
205 void api68_shutdown(api68_t * api);
206 
215 unsigned int api68_sampling_rate(api68_t * api, unsigned int f);
216 
222 void api68_set_share(api68_t * api, const char * path);
223 
229 void api68_set_user(api68_t * api, const char * path);
230 
236 const char * api68_error(void);
237 
244 void api68_debug(const char * fmt, ...);
245 
267 int api68_process(api68_t * api, void * buf, int n);
268 
291 int api68_play(api68_t * api, int track);
292 
305 int api68_stop(api68_t * api);
306 
331 int api68_seek(api68_t * api, int time_ms);
332 
350 int api68_music_info(api68_t * api, api68_music_info_t * info, int track,
351  api68_disk_t disk);
352 
361 int api68_verify(istream_t * is);
362 int api68_verify_file(const char * filename);
363 int api68_verify_mem(const void * buffer, int len);
364 
366 int api68_load(api68_t * api, istream_t * is);
367 int api68_load_file(api68_t * api, const char * filename);
368 int api68_load_mem(api68_t * api, const void * buffer, int len);
369 
371 api68_disk_t api68_load_disk(istream_t * is);
372 api68_disk_t api68_load_disk_file(const char * filename);
373 api68_disk_t api68_disk_load_mem(const void * buffer, int len);
374 
375 
390 int api68_open(api68_t * api, api68_disk_t disk);
391 
398 void api68_close(api68_t * api);
399 
409 int api68_tracks(api68_t * api);
410 
422 int api68_config_load(api68_t * api);
423 
428 int api68_config_save(api68_t * api);
429 
438 int api68_config_id(api68_t * api, const char * name);
439 
450 int api68_config_get(api68_t * api, int idx, int * v);
451 
462 int api68_config_set(api68_t * api, int idx, int v);
463 
468 void api68_config_apply(api68_t * api);
469 
489 void * api68_alloc(unsigned int n);
490 
498 void api68_free(void * data);
499 
507 #ifdef __cplusplus
508 }
509 #endif
510 
511 #endif /* #ifndef _API68_H_ */
int api68_open(api68_t *api, api68_disk_t disk)
Change current disk.
int api68_tracks(api68_t *api)
Get number of tracks.
unsigned int start_ms
Absolute start time in disk in ms.
Definition: api68.h:154
Music information.
Definition: api68.h:138
sc68 debug message.
int api68_config_save(api68_t *api)
Save config file.
int api68_verify_file(const char *filename)
Verify an sc68 disk.
unsigned int rate
Replay rate.
Definition: api68.h:155
void * debug_cookie
debug cookie.
Definition: api68.h:127
int api68_music_info(api68_t *api, api68_music_info_t *info, int track, api68_disk_t disk)
Get disk/track information.
debugmsg68_t debug
debug message handler.
Definition: api68.h:124
struct _api68_s api68_t
API information.
Definition: api68.h:160
void api68_set_share(api68_t *api, const char *path)
Set share data path.
int api68_config_load(api68_t *api)
Load config file.
int tracks
Number of track.
Definition: api68.h:140
int api68_load_mem(api68_t *api, const void *buffer, int len)
Verify an sc68 disk.
void api68_free(void *data)
Free dynamic memory.
int api68_play(api68_t *api, int track)
Set/Get current track.
const char * composer
Composer name.
Definition: api68.h:143
int api68_verify_mem(const void *buffer, int len)
Verify an sc68 disk.
const char * replay
Replay name.
Definition: api68.h:144
api68_disk_t api68_load_disk(istream_t *is)
Load an sc68 disk outside the API.
const char * hwname
Hardware description.
Definition: api68.h:145
const char * user_path
user resource path (0 default).
Definition: api68.h:116
api68_disk_t api68_disk_load_mem(const void *buffer, int len)
Verify an sc68 disk.
int api68_seek(api68_t *api, int time_ms)
Set/Get current play position.
const char * author
Author name.
Definition: api68.h:142
ym2149_t ym
YM-2149 emulator internal data.
void api68_debug(const char *fmt,...)
Display debug message.
void api68_shutdown(api68_t *api)
Shutdown sc68 API.
int track
Track number (0:disk information).
Definition: api68.h:139
const char * shared_path
shared resource path (0 default).
Definition: api68.h:121
void * api68_disk_t
API disk.
Definition: api68.h:163
void api68_set_user(api68_t *api, const char *path)
Set user data path.
API initialization.
Definition: api68.h:96
void * api68_alloc(unsigned int n)
Allocate dynamic memory.
unsigned int time_ms
Duration in ms.
Definition: api68.h:153
int api68_config_get(api68_t *api, int idx, int *v)
Get config variable value.
int api68_load(api68_t *api, istream_t *is)
Load an sc68 disk for playing.
void api68_config_apply(api68_t *api)
Apply current configuration to api.
const char * title
Disk or track title.
Definition: api68.h:141
unsigned int addr
Load address.
Definition: api68.h:156
Input stream structure.
Definition: istream68_def.h:67
const char * api68_error(void)
Pop and return last stacked error message.
unsigned int sampling_rate
sampling rate in hz (non 0 value overrides config default).
Definition: api68.h:101
void api68_close(api68_t *api)
Close current disk.
int api68_stop(api68_t *api)
Stop playing.
int api68_verify(istream_t *is)
Verify an sc68 disk.
api68_disk_t api68_load_disk_file(const char *filename)
Verify an sc68 disk.
int api68_config_id(api68_t *api, const char *name)
Get config variable idex.
void(* debugmsg68_t)(void *cookie, const char *fmt, va_list list)
Debug handler type.
Definition: debugmsg68.h:24
int api68_config_set(api68_t *api, int idx, int v)
Set config variable value.
int api68_process(api68_t *api, void *buf, int n)
Fill PCM buffer.
int api68_load_file(api68_t *api, const char *filename)
Verify an sc68 disk.
unsigned int api68_sampling_rate(api68_t *api, unsigned int f)
Set/Get sampling rate.
generic stream operation.