annotate src/amidi-plug/amidi-plug.h @ 1414:5f892afeb8e1 audacious-plugins-1.4.0-dr2

- amidi-plug 0.8 beta1; support for gthread and v3 plugin system; needs testing and refinements
author Giacomo Lozito <james@develia.org>
date Mon, 06 Aug 2007 14:01:24 +0200
parents 592442919dbd
children b7665ebc9e1e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1 /*
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
2 *
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
3 * Author: Giacomo Lozito <james@develia.org>, (C) 2005-2006
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
4 *
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
5 * This program is free software; you can redistribute it and/or modify it
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
6 * under the terms of the GNU General Public License as published by the
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
7 * Free Software Foundation; either version 2 of the License, or (at your
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
8 * option) any later version.
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
9 *
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
10 * This program is distributed in the hope that it will be useful, but
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
13 * General Public License for more details.
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
14 *
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License along
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
16 * with this program; if not, write to the Free Software Foundation, Inc.,
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
18 *
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
19 */
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
20
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
21 #ifndef _I_AMIDIPLUG_H
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
22 #define _I_AMIDIPLUG_H 1
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
23
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
24 #define AMIDIPLUG_STOP 0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
25 #define AMIDIPLUG_PLAY 1
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
26 #define AMIDIPLUG_PAUSE 2
1414
5f892afeb8e1 - amidi-plug 0.8 beta1; support for gthread and v3 plugin system; needs testing and refinements
Giacomo Lozito <james@develia.org>
parents: 1121
diff changeset
27 #define AMIDIPLUG_SEEK 3
5f892afeb8e1 - amidi-plug 0.8 beta1; support for gthread and v3 plugin system; needs testing and refinements
Giacomo Lozito <james@develia.org>
parents: 1121
diff changeset
28 #define AMIDIPLUG_ERR 4
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
29
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
30 #include "i_common.h"
240
59d793da5395 [svn] - import amidi-plug 0.7 (among new features, a transposer to play midi files in different keys)
giacomo
parents: 12
diff changeset
31 #include <audacious/plugin.h>
59d793da5395 [svn] - import amidi-plug 0.7 (among new features, a transposer to play midi files in different keys)
giacomo
parents: 12
diff changeset
32 #include <audacious/output.h>
1020
fe9ffc829b5f [svn] - amidi-plug works again (uses auddrct.h in place of the deprecated beepctrl.h)
giacomo
parents: 561
diff changeset
33 #include <audacious/auddrct.h>
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
34 #include <pthread.h>
240
59d793da5395 [svn] - import amidi-plug 0.7 (among new features, a transposer to play midi files in different keys)
giacomo
parents: 12
diff changeset
35 #include "i_vfslayer.h"
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
36 #include "i_backend.h"
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
37 #include "i_configure.h"
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
38 #include "i_midi.h"
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
39 #include "i_fileinfo.h"
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
40 #include "i_utils.h"
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
41
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
42
1414
5f892afeb8e1 - amidi-plug 0.8 beta1; support for gthread and v3 plugin system; needs testing and refinements
Giacomo Lozito <james@develia.org>
parents: 1121
diff changeset
43 static GThread * amidiplug_play_thread = NULL;
5f892afeb8e1 - amidi-plug 0.8 beta1; support for gthread and v3 plugin system; needs testing and refinements
Giacomo Lozito <james@develia.org>
parents: 1121
diff changeset
44 static GThread * amidiplug_audio_thread = NULL;
5f892afeb8e1 - amidi-plug 0.8 beta1; support for gthread and v3 plugin system; needs testing and refinements
Giacomo Lozito <james@develia.org>
parents: 1121
diff changeset
45 static GMutex * amidiplug_gettime_mutex = NULL;
5f892afeb8e1 - amidi-plug 0.8 beta1; support for gthread and v3 plugin system; needs testing and refinements
Giacomo Lozito <james@develia.org>
parents: 1121
diff changeset
46 static GMutex * amidiplug_playing_mutex = NULL;
5f892afeb8e1 - amidi-plug 0.8 beta1; support for gthread and v3 plugin system; needs testing and refinements
Giacomo Lozito <james@develia.org>
parents: 1121
diff changeset
47 static GCond * amidiplug_pause_cond = NULL;
5f892afeb8e1 - amidi-plug 0.8 beta1; support for gthread and v3 plugin system; needs testing and refinements
Giacomo Lozito <james@develia.org>
parents: 1121
diff changeset
48 static GCond * amidiplug_seekonpause_cond = NULL;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
49
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
50 gint amidiplug_playing_status = AMIDIPLUG_STOP;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
51
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
52 midifile_t midifile;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
53
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
54 amidiplug_sequencer_backend_t backend;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
55
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
56 amidiplug_cfg_ap_t amidiplug_cfg_ap =
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
57 {
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
58 NULL, /* ap_seq_backend */
240
59d793da5395 [svn] - import amidi-plug 0.7 (among new features, a transposer to play midi files in different keys)
giacomo
parents: 12
diff changeset
59 0, /* ap_opts_transpose_value */
59d793da5395 [svn] - import amidi-plug 0.7 (among new features, a transposer to play midi files in different keys)
giacomo
parents: 12
diff changeset
60 0, /* ap_opts_drumshift_value */
59d793da5395 [svn] - import amidi-plug 0.7 (among new features, a transposer to play midi files in different keys)
giacomo
parents: 12
diff changeset
61 0, /* ap_opts_length_precalc */
59d793da5395 [svn] - import amidi-plug 0.7 (among new features, a transposer to play midi files in different keys)
giacomo
parents: 12
diff changeset
62 0, /* ap_opts_comments_extract */
59d793da5395 [svn] - import amidi-plug 0.7 (among new features, a transposer to play midi files in different keys)
giacomo
parents: 12
diff changeset
63 0 /* ap_opts_lyrics_extract */
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
64 };
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
65
461
cfd1b8a88e2d [svn] - updated amidi-plug to the new plugin API
giacomo
parents: 240
diff changeset
66 gchar *amidiplug_vfs_extensions[] = { "mid" , "midi" , "rmi" , "rmid" , NULL };
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
67
1414
5f892afeb8e1 - amidi-plug 0.8 beta1; support for gthread and v3 plugin system; needs testing and refinements
Giacomo Lozito <james@develia.org>
parents: 1121
diff changeset
68 gpointer amidiplug_play_loop( gpointer );
5f892afeb8e1 - amidi-plug 0.8 beta1; support for gthread and v3 plugin system; needs testing and refinements
Giacomo Lozito <james@develia.org>
parents: 1121
diff changeset
69 gpointer amidiplug_audio_loop( gpointer );
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
70 void amidiplug_skipto( gint );
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
71 static void amidiplug_init( void );
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
72 static void amidiplug_cleanup( void );
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
73 static void amidiplug_aboutbox( void );
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
74 static void amidiplug_configure( void );
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
75 static gint amidiplug_is_our_file( gchar * );
461
cfd1b8a88e2d [svn] - updated amidi-plug to the new plugin API
giacomo
parents: 240
diff changeset
76 static gint amidiplug_is_our_file_from_vfs( gchar * , VFSFile * );
559
d5782f3bd760 [svn] Update plugins to the new input plugin API
iabervon
parents: 461
diff changeset
77 static void amidiplug_play( InputPlayback * );
d5782f3bd760 [svn] Update plugins to the new input plugin API
iabervon
parents: 461
diff changeset
78 static void amidiplug_stop( InputPlayback * );
d5782f3bd760 [svn] Update plugins to the new input plugin API
iabervon
parents: 461
diff changeset
79 static void amidiplug_pause( InputPlayback *, gshort );
d5782f3bd760 [svn] Update plugins to the new input plugin API
iabervon
parents: 461
diff changeset
80 static void amidiplug_seek( InputPlayback *, gint );
d5782f3bd760 [svn] Update plugins to the new input plugin API
iabervon
parents: 461
diff changeset
81 static gint amidiplug_get_time( InputPlayback * );
561
914c96de3244 [svn] Convert plugins to use InputPlayback.output instead of InputPlugin.output
iabervon
parents: 559
diff changeset
82 static gint amidiplug_get_volume( gint * , gint * );
914c96de3244 [svn] Convert plugins to use InputPlayback.output instead of InputPlugin.output
iabervon
parents: 559
diff changeset
83 static gint amidiplug_set_volume( gint , gint );
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
84 static void amidiplug_get_song_info( gchar * , gchar ** , gint * );
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
85 static void amidiplug_file_info_box( gchar * );
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
86
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
87 InputPlugin amidiplug_ip =
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
88 {
461
cfd1b8a88e2d [svn] - updated amidi-plug to the new plugin API
giacomo
parents: 240
diff changeset
89 NULL, /* handle */
cfd1b8a88e2d [svn] - updated amidi-plug to the new plugin API
giacomo
parents: 240
diff changeset
90 NULL, /* filename */
1121
592442919dbd [svn] - amidi-plug: small changes
giacomo
parents: 1097
diff changeset
91 "AMIDI-Plug " AMIDIPLUG_VERSION " (MIDI Player)", /* description */
461
cfd1b8a88e2d [svn] - updated amidi-plug to the new plugin API
giacomo
parents: 240
diff changeset
92 amidiplug_init, /* init */
cfd1b8a88e2d [svn] - updated amidi-plug to the new plugin API
giacomo
parents: 240
diff changeset
93 amidiplug_aboutbox, /* aboutbox */
cfd1b8a88e2d [svn] - updated amidi-plug to the new plugin API
giacomo
parents: 240
diff changeset
94 amidiplug_configure, /* configure */
cfd1b8a88e2d [svn] - updated amidi-plug to the new plugin API
giacomo
parents: 240
diff changeset
95 amidiplug_is_our_file, /* is_our_file */
cfd1b8a88e2d [svn] - updated amidi-plug to the new plugin API
giacomo
parents: 240
diff changeset
96 NULL, /* scan_dir */
cfd1b8a88e2d [svn] - updated amidi-plug to the new plugin API
giacomo
parents: 240
diff changeset
97 amidiplug_play, /* play_file */
cfd1b8a88e2d [svn] - updated amidi-plug to the new plugin API
giacomo
parents: 240
diff changeset
98 amidiplug_stop, /* stop */
cfd1b8a88e2d [svn] - updated amidi-plug to the new plugin API
giacomo
parents: 240
diff changeset
99 amidiplug_pause, /* pause */
cfd1b8a88e2d [svn] - updated amidi-plug to the new plugin API
giacomo
parents: 240
diff changeset
100 amidiplug_seek, /* seek */
cfd1b8a88e2d [svn] - updated amidi-plug to the new plugin API
giacomo
parents: 240
diff changeset
101 NULL, /* set_eq */
cfd1b8a88e2d [svn] - updated amidi-plug to the new plugin API
giacomo
parents: 240
diff changeset
102 amidiplug_get_time, /* get_time */
cfd1b8a88e2d [svn] - updated amidi-plug to the new plugin API
giacomo
parents: 240
diff changeset
103 amidiplug_get_volume, /* get_volume */
cfd1b8a88e2d [svn] - updated amidi-plug to the new plugin API
giacomo
parents: 240
diff changeset
104 amidiplug_set_volume, /* set_volume */
cfd1b8a88e2d [svn] - updated amidi-plug to the new plugin API
giacomo
parents: 240
diff changeset
105 amidiplug_cleanup, /* cleanup */
cfd1b8a88e2d [svn] - updated amidi-plug to the new plugin API
giacomo
parents: 240
diff changeset
106 NULL, /* get_vis_type */
cfd1b8a88e2d [svn] - updated amidi-plug to the new plugin API
giacomo
parents: 240
diff changeset
107 NULL, /* add_vis_pcm */
cfd1b8a88e2d [svn] - updated amidi-plug to the new plugin API
giacomo
parents: 240
diff changeset
108 NULL, /* set_info */
cfd1b8a88e2d [svn] - updated amidi-plug to the new plugin API
giacomo
parents: 240
diff changeset
109 NULL, /* set_info_text */
cfd1b8a88e2d [svn] - updated amidi-plug to the new plugin API
giacomo
parents: 240
diff changeset
110 amidiplug_get_song_info, /* get_song_info */
cfd1b8a88e2d [svn] - updated amidi-plug to the new plugin API
giacomo
parents: 240
diff changeset
111 amidiplug_file_info_box, /* file_info_box */
cfd1b8a88e2d [svn] - updated amidi-plug to the new plugin API
giacomo
parents: 240
diff changeset
112 NULL, /* output */
cfd1b8a88e2d [svn] - updated amidi-plug to the new plugin API
giacomo
parents: 240
diff changeset
113 NULL, /* get_song_tuple */
cfd1b8a88e2d [svn] - updated amidi-plug to the new plugin API
giacomo
parents: 240
diff changeset
114 NULL, /* set_song_tuple */
cfd1b8a88e2d [svn] - updated amidi-plug to the new plugin API
giacomo
parents: 240
diff changeset
115 NULL, /* set_status_buffering */
cfd1b8a88e2d [svn] - updated amidi-plug to the new plugin API
giacomo
parents: 240
diff changeset
116 amidiplug_is_our_file_from_vfs, /* is_our_file_from_vfs */
cfd1b8a88e2d [svn] - updated amidi-plug to the new plugin API
giacomo
parents: 240
diff changeset
117 amidiplug_vfs_extensions /* vfs_extensions */
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
118 };
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
119
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
120 #endif /* !_I_AMIDIPLUG_H */