[PD-cvs] pd/src d_soundfile.c,1.1.1.2.2.19,1.1.1.2.2.20

Tim Blechmann timblech at users.sourceforge.net
Wed Sep 1 15:23:13 CEST 2004


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

Modified Files:
      Tag: devel_0_37
	d_soundfile.c 
Log Message:
fixed threaded soundfiler for msvc

Index: d_soundfile.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/d_soundfile.c,v
retrieving revision 1.1.1.2.2.19
retrieving revision 1.1.1.2.2.20
diff -C2 -d -r1.1.1.2.2.19 -r1.1.1.2.2.20
*** d_soundfile.c	23 Jul 2004 08:46:40 -0000	1.1.1.2.2.19
--- d_soundfile.c	1 Sep 2004 13:23:11 -0000	1.1.1.2.2.20
***************
*** 21,24 ****
--- 21,30 ----
  #ifdef MSW
  #include <io.h>
+ #define read _read
+ #define write _write
+ #define lseek _lseek
+ #define close _close
+ #define open _open
+ #define fdopen _fdopen
  #endif
  #include <stdio.h>
***************
*** 919,923 ****
  typedef struct _sfprocess
  {
!     void (* process) (t_soundfiler *,t_symbol *, 
  		      int, t_atom *); /* function to call */
      t_soundfiler * x;        /* soundfiler */
--- 925,929 ----
  typedef struct _sfprocess
  {
! 	void (* process) (t_soundfiler *,t_symbol *, 
  		      int, t_atom *); /* function to call */
      t_soundfiler * x;        /* soundfiler */
***************
*** 928,932 ****
  } t_sfprocess;
  
- 
  /* this is the queue for all soundfiler objects */
  typedef struct _sfqueue
--- 934,937 ----
***************
*** 951,954 ****
--- 956,960 ----
  			 int argc, t_atom * argv)
  {
+     t_sfprocess * last_entry;
      /* preparing argument vector */
      t_atom * largv =  copybytes (argv, argc * sizeof(t_atom));
***************
*** 976,981 ****
      
      /* preparing entry */
!     t_sfprocess * last_entry=getbytes(sizeof(t_sfprocess));
!     pthread_mutex_init(&(last_entry->mutex), NULL);
      pthread_mutex_lock(&(last_entry->mutex));
      last_entry->process=process;
--- 982,988 ----
      
      /* preparing entry */
! 	last_entry = (t_sfprocess*)getbytes(sizeof(t_sfprocess));
! 
! 	pthread_mutex_init(&(last_entry->mutex), NULL);
      pthread_mutex_lock(&(last_entry->mutex));
      last_entry->process=process;
***************
*** 1028,1032 ****
  void soundfiler_thread(void)
  {    
!     while (1)
      {
  #ifdef DEBUG
--- 1035,1042 ----
  void soundfiler_thread(void)
  {    
! 	t_sfprocess * me;
!     t_int i;
! 	t_sfprocess * next;
! 	while (1)
      {
  #ifdef DEBUG
***************
*** 1051,1055 ****
  
  	    /* create a copy that we can work on */
! 	    t_sfprocess * me = copybytes(soundfiler_queue->begin, 
  					 sizeof(t_sfprocess));
  	    
--- 1061,1065 ----
  
  	    /* create a copy that we can work on */
! 	    me = copybytes(soundfiler_queue->begin, 
  					 sizeof(t_sfprocess));
  	    
***************
*** 1062,1066 ****
  #endif
  	    
! 	    static int i;
  	    for (i = 0; i != me->argc; ++i)
  	    {
--- 1072,1076 ----
  #endif
  	    
! 
  	    for (i = 0; i != me->argc; ++i)
  	    {
***************
*** 1126,1130 ****
  
  	    /* the process struct */
! 	    t_sfprocess * next=soundfiler_queue->begin->next;
  	    freebytes(soundfiler_queue->begin,sizeof(t_sfprocess));
  	    soundfiler_queue->begin=next;
--- 1136,1140 ----
  
  	    /* the process struct */
! 	    next=soundfiler_queue->begin->next;
  	    freebytes(soundfiler_queue->begin,sizeof(t_sfprocess));
  	    soundfiler_queue->begin=next;
***************
*** 1165,1169 ****
  void sys_start_sfthread(void)
  {
!     //initialize queue
      soundfiler_queue = getbytes (sizeof(t_sfqueue));
  
--- 1175,1184 ----
  void sys_start_sfthread(void)
  {
!     pthread_attr_t sf_attr;
!     struct sched_param sf_param;
! 
! 	t_int status;
! 
! 	//initialize queue
      soundfiler_queue = getbytes (sizeof(t_sfqueue));
  
***************
*** 1176,1182 ****
      
      // initialize thread
-     pthread_attr_t sf_attr;
      pthread_attr_init(&sf_attr);
-     struct sched_param sf_param;
      
  #ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
--- 1191,1195 ----
***************
*** 1196,1200 ****
  
      //start thread
!     int status = pthread_create(&sf_thread_id, &sf_attr, 
  				(void *) soundfiler_thread,NULL);
      if ( status !=0)
--- 1209,1213 ----
  
      //start thread
!     status = pthread_create(&sf_thread_id, &sf_attr, 
  				(void *) soundfiler_thread,NULL);
      if ( status !=0)
***************
*** 1398,1402 ****
  	    {
  		pd_error(x, "resize failed");
- 		int j;
  		for (j=0; j!=i;++j)
  		    /* if the resizing fails, we'll have to free all arrays again */
--- 1411,1414 ----
***************
*** 1424,1428 ****
  	    {
  		pd_error(x, "resize failed");
- 		int j;
  		for (j=0; j!=i;++j)
  		    /* if the resizing fails, we'll have to free all arrays again */
--- 1436,1439 ----
***************
*** 1651,1654 ****
--- 1662,1671 ----
      int argc, t_atom *argv)
  {
+     int was, elemsize;       /* array contains was elements of size elemsize */
+     t_float * vec;           /* old array */ 
+     t_glist *gl;
+     int dspwas;
+     int n;                   /* resize of n elements */
+     char *nvec;              /* new array */ 
  
      t_garray * x = (t_garray *)pd_findbyclass(argv[0].a_w.w_symbol, garray_class);
***************
*** 1661,1670 ****
      
  
-     int was, elemsize;       /* array contains was elements of size elemsize */
-     t_float * vec;           /* old array */ 
-     t_glist *gl;
-     int dspwas;
-     int n;                   /* resize of n elements */
-     char *nvec;              /* new array */ 
  
      vec = (t_float*) x->x_array.a_vec;
--- 1678,1681 ----
***************
*** 1773,1776 ****
--- 1784,1794 ----
      int argc, t_atom *argv)
  {
+     int size, elemsize;    /* array contains was elements of size elemsize */
+     t_float * vec;         /* old array */ 
+     t_glist *gl;
+     int dspwas;
+     int val;               /* value */
+     char *nvec;            /* new array */ 
+     int i;
  
      t_garray * x = (t_garray *)pd_findbyclass(argv[0].a_w.w_symbol, garray_class);
***************
*** 1783,1792 ****
      
  
-     int size, elemsize;    /* array contains was elements of size elemsize */
-     t_float * vec;         /* old array */ 
-     t_glist *gl;
-     int dspwas;
-     int val;               /* value */
-     char *nvec;            /* new array */ 
  
      vec = (t_float*) x->x_array.a_vec;
--- 1801,1804 ----
***************
*** 1821,1825 ****
      
      /* setting array */
-     int i;
      for (i=0; i!=size; ++i)
      {
--- 1833,1836 ----





More information about the Pd-cvs mailing list