comparison src/vtx/ayemu_vtxfile.h @ 749:26ff35aa9b2b trunk

[svn] - vtx input plugin based on a submission from Pavel Vymetalek.
author nenolod
date Wed, 28 Feb 2007 04:38:53 -0800
parents
children 77dbd83ea6e4
comparison
equal deleted inserted replaced
748:559c68ce2e3d 749:26ff35aa9b2b
1 #ifndef _AYEMU_vtxfile_h
2 #define _AYEMU_vtxfile_h
3
4 #include <glib.h>
5 #include <audacious/vfs.h>
6 #include "ayemu_8912.h"
7
8 /* The following constants and data structure comes from
9 VTX file format description. You can see them on
10 http://
11 */
12
13 #define AYEMU_VTX_NTSTRING_MAX 255
14
15 typedef char NTstring[AYEMU_VTX_NTSTRING_MAX+1];
16
17 BEGIN_C_DECLS
18
19 /** VTX file format header and status of open file
20 * \internal
21 *
22 * This structure used for save VTX file format header's data
23 * (song author, title and so on).
24 */
25 struct VTXFileHeader
26 {
27 ayemu_chip_t chiptype; /**< Type of sound chip */
28 int stereo; /**< Type of stereo: 0-ABC, 1-BCA... (see VTX format description) */
29 int loop; /**< song loop */
30 int chipFreq; /**< AY chip freq (1773400 for ZX) */
31 int playerFreq; /**< 50 Hz for ZX, 60 Hz for yamaha */
32 int year; /**< year song composed */
33 NTstring title; /**< song title */
34 NTstring author; /**< song author */
35 NTstring from; /**< song from */
36 NTstring tracker; /**< tracker */
37 NTstring comment; /**< comment */
38 size_t regdata_size; /**< size of unpacked data. Used in uncompression alhoritm. */
39 };
40
41 /**
42 * \defgroup vtxfile Functions for extract data from vtx files
43 */
44 /*@{*/
45
46
47 /** structure for VTX file format handler
48 * \internal
49 * It stores VTX file header and current state
50 * (open file pointer, extracted register data, etc).
51 */
52 typedef struct
53 {
54 VFSFile *fp; /**< opening .vtx file pointer */
55 struct VTXFileHeader hdr; /**< VTX header data */
56 char *regdata; /**< unpacked song data */
57 int pos; /**< current data frame offset */
58 } ayemu_vtx_t;
59
60
61 /** Open vtx file and read vtx file header
62 \arg \c vtx - pointer to ayemu_vtx_t structure
63 \arg \c filename - filename for open vtx file
64 \return Return true if success, else false
65 */
66 EXTERN int ayemu_vtx_open (ayemu_vtx_t *vtx, const char *filename);
67
68 /** Read and encode lha data from .vtx file.
69 * \return Return pointer to unpacked data or NULL.
70 */
71 EXTERN char *ayemu_vtx_load_data (ayemu_vtx_t *vtx);
72
73 /** Get next 14-bytes frame of AY register data.
74 * \return Return value: true if sucess, false if not enought data.
75 */
76 EXTERN int ayemu_vtx_get_next_frame (ayemu_vtx_t *vtx, char *regs);
77
78 /** Print formated file name. If fmt is NULL the default format %a - %t will used
79 * \return none.
80 */
81 EXTERN void ayemu_vtx_sprintname (const ayemu_vtx_t *vtx, char *buf, const int sz, const char *fmt);
82
83 /** Free all of allocaded resource for this file.
84 * You must call this function on end work with vtx file
85 */
86 EXTERN void ayemu_vtx_free (ayemu_vtx_t *vtx);
87
88 /*@}*/
89
90 END_C_DECLS
91
92 #endif