comparison src/xmms-sid.c @ 760:f6a57c0656fa

Handle engine initialization failures a bit more .. "gracefully".
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 05 Nov 2012 20:03:14 +0200
parents 36c6a6e629bb
children 61a527ac3baa
comparison
equal deleted inserted replaced
759:693594421516 760:f6a57c0656fa
109 xs_status.audioBitsPerSample = xs_cfg.audioBitsPerSample; 109 xs_status.audioBitsPerSample = xs_cfg.audioBitsPerSample;
110 xs_status.audioChannels = xs_cfg.audioChannels; 110 xs_status.audioChannels = xs_cfg.audioChannels;
111 xs_status.audioFormat = -1; 111 xs_status.audioFormat = -1;
112 112
113 /* Try to initialize emulator engine */ 113 /* Try to initialize emulator engine */
114 xs_init_emu_engine(&xs_cfg.playerEngine, &xs_status); 114 if (!xs_init_emu_engine(&xs_cfg.playerEngine, &xs_status))
115 xs_error("Could not initialize any emulator engine!\n");
115 116
116 /* Get settings back, in case the chosen emulator backend changed them */ 117 /* Get settings back, in case the chosen emulator backend changed them */
117 xs_cfg.audioFrequency = xs_status.audioFrequency; 118 xs_cfg.audioFrequency = xs_status.audioFrequency;
118 xs_cfg.audioBitsPerSample = xs_status.audioBitsPerSample; 119 xs_cfg.audioBitsPerSample = xs_status.audioBitsPerSample;
119 xs_cfg.audioChannels = xs_status.audioChannels; 120 xs_cfg.audioChannels = xs_status.audioChannels;
130 /* Initialize STIL database */ 131 /* Initialize STIL database */
131 xs_stil_close(); 132 xs_stil_close();
132 if (xs_cfg.stilDBEnable && (xs_stil_init() != 0)) { 133 if (xs_cfg.stilDBEnable && (xs_stil_init() != 0)) {
133 xs_error("Error initializing STIL database!\n"); 134 xs_error("Error initializing STIL database!\n");
134 } 135 }
135
136 } 136 }
137 137
138 138
139 /* 139 /*
140 * Initialize XMMS-SID 140 * Initialize XMMS-SID
180 * Check whether the given file is handled by this plugin 180 * Check whether the given file is handled by this plugin
181 */ 181 */
182 gint xs_is_our_file(gchar *filename) 182 gint xs_is_our_file(gchar *filename)
183 { 183 {
184 gchar *ext; 184 gchar *ext;
185 assert(xs_status.engine); 185 if (xs_status.engine == NULL)
186 return FALSE;
186 187
187 /* Check the filename */ 188 /* Check the filename */
188 if (filename == NULL) 189 if (filename == NULL)
189 return FALSE; 190 return FALSE;
190 191
453 * Usually you would also initialize the output-plugin, but 454 * Usually you would also initialize the output-plugin, but
454 * this is XMMS-SID and we do it on the player thread instead. 455 * this is XMMS-SID and we do it on the player thread instead.
455 */ 456 */
456 void xs_play_file(gchar *filename) 457 void xs_play_file(gchar *filename)
457 { 458 {
458 assert(xs_status.engine); 459 if (xs_status.engine == NULL)
460 return;
459 461
460 XSDEBUG("play '%s'\n", filename); 462 XSDEBUG("play '%s'\n", filename);
461 463
462 /* Get tune information */ 464 /* Get tune information */
463 if ((xs_status.tuneInfo = xs_status.engine->plrGetSIDInfo(filename)) == NULL) 465 if ((xs_status.tuneInfo = xs_status.engine->plrGetSIDInfo(filename)) == NULL)