Mercurial > hg > xmms-sid
comparison src/xmms-sid.c @ 872:b02f934d8224
Move some code to xs_backend.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Fri, 09 Nov 2012 04:37:25 +0200 |
parents | 9052d9096c59 |
children | 0fdb001e456c |
comparison
equal
deleted
inserted
replaced
871:d183ac29b879 | 872:b02f934d8224 |
---|---|
35 #include "xs_stil.h" | 35 #include "xs_stil.h" |
36 #include "xs_title.h" | 36 #include "xs_title.h" |
37 #include "xs_fileinfo.h" | 37 #include "xs_fileinfo.h" |
38 #include "xs_interface.h" | 38 #include "xs_interface.h" |
39 #include "xs_glade.h" | 39 #include "xs_glade.h" |
40 #include "xs_player.h" | 40 #include "xs_backend.h" |
41 #include "xs_slsup.h" | 41 #include "xs_slsup.h" |
42 | |
43 | |
44 /* List of emulator engines | |
45 */ | |
46 #ifdef HAVE_SIDPLAY1 | |
47 # include "xs_sidplay1.h" | |
48 #endif | |
49 #ifdef HAVE_SIDPLAY2 | |
50 # include "xs_sidplay2.h" | |
51 #endif | |
52 #ifdef HAVE_SIDPLAYFP | |
53 # include "xs_sidplayfp.h" | |
54 #endif | |
55 | |
56 static XSEngine xs_enginelist[] = | |
57 { | |
58 #ifdef HAVE_SIDPLAY1 | |
59 { | |
60 XS_ENG_SIDPLAY1, | |
61 xs_sidplay1_probe, | |
62 xs_sidplay1_init, xs_sidplay1_close, | |
63 xs_sidplay1_initsong, xs_sidplay1_fillbuffer, | |
64 xs_sidplay1_load, xs_sidplay1_delete, | |
65 xs_sidplay1_getinfo, xs_sidplay1_updateinfo, | |
66 NULL | |
67 }, | |
68 #endif | |
69 #ifdef HAVE_SIDPLAY2 | |
70 { | |
71 XS_ENG_SIDPLAY2, | |
72 xs_sidplay2_probe, | |
73 xs_sidplay2_init, xs_sidplay2_close, | |
74 xs_sidplay2_initsong, xs_sidplay2_fillbuffer, | |
75 xs_sidplay2_load, xs_sidplay2_delete, | |
76 xs_sidplay2_getinfo, xs_sidplay2_updateinfo, | |
77 xs_sidplay2_flush | |
78 }, | |
79 #endif | |
80 #ifdef HAVE_SIDPLAYFP | |
81 { | |
82 XS_ENG_SIDPLAYFP, | |
83 xs_sidplayfp_probe, | |
84 xs_sidplayfp_init, xs_sidplayfp_close, | |
85 xs_sidplayfp_initsong, xs_sidplayfp_fillbuffer, | |
86 xs_sidplayfp_load, xs_sidplayfp_delete, | |
87 xs_sidplayfp_getinfo, xs_sidplayfp_updateinfo, | |
88 xs_sidplayfp_flush | |
89 }, | |
90 #endif | |
91 }; | |
92 | |
93 static const gint xs_nenginelist = sizeof(xs_enginelist) / sizeof(xs_enginelist[0]); | |
94 | 42 |
95 | 43 |
96 /* Global variables | 44 /* Global variables |
97 */ | 45 */ |
98 XSEngineState xs_status; | 46 XSEngineState xs_status; |
135 /* | 83 /* |
136 * Initialization functions | 84 * Initialization functions |
137 */ | 85 */ |
138 void xs_reinit(void) | 86 void xs_reinit(void) |
139 { | 87 { |
140 gint engine; | |
141 gboolean initialized = FALSE; | |
142 | |
143 /* Stop playing, if we are */ | 88 /* Stop playing, if we are */ |
144 XS_MUTEX_LOCK(xs_status); | 89 XS_MUTEX_LOCK(xs_status); |
145 if (xs_status.playing) | 90 if (xs_status.playing) |
146 { | 91 { |
147 XS_MUTEX_UNLOCK(xs_status); | 92 XS_MUTEX_UNLOCK(xs_status); |
174 xs_status.audioBitsPerSample = xs_cfg.audioBitsPerSample; | 119 xs_status.audioBitsPerSample = xs_cfg.audioBitsPerSample; |
175 xs_status.audioChannels = xs_cfg.audioChannels; | 120 xs_status.audioChannels = xs_cfg.audioChannels; |
176 xs_status.audioFormat = -1; | 121 xs_status.audioFormat = -1; |
177 | 122 |
178 /* Try to initialize emulator engine */ | 123 /* Try to initialize emulator engine */ |
179 XSDEBUG("initializing emulator engine #%i...\n", xs_cfg.playerEngine); | 124 xs_init_emu_backend(&xs_cfg.playerEngine); |
180 | |
181 for (engine = 0; engine < xs_nenginelist && !initialized; engine++) | |
182 { | |
183 if (xs_enginelist[engine].plrIdent == xs_cfg.playerEngine && | |
184 xs_enginelist[engine].plrInit(&xs_status)) | |
185 { | |
186 initialized = TRUE; | |
187 xs_status.engine = &xs_enginelist[engine]; | |
188 } | |
189 } | |
190 | |
191 XSDEBUG("init#1: %s, %i\n", initialized ? "OK" : "FAILED", xs_cfg.playerEngine); | |
192 | 125 |
193 /* Get settings back, in case the chosen emulator backend changed them */ | 126 /* Get settings back, in case the chosen emulator backend changed them */ |
194 xs_cfg.audioFrequency = xs_status.audioFrequency; | 127 xs_cfg.audioFrequency = xs_status.audioFrequency; |
195 xs_cfg.audioBitsPerSample = xs_status.audioBitsPerSample; | 128 xs_cfg.audioBitsPerSample = xs_status.audioBitsPerSample; |
196 xs_cfg.audioChannels = xs_status.audioChannels; | 129 xs_cfg.audioChannels = xs_status.audioChannels; |