annotate src/vtx/ayemu_vtxfile.h @ 2190:36b9f3e6cbcf

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