[xiph-cvs] cvs commit: ogg-tools/omplay omplay.c

Jack Moffitt jack at xiph.org
Wed Oct 3 11:18:48 PDT 2001



jack        01/10/03 11:18:48

  Modified:    omplay   omplay.c
  Log:
  Send noteoffs on every channel/note after a pause or stop.  This will prevent
  hanging notes.

Revision  Changes    Path
1.5       +22 -3     ogg-tools/omplay/omplay.c

Index: omplay.c
===================================================================
RCS file: /usr/local/cvsroot/ogg-tools/omplay/omplay.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- omplay.c	2001/10/02 21:58:41	1.4
+++ omplay.c	2001/10/03 18:18:47	1.5
@@ -669,6 +669,20 @@
         fclose(fp);
 }
 
+void global_note_off(void)
+{
+	snd_seq_event_t ev;
+	int n, c;
+
+	snd_seq_ev_clear(&ev);
+	for (c = 0; c < 16; c++) {
+		for (n = 0; n < 128; n++) {
+			snd_seq_ev_set_noteoff(&ev, c, n, 127);
+			snd_seq_event_output_direct(device.seqhandle, &ev);
+		}
+	}
+}
+
 int main(int argc, char **argv)
 {
         int err;
@@ -791,9 +805,12 @@
         // PLAYBACK :)
         while (!eos && device.play.status) {
                 /* Pause if we're supposed to */
-		while (device.pause.status) {
-			usleep(10000);
-			update_status();
+		if (device.pause.status) {
+			while (device.pause.status) {
+				usleep(10000);
+				update_status();
+			}
+			global_note_off();
                 }
 
                 /* Handle fast foward */
@@ -880,6 +897,8 @@
         close_file();
 
         if (use_status_files) close_status_files();
+
+	global_note_off();
 
         snd_seq_stop_queue(device.seqhandle, device.q, 0);
 

--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.



More information about the commits mailing list