Mercurial > audlegacy
comparison Plugins/Input/console/Audacious_Driver.cpp @ 99:4b2b964a7694 trunk
[svn] What i have right now is this.
| author | nenolod |
|---|---|
| date | Tue, 01 Nov 2005 21:53:40 -0800 |
| parents | e42694a28331 |
| children | 05d05f290c04 |
comparison
equal
deleted
inserted
replaced
| 98:e42694a28331 | 99:4b2b964a7694 |
|---|---|
| 53 reader.open(filename); | 53 reader.open(filename); |
| 54 reader.read(&header, sizeof(header)); | 54 reader.read(&header, sizeof(header)); |
| 55 | 55 |
| 56 title = g_strdup(header.song); | 56 title = g_strdup(header.song); |
| 57 | 57 |
| 58 printf("song title is: %s\n", title); | |
| 59 | |
| 58 return title; | 60 return title; |
| 59 } | 61 } |
| 60 | 62 |
| 61 static void get_song_info(char *filename, char **title, int *length) | 63 static void get_song_info(char *filename, char **title, int *length) |
| 62 { | 64 { |
| 63 (*title) = get_title(filename); | 65 (*title) = get_title(filename); |
| 64 (*length) = -1; | 66 (*length) = -1; |
| 67 | |
| 68 printf("get_song_info() finished\n"); | |
| 65 } | 69 } |
| 66 | 70 |
| 67 static void play_file(char *filename) | 71 static void play_file(char *filename) |
| 68 { | 72 { |
| 69 Emu_Std_Reader reader; | 73 Emu_Std_Reader reader; |
| 75 spc = new Spc_Emu; | 79 spc = new Spc_Emu; |
| 76 spc->init(44100); | 80 spc->init(44100); |
| 77 spc->load(header, reader); | 81 spc->load(header, reader); |
| 78 spc->start_track(0); | 82 spc->start_track(0); |
| 79 | 83 |
| 80 decode_thread = g_thread_create(play_loop, NULL, FALSE, NULL); | 84 decode_thread = g_thread_create(play_loop, spc, TRUE, NULL); |
| 85 | |
| 86 printf("decode_thread started.\n"); | |
| 81 } | 87 } |
| 82 | 88 |
| 83 static void seek(gint time) | 89 static void seek(gint time) |
| 84 { | 90 { |
| 85 // XXX: Not yet implemented | 91 // XXX: Not yet implemented |
| 134 console_ip.output->pause(p); | 140 console_ip.output->pause(p); |
| 135 } | 141 } |
| 136 | 142 |
| 137 static void *play_loop(gpointer arg) | 143 static void *play_loop(gpointer arg) |
| 138 { | 144 { |
| 145 Spc_Emu *my_spc = (Spc_Emu *) arg; | |
| 139 Music_Emu::sample_t buf[1024]; | 146 Music_Emu::sample_t buf[1024]; |
| 140 | 147 |
| 141 while (spc->play(1024, buf)) | 148 printf("inside decode_thread, my_spc = %p, spc = %p\n", my_spc, spc); |
| 149 | |
| 150 do | |
| 142 { | 151 { |
| 152 printf("buf = %s\n", buf); | |
| 143 produce_audio(console_ip.output->written_time(), | 153 produce_audio(console_ip.output->written_time(), |
| 144 FMT_S16_LE, 2, 1024, (char *) buf, | 154 FMT_S16_LE, 2, 1024, (char *) buf, |
| 145 NULL); | 155 NULL); |
| 156 printf("writing audio to output device\n"); | |
| 146 xmms_usleep(100000); | 157 xmms_usleep(100000); |
| 147 } | 158 } while (my_spc->play(1024, buf)); |
| 159 | |
| 160 printf("we're through in decode_thread, cleaning up\n"); | |
| 148 | 161 |
| 149 delete spc; | 162 delete spc; |
| 150 g_thread_exit(NULL); | 163 g_thread_exit(NULL); |
| 151 | 164 |
| 152 return NULL; | 165 return NULL; |
