comparison jssplr.c @ 182:9024d249e47a

Add a new function jmpChangeOrder() to change orderlist position "on fly", and use it in PPL.
author Matti Hamalainen <ccr@tnsp.org>
date Sat, 06 Oct 2012 13:25:37 +0300
parents 879b2488340a
children a65f0c3deaa7
comparison
equal deleted inserted replaced
181:879b2488340a 182:9024d249e47a
533 JSS_LOCK(mp); 533 JSS_LOCK(mp);
534 assert(mp->device != NULL); 534 assert(mp->device != NULL);
535 assert(mp->module != NULL); 535 assert(mp->module != NULL);
536 536
537 for (i = 0; i < mp->module->nchannels; i++) 537 for (i = 0; i < mp->module->nchannels; i++)
538 {
539 jvmStop(mp->device, i); 538 jvmStop(mp->device, i);
540 jvmClear(mp->device, i);
541 }
542 539
543 // Initialize channel data 540 // Initialize channel data
544 for (i = 0; i < jsetNChannels; i++) 541 for (i = 0; i < jsetNChannels; i++)
545 jmpClearChannel(&mp->channels[i]); 542 jmpClearChannel(&mp->channels[i]);
546 543
562 { 559 {
563 JSSERROR(result, result, "Could not initialize callback for player.\n"); 560 JSSERROR(result, result, "Could not initialize callback for player.\n");
564 } 561 }
565 562
566 mp->isPlaying = TRUE; 563 mp->isPlaying = TRUE;
564 return DMERR_OK;
565 }
566
567
568 int jmpChangeOrder(JSSPlayer *mp, int order)
569 {
570 assert(mp != NULL);
571
572 JSS_LOCK(mp);
573 assert(mp->module != NULL);
574
575 jmpClearChannels(mp);
576 jmpClearPlayer(mp);
577
578 jmpSetNewOrder(mp, order);
579 if (mp->order == jsetNotSet)
580 {
581 JSS_UNLOCK(mp);
582 JSSERROR(DMERR_NOT_SUPPORTED, DMERR_NOT_SUPPORTED,
583 "Could not start playing from given order #%i\n", order);
584 }
585
586 if (mp->future != NULL)
587 {
588 jmpChangeOrder(mp->future, order);
589 jmpExec(mp->future->device, mp->future);
590 }
591
592 JSS_UNLOCK(mp);
567 return DMERR_OK; 593 return DMERR_OK;
568 } 594 }
569 595
570 596
571 int jmpPlayOrder(JSSPlayer * mp, int order) 597 int jmpPlayOrder(JSSPlayer * mp, int order)