Mercurial > hg > xmms-sid
comparison src/xmms-sid.c @ 91:f9063960f04e
Fixed sub-song changing
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Sun, 05 Oct 2003 14:22:04 +0000 |
parents | 94497283affa |
children | 2bc56809ec0b |
comparison
equal
deleted
inserted
replaced
90:edec1818cf48 | 91:f9063960f04e |
---|---|
248 void *xs_play_loop(void *argPointer) | 248 void *xs_play_loop(void *argPointer) |
249 { | 249 { |
250 t_xs_status myStatus; | 250 t_xs_status myStatus; |
251 t_xs_tune *myTune; | 251 t_xs_tune *myTune; |
252 gboolean audioOpen, doPlay; | 252 gboolean audioOpen, doPlay; |
253 gint mySong, audioFreq, audioChannels, songLength, audioFmt; | 253 gint audioFreq, audioChannels, songLength, audioFmt; |
254 gchar audioBuffer[XS_BUFSIZE]; | 254 gchar audioBuffer[XS_BUFSIZE]; |
255 | 255 |
256 /* Initialize */ | 256 /* Initialize */ |
257 pthread_mutex_lock(&xs_mutex); | 257 pthread_mutex_lock(&xs_mutex); |
258 XSDEBUG("entering play thread\n"); | 258 XSDEBUG("entering play thread\n"); |
275 */ | 275 */ |
276 doPlay = TRUE; | 276 doPlay = TRUE; |
277 while (xs_status.isPlaying && doPlay) | 277 while (xs_status.isPlaying && doPlay) |
278 { | 278 { |
279 pthread_mutex_lock(&xs_mutex); | 279 pthread_mutex_lock(&xs_mutex); |
280 mySong = xs_status.currSong; | 280 myStatus.currSong = xs_status.currSong; |
281 songLength = myTune->subTunes[mySong - 1].tuneLength; | 281 songLength = myTune->subTunes[myStatus.currSong - 1].tuneLength; |
282 pthread_mutex_unlock(&xs_mutex); | 282 pthread_mutex_unlock(&xs_mutex); |
283 | 283 |
284 XSDEBUG("subtune #%i selected, initializing...\n", mySong); | 284 XSDEBUG("subtune #%i selected, initializing...\n", myStatus.currSong); |
285 | 285 |
286 | 286 |
287 /* Initialize song */ | 287 /* Initialize song */ |
288 if (!xs_player->plrInitSong(&myStatus)) | 288 if (!xs_player->plrInitSong(&myStatus)) |
289 { | 289 { |
290 XSERR("Couldn't initialize SID-tune '%s' (sub-tune #%i)!\n", | 290 XSERR("Couldn't initialize SID-tune '%s' (sub-tune #%i)!\n", |
291 myTune->tuneFilename, mySong); | 291 myTune->tuneFilename, myStatus.currSong); |
292 goto err_exit; | 292 goto err_exit; |
293 } | 293 } |
294 | 294 |
295 | 295 |
296 /* Get song information for current subtune */ | 296 /* Get song information for current subtune */ |
297 xs_plugin_ip.set_info( | 297 xs_plugin_ip.set_info( |
298 myTune->subTunes[mySong - 1].tuneTitle, | 298 myTune->subTunes[myStatus.currSong - 1].tuneTitle, |
299 (songLength > 0) ? (songLength * 1000) : -1, | 299 (songLength > 0) ? (songLength * 1000) : -1, |
300 (myTune->subTunes[mySong - 1].tuneSpeed > 0) ? (myTune->subTunes[mySong - 1].tuneSpeed * 1000) : -1, | 300 (myTune->subTunes[myStatus.currSong - 1].tuneSpeed > 0) ? (myTune->subTunes[myStatus.currSong - 1].tuneSpeed * 1000) : -1, |
301 audioFreq, | 301 audioFreq, |
302 audioChannels); | 302 audioChannels); |
303 | 303 |
304 | 304 |
305 /* Open the audio output */ | 305 /* Open the audio output */ |
315 audioOpen = TRUE; | 315 audioOpen = TRUE; |
316 | 316 |
317 /* | 317 /* |
318 * Play the subtune | 318 * Play the subtune |
319 */ | 319 */ |
320 while (xs_status.isPlaying && myStatus.isPlaying && (xs_status.currSong == mySong)) | 320 while (xs_status.isPlaying && myStatus.isPlaying && (xs_status.currSong == myStatus.currSong)) |
321 { | 321 { |
322 /* Render audio data */ | 322 /* Render audio data */ |
323 xs_player->plrFillBuffer(&myStatus, audioBuffer, XS_BUFSIZE); | 323 xs_player->plrFillBuffer(&myStatus, audioBuffer, XS_BUFSIZE); |
324 | 324 |
325 /* I <3 visualice/haujobb */ | 325 /* I <3 visualice/haujobb */ |
327 xs_plugin_ip.output->written_time(), | 327 xs_plugin_ip.output->written_time(), |
328 audioFmt, audioChannels, XS_BUFSIZE, audioBuffer); | 328 audioFmt, audioChannels, XS_BUFSIZE, audioBuffer); |
329 | 329 |
330 /* Wait a little */ | 330 /* Wait a little */ |
331 while (xs_status.isPlaying && | 331 while (xs_status.isPlaying && |
332 (xs_status.currSong == mySong) && | 332 (xs_status.currSong == myStatus.currSong) && |
333 (xs_plugin_ip.output->buffer_free() < XS_BUFSIZE)) | 333 (xs_plugin_ip.output->buffer_free() < XS_BUFSIZE)) |
334 xmms_usleep(10000); | 334 xmms_usleep(10000); |
335 | 335 |
336 /* Output audio */ | 336 /* Output audio */ |
337 if (xs_status.isPlaying && (xs_status.currSong == mySong)) | 337 if (xs_status.isPlaying && (xs_status.currSong == myStatus.currSong)) |
338 xs_plugin_ip.output->write_audio(audioBuffer, XS_BUFSIZE); | 338 xs_plugin_ip.output->write_audio(audioBuffer, XS_BUFSIZE); |
339 | 339 |
340 /* Check if we have played enough */ | 340 /* Check if we have played enough */ |
341 if (xs_cfg.playMaxTimeEnable) | 341 if (xs_cfg.playMaxTimeEnable) |
342 { | 342 { |