comparison src/xmms-sid.c @ 424:faf12767a6f1

Preparing for internationalization.
author Matti Hamalainen <ccr@tnsp.org>
date Sun, 31 Dec 2006 21:43:04 +0000
parents d2e6682d3ef8
children fe3b0623955a
comparison
equal deleted inserted replaced
423:c0fdf3b3f3e6 424:faf12767a6f1
196 xs_cfg.oversampleEnable = xs_status.oversampleEnable; 196 xs_cfg.oversampleEnable = xs_status.oversampleEnable;
197 197
198 /* Initialize song-length database */ 198 /* Initialize song-length database */
199 xs_songlen_close(); 199 xs_songlen_close();
200 if (xs_cfg.songlenDBEnable && (xs_songlen_init() != 0)) { 200 if (xs_cfg.songlenDBEnable && (xs_songlen_init() != 0)) {
201 xs_error("Error initializing song-length database!\n"); 201 xs_error(_("Error initializing song-length database!\n"));
202 } 202 }
203 203
204 /* Initialize STIL database */ 204 /* Initialize STIL database */
205 xs_stil_close(); 205 xs_stil_close();
206 if (xs_cfg.stilDBEnable && (xs_stil_init() != 0)) { 206 if (xs_cfg.stilDBEnable && (xs_stil_init() != 0)) {
207 xs_error("Error initializing STIL database!\n"); 207 xs_error(_("Error initializing STIL database!\n"));
208 } 208 }
209 } 209 }
210 210
211 211
212 /* 212 /*
314 XS_MUTEX_UNLOCK(xs_status); 314 XS_MUTEX_UNLOCK(xs_status);
315 315
316 /* Allocate audio buffer */ 316 /* Allocate audio buffer */
317 audioBuffer = (gchar *) g_malloc(XS_AUDIOBUF_SIZE); 317 audioBuffer = (gchar *) g_malloc(XS_AUDIOBUF_SIZE);
318 if (audioBuffer == NULL) { 318 if (audioBuffer == NULL) {
319 xs_error("Couldn't allocate memory for audio data buffer!\n"); 319 xs_error(_("Couldn't allocate memory for audio data buffer!\n"));
320 goto xs_err_exit; 320 goto xs_err_exit;
321 } 321 }
322 322
323 if (myStatus.oversampleEnable) { 323 if (myStatus.oversampleEnable) {
324 oversampleBuffer = (gchar *) g_malloc(XS_AUDIOBUF_SIZE * myStatus.oversampleFactor); 324 oversampleBuffer = (gchar *) g_malloc(XS_AUDIOBUF_SIZE * myStatus.oversampleFactor);
325 if (oversampleBuffer == NULL) { 325 if (oversampleBuffer == NULL) {
326 xs_error("Couldn't allocate memory for audio oversampling buffer!\n"); 326 xs_error(_("Couldn't allocate memory for audio oversampling buffer!\n"));
327 goto xs_err_exit; 327 goto xs_err_exit;
328 } 328 }
329 } 329 }
330 330
331 /* 331 /*
398 songLength = xs_cfg.playMinTime; 398 songLength = xs_cfg.playMinTime;
399 } 399 }
400 400
401 /* Initialize song */ 401 /* Initialize song */
402 if (!myStatus.sidPlayer->plrInitSong(&myStatus)) { 402 if (!myStatus.sidPlayer->plrInitSong(&myStatus)) {
403 xs_error("Couldn't initialize SID-tune '%s' (sub-tune #%i)!\n", 403 xs_error(_("Couldn't initialize SID-tune '%s' (sub-tune #%i)!\n"),
404 myTune->sidFilename, myStatus.currSong); 404 myTune->sidFilename, myStatus.currSong);
405 goto xs_err_exit; 405 goto xs_err_exit;
406 } 406 }
407 407
408 408
410 XSDEBUG("open audio output (%d, %d, %d)\n", 410 XSDEBUG("open audio output (%d, %d, %d)\n",
411 myStatus.audioFormat, myStatus.audioFrequency, myStatus.audioChannels); 411 myStatus.audioFormat, myStatus.audioFrequency, myStatus.audioChannels);
412 412
413 if (!xs_plugin_ip.output-> 413 if (!xs_plugin_ip.output->
414 open_audio(myStatus.audioFormat, myStatus.audioFrequency, myStatus.audioChannels)) { 414 open_audio(myStatus.audioFormat, myStatus.audioFrequency, myStatus.audioChannels)) {
415 xs_error("Couldn't open XMMS audio output (fmt=%x, freq=%i, nchan=%i)!\n", myStatus.audioFormat, 415 xs_error(_("Couldn't open XMMS audio output (fmt=%x, freq=%i, nchan=%i)!\n"),
416 myStatus.audioFrequency, myStatus.audioChannels); 416 myStatus.audioFormat,
417 myStatus.audioFrequency,
418 myStatus.audioChannels);
417 419
418 XS_MUTEX_LOCK(xs_status); 420 XS_MUTEX_LOCK(xs_status);
419 xs_status.isError = TRUE; 421 xs_status.isError = TRUE;
420 XS_MUTEX_UNLOCK(xs_status); 422 XS_MUTEX_UNLOCK(xs_status);
421 goto xs_err_exit; 423 goto xs_err_exit;
449 audioGot /= myStatus.oversampleFactor; 451 audioGot /= myStatus.oversampleFactor;
450 452
451 /* Execute rate-conversion with filtering */ 453 /* Execute rate-conversion with filtering */
452 if (xs_filter_rateconv(audioBuffer, oversampleBuffer, 454 if (xs_filter_rateconv(audioBuffer, oversampleBuffer,
453 myStatus.audioFormat, myStatus.oversampleFactor, audioGot) < 0) { 455 myStatus.audioFormat, myStatus.oversampleFactor, audioGot) < 0) {
454 xs_error("Oversampling rate-conversion pass failed.\n"); 456 xs_error(_("Oversampling rate-conversion pass failed.\n"));
455 XS_MUTEX_LOCK(xs_status); 457 XS_MUTEX_LOCK(xs_status);
456 xs_status.isError = TRUE; 458 xs_status.isError = TRUE;
457 XS_MUTEX_UNLOCK(xs_status); 459 XS_MUTEX_UNLOCK(xs_status);
458 goto xs_err_exit; 460 goto xs_err_exit;
459 } 461 }
565 xs_status.isError = FALSE; 567 xs_status.isError = FALSE;
566 xs_status.currSong = xs_status.tuneInfo->startTune; 568 xs_status.currSong = xs_status.tuneInfo->startTune;
567 569
568 /* Start the playing thread! */ 570 /* Start the playing thread! */
569 if (pthread_create(&xs_decode_thread, NULL, xs_playthread, NULL) < 0) { 571 if (pthread_create(&xs_decode_thread, NULL, xs_playthread, NULL) < 0) {
570 xs_error("Couldn't start playing thread!\n"); 572 xs_error(_("Couldn't create playing thread!\n"));
571 xs_tuneinfo_free(xs_status.tuneInfo); 573 xs_tuneinfo_free(xs_status.tuneInfo);
572 xs_status.tuneInfo = NULL; 574 xs_status.tuneInfo = NULL;
573 xs_status.sidPlayer->plrDeleteSID(&xs_status); 575 xs_status.sidPlayer->plrDeleteSID(&xs_status);
574 } 576 }
575 577
762 /* Create the pop-up window */ 764 /* Create the pop-up window */
763 xs_subctrl = gtk_window_new(GTK_WINDOW_DIALOG); 765 xs_subctrl = gtk_window_new(GTK_WINDOW_DIALOG);
764 gtk_widget_set_name(xs_subctrl, "xs_subctrl"); 766 gtk_widget_set_name(xs_subctrl, "xs_subctrl");
765 gtk_object_set_data(GTK_OBJECT(xs_subctrl), "xs_subctrl", xs_subctrl); 767 gtk_object_set_data(GTK_OBJECT(xs_subctrl), "xs_subctrl", xs_subctrl);
766 768
767 gtk_window_set_title(GTK_WINDOW(xs_subctrl), "Subtune Control"); 769 gtk_window_set_title(GTK_WINDOW(xs_subctrl), _("Subtune Control"));
768 gtk_window_set_position(GTK_WINDOW(xs_subctrl), GTK_WIN_POS_MOUSE); 770 gtk_window_set_position(GTK_WINDOW(xs_subctrl), GTK_WIN_POS_MOUSE);
769 gtk_container_set_border_width(GTK_CONTAINER(xs_subctrl), 0); 771 gtk_container_set_border_width(GTK_CONTAINER(xs_subctrl), 0);
770 gtk_window_set_policy(GTK_WINDOW(xs_subctrl), FALSE, FALSE, FALSE); 772 gtk_window_set_policy(GTK_WINDOW(xs_subctrl), FALSE, FALSE, FALSE);
771 773
772 gtk_signal_connect(GTK_OBJECT(xs_subctrl), "destroy", GTK_SIGNAL_FUNC(gtk_widget_destroyed), &xs_subctrl); 774 gtk_signal_connect(GTK_OBJECT(xs_subctrl), "destroy", GTK_SIGNAL_FUNC(gtk_widget_destroyed), &xs_subctrl);
957 gint i; 959 gint i;
958 960
959 /* Allocate structure */ 961 /* Allocate structure */
960 pResult = (t_xs_tuneinfo *) g_malloc0(sizeof(t_xs_tuneinfo)); 962 pResult = (t_xs_tuneinfo *) g_malloc0(sizeof(t_xs_tuneinfo));
961 if (!pResult) { 963 if (!pResult) {
962 xs_error("Could not allocate memory for t_xs_tuneinfo ('%s')\n", pcFilename); 964 xs_error(_("Could not allocate memory for t_xs_tuneinfo ('%s')\n"),
965 pcFilename);
963 return NULL; 966 return NULL;
964 } 967 }
965 968
966 pResult->sidFilename = g_strdup(pcFilename); 969 pResult->sidFilename = g_strdup(pcFilename);
967 if (!pResult->sidFilename) { 970 if (!pResult->sidFilename) {
968 xs_error("Could not allocate sidFilename ('%s')\n", pcFilename); 971 xs_error(_("Could not allocate sidFilename ('%s')\n"),
972 pcFilename);
969 g_free(pResult); 973 g_free(pResult);
970 return NULL; 974 return NULL;
971 } 975 }
972 976
973 /* Allocate space for subtune information */ 977 /* Allocate space for subtune information */
974 pResult->subTunes = g_malloc0(sizeof(t_xs_subtuneinfo) * (nsubTunes + 1)); 978 pResult->subTunes = g_malloc0(sizeof(t_xs_subtuneinfo) * (nsubTunes + 1));
975 if (!pResult->subTunes) { 979 if (!pResult->subTunes) {
976 xs_error("Could not allocate memory for t_xs_subtuneinfo ('%s', %i)\n", 980 xs_error(_("Could not allocate memory for t_xs_subtuneinfo ('%s', %i)\n"),
977 pcFilename, nsubTunes); 981 pcFilename, nsubTunes);
978 982
979 g_free(pResult->sidFilename); 983 g_free(pResult->sidFilename);
980 g_free(pResult); 984 g_free(pResult);
981 return NULL; 985 return NULL;