|
@@ -201,7 +201,7 @@ void laui_NoiseNode(laUiList *uil, laPropPack *This, laPropPack *Extra, laColumn
|
|
|
void IDN_ScopeInit(laSynthNodeScope* n, int NoCreate){
|
|
|
if(!n->Display1){ n->Display1=memAcquireSimple(sizeof(real)*LA_SYNTH_PLEN*2); }
|
|
|
if(!n->Display2){ n->Display2=memAcquireSimple(sizeof(real)*LA_SYNTH_PLEN*2); }
|
|
|
- pthread_spin_init(&n->Lock,0);
|
|
|
+ laSpinInit(&n->Lock);
|
|
|
if(NoCreate){ return; }
|
|
|
n->In1=laCreateInSocket("CH1",0); n->In2=laCreateInSocket("CH2",0);
|
|
|
strSafeSet(&n->Base.Name,"SCOPE"); n->Time=5; n->Brightness1=0.7f; n->Brightness2=0.4f;
|
|
@@ -210,7 +210,7 @@ void IDN_ScopeInit(laSynthNodeScope* n, int NoCreate){
|
|
|
void IDN_ScopeDestroy(laSynthNodeScope* n){
|
|
|
laDestroyInSocket(n->In1); laDestroyOutSocket(n->In2); strSafeDestroy(&n->Base.Name);
|
|
|
memFree(n->Display1); memFree(n->Display2);
|
|
|
- pthread_spin_destroy(&n->Lock);
|
|
|
+ laSpinDestroy(&n->Lock);
|
|
|
}
|
|
|
int IDN_ScopeVisit(laSynthNodeScope* n, laNodeVisitInfo* vi){
|
|
|
LA_GUARD_THIS_NODE(n,vi);
|
|
@@ -224,7 +224,7 @@ int IDN_ScopeEval(laSynthNodeScope* n){
|
|
|
if(!n->Display2){ n->Display2=memAcquireSimple(sizeof(real)*LA_SYNTH_PLEN*2); }
|
|
|
real* ch1,*ch2; INPUTPACKET(ch1,n->In1); INPUTPACKET(ch2,n->In2);
|
|
|
int Frame=1<<(n->Time-1); TNS_CLAMP(Frame,1,LA_SYNTH_PLEN);
|
|
|
- int Times=LA_SYNTH_PLEN/Frame; int sp=0; pthread_spin_lock(&n->Lock);
|
|
|
+ int Times=LA_SYNTH_PLEN/Frame; int sp=0; laSpinLock(&n->Lock);
|
|
|
for(int t=0;t<Times;t++){
|
|
|
real smin1=FLT_MAX,smax1=-FLT_MAX,smin2=FLT_MAX,smax2=-FLT_MAX;
|
|
|
for(int i=0;i<Frame;i++){
|
|
@@ -239,7 +239,7 @@ int IDN_ScopeEval(laSynthNodeScope* n){
|
|
|
n->NextSample++; if(n->NextSample>=LA_SYNTH_PLEN) n->NextSample=0;
|
|
|
}
|
|
|
n->FromSynth=MAIN.Audio->AudioEvalSynth;
|
|
|
- pthread_spin_unlock(&n->Lock);
|
|
|
+ laSpinUnlock(&n->Lock);
|
|
|
return 1;
|
|
|
}
|
|
|
void IDN_ScopeCopy(laSynthNodeScope* new, laSynthNodeScope* old, int DoRematch){
|
|
@@ -308,20 +308,20 @@ void laui_OutputNode(laUiList *uil, laPropPack *This, laPropPack *Extra, laColum
|
|
|
|
|
|
void laRebuildSynthGraphs(){
|
|
|
if(MAIN.Audio->CurrentSynth){
|
|
|
- pthread_spin_lock(&MAIN.Audio->CurrentSynth->Lock);
|
|
|
+ laSpinLock(&MAIN.Audio->CurrentSynth->Lock);
|
|
|
laRebuildPageEval(MAIN.Audio->CurrentSynth->Page);
|
|
|
- pthread_spin_unlock(&MAIN.Audio->CurrentSynth->Lock);
|
|
|
+ laSpinUnlock(&MAIN.Audio->CurrentSynth->Lock);
|
|
|
}
|
|
|
}
|
|
|
int laEvalSynthGraphs(){
|
|
|
laSynth* ss; int any=0;
|
|
|
memset(MAIN.Audio->AudioSamples,0,sizeof(real)*LA_SYNTH_PLEN);
|
|
|
for(ss=MAIN.Audio->Synths.pFirst;ss;ss=ss->Item.pNext){
|
|
|
- pthread_spin_lock(&ss->Lock);
|
|
|
- if(!ss->Playing){ pthread_spin_unlock(&ss->Lock); continue; }
|
|
|
+ laSpinLock(&ss->Lock);
|
|
|
+ if(!ss->Playing){ laSpinUnlock(&ss->Lock); continue; }
|
|
|
MAIN.Audio->AudioEvalSynth=ss; MAIN.Audio->AudioEvalTime=0; INITPACKET(ss->AudioSamples);
|
|
|
laRunPage(ss->Page,1);
|
|
|
- pthread_spin_unlock(&ss->Lock);
|
|
|
+ laSpinUnlock(&ss->Lock);
|
|
|
for(int i=0;i<LA_SYNTH_PLEN;i++){
|
|
|
MAIN.Audio->AudioSamples[i]+=ss->AudioSamples[i];
|
|
|
}
|
|
@@ -343,9 +343,9 @@ void laaudio_DataCallback(ma_device* pDevice, void* pOutput, const void* pInput,
|
|
|
out[i]=MAIN.Audio->AudioSamples[MAIN.Audio->NextAudioSample]/10;
|
|
|
MAIN.Audio->NextAudioSample++;
|
|
|
}
|
|
|
- pthread_spin_lock(&MAIN.Audio->AudioStatusLock);
|
|
|
+ laSpinLock(&MAIN.Audio->AudioStatusLock);
|
|
|
MAIN.Audio->AudioAny=any;
|
|
|
- pthread_spin_unlock(&MAIN.Audio->AudioStatusLock);
|
|
|
+ laSpinUnlock(&MAIN.Audio->AudioStatusLock);
|
|
|
}
|
|
|
|
|
|
void laInitMiniAudio(){
|
|
@@ -381,11 +381,11 @@ void laInitMiniAudio(){
|
|
|
MAIN.Audio->NextAudioSample=LA_SYNTH_PLEN;
|
|
|
MAIN.Audio->AudioFrameInterval=1.0f/SampleRate;
|
|
|
INITPACKET(MAIN.Audio->AudioSamples);
|
|
|
- pthread_spin_init(&MAIN.Audio->AudioStatusLock,0);
|
|
|
+ laSpinInit(&MAIN.Audio->AudioStatusLock);
|
|
|
|
|
|
}
|
|
|
void laDeinitAudio(){
|
|
|
- pthread_spin_destroy(&MAIN.Audio->AudioStatusLock);
|
|
|
+ laSpinDestroy(&MAIN.Audio->AudioStatusLock);
|
|
|
ma_device_stop(&MAIN.Audio->AudioDevice);
|
|
|
ma_device_uninit(&MAIN.Audio->AudioDevice);
|
|
|
}
|
|
@@ -399,7 +399,7 @@ laSynth* laNewSynth(char* Name){
|
|
|
strSafeSet(&ss->Name,Name);
|
|
|
lstAppendItem(&MAIN.Audio->Synths,ss);
|
|
|
memAssignRef(MAIN.Audio,&MAIN.Audio->CurrentSynth,ss);
|
|
|
- pthread_spin_init(&ss->Lock,0);
|
|
|
+ laSpinInit(&ss->Lock);
|
|
|
return ss;
|
|
|
}
|
|
|
void laRemoveSynth(laSynth* ss){ if(!ss) return;
|
|
@@ -410,7 +410,7 @@ void laRemoveSynth(laSynth* ss){ if(!ss) return;
|
|
|
}laNotifyInstanceUsers(ss);
|
|
|
while(ss->Page->Racks.pFirst){ laDestroyRack(ss->Page->Racks.pFirst); } memLeave(ss->Page); ss->Page=0;
|
|
|
lstRemoveItem(&MAIN.Audio->Synths,ss);
|
|
|
- pthread_spin_destroy(&ss->Lock);
|
|
|
+ laSpinDestroy(&ss->Lock);
|
|
|
memLeave(ss);
|
|
|
}
|
|
|
|
|
@@ -445,7 +445,7 @@ int OPINV_laSynthPlay(laOperator* a, laEvent* e){
|
|
|
int play=0; if(str && strSame(str,"PLAY")) play=1;
|
|
|
if(play){ MAIN.Audio->AudioAny=1; }
|
|
|
|
|
|
- pthread_spin_lock(&ss->Lock); ss->Playing=play; pthread_spin_unlock(&ss->Lock);
|
|
|
+ laSpinLock(&ss->Lock); ss->Playing=play; laSpinUnlock(&ss->Lock);
|
|
|
|
|
|
ma_device_start(&MAIN.Audio->AudioDevice); laNotifyInstanceUsers(ss);
|
|
|
return LA_FINISHED;
|
|
@@ -502,11 +502,11 @@ void* laget_FirstSynth(void* unused1,void* unused2){
|
|
|
return MAIN.Audio->Synths.pFirst;
|
|
|
}
|
|
|
void lapost_Synth(laSynth* ss){
|
|
|
- pthread_spin_init(&ss->Lock,0);
|
|
|
+ laSpinInit(&ss->Lock);
|
|
|
}
|
|
|
int laget_SynthPlaying(laSynth* ss){
|
|
|
int play=0;
|
|
|
- pthread_spin_lock(&ss->Lock); play=ss->Playing; pthread_spin_unlock(&ss->Lock);
|
|
|
+ laSpinLock(&ss->Lock); play=ss->Playing; laSpinUnlock(&ss->Lock);
|
|
|
return play;
|
|
|
}
|
|
|
void laset_CurrentSynth(laAudio* a,laSynth* s){
|
|
@@ -517,9 +517,9 @@ void la_AudioPreFrame(){
|
|
|
if(MAIN.GraphNeedsRebuild){ laRebuildSynthGraphs(); }
|
|
|
|
|
|
int anyaudio=0;
|
|
|
- pthread_spin_lock(&MAIN.Audio->AudioStatusLock);
|
|
|
+ laSpinLock(&MAIN.Audio->AudioStatusLock);
|
|
|
anyaudio=MAIN.Audio->AudioAny;
|
|
|
- pthread_spin_unlock(&MAIN.Audio->AudioStatusLock);
|
|
|
+ laSpinUnlock(&MAIN.Audio->AudioStatusLock);
|
|
|
if(!anyaudio){ ma_device_stop(&MAIN.Audio->AudioDevice); }
|
|
|
}
|
|
|
|