From mboxrd@z Thu Jan 1 00:00:00 1970 From: Takashi Iwai Subject: Re: ALSA OSS MIDI emulation: input problems Date: Wed, 26 Mar 2003 18:53:29 +0100 Sender: alsa-devel-admin@lists.sourceforge.net Message-ID: References: <200303260700.h2Q709p03090@sprite.physics.adelaide.edu.au> Mime-Version: 1.0 (generated by SEMI 1.14.4 - "Hosorogi") Content-Type: multipart/mixed; boundary="Multipart_Wed_Mar_26_18:53:29_2003-1" Return-path: In-Reply-To: <200303260700.h2Q709p03090@sprite.physics.adelaide.edu.au> Errors-To: alsa-devel-admin@lists.sourceforge.net List-Help: List-Post: List-Subscribe: , List-Unsubscribe: , List-Archive: To: Jonathan Woithe Cc: alsa-devel@lists.sourceforge.net List-Id: alsa-devel@alsa-project.org --Multipart_Wed_Mar_26_18:53:29_2003-1 Content-Type: text/plain; charset=US-ASCII At Wed, 26 Mar 2003 17:30:09 +1030 (CST), Jonathan Woithe wrote: > > Hi all > > I've been messing with the following problem on and off for the last few > weeks. It occurs when the OSS sequencer emulation is used with Jazz++ > 4.1.3. In essence, incoming MIDI events from an external MIDI interface > have their time quantised to multiples of 48 ticks, which is not very > satisfactory. > > After a lot of messing around, I think I'm starting to work out why this is. > Jazz++ updates its play position every 48 ticks and the trigger for this is > a SEQ_ECHO event. When one of these arrives, jazz increments its time > counters, sets another SEQ_ECHO event to happen in 48 ticks time and then > finishes. This means that in the absence of MIDI input, jazz++ time goes up > in increments of 48 ticks. > > Now, when input occurs, Jazz++ needs to know the current time, which is very > unlikely to be a multiple of 48 ticks. Under nateive OSS it seems that > before the NOTEON event (for example) OSS sends a TMR_WAIT_ABS event to > update the application on the current time - the NOTEON event then follows > and is assumed to have occurred at the "current time" which of course will > be the time set by the TMR_WAIT_ABS event. > > The problem as I see it is that the ALSA OSS emulation does not send this > TMR_WAIT_ABS event - it only sends the NOTEON event. Jazz gets this and > without any TMR_WAIT_ABS to tell it otherwise, assumes that it occured at > the "current" time - which is always a multiple of 48 ticks. does the attached patch cure? Takashi --Multipart_Wed_Mar_26_18:53:29_2003-1 Content-Type: application/octet-stream Content-Disposition: attachment; filename="seq-oss-timestamp.dif" Content-Transfer-Encoding: 7bit Index: alsa-kernel/core/seq/oss/seq_oss_midi.c =================================================================== RCS file: /suse/tiwai/cvs/alsa/alsa-kernel/core/seq/oss/seq_oss_midi.c,v retrieving revision 1.8 diff -u -r1.8 seq_oss_midi.c --- alsa-kernel/core/seq/oss/seq_oss_midi.c 12 Mar 2003 11:26:20 -0000 1.8 +++ alsa-kernel/core/seq/oss/seq_oss_midi.c 26 Mar 2003 17:51:31 -0000 @@ -593,6 +593,7 @@ break; } + snd_seq_oss_readq_put_timestamp(dp->readq, ev->time.tick, dp->seq_mode); snd_seq_oss_readq_put_event(dp->readq, &ossev); return 0; --Multipart_Wed_Mar_26_18:53:29_2003-1-- ------------------------------------------------------- This SF.net email is sponsored by: The Definitive IT and Networking Event. Be There! NetWorld+Interop Las Vegas 2003 -- Register today! http://ads.sourceforge.net/cgi-bin/redirect.pl?keyn0001en