1 /* vi:set ts=8 sts=8 sw=8 noexpandtab: */
11 #include <jack/jack.h>
14 #include "pineapple.h"
15 #include "filetypes.h"
16 #include "hvl_replay.h"
20 pineapple_tune
*importHvl(struct hvl_tune
*ht
);
23 //\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\/\\
24 \\\
< struct pineapple_tune
*importHvl(struct hvl_tune
*ht
) > .|
25 /// Gives you a struct pineapple_tune from a struct *hvl_tune. .\
26 \\/\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\//
27 pineapple_tune
*importHvl(struct hvl_tune
*ht
) {
29 tune
= (pineapple_tune
*) malloc(sizeof(pineapple_tune
));
31 fprintf(stderr
, "couldn't malloc pineapple_tune *tune!\n");
37 tune
->songlen
= ht
->ht_PositionNr
;
38 /* TODO: turn songpos and trackpos into pointers */
40 //tune->songpos = ht->ht_PosNr;
41 //tune->trackpos = &ht->ht_NoteNr;
43 tune
->tracklen
= ht
->ht_TrackLength
;
44 for(int i
= 0; i
< tune
->songlen
; i
++) {
45 for(int j
= 0; j
< ht
->ht_Channels
; j
++){
46 tune
->sng
[i
].track
[j
] = ht
->ht_Positions
[i
].pos_Track
[j
];
47 tune
->sng
[i
].transp
[j
] = ht
->ht_Positions
[i
].pos_Transpose
[j
];
51 for(int i
= 0; i
< ht
->ht_TrackNr
; i
++) {
52 for(int j
= 0; j
< tune
->tracklen
; j
++) {
53 tune
->trk
[i
].line
[j
].note
= ht
->ht_Tracks
[i
][j
].stp_Note
;
54 tune
->trk
[i
].line
[j
].instr
= ht
->ht_Tracks
[i
][j
].stp_Instrument
;
55 tune
->trk
[i
].line
[j
].cmd
[0] = ht
->ht_Tracks
[i
][j
].stp_FX
;
56 //fprintf(stderr, "fx: %i \n", ht->ht_Tracks[i][j].stp_FX);
57 tune
->trk
[i
].line
[j
].param
[0] = ht
->ht_Tracks
[i
][j
].stp_FXParam
;
58 tune
->trk
[i
].line
[j
].cmd
[1] = ht
->ht_Tracks
[i
][j
].stp_FXb
;
59 tune
->trk
[i
].line
[j
].param
[1] = ht
->ht_Tracks
[i
][j
].stp_FXbParam
;
63 tune
->iedplonk
= hvl_iedplonk
;
68 int main(int argc
, char **argv
){
69 //----------------------------------\\
70 // parse those args :^)
71 //----------------------------------//
72 /*tune = (pineapple_tune*) malloc(sizeof(pineapple_tune));
74 fprintf(stderr, "couldn't malloc pineapple_tune *tune!\n");
82 if((tune
= lft_loadfile(argv
[1]))){
83 fprintf(stderr
, "loaded %s\n", argv
[1]);
84 sdl_init
= lft_sdl_init
;
85 //TODO make 48000 configurable as 'samplefreq'
86 }else if((htTune
= hvl_LoadTune(argv
[1], 48000, 4))){
87 fprintf(stderr
, "loading ahx/hvl...\n");
88 fprintf(stderr
, "loaded %s\n", argv
[1]);
90 tune
= importHvl(htTune
);
91 sdl_init
= hvl_sdl_init
;
92 hvl_InitSubsong(htTune
,0);
94 fprintf(stderr
, "couldn't load %s\n", argv
[1]);
95 fprintf(stderr
, "loading empty tune");
96 tune
= lft_loadfile("");
97 sdl_init
= lft_sdl_init
;
98 //hvl_InitSubsong(htTune, 0);
101 //what happens if we load with no filename?
102 // make an empty tune?
103 //tune = pt_empty_tune();
104 /* FIXME: the function below segfaults! */
105 tune
= lft_loadfile("");
109 //----------------------------------\\
111 //----------------------------------//
117 //----------------------------------\\
118 // ACTUALLY start the program
119 //----------------------------------//
126 hvl_FreeTune(htTune
);