changeset 227:b7e23d91a8c2

Add jvmReset() function for reseting channel's position and pitch.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 08 Oct 2012 01:44:34 +0300
parents 725ac9d4962f
children 4d979914e837
files jssmix.c jssmix.h
diffstat 2 files changed, 15 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/jssmix.c	Mon Oct 08 01:19:48 2012 +0300
+++ b/jssmix.c	Mon Oct 08 01:44:34 2012 +0300
@@ -495,6 +495,20 @@
 }
 
 
+void jvmReset(JSSMixer * mixer, const int channel)
+{
+    JSSChannel *c;
+    
+    JSS_LOCK(mixer);
+    c = &mixer->channels[channel];
+
+    c->chDirection = TRUE;
+    c->chPos.dw    = c->chDeltaO.dw = 0;
+
+    JSS_UNLOCK(mixer);
+}
+
+
 void jvmSetSample(JSSMixer * mixer, const int channel,
           void *data, const Sint32 size, const Sint32 loopS,
           const Sint32 loopE, const int flags)
--- a/jssmix.h	Mon Oct 08 01:19:48 2012 +0300
+++ b/jssmix.h	Mon Oct 08 01:44:34 2012 +0300
@@ -129,6 +129,7 @@
  */
 void        jvmPlay(JSSMixer *mixer, const int channel);
 void        jvmStop(JSSMixer *mixer, const int channel);
+void        jvmReset(JSSMixer * mixer, const int channel);
 
 void        jvmSetSample(JSSMixer *mixer, const int channel,
             void *data, const Sint32 size, const Sint32 loopS,