Mercurial > audlegacy
annotate Plugins/Input/amidi-plug/i_midi.h @ 1236:fc478bfe6fe6 trunk
[svn] - disconnect the scrobbler client from metatag logically
author | nenolod |
---|---|
date | Wed, 14 Jun 2006 22:30:04 -0700 |
parents | b8b9d7f5d371 |
children | b0590e16329f |
rev | line source |
---|---|
522
60c744f652f4
[svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff
changeset
|
1 /* |
60c744f652f4
[svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff
changeset
|
2 * |
60c744f652f4
[svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff
changeset
|
3 * Author: Giacomo Lozito <james@develia.org>, (C) 2005-2006 |
60c744f652f4
[svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff
changeset
|
4 * |
60c744f652f4
[svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff
changeset
|
5 * This program is free software; you can redistribute it and/or modify it |
60c744f652f4
[svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License as published by the |
60c744f652f4
[svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff
changeset
|
7 * Free Software Foundation; either version 2 of the License, or (at your |
60c744f652f4
[svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff
changeset
|
8 * option) any later version. |
60c744f652f4
[svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff
changeset
|
9 * |
60c744f652f4
[svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff
changeset
|
10 * This program is distributed in the hope that it will be useful, but |
60c744f652f4
[svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff
changeset
|
11 * WITHOUT ANY WARRANTY; without even the implied warranty of |
60c744f652f4
[svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff
changeset
|
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
60c744f652f4
[svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff
changeset
|
13 * General Public License for more details. |
60c744f652f4
[svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff
changeset
|
14 * |
60c744f652f4
[svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License along |
60c744f652f4
[svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff
changeset
|
16 * with this program; if not, write to the Free Software Foundation, Inc., |
60c744f652f4
[svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff
changeset
|
17 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
60c744f652f4
[svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff
changeset
|
18 * |
60c744f652f4
[svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff
changeset
|
19 */ |
60c744f652f4
[svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff
changeset
|
20 |
60c744f652f4
[svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff
changeset
|
21 #ifndef _I_MIDI_H |
60c744f652f4
[svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff
changeset
|
22 #define _I_MIDI_H 1 |
60c744f652f4
[svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff
changeset
|
23 |
60c744f652f4
[svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff
changeset
|
24 #include "i_common.h" |
60c744f652f4
[svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff
changeset
|
25 #include <alsa/asoundlib.h> |
60c744f652f4
[svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff
changeset
|
26 |
60c744f652f4
[svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff
changeset
|
27 #define MAKE_ID(c1, c2, c3, c4) ((c1) | ((c2) << 8) | ((c3) << 16) | ((c4) << 24)) |
60c744f652f4
[svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff
changeset
|
28 |
60c744f652f4
[svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff
changeset
|
29 /* MIDI event we care of */ |
60c744f652f4
[svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff
changeset
|
30 #define MIDI_EVENT_NOTEOFF 1 |
60c744f652f4
[svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff
changeset
|
31 #define MIDI_EVENT_NOTEON 2 |
60c744f652f4
[svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff
changeset
|
32 #define MIDI_EVENT_KEYPRESS 3 |
60c744f652f4
[svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff
changeset
|
33 #define MIDI_EVENT_CONTROLLER 4 |
60c744f652f4
[svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff
changeset
|
34 #define MIDI_EVENT_PGMCHANGE 5 |
60c744f652f4
[svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff
changeset
|
35 #define MIDI_EVENT_CHANPRESS 6 |
60c744f652f4
[svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff
changeset
|
36 #define MIDI_EVENT_PITCHBEND 7 |
60c744f652f4
[svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff
changeset
|
37 #define MIDI_EVENT_SYSEX 8 |
60c744f652f4
[svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff
changeset
|
38 #define MIDI_EVENT_TEMPO 9 |
60c744f652f4
[svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff
changeset
|
39 |
60c744f652f4
[svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff
changeset
|
40 |
60c744f652f4
[svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff
changeset
|
41 struct midievent_stru { |
60c744f652f4
[svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff
changeset
|
42 struct midievent_stru * next; /* linked list */ |
60c744f652f4
[svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff
changeset
|
43 guchar type; /* SND_SEQ_EVENT_xxx */ |
60c744f652f4
[svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff
changeset
|
44 guchar port; /* port index */ |
60c744f652f4
[svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff
changeset
|
45 guint tick; |
60c744f652f4
[svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff
changeset
|
46 union { |
60c744f652f4
[svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff
changeset
|
47 guchar d[3]; /* channel and data bytes */ |
60c744f652f4
[svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff
changeset
|
48 gint tempo; |
60c744f652f4
[svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff
changeset
|
49 guint length; /* length of sysex data */ |
60c744f652f4
[svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff
changeset
|
50 } data; |
60c744f652f4
[svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff
changeset
|
51 guchar sysex[0]; |
60c744f652f4
[svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff
changeset
|
52 }; |
60c744f652f4
[svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff
changeset
|
53 |
60c744f652f4
[svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff
changeset
|
54 typedef struct midievent_stru midievent_t; |
60c744f652f4
[svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff
changeset
|
55 |
60c744f652f4
[svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff
changeset
|
56 typedef struct |
60c744f652f4
[svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff
changeset
|
57 { |
60c744f652f4
[svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff
changeset
|
58 midievent_t * first_event; /* list of all events in this track */ |
60c744f652f4
[svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff
changeset
|
59 gint end_tick; /* length of this track */ |
60c744f652f4
[svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff
changeset
|
60 midievent_t * current_event; /* used while loading and playing */ |
60c744f652f4
[svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff
changeset
|
61 } |
60c744f652f4
[svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff
changeset
|
62 midifile_track_t; |
60c744f652f4
[svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff
changeset
|
63 |
60c744f652f4
[svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff
changeset
|
64 typedef struct |
60c744f652f4
[svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff
changeset
|
65 { |
60c744f652f4
[svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff
changeset
|
66 FILE * file_pointer; |
60c744f652f4
[svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff
changeset
|
67 gchar * file_name; |
60c744f652f4
[svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff
changeset
|
68 gint file_offset; |
60c744f652f4
[svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff
changeset
|
69 |
60c744f652f4
[svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff
changeset
|
70 gint num_tracks; |
60c744f652f4
[svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff
changeset
|
71 midifile_track_t *tracks; |
60c744f652f4
[svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff
changeset
|
72 |
60c744f652f4
[svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff
changeset
|
73 gushort format; |
60c744f652f4
[svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff
changeset
|
74 guint max_tick; |
60c744f652f4
[svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff
changeset
|
75 gint smpte_timing; |
60c744f652f4
[svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff
changeset
|
76 |
60c744f652f4
[svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff
changeset
|
77 gint time_division; |
60c744f652f4
[svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff
changeset
|
78 gint ppq; |
60c744f652f4
[svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff
changeset
|
79 gint current_tempo; |
60c744f652f4
[svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff
changeset
|
80 |
60c744f652f4
[svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff
changeset
|
81 gint playing_tick; |
60c744f652f4
[svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff
changeset
|
82 gint avg_microsec_per_tick; |
60c744f652f4
[svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff
changeset
|
83 gint length; |
60c744f652f4
[svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff
changeset
|
84 |
60c744f652f4
[svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff
changeset
|
85 gint skip_offset; |
60c744f652f4
[svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff
changeset
|
86 } |
60c744f652f4
[svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff
changeset
|
87 midifile_t; |
60c744f652f4
[svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff
changeset
|
88 |
60c744f652f4
[svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff
changeset
|
89 extern midifile_t midifile; |
60c744f652f4
[svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff
changeset
|
90 |
60c744f652f4
[svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff
changeset
|
91 midievent_t * i_midi_file_new_event( midifile_track_t * , gint ); |
60c744f652f4
[svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff
changeset
|
92 void i_midi_file_skip_bytes( midifile_t * , gint ); |
60c744f652f4
[svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff
changeset
|
93 gint i_midi_file_read_byte( midifile_t * ); |
60c744f652f4
[svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff
changeset
|
94 gint i_midi_file_read_32_le( midifile_t * ); |
60c744f652f4
[svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff
changeset
|
95 gint i_midi_file_read_id( midifile_t * ); |
60c744f652f4
[svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff
changeset
|
96 gint i_midi_file_read_int( midifile_t * , gint ); |
60c744f652f4
[svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff
changeset
|
97 gint i_midi_file_read_var( midifile_t * ); |
60c744f652f4
[svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff
changeset
|
98 gint i_midi_file_read_track( midifile_t * , midifile_track_t * , gint , gint ); |
60c744f652f4
[svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff
changeset
|
99 gint i_midi_file_parse_riff( midifile_t * ); |
60c744f652f4
[svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff
changeset
|
100 gint i_midi_file_parse_smf( midifile_t * , gint ); |
60c744f652f4
[svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff
changeset
|
101 void i_midi_init( midifile_t * ); |
60c744f652f4
[svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff
changeset
|
102 void i_midi_free( midifile_t * ); |
60c744f652f4
[svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff
changeset
|
103 gint i_midi_setget_tempo( midifile_t * ); |
60c744f652f4
[svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff
changeset
|
104 void i_midi_setget_length( midifile_t * ); |
60c744f652f4
[svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff
changeset
|
105 void i_midi_get_bpm( midifile_t * , gint * , gint * ); |
805
b8b9d7f5d371
[svn] update amidi-plug towards 0.2; bug fixes and a new option (midi length pre-calculation)
giacomo
parents:
522
diff
changeset
|
106 /* helper function */ |
b8b9d7f5d371
[svn] update amidi-plug towards 0.2; bug fixes and a new option (midi length pre-calculation)
giacomo
parents:
522
diff
changeset
|
107 gint i_midi_parse_from_filename( gchar * , midifile_t * ); |
522
60c744f652f4
[svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff
changeset
|
108 |
60c744f652f4
[svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff
changeset
|
109 #endif /* !_I_MIDI_H */ |