Mercurial > hg > dmlib
changeset 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 |
files | jssplr.c jssplr.h ppl.c |
diffstat | 3 files changed, 32 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/jssplr.c Sat Oct 06 13:24:50 2012 +0300 +++ b/jssplr.c Sat Oct 06 13:25:37 2012 +0300 @@ -535,10 +535,7 @@ assert(mp->module != NULL); for (i = 0; i < mp->module->nchannels; i++) - { jvmStop(mp->device, i); - jvmClear(mp->device, i); - } // Initialize channel data for (i = 0; i < jsetNChannels; i++) @@ -568,6 +565,35 @@ } +int jmpChangeOrder(JSSPlayer *mp, int order) +{ + assert(mp != NULL); + + JSS_LOCK(mp); + assert(mp->module != NULL); + + jmpClearChannels(mp); + jmpClearPlayer(mp); + + jmpSetNewOrder(mp, order); + if (mp->order == jsetNotSet) + { + JSS_UNLOCK(mp); + JSSERROR(DMERR_NOT_SUPPORTED, DMERR_NOT_SUPPORTED, + "Could not start playing from given order #%i\n", order); + } + + if (mp->future != NULL) + { + jmpChangeOrder(mp->future, order); + jmpExec(mp->future->device, mp->future); + } + + JSS_UNLOCK(mp); + return DMERR_OK; +} + + int jmpPlayOrder(JSSPlayer * mp, int order) { int result;
--- a/jssplr.h Sat Oct 06 13:24:50 2012 +0300 +++ b/jssplr.h Sat Oct 06 13:25:37 2012 +0300 @@ -145,6 +145,7 @@ /* External functions for end users */ int jmpPlayOrder(JSSPlayer *, int); +int jmpChangeOrder(JSSPlayer *, int); int jmpPlayPattern(JSSPlayer *, int); void jmpStop(JSSPlayer *); void jmpResume(JSSPlayer *);
--- a/ppl.c Sat Oct 06 13:24:50 2012 +0300 +++ b/ppl.c Sat Oct 06 13:25:37 2012 +0300 @@ -715,7 +715,7 @@ case SDLK_PAGEUP: JSS_LOCK(engine.dev); JSS_LOCK(engine.plr); - jmpPlayOrder(engine.plr, dmClamp(engine.plr->order - 1, 0, engine.mod->norders)); + jmpChangeOrder(engine.plr, dmClamp(engine.plr->order - 1, 0, engine.mod->norders)); JSS_UNLOCK(engine.plr); JSS_UNLOCK(engine.dev); force = TRUE; @@ -724,7 +724,7 @@ case SDLK_PAGEDOWN: JSS_LOCK(engine.dev); JSS_LOCK(engine.plr); - jmpPlayOrder(engine.plr, dmClamp(engine.plr->order + 1, 0, engine.mod->norders)); + jmpChangeOrder(engine.plr, dmClamp(engine.plr->order + 1, 0, engine.mod->norders)); JSS_UNLOCK(engine.plr); JSS_UNLOCK(engine.dev); force = TRUE;