List Info

Thread: dummy problems




dummy problems
user name
2006-06-28 20:48:19
> Subject: [Jackit-devel] dummy problems

Sorry for the noise; patch attached this time.

-- 
Ian Gulliver
Penguin Hosting
"Failure is not an option; it comes bundled with your
Microsoft products."
Index: drivers/dummy/dummy_driver.c
============================================================
=======
--- drivers/dummy/dummy_driver.c	(revision 979)
+++ drivers/dummy/dummy_driver.c	(working copy)
 -38,19
+38,33 
 
 #undef DEBUG_WAKEUP
 
+/* this is used for calculate what counts as an xrun */
+#define PRETEND_BUFFER_SIZE 4096
 
 static jack_nframes_t 
 dummy_driver_wait (dummy_driver_t *driver, int extra_fd,
int *status,
 		   float *delayed_usecs)
 {
-	jack_time_t starting_time = jack_get_microseconds();
-	jack_time_t processing_time = (driver->last_wait_ust?
-				       starting_time - driver->last_wait_ust:
-				       0);
+	jack_time_t now = jack_get_microseconds();
 
-	/* wait until time for next cycle */
-	if (driver->wait_time > processing_time)
-		usleep (driver->wait_time - processing_time);
+	if (driver->next_time < now) {
+		if (driver->next_time == 0) {
+			/* first time through */
+			driver->next_time = now + driver->wait_time;
+		}  else if (now - driver->next_time >
PRETEND_BUFFER_SIZE * 1000000LL / driver->sample_rate) {
+			/* xrun */
+			fprintf(stderr,"**** dummy: xrun of %ju
usec\n",(uintmax_t)now - driver->next_time);
+			driver->next_time = now + driver->wait_time;
+		} else {
+			/* late, but handled by our "buffer"; try to
get back on track */
+			driver->next_time += driver->wait_time;
+		}
+	} else {
+		jack_time_t wait = driver->next_time - now;
+		struct timespec ts = { .tv_sec = wait / 1000000, .tv_nsec
= (wait % 1000000) * 1000 };
+		nanosleep(&ts,NULL);
+		driver->next_time += driver->wait_time;
+	}
 
 	driver->last_wait_ust = jack_get_microseconds ();
 	driver->engine->transport_cycle_start
(driver->engine,
 -96,14
+110,6 
 static int
 dummy_driver_bufsize (dummy_driver_t* driver,
jack_nframes_t nframes)
 {
-	/* This is a somewhat arbitrary size restriction.  The
dummy
-	 * driver doesn't work well with smaller buffer sizes,
-	 * apparantly due to usleep() inaccuracy under Linux 2.4. 
If
-	 * you can get it working with smaller buffers, lower the
-	 * limit.  (JOQ) */
-	if (nframes < 128)
-		return EINVAL;
-
 	driver->period_size = nframes;  
 	driver->period_usecs = driver->wait_time =
 		(jack_time_t) floor ((((float) nframes) /
driver->sample_rate)
 -243,6
+249,7 
 	driver->sample_rate = sample_rate;
 	driver->period_size = period_size;
 	driver->wait_time   = wait_time;
+	driver->next_time   = 0;
 	driver->last_wait_ust = 0;
 
 	driver->capture_channels  = capture_ports;
Index: drivers/dummy/dummy_driver.h
============================================================
=======
--- drivers/dummy/dummy_driver.h	(revision 979)
+++ drivers/dummy/dummy_driver.h	(working copy)
 -36,6
+36,7 
     jack_nframes_t  sample_rate;
     jack_nframes_t  period_size;
     unsigned long   wait_time;
+    jack_time_t     next_time;
 
     unsigned int    capture_channels;
     unsigned int    playback_channels;
Using Tomcat but need to do more? Need to support web
services, security?
Get stuff done quickly with pre-integrated technology to
make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on
Apache Geronimo
http://sel.as-us.falkag.net/
sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Jackit-devel mailing list
Jackit-devellists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jackit-dev
el
dummy problems
user name
2006-06-29 03:37:42
On 6/28/06, Ian Gulliver <ian-jackpenguinhosting.net>
wrote:
> > Subject: [Jackit-devel] dummy problems
>
> Sorry for the noise; patch attached this time.

What does PRETEND_BUFFER_SIZE represent?

Why is it different from driver->period_size?
-- 
 joq

Using Tomcat but need to do more? Need to support web
services, security?
Get stuff done quickly with pre-integrated technology to
make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on
Apache Geronimo
http://sel.as-us.falkag.net/
sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Jackit-devel mailing list
Jackit-devellists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jackit-dev
el
dummy problems
user name
2006-06-30 13:53:25
> What does PRETEND_BUFFER_SIZE represent?
> 
> Why is it different from driver->period_size?

It's the size, in samples, of the dummy devices
"hardware" buffer
(pretend, because there's no actual hardware).  This is
used to
determine when it prints warnings, by calculating when it
actually would
have skipped, had there been a real device there.

-- 
Ian Gulliver
Penguin Hosting
"Failure is not an option; it comes bundled with your
Microsoft products."
Using Tomcat but need to do more? Need to support web
services, security?
Get stuff done quickly with pre-integrated technology to
make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on
Apache Geronimo
http://sel.as-us.falkag.net/
sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Jackit-devel mailing list
Jackit-devellists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jackit-dev
el
dummy problems
user name
2006-06-30 14:46:53
On 6/30/06, Ian Gulliver <ian-jackpenguinhosting.net>
wrote:
> > What does PRETEND_BUFFER_SIZE represent?
> >
> > Why is it different from driver->period_size?
>
> It's the size, in samples, of the dummy devices
"hardware" buffer
> (pretend, because there's no actual hardware).  This
is used to
> determine when it prints warnings, by calculating when
it actually would
> have skipped, had there been a real device there.

OK.  This patch seems to work well for me.  Unless someone
objects,
I plan to commit it soon.
-- 
 joq

Using Tomcat but need to do more? Need to support web
services, security?
Get stuff done quickly with pre-integrated technology to
make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on
Apache Geronimo
http://sel.as-us.falkag.net/
sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Jackit-devel mailing list
Jackit-devellists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jackit-dev
el
dummy problems
user name
2006-07-04 03:18:59
On 6/30/06, Jack O'Quin <jack.oquingmail.com> wrote:
> On 6/30/06, Ian Gulliver <ian-jackpenguinhosting.net> wrote:
> > > What does PRETEND_BUFFER_SIZE represent?
> > >
> > > Why is it different from
driver->period_size?
> >
> > It's the size, in samples, of the dummy devices
"hardware" buffer
> > (pretend, because there's no actual hardware). 
This is used to
> > determine when it prints warnings, by calculating
when it actually would
> > have skipped, had there been a real device there.
>
> OK.  This patch seems to work well for me.  Unless
someone objects,
> I plan to commit it soon.

Committed to SVN, version 0.102.19, rev 980.

Thanks for the patch, Ian.
-- 
 joq

Using Tomcat but need to do more? Need to support web
services, security?
Get stuff done quickly with pre-integrated technology to
make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on
Apache Geronimo
http://sel.as-us.falkag.net/
sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Jackit-devel mailing list
Jackit-devellists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jackit-dev
el
[1-5]

about | contact  Other archives ( Real Estate discussion Medical topics )