annotate Plugins/Input/amidi-plug/amidi-plug.h @ 805:b8b9d7f5d371 trunk

[svn] update amidi-plug towards 0.2; bug fixes and a new option (midi length pre-calculation)
author giacomo
date Tue, 07 Mar 2006 11:47:20 -0800
parents 8efa4b799c19
children b0590e16329f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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_AMIDIPLUG_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_AMIDIPLUG_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 #define AMIDIPLUG_STOP 0
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
25 #define AMIDIPLUG_PLAY 1
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
26 #define AMIDIPLUG_PAUSE 2
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
27 #define AMIDIPLUG_ERR 3
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 #include "i_common.h"
524
2d0c099a1e85 [svn] adjusted audacious headers includes in amidi-plug
giacomo
parents: 522
diff changeset
30 #include "audacious/plugin.h"
2d0c099a1e85 [svn] adjusted audacious headers includes in amidi-plug
giacomo
parents: 522
diff changeset
31 #include "libaudacious/beepctrl.h"
545
7d29b069b98a [svn] *ding* fix for chainsaw
nenolod
parents: 524
diff changeset
32 #include "libaudacious/vfs.h"
522
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
33 #include <pthread.h>
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
34 #include "i_configure.h"
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
35 #include "i_seq.h"
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
36 #include "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
37 #include "i_fileinfo.h"
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
38 #include "i_utils.h"
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 /* if this is defined, possible midi files are
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
42 checked by looking at their first (magic) bytes
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
43 instead of just reading the file extension */
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
44 #define MIDIFILE_PROBE_MAGICBYTES 1
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
45
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
46
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
47 static pthread_t amidiplug_play_thread;
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
48 static pthread_mutex_t amidiplug_gettime_mutex = PTHREAD_MUTEX_INITIALIZER;
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
49 static pthread_mutex_t amidiplug_playing_mutex = PTHREAD_MUTEX_INITIALIZER;
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
50 static pthread_cond_t amidiplug_playing_cond = PTHREAD_COND_INITIALIZER;
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
51
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
52 gint amidiplug_playing_status = AMIDIPLUG_STOP;
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 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
55 sequencer_client_t sc =
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
56 {
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
57 NULL, /* seq */
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
58 0, /* client_port */
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
59 0, /* queue */
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
60 NULL, /* dest_port */
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
61 0 /* dest_port_num */
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
62 };
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 amidiplug_cfg_t amidiplug_cfg =
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 NULL, /* seq_writable_ports */
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
67 0, /* mixer_card_id */
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
68 NULL, /* mixer_control_name */
805
b8b9d7f5d371 [svn] update amidi-plug towards 0.2; bug fixes and a new option (midi length pre-calculation)
giacomo
parents: 737
diff changeset
69 0, /* mixer_control_id */
b8b9d7f5d371 [svn] update amidi-plug towards 0.2; bug fixes and a new option (midi length pre-calculation)
giacomo
parents: 737
diff changeset
70 0 /* length_precalc_enable */
522
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
71 };
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 void * amidiplug_play_loop( void * );
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
74 void amidiplug_skipto( gint );
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
75 static void amidiplug_init( void );
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
76 static void amidiplug_cleanup( void );
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
77 static void amidiplug_aboutbox( void );
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
78 static void amidiplug_configure( void );
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
79 static gint amidiplug_is_our_file( gchar * );
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
80 static void amidiplug_play( gchar * );
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
81 static void amidiplug_stop( void );
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
82 static void amidiplug_pause( gshort );
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
83 static void amidiplug_seek( gint );
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
84 static gint amidiplug_get_time( void );
737
8efa4b799c19 [svn] Added a get_volume plugin function, to ensure that the player volume is properly updated when the player is remotely controlled
giacomo
parents: 545
diff changeset
85 static void amidiplug_get_volume( gint * , gint * );
522
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
86 static void amidiplug_set_volume( gint , gint );
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
87 static void amidiplug_get_song_info( gchar * , gchar ** , gint * );
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
88 static void amidiplug_file_info_box( gchar * );
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
89
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
90 InputPlugin amidiplug_ip =
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
91 {
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
92 NULL, /* handle */
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
93 NULL, /* filename */
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
94 NULL, /* description */
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
95 amidiplug_init, /* init */
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
96 amidiplug_aboutbox, /* aboutbox */
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
97 amidiplug_configure, /* configure */
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
98 amidiplug_is_our_file, /* is_our_file */
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
99 NULL, /* scan_dir */
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
100 amidiplug_play, /* play_file */
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
101 amidiplug_stop, /* stop */
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
102 amidiplug_pause, /* pause */
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
103 amidiplug_seek, /* seek */
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
104 NULL, /* set_eq */
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
105 amidiplug_get_time, /* get_time */
737
8efa4b799c19 [svn] Added a get_volume plugin function, to ensure that the player volume is properly updated when the player is remotely controlled
giacomo
parents: 545
diff changeset
106 amidiplug_get_volume, /* get_volume */
522
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
107 amidiplug_set_volume, /* set_volume */
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
108 amidiplug_cleanup, /* cleanup */
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
109 NULL, /* get_vis_type */
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
110 NULL, /* add_vis_pcm */
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
111 NULL, /* set_info */
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
112 NULL, /* set_info_text */
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
113 amidiplug_get_song_info, /* get_song_info */
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
114 amidiplug_file_info_box, /* file_info_box */
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
115 NULL /* output */
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
116 };
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
117
60c744f652f4 [svn] amidi-plug (MIDI through ALSA seq) input plugin added, brand new and completely written from scratch :)
giacomo
parents:
diff changeset
118 #endif /* !_I_AMIDIPLUG_H */