comparison src/psf2/peops2/spu.c @ 2742:fd5373830ac1

Initial plugin. Don't use this unless you like aud to use 100% cpu.
author William Pitcock <nenolod@atheme.org>
date Mon, 30 Jun 2008 22:12:23 -0500
parents 62cc6d667119
children 6319a15e7243
comparison
equal deleted inserted replaced
2741:f16fdcabe069 2742:fd5373830ac1
166 166
167 static int lastch=-1; // last channel processed on spu irq in timer mode 167 static int lastch=-1; // last channel processed on spu irq in timer mode
168 static int lastns=0; // last ns pos 168 static int lastns=0; // last ns pos
169 static int iSecureStart=0; // secure start counter 169 static int iSecureStart=0; // secure start counter
170 170
171 extern void ps2_update(unsigned char *samples, long lBytes); 171 extern void psf2_update(unsigned char *samples, long lBytes, void *data);
172 172
173 //////////////////////////////////////////////////////////////////////// 173 ////////////////////////////////////////////////////////////////////////
174 // CODE AREA 174 // CODE AREA
175 //////////////////////////////////////////////////////////////////////// 175 ////////////////////////////////////////////////////////////////////////
176 176
357 357
358 //////////////////////////////////////////////////////////////////////// 358 ////////////////////////////////////////////////////////////////////////
359 359
360 int iSpuAsyncWait=0; 360 int iSpuAsyncWait=0;
361 361
362 static void *MAINThread(int samp2run) 362 static void *MAINThread(int samp2run, void *data)
363 { 363 {
364 int s_1,s_2,fa,voldiv=iVolume; 364 int s_1,s_2,fa,voldiv=iVolume;
365 unsigned char * start;unsigned int nSample; 365 unsigned char * start;unsigned int nSample;
366 int ch,predict_nr,shift_factor,flags,d,d2,s; 366 int ch,predict_nr,shift_factor,flags,d,d2,s;
367 int gpos,bIRQReturn=0; 367 int gpos,bIRQReturn=0;
760 ////////////////////////////////////////////////////// 760 //////////////////////////////////////////////////////
761 // feed the sound 761 // feed the sound
762 // wanna have around 1/60 sec (16.666 ms) updates 762 // wanna have around 1/60 sec (16.666 ms) updates
763 if ((((unsigned char *)pS)-((unsigned char *)pSpuBuffer)) == (735*4)) 763 if ((((unsigned char *)pS)-((unsigned char *)pSpuBuffer)) == (735*4))
764 { 764 {
765 ps2_update((u8*)pSpuBuffer,(u8*)pS-(u8*)pSpuBuffer); 765 psf2_update((u8*)pSpuBuffer,(u8*)pS-(u8*)pSpuBuffer, data);
766 pS=(short *)pSpuBuffer; 766 pS=(short *)pSpuBuffer;
767 } 767 }
768 } 768 }
769 769
770 // end of big main loop... 770 // end of big main loop...
781 //////////////////////////////////////////////////////////////////////// 781 ////////////////////////////////////////////////////////////////////////
782 // SPU ASYNC... even newer epsxe func 782 // SPU ASYNC... even newer epsxe func
783 // 1 time every 'cycle' cycles... harhar 783 // 1 time every 'cycle' cycles... harhar
784 //////////////////////////////////////////////////////////////////////// 784 ////////////////////////////////////////////////////////////////////////
785 785
786 EXPORT_GCC void CALLBACK SPU2async(unsigned long cycle) 786 EXPORT_GCC void CALLBACK SPU2async(unsigned long cycle, void *data)
787 { 787 {
788 if(iSpuAsyncWait) 788 if(iSpuAsyncWait)
789 { 789 {
790 iSpuAsyncWait++; 790 iSpuAsyncWait++;
791 if(iSpuAsyncWait<=64) return; 791 if(iSpuAsyncWait<=64) return;
792 iSpuAsyncWait=0; 792 iSpuAsyncWait=0;
793 } 793 }
794 794
795 MAINThread(0); // -> linux high-compat mode 795 MAINThread(0, data); // -> linux high-compat mode
796 } 796 }
797 797
798 //////////////////////////////////////////////////////////////////////// 798 ////////////////////////////////////////////////////////////////////////
799 // INIT/EXIT STUFF 799 // INIT/EXIT STUFF
800 //////////////////////////////////////////////////////////////////////// 800 ////////////////////////////////////////////////////////////////////////