1 /*(LGPL)
2 ---------------------------------------------------------------------------
3 	a_sequencer.h - MIDI Sequencer
4 ---------------------------------------------------------------------------
5  * Copyright (C) 2002, David Olofson
6  *
7  * This program is free software; you can redistribute it and/or modify it
8  * under the terms of the GNU Lesser General Public License as published by
9  * the Free Software Foundation; either version 2.1 of the License, or (at
10  * your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public License
18  * along with this program; if not, write to the Free Software Foundation,
19  * Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20  */
21 
22 #ifndef _A_SEQUENCER_H_
23 #define _A_SEQUENCER_H_
24 
25 #include "a_midisock.h"
26 #include "a_midifile.h"
27 
28 int sequencer_open(midisock_t *ms, float framerate);
29 void sequencer_close(void);
30 
31 /*
32  * Starts playing 'mf' at 'pitch' (0 ==> normal) and 'volume'.
33  * The sequencer context is marked with the positive value 'tag'
34  * for later reference. 'pitch' and 'volume' are 16:16 fixed
35  * point values, to match the engine control data type.
36  * Returns a negative value if an error occurred.
37  */
38 int sequencer_play(midi_file_t *mf, int tag, int pitch, int volume);
39 
40 /*
41  * Stop the sequence marked with 'tag'.
42  * Pass -1 for 'tag' to stop all playing sequences.
43  */
44 void sequencer_stop(int tag);
45 
46 /* Returns 1 if the sequence marked 'tag' is still playing. */
47 int sequencer_playing(int tag);
48 
49 void sequencer_process(unsigned frames);
50 
51 #endif /*_A_SEQUENCER_H_*/
52