[PD-cvs] pd/src s_audio_jack.c, 1.5.4.8.2.6, 1.5.4.8.2.7 m_sched.c, 1.5.4.35.2.10, 1.5.4.35.2.11

Tim Blechmann timblech at users.sourceforge.net
Thu Apr 13 20:50:25 CEST 2006


Update of /cvsroot/pure-data/pd/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4376

Modified Files:
      Tag: devel_0_39
	s_audio_jack.c m_sched.c 
Log Message:
running idle callbacks in audio api callback


Index: m_sched.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/m_sched.c,v
retrieving revision 1.5.4.35.2.10
retrieving revision 1.5.4.35.2.11
diff -C2 -d -r1.5.4.35.2.10 -r1.5.4.35.2.11
*** m_sched.c	9 Apr 2006 01:01:10 -0000	1.5.4.35.2.10
--- m_sched.c	13 Apr 2006 18:50:23 -0000	1.5.4.35.2.11
***************
*** 506,513 ****
  			while(sys_keepsched)
  			{
! 				int didsomething = 0;
! 				
! 				/* tb: allow the audio callback to run */
! 				sys_unlock();
  				sys_lock();
  
--- 506,512 ----
  			while(sys_keepsched)
  			{
!                 /* tb: allow the audio callback to run */
!                 sys_unlock();
! 				sys_microsleep(sys_sleepgrain);
  				sys_lock();
  
***************
*** 519,524 ****
  				
  				/* do graphics updates and run idle callbacks */
! 					sched_pollformeters();
! 				run_idle_callbacks(sys_sleepgrain);
  			}
  		sys_keepsched = 1;
--- 518,523 ----
  				
  				/* do graphics updates and run idle callbacks */
!                 sched_pollformeters();
! 
  			}
  		sys_keepsched = 1;
***************
*** 701,704 ****
--- 700,767 ----
  static t_sched_callback *ringbuffer_head;
  
+ void run_all_idle_callbacks(void)
+ {
+ 	t_sched_callback * new_callback;
+ 	/* append idle callback to ringbuffer */
+ 	while (new_callback = (t_sched_callback*) fifo_get(callback_fifo))
+ 	{
+ 		t_sched_callback * next;
+ 		
+ 		/* set the next field to NULL ... it might be set in the fifo */
+ 		new_callback->next = NULL;
+ 		if (ringbuffer_head == NULL)
+ 		{
+ 			ringbuffer_head = new_callback;
+ 		}
+ 		else
+ 		{
+ 			next = ringbuffer_head;
+ 			while (next->next != 0)
+ 				next = next->next;
+ 			next->next = new_callback;
+ 		}
+ 	}
+ 
+ 	if (ringbuffer_head != NULL)
+ 	{
+ 		t_sched_callback * idle_callback = ringbuffer_head;
+ 		t_sched_callback * last = NULL;
+ 		t_sched_callback * next;
+ 
+ 		do
+ 		{
+ 			int status;
+ 			status = (idle_callback->function)(idle_callback->argv);
+ 			
+ 			switch (status)
+ 			{
+ 				/* callbacks returning 0 will be deleted */
+ 			case 0:
+ 				next = idle_callback->next;
+ 				freebytes (idle_callback->argv, idle_callback->argc);
+ 				freebytes ((void*)idle_callback, sizeof(t_sched_callback));
+ 				
+ 				if (last == NULL)
+ 					ringbuffer_head = next;
+ 				else
+ 					last->next = next;
+ 					
+ 				idle_callback = next;
+ 				
+ 				/* callbacks returning 1 will be run again */
+ 			case 1:
+ 				break;
+ 
+ 				/* callbacks returning 2 will be run during the next idle callback */
+ 			case 2:
+ 				last = idle_callback;
+ 				idle_callback = idle_callback->next;
+ 			}
+ 
+         }
+ 		while ((idle_callback != NULL));
+     }
+ }
+ 
  static void run_idle_callbacks(int microsec)
  {

Index: s_audio_jack.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/s_audio_jack.c,v
retrieving revision 1.5.4.8.2.6
retrieving revision 1.5.4.8.2.7
diff -C2 -d -r1.5.4.8.2.6 -r1.5.4.8.2.7
*** s_audio_jack.c	30 Nov 2005 13:36:58 -0000	1.5.4.8.2.6
--- s_audio_jack.c	13 Apr 2006 18:50:23 -0000	1.5.4.8.2.7
***************
*** 39,42 ****
--- 39,45 ----
  static void jack_restore_connection_state(void);
  
+ void run_all_idle_callbacks(void);
+ 
+ 
  static int
  process (jack_nframes_t nframes, void *arg)
***************
*** 69,74 ****
  		jack_filled = 0;
  	}
! /* 	tb: wait in the scheduler */
! /* 	pthread_cond_broadcast(&jack_sem); */
  	return 0;
  }
--- 72,78 ----
  		jack_filled = 0;
  	}
! 
!     /* 	tb: wait in the scheduler */
!     /* 	pthread_cond_broadcast(&jack_sem); */
  	return 0;
  }
***************
*** 151,154 ****
--- 155,160 ----
  	}
  	
+     run_all_idle_callbacks();
+ 
  	sys_unlock();
  





More information about the Pd-cvs mailing list