Mercurial > audlegacy-plugins
annotate src/sap/sap_plug.c @ 157:34b6f9d5633a trunk
[svn] - use xmms_show_message() here.
author | nenolod |
---|---|
date | Tue, 31 Oct 2006 12:45:32 -0800 |
parents | 7804476ba85a |
children | a927c9688584 |
rev | line source |
---|---|
142
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
1 /* |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
2 * SAP xmms plug-in. |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
3 * Copyright 2002/2003 by Michal 'Mikey' Szwaczko <mikey@scene.pl> |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
4 * |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
5 * SAP Library ver. 1.56 by Adam Bienias |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
6 * |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
7 * This is free software. You can modify it and distribute it under the terms |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
8 * of the GNU General Public License. The verbatim text of the license can |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
9 * be found in file named COPYING in the source directory. |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
10 * |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
11 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
12 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
13 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
14 * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
15 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
16 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
17 * OTHER DEALINGS IN THE SOFTWARE. |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
18 * |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
19 */ |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
20 #include <stdio.h> |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
21 #include <stdlib.h> |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
22 #include <unistd.h> |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
23 #include <audacious/util.h> |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
24 #include <audacious/plugin.h> |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
25 #include <glib.h> |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
26 #include <string.h> |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
27 #include <pthread.h> |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
28 |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
29 #include "sap_plug.h" |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
30 |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
31 InputPlugin sap_ip = { |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
32 |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
33 NULL, |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
34 NULL, |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
35 "SAP Plugin " VERSION, |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
36 NULL, |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
37 sap_about, |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
38 NULL, |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
39 sap_is_our_file, |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
40 NULL, |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
41 sap_play_file, |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
42 sap_stop, |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
43 sap_pause, |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
44 sap_seek, |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
45 NULL, |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
46 sap_get_time, |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
47 NULL, |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
48 NULL, |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
49 NULL, |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
50 NULL, |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
51 NULL, |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
52 NULL, |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
53 NULL, |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
54 NULL, |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
55 sap_file_info_box, |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
56 NULL |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
57 }; |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
58 |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
59 InputPlugin *get_iplugin_info (void) { |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
60 return &sap_ip; |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
61 } |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
62 |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
63 static int sap_is_our_file (char *filename) { |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
64 |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
65 char *ext; |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
66 |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
67 ext = strrchr(filename, '.'); |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
68 |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
69 if (ext) |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
70 { |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
71 if (!strcmp(ext, ".SAP")) |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
72 return 1; |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
73 if (!strcmp(ext, ".sap")) |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
74 return 1; |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
75 } |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
76 |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
77 return 0; |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
78 } |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
79 |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
80 static void *play_loop (void *arg) { |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
81 |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
82 int datasize = N_RENDER << 2; |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
83 |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
84 while (going) { |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
85 |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
86 sapRenderBuffer(play_buf,N_RENDER); |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
87 /* for spectrum analyser */ |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
88 sap_ip.add_vis_pcm(sap_ip.output->written_time(), FMT_S16_NE, 2, N_RENDER, play_buf); |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
89 |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
90 while (sap_ip.output->buffer_free() < ( N_RENDER << 2 ) && going) |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
91 |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
92 xmms_usleep(30000); |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
93 |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
94 if (going) |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
95 |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
96 sap_ip.output->write_audio(play_buf, datasize); |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
97 |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
98 |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
99 } |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
100 |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
101 sap_ip.output->buffer_free(); |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
102 sap_ip.output->buffer_free(); |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
103 pthread_exit(NULL); |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
104 |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
105 } |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
106 |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
107 static void sap_play_file (char *filename) { |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
108 |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
109 GString *titstr; |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
110 |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
111 if ((currentFile = sapLoadMusicFile(filename)) == NULL) return; |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
112 |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
113 /* for tunes */ |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
114 tunes = currentFile->numOfSongs; |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
115 |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
116 if (tunes < 0) tunes = 1; |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
117 |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
118 /* we always start with 1st tune */ |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
119 currentSong = 0; |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
120 |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
121 sapPlaySong(currentSong); |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
122 |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
123 going = TRUE; |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
124 audio_error = FALSE; |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
125 |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
126 if (sap_ip.output->open_audio(FMT_S16_LE, OUTPUT_FREQ, 2) == 0) { |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
127 |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
128 audio_error = TRUE; |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
129 going = FALSE; |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
130 |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
131 return; |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
132 } |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
133 /* delete '.sap' from filename to display */ |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
134 titstr = g_string_new(g_basename(filename)); |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
135 g_string_truncate(titstr,titstr->len - 4); |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
136 |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
137 sap_ip.set_info(titstr->str, tunes, tunes*1024, OUTPUT_FREQ, 2); |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
138 |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
139 g_string_free(titstr,TRUE); |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
140 |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
141 pthread_create(&play_thread, NULL, play_loop, NULL); |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
142 |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
143 |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
144 } |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
145 |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
146 static void sap_stop (void) { |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
147 |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
148 if (going) { |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
149 |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
150 going = FALSE; |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
151 pthread_join(play_thread, NULL); |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
152 sap_ip.output->close_audio(); |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
153 } |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
154 } |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
155 |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
156 static void sap_seek(int time) { |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
157 |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
158 if (currentSong != tunes) { |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
159 |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
160 currentSong = (currentSong+1) % currentFile->numOfSongs; |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
161 sapPlaySong(currentSong); |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
162 sap_ip.output->flush(currentSong * 1000); |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
163 |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
164 } |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
165 } |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
166 |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
167 static void sap_pause(short paused) { |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
168 |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
169 sap_ip.output->pause(paused); |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
170 |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
171 } |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
172 |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
173 static int sap_get_time(void) { |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
174 |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
175 return sap_ip.output->output_time(); |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
176 } |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
177 |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
178 static void sap_about (void) { |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
179 |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
180 static GtkWidget *aboutbox; |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
181 |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
182 if (aboutbox != NULL) |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
183 return; |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
184 |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
185 aboutbox = xmms_show_message( |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
186 "About SAP Plugin", |
145 | 187 "SAP Player plug-in v"VERSION"\nby Michal Szwaczko <mikey@scene.pl>\n SAP library ver 0.3F by Adam Bienias\n\n" |
142
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
188 "Get more POKEY sound from ASMA at:\n[http://asma.musichall.cz]\n\nEnjoy!", |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
189 "Ok", FALSE, NULL, NULL); |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
190 |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
191 gtk_signal_connect(GTK_OBJECT(aboutbox), "destroy", |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
192 GTK_SIGNAL_FUNC(gtk_widget_destroyed), &aboutbox); |
c0b31cf2c7cd
[svn] Atari XL SAP. This compiles anything but cleanly, but somehow still
asheldon
parents:
diff
changeset
|
193 } |