template<int SizeAtCompileType> void mixingtypes(int size = SizeAtCompileType) { typedef Matrix<float, SizeAtCompileType, SizeAtCompileType> Mat_f; typedef Matrix<double, SizeAtCompileType, SizeAtCompileType> Mat_d; typedef Matrix<std::complex<float>, SizeAtCompileType, SizeAtCompileType> Mat_cf; typedef Matrix<std::complex<double>, SizeAtCompileType, SizeAtCompileType> Mat_cd; typedef Matrix<float, SizeAtCompileType, 1> Vec_f; typedef Matrix<double, SizeAtCompileType, 1> Vec_d; typedef Matrix<std::complex<float>, SizeAtCompileType, 1> Vec_cf; typedef Matrix<std::complex<double>, SizeAtCompileType, 1> Vec_cd; Mat_f mf(size,size); Mat_d md(size,size); Mat_cf mcf(size,size); Mat_cd mcd(size,size); Vec_f vf(size,1); Vec_d vd(size,1); Vec_cf vcf(size,1); Vec_cd vcd(size,1); mf+mf; VERIFY_RAISES_ASSERT(mf+md); VERIFY_RAISES_ASSERT(mf+mcf); VERIFY_RAISES_ASSERT(vf=vd); VERIFY_RAISES_ASSERT(vf+=vd); VERIFY_RAISES_ASSERT(mcd=md); mf*mf; md*mcd; mcd*md; mf*vcf; mcf*vf; mcf *= mf; vcd = md*vcd; vcf = mcf*vf; #if 0 // these are know generating hard build errors in eigen3 VERIFY_RAISES_ASSERT(mf*md); VERIFY_RAISES_ASSERT(mcf*mcd); VERIFY_RAISES_ASSERT(mcf*vcd); VERIFY_RAISES_ASSERT(vcf = mf*vf); vf.eigen2_dot(vf); VERIFY_RAISES_ASSERT(vd.eigen2_dot(vf)); VERIFY_RAISES_ASSERT(vcf.eigen2_dot(vf)); // yeah eventually we should allow this but i'm too lazy to make that change now in Dot.h // especially as that might be rewritten as cwise product .sum() which would make that automatic. #endif }
Skeleton_basic::Neighbours::Neighbours( const clipper::Xmap_base &map, const float min_distsq, const float max_distsq ) { /* note that thisd2 is a mesure of distance in real space So here we look around an arbitary current point and take note if the distance between the centre point and points one unit away from it (all directions) is less than a certain cuttoff distance. We are left with a list of ndn neighbouring cells that are sufficicently close to be considered neighbours. Typically, ndn will be 18-20 at then end of this block. Note that body diagonals have length sqrt(3) ~= 1.73, but we passed squared limits. */ clipper::Cell_descr rcd( map.cell().descr() ); clipper::Cell_descr vcd( 1.0,1.0,1.0, rcd.alpha(), rcd.beta(), rcd.gamma() ); clipper::Cell vcell( vcd ); clipper::Coord_grid g0(-1,-1,-1); clipper::Coord_grid g1( 1, 1, 1); clipper::Grid_sampling vgrid( 1, 1, 1 ); clipper::Coord_grid iu, iv, iw; float thisd2; for ( iu = g0; iu.u() <= g1.u(); iu.u()++ ) { for ( iv = iu; iv.v() <= g1.v(); iv.v()++ ) { for ( iw = iv; iw.w() <= g1.w(); iw.w()++ ) { thisd2 = iw.coord_frac( vgrid ).lengthsq( vcell ); if (thisd2 > min_distsq && thisd2 < max_distsq) nlist.push_back( iw ); } } } }
void UpdateDebugDialog() { if(!debugDialogOpen) return; lCount++; if(lCount>=(SampleRate/100)) // Increase to SampleRate/200 for smooth display. { HDC hdc = GetDC(hDebugDialog); if(!hf) { hf = CreateFont( 12, 0, 0, 0, 0, FALSE, FALSE, FALSE, ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_SWISS, L"Lucida Console" ); } SelectObject(hdc,hf); SelectObject(hdc,GetStockObject(DC_BRUSH)); SelectObject(hdc,GetStockObject(DC_PEN)); for(int c=0;c<2;c++) { V_Core& cx(Cores[c]); V_CoreDebug& cd(DebugCores[c]); for(int v=0;v<24;v++) { int cc = c*2 + (v/12); int vv = v % 12; int IX = 8+128*cc; int IY = 8+ 48*vv; V_Voice& vc(cx.Voices[v]); V_VoiceDebug& vcd(cd.Voices[v] ); SetDCBrushColor(hdc,RGB( 0, 0, 0)); if((vc.ADSR.Phase>0)&&(vc.ADSR.Phase<6)) { SetDCBrushColor(hdc,RGB( 0, 0,128)); } /* else { if(vcd.lastStopReason==1) { SetDCBrushColor(hdc,RGB(128, 0, 0)); } if(vcd.lastStopReason==2) { SetDCBrushColor(hdc,RGB( 0,128, 0)); } }*/ FillRectangle(hdc,IX,IY,124,46); SetDCPenColor(hdc,RGB( 255, 128, 32)); DrawRectangle(hdc,IX,IY,124,46); SetDCBrushColor(hdc,RGB( 0,255, 0)); int vl = abs(((vc.Volume.Left.Value >> 16) * 38) >> 15); int vr = abs(((vc.Volume.Right.Value >> 16) * 38) >> 15); FillRectangle(hdc,IX+58,IY+42 - vl, 4, vl); FillRectangle(hdc,IX+62,IY+42 - vr, 4, vr); int adsr = ((vc.ADSR.Value>>16) * 38) / 32768; FillRectangle(hdc,IX+66,IY+42 - adsr, 4, adsr); int peak = (vcd.displayPeak * 38) / 32768; if(vcd.displayPeak >= 32700) // leave a little bit of margin { SetDCBrushColor(hdc,RGB( 255, 0, 0)); } FillRectangle(hdc,IX+70,IY+42 - peak, 4, peak); if(vc.ADSR.Value>0) { if(vc.SBuffer) for(int i=0;i<28;i++) { int val = ((int)vc.SBuffer[i] * 20) / 32768; int y=0; if(val>0) { y=val; } else val=-val; if(val!=0) { FillRectangle(hdc,IX+90+i,IY+24-y, 1, val); } } } SetTextColor(hdc,RGB( 0,255, 0)); SetBkColor (hdc,RGB( 0, 0, 0)); static wchar_t t[256]; swprintf_s(t,L"%06x",vc.StartA); TextOut(hdc,IX+4,IY+4,t,6); swprintf_s(t,L"%06x",vc.NextA); TextOut(hdc,IX+4,IY+18,t,6); swprintf_s(t,L"%06x",vc.LoopStartA); TextOut(hdc,IX+4,IY+32,t,6); vcd.displayPeak = 0; if(vcd.lastSetStartA != vc.StartA) { printf(" *** Warning! Core %d Voice %d: StartA should be %06x, and is %06x.\n", c,v,vcd.lastSetStartA,vc.StartA); vcd.lastSetStartA = vc.StartA; } } // top now: 400 int JX = 8 + c * 256; int JY = 584; SetDCBrushColor(hdc,RGB( 0, 0, 0)); SetDCPenColor(hdc,RGB( 255, 128, 32)); FillRectangle(hdc,JX,JY,252,60); DrawRectangle(hdc,JX,JY,252,60); SetTextColor(hdc,RGB(255,255,255)); SetBkColor (hdc,RGB( 0, 0, 0)); static wchar_t t[256]; TextOut(hdc,JX+4,JY+ 4,L"REVB",4); TextOut(hdc,JX+4,JY+18,L"IRQE",4); TextOut(hdc,JX+4,JY+32,L"ADMA",4); swprintf_s(t,L"DMA%s",c==0 ? L"4" : L"7"); TextOut(hdc,JX+4,JY+46,t, 4); SetTextColor(hdc,RGB( 0,255, 0)); memset(t, 0, sizeof(t)); swprintf_s(t,L"ESA %x",cx.EffectsStartA); TextOut(hdc,JX+56,JY+ 4,t, 9); memset(t, 0, sizeof(t)); swprintf_s(t,L"EEA %x",cx.EffectsEndA); TextOut(hdc,JX+128,JY+ 4,t, 9); memset(t, 0, sizeof(t)); swprintf_s(t,L"(%x)",cx.EffectsBufferSize); TextOut(hdc,JX+200,JY+ 4,t,7); memset(t, 0, sizeof(t)); swprintf_s(t,L"IRQA %x",cx.IRQA); TextOut(hdc,JX+56,JY+18,t, 12); SetTextColor(hdc,RGB(255,255,255)); SetDCBrushColor(hdc,RGB( 255,0, 0)); if(cx.FxEnable) { FillRectangle(hdc,JX+40,JY+4,10,10); } if(cx.IRQEnable) { FillRectangle(hdc,JX+40,JY+18,10,10); } if(cx.AutoDMACtrl != 0) { FillRectangle(hdc,JX+40,JY+32,10,10); for(int j=0;j<64;j++) { int i=j*256/64; int val = (cd.admaWaveformL[i] * 26) / 32768; int y=0; if(val>0) y=val; else val=-val; if(val!=0) { FillRectangle(hdc,JX+60+j,JY+30-y, 1, val); } } for(int j=0;j<64;j++) { int i=j*256/64; int val = (cd.admaWaveformR[i] * 26) / 32768; int y=0; if(val>0) y=val; else val=-val; if(val!=0) { FillRectangle(hdc,JX+136+j,JY+30-y, 1, val); } } } if(cd.dmaFlag > 0) // So it shows x times this is called, since dmas are so fast { swprintf_s(t,L"size = %d",cd.lastsize); TextOut(hdc,JX+64,JY+46,t,wcslen(t)); FillRectangle(hdc,JX+40,JY+46,10,10); cd.dmaFlag--; } } ReleaseDC(hDebugDialog,hdc); lCount=0; }
void EffectPanelUtils::OnVCButtonClick(wxCommandEvent& event) { ValueCurveButton * vc = (ValueCurveButton*)event.GetEventObject(); wxString name = vc->GetName(); name.Replace("IDD_VALUECURVE_", "ID_SLIDER_"); name.Replace("ID_VALUECURVE_", "ID_SLIDER_"); wxSlider *slider = (wxSlider*)vc->GetParent()->FindWindowByName(name); if (slider == NULL || (void*)slider == (void*)vc) { name = vc->GetName(); name.Replace("IDD_VALUECURVE_", "IDD_SLIDER_"); name.Replace("ID_VALUECURVE_", "IDD_SLIDER_"); slider = (wxSlider*)vc->GetParent()->FindWindowByName(name); } name = vc->GetName(); name.Replace("IDD_VALUECURVE_", "ID_TEXTCTRL_"); name.Replace("ID_VALUECURVE_", "ID_TEXTCTRL_"); wxTextCtrl *txt = (wxTextCtrl*)vc->GetParent()->FindWindowByName(name); if (txt == NULL || (void*)txt == (void*)vc) { name = vc->GetName(); name.Replace("IDD_VALUECURVE_", "IDD_TEXTCTRL_"); name.Replace("ID_VALUECURVE_", "IDD_TEXTCTRL_"); txt = (wxTextCtrl*)vc->GetParent()->FindWindowByName(name); } vc->ToggleActive(); if (vc->GetValue()->IsActive()) { ValueCurveDialog vcd(vc->GetParent(), vc->GetValue()); if (vcd.ShowModal() == wxOK) { if (slider != NULL) { slider->Disable(); } if (txt != NULL) { txt->Disable(); } } else { if (slider != NULL) { slider->Enable(); } if (txt != NULL) { txt->Enable(); } vc->SetActive(false); } vc->UpdateState(); } else { if (slider != NULL) { slider->Enable(); } if (txt != NULL) { txt->Enable(); } } }
void UpdateDebugDialog() { if(!debugDialogOpen) return; lCount++; if(lCount>=(SampleRate/10)) { HDC hdc = GetDC(hDebugDialog); if(!hf) { hf = CreateFont( 8, 0, 0, 0, 0, FALSE, FALSE, FALSE, ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_SWISS, _T("Lucida Console") ); } SelectObject(hdc,hf); SelectObject(hdc,GetStockObject(DC_BRUSH)); SelectObject(hdc,GetStockObject(DC_PEN)); for(int c=0;c<2;c++) { for(int v=0;v<24;v++) { int IX = 8+256*c; int IY = 8+ 32*v; V_Voice& vc(Cores[c].Voices[v]); V_VoiceDebug& vcd( DebugCores[c].Voices[v] ); SetDCBrushColor(hdc,RGB( 0, 0, 0)); if((vc.ADSR.Phase>0)&&(vc.ADSR.Phase<6)) { SetDCBrushColor(hdc,RGB( 0, 0,128)); } else { if(vcd.lastStopReason==1) { SetDCBrushColor(hdc,RGB(128, 0, 0)); } if(vcd.lastStopReason==2) { SetDCBrushColor(hdc,RGB( 0,128, 0)); } } FillRectangle(hdc,IX,IY,252,30); SetDCPenColor(hdc,RGB( 255, 128, 32)); DrawRectangle(hdc,IX,IY,252,30); SetDCBrushColor (hdc,RGB( 0,255, 0)); int vl = abs(((vc.Volume.Left.Value >> 16) * 24) >> 15); int vr = abs(((vc.Volume.Right.Value >> 16) * 24) >> 15); FillRectangle(hdc,IX+38,IY+26 - vl, 4, vl); FillRectangle(hdc,IX+42,IY+26 - vr, 4, vr); int adsr = (vc.ADSR.Value>>16) * 24 / 32768; FillRectangle(hdc,IX+48,IY+26 - adsr, 4, adsr); int peak = vcd.displayPeak * 24 / 32768; FillRectangle(hdc,IX+56,IY+26 - peak, 4, peak); SetTextColor(hdc,RGB( 0,255, 0)); SetBkColor (hdc,RGB( 0, 0, 0)); static wchar_t t[1024]; swprintf_s(t,_T("%06x"),vc.StartA); TextOut(hdc,IX+4,IY+3,t,6); swprintf_s(t,_T("%06x"),vc.NextA); TextOut(hdc,IX+4,IY+12,t,6); swprintf_s(t,_T("%06x"),vc.LoopStartA); TextOut(hdc,IX+4,IY+21,t,6); vcd.displayPeak = 0; if(vcd.lastSetStartA != vc.StartA) { printf(" *** Warning! Core %d Voice %d: StartA should be %06x, and is %06x.\n", c,v,vcd.lastSetStartA,vc.StartA); vcd.lastSetStartA = vc.StartA; } } } ReleaseDC(hDebugDialog,hdc); lCount=0; }