comparison src/xs_sidplay.h @ 849:2663b1ac9ce6

Improve debugging.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 08 Nov 2012 23:02:05 +0200
parents ae1f6418d093
children
comparison
equal deleted inserted replaced
848:a293b88eb3fb 849:2663b1ac9ce6
29 XSTuneInfo *TFUNCTION(const gchar *filename) 29 XSTuneInfo *TFUNCTION(const gchar *filename)
30 { 30 {
31 XSTuneInfo *res; 31 XSTuneInfo *res;
32 TTUNEINFO info; 32 TTUNEINFO info;
33 TTUNE *tune; 33 TTUNE *tune;
34 guint8 *buf = NULL;
35 size_t bufSize = 0;
36 34
37 /* Load file */
38 if (xs_fload_buffer(filename, &buf, &bufSize) != 0)
39 return NULL;
40
41 /* Check if the tune exists and is readable */ 35 /* Check if the tune exists and is readable */
42 if ((tune = new TTUNE(buf, bufSize)) == NULL) 36 if ((tune = new TTUNE(filename)) == NULL)
43 { 37 {
44 g_free(buf); 38 XSDEBUG("could not initialize tune from '%s'.\n", filename);
45 return NULL; 39 return NULL;
46 } 40 }
47 g_free(buf);
48 41
49 if (!tune->getStatus()) 42 if (!tune->getStatus())
50 { 43 {
44 XSDEBUG("tune->getStatus() returned false for '%s'.\n", filename);
51 delete tune; 45 delete tune;
52 return NULL; 46 return NULL;
53 } 47 }
54 48
55 /* Get general tune information */ 49 /* Get general tune information */
56 #ifdef XS_SIDPLAY1_H 50 #if defined(XS_SIDPLAY1_H)
57 tune->getInfo(info); 51 tune->getInfo(info);
58 #endif 52 #elif defined(XS_SIDPLAY2_H)
59 53 info = tune->getInfo();
60 #ifdef XS_SIDPLAY2_H 54 #elif defined(XS_SIDPLAYFP_H)
61 info = tune->getInfo(); 55 info = tune->getInfo();
62 #endif 56 #endif
63 57
64 /* Allocate tuneinfo structure and set information */ 58 /* Allocate tuneinfo structure and set information */
65 res = xs_tuneinfo_new(filename, 59 res = xs_tuneinfo_new(filename,