diff options
Diffstat (limited to 'win32/plugins/dfsound/winsrc')
| -rwxr-xr-x[-rw-r--r--] | win32/plugins/dfsound/winsrc/cfg.c | 22 | ||||
| -rwxr-xr-x[-rw-r--r--] | win32/plugins/dfsound/winsrc/debug.c | 742 | ||||
| -rwxr-xr-x[-rw-r--r--] | win32/plugins/dfsound/winsrc/debug.h | 58 | ||||
| -rwxr-xr-x[-rw-r--r--] | win32/plugins/dfsound/winsrc/dsound.c | 554 | ||||
| -rwxr-xr-x[-rw-r--r--] | win32/plugins/dfsound/winsrc/dsound.h | 0 | ||||
| -rwxr-xr-x[-rw-r--r--] | win32/plugins/dfsound/winsrc/psemu.c | 202 | ||||
| -rwxr-xr-x[-rw-r--r--] | win32/plugins/dfsound/winsrc/record.c | 376 | ||||
| -rwxr-xr-x[-rw-r--r--] | win32/plugins/dfsound/winsrc/record.h | 20 | ||||
| -rwxr-xr-x[-rw-r--r--] | win32/plugins/dfsound/winsrc/winmain.c | 68 |
9 files changed, 1021 insertions, 1021 deletions
diff --git a/win32/plugins/dfsound/winsrc/cfg.c b/win32/plugins/dfsound/winsrc/cfg.c index dc497989..f5f9cff5 100644..100755 --- a/win32/plugins/dfsound/winsrc/cfg.c +++ b/win32/plugins/dfsound/winsrc/cfg.c @@ -64,8 +64,8 @@ void ReadConfig(void) iRecordMode=0; iUseReverb=2; iUseInterpolation=2; - iDisStereo=0;
- iFreqResponse=0;
+ iDisStereo=0; + iFreqResponse=0; if (RegOpenKeyEx(HKEY_CURRENT_USER,"Software\\Vision Thing\\PSEmu Pro\\SPU\\DFSound",0,KEY_ALL_ACCESS,&myKey)==ERROR_SUCCESS) { @@ -82,8 +82,8 @@ void ReadConfig(void) if(RegQueryValueEx(myKey,"SPUIRQWait",0,&type,(LPBYTE)&temp,&size)==ERROR_SUCCESS) iSPUIRQWait=(int)temp; size = 4; - if(RegQueryValueEx(myKey,"FreqResponse",0,&type,(LPBYTE)&temp,&size)==ERROR_SUCCESS)
- iFreqResponse=(int)temp;
+ if(RegQueryValueEx(myKey,"FreqResponse",0,&type,(LPBYTE)&temp,&size)==ERROR_SUCCESS) + iFreqResponse=(int)temp; size = 4; if(RegQueryValueEx(myKey,"DebugMode",0,&type,(LPBYTE)&temp,&size)==ERROR_SUCCESS) iDebugMode=(int)temp; @@ -127,8 +127,8 @@ void WriteConfig(void) RegSetValueEx(myKey,"UseTimer",0,REG_DWORD,(LPBYTE) &temp,sizeof(temp)); temp=iSPUIRQWait; RegSetValueEx(myKey,"SPUIRQWait",0,REG_DWORD,(LPBYTE) &temp,sizeof(temp)); - temp=iFreqResponse;
- RegSetValueEx(myKey,"FreqResponse",0,REG_DWORD,(LPBYTE) &temp,sizeof(temp));
+ temp=iFreqResponse; + RegSetValueEx(myKey,"FreqResponse",0,REG_DWORD,(LPBYTE) &temp,sizeof(temp)); temp=iDebugMode; RegSetValueEx(myKey,"DebugMode",0,REG_DWORD,(LPBYTE) &temp,sizeof(temp)); temp=iRecordMode; @@ -139,7 +139,7 @@ void WriteConfig(void) RegSetValueEx(myKey,"UseInterpolation",0,REG_DWORD,(LPBYTE) &temp,sizeof(temp)); temp=iDisStereo; RegSetValueEx(myKey,"DisStereo",0,REG_DWORD,(LPBYTE) &temp,sizeof(temp)); -
+ RegCloseKey(myKey); } @@ -225,10 +225,10 @@ void OnDSoundOK(HWND hW) if(IsDlgButtonChecked(hW,IDC_DISSTEREO)) iDisStereo=1; else iDisStereo=0; -
- if(IsDlgButtonChecked(hW,IDC_FREQRESPONSE))
- iFreqResponse=1; else iFreqResponse=0;
-
+ + if(IsDlgButtonChecked(hW,IDC_FREQRESPONSE)) + iFreqResponse=1; else iFreqResponse=0; + WriteConfig(); // write registry EndDialog(hW,TRUE); diff --git a/win32/plugins/dfsound/winsrc/debug.c b/win32/plugins/dfsound/winsrc/debug.c index 223be4ce..26c15c14 100644..100755 --- a/win32/plugins/dfsound/winsrc/debug.c +++ b/win32/plugins/dfsound/winsrc/debug.c @@ -1,372 +1,372 @@ -/***************************************************************************
- debug.c - description
- -------------------
- begin : Wed May 15 2002
- copyright : (C) 2002 by Pete Bernert
- email : BlackDove@addcom.de
- ***************************************************************************/
-
-/***************************************************************************
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. See also the license.txt file for *
- * additional informations. *
- * *
- ***************************************************************************/
-
-//*************************************************************************//
-// History of changes:
-//
-// 2004/09/18 - Pete
-// - corrected ADSRX value display
-//
-// 2003/01/06 - Pete
-// - added Neil's ADSR timings
-//
-// 2002/05/15 - Pete
-// - generic cleanup for the Peops release
-//
-//*************************************************************************//
-
-#include "stdafx.h"
-
-#define _IN_DEBUG
-
-#include "externals.h"
-
-////////////////////////////////////////////////////////////////////////
-// WINDOWS DEBUG DIALOG HANDLING
-////////////////////////////////////////////////////////////////////////
-
-#ifdef _WINDOWS
-
-#include "resource.h"
-
-//#define SMALLDEBUG
-//#include <dbgout.h>
-
-////////////////////////////////////////////////////////////////////////
-// display debug infos
-
-const COLORREF crStreamCol[]={
- RGB( 0, 0, 0),
- RGB(255,255,255),
- RGB(128, 0,128),
- RGB( 0,128, 0),
- RGB( 0, 0,255),
- RGB(255, 0, 0)
- };
-
-const COLORREF crAdsrCol[] ={
- RGB( 0, 0, 0),
- RGB(255, 0, 0),
- RGB( 0,255, 0),
- RGB(255, 0,255),
- RGB( 0, 0,255),
- RGB( 0, 0, 0),
- };
-
-HBRUSH hBStream[6]; // brushes for stream lines
-HPEN hPAdsr[6]; // pens for adsr lines
-int iSelChannel=0; // user selected channel
-
-////////////////////////////////////////////////////////////////////////
-// display the sound data waves: no subclassing used, so the
-// area will not be redrawn... but faster that way, and good enuff
-// for debugging purposes
-
-void DisplayStreamInfos(HWND hW)
-{
- HWND hWS=GetDlgItem(hW,IDC_SAREA);
- HDC hdc;RECT r;HBRUSH hBO;int ch,dy,i,j,id;
-
- //----------------------------------------------------//
-
- GetClientRect(hWS,&r); // get size of stream display
- hdc=GetDC(hWS); // device context
- r.right--; // leave the right border intact
- ScrollDC(hdc,-1,0,&r,&r,NULL,NULL); // scroll one pixel to the left
-
- //----------------------------------------------------//
-
- hBO=SelectObject(hdc,hBStream[0]); // clean the right border
- PatBlt(hdc,r.right-1,0,1,r.bottom,PATCOPY);
-
- //----------------------------------------------------//
-
- dy=r.bottom/MAXCHAN; // size of one channel area
-
- for(ch=0;ch<MAXCHAN;ch++) // loop the channels
- {
- if(s_chan[ch].bOn) // channel is on?
- {
- if(s_chan[ch].iIrqDone)
- {
- s_chan[ch].iIrqDone=0;
- PatBlt(hdc,r.right-1,ch*r.bottom/MAXCHAN,
- 1,dy,BLACKNESS);
- continue;
- }
-
- j=s_chan[ch].sval;if(j<0) j=-j; // -> get one channel data (-32k ... 32k)
- j=(dy*j)/32768; if(j==0) j=1; // -> adjust to display coords
- i=(dy/2)+(ch*r.bottom/MAXCHAN)-j/2; // -> position where to paint it
-
-
-
- if (s_chan[ch].iMute) id=1; // -> get color id
- else if(s_chan[ch].bNoise) id=2;
- else if(s_chan[ch].bFMod==2) id=3;
- else if(s_chan[ch].bFMod==1) id=4;
- else id=5;
-
- SelectObject(hdc,hBStream[id]); // -> select the brush
- PatBlt(hdc,r.right-1,i,1,j,PATCOPY); // -> paint the value line
- }
-
- if(ch) SetPixel(hdc,r.right-1, // -> not first line?
- ch*r.bottom/MAXCHAN,RGB(0,0,0)); // --> draw the line (one dot scrolled to the left)
- }
-
- //----------------------------------------------------//
-
- SelectObject(hdc,hBO); // repair brush
-
- ReleaseDC(hWS,hdc); // release context
-}
-
-////////////////////////////////////////////////////////////////////////
-// display adsr lines: also no subclassing for repainting used
-
-void DisplayADSRInfos(HWND hW)
-{
- HWND hWS=GetDlgItem(hW,IDC_ADSR);
- HDC hdc;RECT r;HBRUSH hBO;char szB[16];
- int ch=iSelChannel,dx,dy,dm,dn,ia,id,is,ir;
-
- //----------------------------------------------------// get display size
-
- GetClientRect(hWS,&r);
- hdc=GetDC(hWS);
-
- //----------------------------------------------------// clean the area
-
- hBO=SelectObject(hdc,hBStream[0]);
- PatBlt(hdc,0,0,r.right,r.bottom,PATCOPY);
- r.left++;r.right-=2;r.top++;r.bottom-=2; // shrink the display rect for better optics
-
- //----------------------------------------------------//
-
- ia=min(s_chan[ch].ADSR.AttackTime,10000); // get adsr, but limit it for drawing
- id=min(s_chan[ch].ADSR.DecayTime,10000);
- is=min(s_chan[ch].ADSR.SustainTime,10000);
- ir=min(s_chan[ch].ADSR.ReleaseTime,10000);
-
- dx=ia+id+is+ir; // get the dx in (limited) adsr units
-
- // set the real values to the info statics
- SetDlgItemInt(hW,IDC_SADSR1,s_chan[ch].ADSRX.AttackRate^0x7f,FALSE);
- SetDlgItemInt(hW,IDC_SADSR2,(s_chan[ch].ADSRX.DecayRate^0x1f)/4,FALSE);
- SetDlgItemInt(hW,IDC_SADSR3,s_chan[ch].ADSRX.SustainRate^0x7f,FALSE);
- SetDlgItemInt(hW,IDC_SADSR4,(s_chan[ch].ADSRX.ReleaseRate^0x1f)/4,FALSE);
- SetDlgItemInt(hW,IDC_SADSR5,s_chan[ch].ADSRX.SustainLevel>>27,FALSE);
-
- SetDlgItemInt(hW,IDC_SADSR6,s_chan[ch].ADSRX.SustainIncrease,TRUE);
- SetDlgItemInt(hW,IDC_SADSR7,s_chan[ch].ADSRX.lVolume,TRUE);
- wsprintf(szB,"%08lx",s_chan[ch].ADSRX.EnvelopeVol);
- SetDlgItemText(hW,IDC_SADSR8,szB);
-
- if(dx) // something to draw?
- {
- HPEN hPO=SelectObject(hdc,hPAdsr[1]); // sel A pen
- dn=r.left;
- MoveToEx(hdc,dn,r.bottom,NULL); // move to bottom left corner
-
- dn+=(ia*r.right)/dx; // calc A x line pos
- LineTo(hdc,dn,r.top); // line to AxPos,top
-
- SelectObject(hdc,hPAdsr[2]); // sel D pen
- dn+=(id*r.right)/dx; // calc D x line pos
- dy=r.top+((1024-s_chan[ch].ADSR.SustainLevel)* // calc the D y pos
- r.bottom)/1024; // (our S level is ranged from 0 to 1024)
- LineTo(hdc,dn,dy); // line to DxPos,SLevel
-
- SelectObject(hdc,hPAdsr[3]); // sel S pen
- if(s_chan[ch].ADSR.SustainTime>10000) dm=1; // we have to fake the S values... S will
- else // inc/decrease until channel stop...
- if(s_chan[ch].ADSR.SustainTime==0) dm=0; // we dunno here when this will happen,
- else dm=21-(((s_chan[ch].ADSR.SustainTime/500))); // so we do some more ore less angled line,
- dy=dy-(s_chan[ch].ADSR.SustainModeDec*dm); // roughly depending on the S Time
- if(dy>r.bottom) dy=r.bottom;
- if(dy<r.top) dy=r.top;
- dn+=(is*r.right)/dx;
- LineTo(hdc,dn,dy); // line to SxPos, fake end volume level
-
- SelectObject(hdc,hPAdsr[4]); // sel R pen
- dn+=(ir*r.right)/dx; // calc R x line pos
- LineTo(hdc,dn,r.bottom); // line to RxPos, bottom right y
-
- SelectObject(hdc,hPO); // repair pen
- }
-
- SelectObject(hdc,hBO); // repair brush
- ReleaseDC(hWS,hdc); // release context
-}
-
-////////////////////////////////////////////////////////////////////////
-
-void DisplayChannelInfos(HWND hW)
-{
- int ch=iSelChannel;char szB[16];
-
- // channel infos
- SetDlgItemInt(hW,IDC_CI1,s_chan[ch].bOn,TRUE);
- SetDlgItemInt(hW,IDC_CI2,s_chan[ch].bStop,TRUE);
- SetDlgItemInt(hW,IDC_CI3,s_chan[ch].bNoise,TRUE);
- SetDlgItemInt(hW,IDC_CI4,s_chan[ch].bFMod,TRUE);
- SetDlgItemInt(hW,IDC_CI5,s_chan[ch].bReverb,TRUE);
- SetDlgItemInt(hW,IDC_CI6,s_chan[ch].bRVBActive,TRUE);
- SetDlgItemInt(hW,IDC_CI7,s_chan[ch].iRVBNum,TRUE);
- SetDlgItemInt(hW,IDC_CI8,s_chan[ch].iRVBOffset,TRUE);
- SetDlgItemInt(hW,IDC_CI9,s_chan[ch].iRVBRepeat,TRUE);
- SetDlgItemInt(hW,IDC_CI10,(unsigned long)s_chan[ch].pStart-(unsigned long)spuMemC,FALSE);
- SetDlgItemInt(hW,IDC_CI11,(unsigned long)s_chan[ch].pCurr-(unsigned long)spuMemC,FALSE);
- SetDlgItemInt(hW,IDC_CI12,(unsigned long)s_chan[ch].pLoop-(unsigned long)spuMemC,FALSE);
- SetDlgItemInt(hW,IDC_CI13,s_chan[ch].iRightVolume,TRUE);
- SetDlgItemInt(hW,IDC_CI14,s_chan[ch].iLeftVolume,TRUE);
- SetDlgItemInt(hW,IDC_CI15,s_chan[ch].iActFreq,TRUE);
- SetDlgItemInt(hW,IDC_CI16,s_chan[ch].iUsedFreq,TRUE);
-
- wsprintf(szB,"%04x",s_chan[ch].iRightVolRaw);
- SetDlgItemText(hW,IDC_CI17,szB);
- wsprintf(szB,"%04x",s_chan[ch].iLeftVolRaw);
- SetDlgItemText(hW,IDC_CI18,szB);
-
- // generic infos
- if(pSpuIrq==0)
- SetDlgItemInt(hW,IDC_STA1,-1,TRUE);
- else SetDlgItemInt(hW,IDC_STA1,(unsigned long)pSpuIrq-(unsigned long)spuMemC,FALSE);
- wsprintf(szB,"%04x",spuCtrl);
- SetDlgItemText(hW,IDC_STA2,szB);
- wsprintf(szB,"%04x",spuStat);
- SetDlgItemText(hW,IDC_STA3,szB);
- SetDlgItemInt(hW,IDC_STA4,spuAddr,TRUE);
-
- // xa infos
- if(XAPlay<=XAFeed) ch=XAFeed-XAPlay;
- else ch=(XAFeed-XAStart)+(XAEnd-XAPlay);
- SetDlgItemInt(hW,IDC_XA4,ch,FALSE);
- SetDlgItemInt(hW,IDC_XA5,iLeftXAVol,TRUE);
- SetDlgItemInt(hW,IDC_XA6,iRightXAVol,TRUE);
- if(!xapGlobal) return;
- SetDlgItemInt(hW,IDC_XA1,xapGlobal->freq,TRUE);
- SetDlgItemInt(hW,IDC_XA2,xapGlobal->stereo,TRUE);
- SetDlgItemInt(hW,IDC_XA3,xapGlobal->nsamples,TRUE);
-}
-
-////////////////////////////////////////////////////////////////////////
-// display everything (called in dialog timer for value refreshing)
-
-void DisplayDebugInfos(HWND hW)
-{
- DisplayStreamInfos(hW);
- DisplayADSRInfos(hW);
- DisplayChannelInfos(hW);
-}
-
-////////////////////////////////////////////////////////////////////////
-// main debug dlg handler
-
-BOOL CALLBACK DebugDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam)
-{
- switch(uMsg)
- {
- //--------------------------------------------------// init
- case WM_INITDIALOG:
- {
- int i;
- ShowCursor(TRUE); // mmm... who is hiding it? main emu? tsts
- iSelChannel=0; // sel first channel
- CheckRadioButton(hW,IDC_CHAN1,IDC_CHAN24,IDC_CHAN1);
- // create brushes/pens
- hBStream[0]=CreateSolidBrush(GetSysColor(COLOR_3DFACE));
- hPAdsr[0]=CreatePen(PS_SOLID,0,GetSysColor(COLOR_3DFACE));
- for(i=1;i<6;i++)
- {
- hBStream[i]=CreateSolidBrush(crStreamCol[i]);
- hPAdsr[i]=CreatePen(PS_SOLID,0,crAdsrCol[i]);
- }
- SetTimer(hW,999,50,NULL); // now create update timer
- return TRUE;
- }
- //--------------------------------------------------// destroy
- case WM_DESTROY:
- {
- int i;
- KillTimer(hW,999); // first kill timer
- for(i=0;i<6;i++) // then kill brushes/pens
- {
- DeleteObject(hBStream[i]);
- DeleteObject(hPAdsr[i]);
- }
- }break;
- //--------------------------------------------------// timer
- case WM_TIMER:
- {
- if(wParam==999) DisplayDebugInfos(hW); // update all values
- }break;
- //--------------------------------------------------// command
- case WM_COMMAND:
- {
- if(wParam==IDCANCEL) iDebugMode=2; // cancel? raise flag for destroying the dialog
-
- if(wParam>=IDC_MUTE1 && wParam<=IDC_MUTE24) // mute clicked?
- {
- if(IsDlgButtonChecked(hW,wParam)) // -> mute/unmute it
- s_chan[wParam-IDC_MUTE1].iMute=1;
- else s_chan[wParam-IDC_MUTE1].iMute=0;
- }
- // all mute/unmute
- if(wParam==IDC_MUTEOFF) SendMessage(hW,WM_MUTE,0,0);
- if(wParam==IDC_MUTEON) SendMessage(hW,WM_MUTE,1,0);
-
- if(wParam>=IDC_CHAN1 && wParam<=IDC_CHAN24) // sel channel
- {
- if(IsDlgButtonChecked(hW,wParam))
- {
- iSelChannel=wParam-IDC_CHAN1;
- SetDlgItemInt(hW,IDC_CHANNUM,iSelChannel+1,FALSE);
- }
- }
- }break;
- //--------------------------------------------------// mute
- case WM_MUTE:
- { // will be called by the mute/unmute all button and on savestate load
- int i;
- for(i=IDC_MUTE1;i<=IDC_MUTE24;i++)
- {
- CheckDlgButton(hW,i,wParam);
- if(wParam) s_chan[i-IDC_MUTE1].iMute=1;
- else s_chan[i-IDC_MUTE1].iMute=0;
- }
- }break;
- //--------------------------------------------------// size
- case WM_SIZE:
- if(wParam==SIZE_MINIMIZED) SetFocus(hWMain); // if we get minimized, set the foxus to the main window
- break;
- //--------------------------------------------------// setcursor
- case WM_SETCURSOR:
- {
- SetCursor(LoadCursor(NULL,IDC_ARROW)); // force the arrow
- return TRUE;
- }
- //--------------------------------------------------//
- }
- return FALSE;
-}
-
-////////////////////////////////////////////////////////////////////////
-
+/*************************************************************************** + debug.c - description + ------------------- + begin : Wed May 15 2002 + copyright : (C) 2002 by Pete Bernert + email : BlackDove@addcom.de + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. See also the license.txt file for * + * additional informations. * + * * + ***************************************************************************/ + +//*************************************************************************// +// History of changes: +// +// 2004/09/18 - Pete +// - corrected ADSRX value display +// +// 2003/01/06 - Pete +// - added Neil's ADSR timings +// +// 2002/05/15 - Pete +// - generic cleanup for the Peops release +// +//*************************************************************************// + +#include "stdafx.h" + +#define _IN_DEBUG + +#include "externals.h" + +//////////////////////////////////////////////////////////////////////// +// WINDOWS DEBUG DIALOG HANDLING +//////////////////////////////////////////////////////////////////////// + +#ifdef _WINDOWS + +#include "resource.h" + +//#define SMALLDEBUG +//#include <dbgout.h> + +//////////////////////////////////////////////////////////////////////// +// display debug infos + +const COLORREF crStreamCol[]={ + RGB( 0, 0, 0), + RGB(255,255,255), + RGB(128, 0,128), + RGB( 0,128, 0), + RGB( 0, 0,255), + RGB(255, 0, 0) + }; + +const COLORREF crAdsrCol[] ={ + RGB( 0, 0, 0), + RGB(255, 0, 0), + RGB( 0,255, 0), + RGB(255, 0,255), + RGB( 0, 0,255), + RGB( 0, 0, 0), + }; + +HBRUSH hBStream[6]; // brushes for stream lines +HPEN hPAdsr[6]; // pens for adsr lines +int iSelChannel=0; // user selected channel + +//////////////////////////////////////////////////////////////////////// +// display the sound data waves: no subclassing used, so the +// area will not be redrawn... but faster that way, and good enuff +// for debugging purposes + +void DisplayStreamInfos(HWND hW) +{ + HWND hWS=GetDlgItem(hW,IDC_SAREA); + HDC hdc;RECT r;HBRUSH hBO;int ch,dy,i,j,id; + + //----------------------------------------------------// + + GetClientRect(hWS,&r); // get size of stream display + hdc=GetDC(hWS); // device context + r.right--; // leave the right border intact + ScrollDC(hdc,-1,0,&r,&r,NULL,NULL); // scroll one pixel to the left + + //----------------------------------------------------// + + hBO=SelectObject(hdc,hBStream[0]); // clean the right border + PatBlt(hdc,r.right-1,0,1,r.bottom,PATCOPY); + + //----------------------------------------------------// + + dy=r.bottom/MAXCHAN; // size of one channel area + + for(ch=0;ch<MAXCHAN;ch++) // loop the channels + { + if(s_chan[ch].bOn) // channel is on? + { + if(s_chan[ch].iIrqDone) + { + s_chan[ch].iIrqDone=0; + PatBlt(hdc,r.right-1,ch*r.bottom/MAXCHAN, + 1,dy,BLACKNESS); + continue; + } + + j=s_chan[ch].sval;if(j<0) j=-j; // -> get one channel data (-32k ... 32k) + j=(dy*j)/32768; if(j==0) j=1; // -> adjust to display coords + i=(dy/2)+(ch*r.bottom/MAXCHAN)-j/2; // -> position where to paint it + + + + if (s_chan[ch].iMute) id=1; // -> get color id + else if(s_chan[ch].bNoise) id=2; + else if(s_chan[ch].bFMod==2) id=3; + else if(s_chan[ch].bFMod==1) id=4; + else id=5; + + SelectObject(hdc,hBStream[id]); // -> select the brush + PatBlt(hdc,r.right-1,i,1,j,PATCOPY); // -> paint the value line + } + + if(ch) SetPixel(hdc,r.right-1, // -> not first line? + ch*r.bottom/MAXCHAN,RGB(0,0,0)); // --> draw the line (one dot scrolled to the left) + } + + //----------------------------------------------------// + + SelectObject(hdc,hBO); // repair brush + + ReleaseDC(hWS,hdc); // release context +} + +//////////////////////////////////////////////////////////////////////// +// display adsr lines: also no subclassing for repainting used + +void DisplayADSRInfos(HWND hW) +{ + HWND hWS=GetDlgItem(hW,IDC_ADSR); + HDC hdc;RECT r;HBRUSH hBO;char szB[16]; + int ch=iSelChannel,dx,dy,dm,dn,ia,id,is,ir; + + //----------------------------------------------------// get display size + + GetClientRect(hWS,&r); + hdc=GetDC(hWS); + + //----------------------------------------------------// clean the area + + hBO=SelectObject(hdc,hBStream[0]); + PatBlt(hdc,0,0,r.right,r.bottom,PATCOPY); + r.left++;r.right-=2;r.top++;r.bottom-=2; // shrink the display rect for better optics + + //----------------------------------------------------// + + ia=min(s_chan[ch].ADSR.AttackTime,10000); // get adsr, but limit it for drawing + id=min(s_chan[ch].ADSR.DecayTime,10000); + is=min(s_chan[ch].ADSR.SustainTime,10000); + ir=min(s_chan[ch].ADSR.ReleaseTime,10000); + + dx=ia+id+is+ir; // get the dx in (limited) adsr units + + // set the real values to the info statics + SetDlgItemInt(hW,IDC_SADSR1,s_chan[ch].ADSRX.AttackRate^0x7f,FALSE); + SetDlgItemInt(hW,IDC_SADSR2,(s_chan[ch].ADSRX.DecayRate^0x1f)/4,FALSE); + SetDlgItemInt(hW,IDC_SADSR3,s_chan[ch].ADSRX.SustainRate^0x7f,FALSE); + SetDlgItemInt(hW,IDC_SADSR4,(s_chan[ch].ADSRX.ReleaseRate^0x1f)/4,FALSE); + SetDlgItemInt(hW,IDC_SADSR5,s_chan[ch].ADSRX.SustainLevel>>27,FALSE); + + SetDlgItemInt(hW,IDC_SADSR6,s_chan[ch].ADSRX.SustainIncrease,TRUE); + SetDlgItemInt(hW,IDC_SADSR7,s_chan[ch].ADSRX.lVolume,TRUE); + wsprintf(szB,"%08lx",s_chan[ch].ADSRX.EnvelopeVol); + SetDlgItemText(hW,IDC_SADSR8,szB); + + if(dx) // something to draw? + { + HPEN hPO=SelectObject(hdc,hPAdsr[1]); // sel A pen + dn=r.left; + MoveToEx(hdc,dn,r.bottom,NULL); // move to bottom left corner + + dn+=(ia*r.right)/dx; // calc A x line pos + LineTo(hdc,dn,r.top); // line to AxPos,top + + SelectObject(hdc,hPAdsr[2]); // sel D pen + dn+=(id*r.right)/dx; // calc D x line pos + dy=r.top+((1024-s_chan[ch].ADSR.SustainLevel)* // calc the D y pos + r.bottom)/1024; // (our S level is ranged from 0 to 1024) + LineTo(hdc,dn,dy); // line to DxPos,SLevel + + SelectObject(hdc,hPAdsr[3]); // sel S pen + if(s_chan[ch].ADSR.SustainTime>10000) dm=1; // we have to fake the S values... S will + else // inc/decrease until channel stop... + if(s_chan[ch].ADSR.SustainTime==0) dm=0; // we dunno here when this will happen, + else dm=21-(((s_chan[ch].ADSR.SustainTime/500))); // so we do some more ore less angled line, + dy=dy-(s_chan[ch].ADSR.SustainModeDec*dm); // roughly depending on the S Time + if(dy>r.bottom) dy=r.bottom; + if(dy<r.top) dy=r.top; + dn+=(is*r.right)/dx; + LineTo(hdc,dn,dy); // line to SxPos, fake end volume level + + SelectObject(hdc,hPAdsr[4]); // sel R pen + dn+=(ir*r.right)/dx; // calc R x line pos + LineTo(hdc,dn,r.bottom); // line to RxPos, bottom right y + + SelectObject(hdc,hPO); // repair pen + } + + SelectObject(hdc,hBO); // repair brush + ReleaseDC(hWS,hdc); // release context +} + +//////////////////////////////////////////////////////////////////////// + +void DisplayChannelInfos(HWND hW) +{ + int ch=iSelChannel;char szB[16]; + + // channel infos + SetDlgItemInt(hW,IDC_CI1,s_chan[ch].bOn,TRUE); + SetDlgItemInt(hW,IDC_CI2,s_chan[ch].bStop,TRUE); + SetDlgItemInt(hW,IDC_CI3,s_chan[ch].bNoise,TRUE); + SetDlgItemInt(hW,IDC_CI4,s_chan[ch].bFMod,TRUE); + SetDlgItemInt(hW,IDC_CI5,s_chan[ch].bReverb,TRUE); + SetDlgItemInt(hW,IDC_CI6,s_chan[ch].bRVBActive,TRUE); + SetDlgItemInt(hW,IDC_CI7,s_chan[ch].iRVBNum,TRUE); + SetDlgItemInt(hW,IDC_CI8,s_chan[ch].iRVBOffset,TRUE); + SetDlgItemInt(hW,IDC_CI9,s_chan[ch].iRVBRepeat,TRUE); + SetDlgItemInt(hW,IDC_CI10,(unsigned long)s_chan[ch].pStart-(unsigned long)spuMemC,FALSE); + SetDlgItemInt(hW,IDC_CI11,(unsigned long)s_chan[ch].pCurr-(unsigned long)spuMemC,FALSE); + SetDlgItemInt(hW,IDC_CI12,(unsigned long)s_chan[ch].pLoop-(unsigned long)spuMemC,FALSE); + SetDlgItemInt(hW,IDC_CI13,s_chan[ch].iRightVolume,TRUE); + SetDlgItemInt(hW,IDC_CI14,s_chan[ch].iLeftVolume,TRUE); + SetDlgItemInt(hW,IDC_CI15,s_chan[ch].iActFreq,TRUE); + SetDlgItemInt(hW,IDC_CI16,s_chan[ch].iUsedFreq,TRUE); + + wsprintf(szB,"%04x",s_chan[ch].iRightVolRaw); + SetDlgItemText(hW,IDC_CI17,szB); + wsprintf(szB,"%04x",s_chan[ch].iLeftVolRaw); + SetDlgItemText(hW,IDC_CI18,szB); + + // generic infos + if(pSpuIrq==0) + SetDlgItemInt(hW,IDC_STA1,-1,TRUE); + else SetDlgItemInt(hW,IDC_STA1,(unsigned long)pSpuIrq-(unsigned long)spuMemC,FALSE); + wsprintf(szB,"%04x",spuCtrl); + SetDlgItemText(hW,IDC_STA2,szB); + wsprintf(szB,"%04x",spuStat); + SetDlgItemText(hW,IDC_STA3,szB); + SetDlgItemInt(hW,IDC_STA4,spuAddr,TRUE); + + // xa infos + if(XAPlay<=XAFeed) ch=XAFeed-XAPlay; + else ch=(XAFeed-XAStart)+(XAEnd-XAPlay); + SetDlgItemInt(hW,IDC_XA4,ch,FALSE); + SetDlgItemInt(hW,IDC_XA5,iLeftXAVol,TRUE); + SetDlgItemInt(hW,IDC_XA6,iRightXAVol,TRUE); + if(!xapGlobal) return; + SetDlgItemInt(hW,IDC_XA1,xapGlobal->freq,TRUE); + SetDlgItemInt(hW,IDC_XA2,xapGlobal->stereo,TRUE); + SetDlgItemInt(hW,IDC_XA3,xapGlobal->nsamples,TRUE); +} + +//////////////////////////////////////////////////////////////////////// +// display everything (called in dialog timer for value refreshing) + +void DisplayDebugInfos(HWND hW) +{ + DisplayStreamInfos(hW); + DisplayADSRInfos(hW); + DisplayChannelInfos(hW); +} + +//////////////////////////////////////////////////////////////////////// +// main debug dlg handler + +BOOL CALLBACK DebugDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam) +{ + switch(uMsg) + { + //--------------------------------------------------// init + case WM_INITDIALOG: + { + int i; + ShowCursor(TRUE); // mmm... who is hiding it? main emu? tsts + iSelChannel=0; // sel first channel + CheckRadioButton(hW,IDC_CHAN1,IDC_CHAN24,IDC_CHAN1); + // create brushes/pens + hBStream[0]=CreateSolidBrush(GetSysColor(COLOR_3DFACE)); + hPAdsr[0]=CreatePen(PS_SOLID,0,GetSysColor(COLOR_3DFACE)); + for(i=1;i<6;i++) + { + hBStream[i]=CreateSolidBrush(crStreamCol[i]); + hPAdsr[i]=CreatePen(PS_SOLID,0,crAdsrCol[i]); + } + SetTimer(hW,999,50,NULL); // now create update timer + return TRUE; + } + //--------------------------------------------------// destroy + case WM_DESTROY: + { + int i; + KillTimer(hW,999); // first kill timer + for(i=0;i<6;i++) // then kill brushes/pens + { + DeleteObject(hBStream[i]); + DeleteObject(hPAdsr[i]); + } + }break; + //--------------------------------------------------// timer + case WM_TIMER: + { + if(wParam==999) DisplayDebugInfos(hW); // update all values + }break; + //--------------------------------------------------// command + case WM_COMMAND: + { + if(wParam==IDCANCEL) iDebugMode=2; // cancel? raise flag for destroying the dialog + + if(wParam>=IDC_MUTE1 && wParam<=IDC_MUTE24) // mute clicked? + { + if(IsDlgButtonChecked(hW,wParam)) // -> mute/unmute it + s_chan[wParam-IDC_MUTE1].iMute=1; + else s_chan[wParam-IDC_MUTE1].iMute=0; + } + // all mute/unmute + if(wParam==IDC_MUTEOFF) SendMessage(hW,WM_MUTE,0,0); + if(wParam==IDC_MUTEON) SendMessage(hW,WM_MUTE,1,0); + + if(wParam>=IDC_CHAN1 && wParam<=IDC_CHAN24) // sel channel + { + if(IsDlgButtonChecked(hW,wParam)) + { + iSelChannel=wParam-IDC_CHAN1; + SetDlgItemInt(hW,IDC_CHANNUM,iSelChannel+1,FALSE); + } + } + }break; + //--------------------------------------------------// mute + case WM_MUTE: + { // will be called by the mute/unmute all button and on savestate load + int i; + for(i=IDC_MUTE1;i<=IDC_MUTE24;i++) + { + CheckDlgButton(hW,i,wParam); + if(wParam) s_chan[i-IDC_MUTE1].iMute=1; + else s_chan[i-IDC_MUTE1].iMute=0; + } + }break; + //--------------------------------------------------// size + case WM_SIZE: + if(wParam==SIZE_MINIMIZED) SetFocus(hWMain); // if we get minimized, set the foxus to the main window + break; + //--------------------------------------------------// setcursor + case WM_SETCURSOR: + { + SetCursor(LoadCursor(NULL,IDC_ARROW)); // force the arrow + return TRUE; + } + //--------------------------------------------------// + } + return FALSE; +} + +//////////////////////////////////////////////////////////////////////// + #endif
\ No newline at end of file diff --git a/win32/plugins/dfsound/winsrc/debug.h b/win32/plugins/dfsound/winsrc/debug.h index 9c309c17..47a9343b 100644..100755 --- a/win32/plugins/dfsound/winsrc/debug.h +++ b/win32/plugins/dfsound/winsrc/debug.h @@ -1,29 +1,29 @@ -/***************************************************************************
- debug.h - description
- -------------------
- begin : Wed May 15 2002
- copyright : (C) 2002 by Pete Bernert
- email : BlackDove@addcom.de
- ***************************************************************************/
-
-/***************************************************************************
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. See also the license.txt file for *
- * additional informations. *
- * *
- ***************************************************************************/
-
-//*************************************************************************//
-// History of changes:
-//
-// 2002/05/15 - Pete
-// - generic cleanup for the Peops release
-//
-//*************************************************************************//
-
-#ifdef _WINDOWS
-BOOL CALLBACK DebugDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam);
-#endif
+/*************************************************************************** + debug.h - description + ------------------- + begin : Wed May 15 2002 + copyright : (C) 2002 by Pete Bernert + email : BlackDove@addcom.de + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. See also the license.txt file for * + * additional informations. * + * * + ***************************************************************************/ + +//*************************************************************************// +// History of changes: +// +// 2002/05/15 - Pete +// - generic cleanup for the Peops release +// +//*************************************************************************// + +#ifdef _WINDOWS +BOOL CALLBACK DebugDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam); +#endif diff --git a/win32/plugins/dfsound/winsrc/dsound.c b/win32/plugins/dfsound/winsrc/dsound.c index 1d6ce66e..94a606f3 100644..100755 --- a/win32/plugins/dfsound/winsrc/dsound.c +++ b/win32/plugins/dfsound/winsrc/dsound.c @@ -1,277 +1,277 @@ -/***************************************************************************
- dsound.c - description
- -------------------
- begin : Wed May 15 2002
- copyright : (C) 2002 by Pete Bernert
- email : BlackDove@addcom.de
- ***************************************************************************/
-
-/***************************************************************************
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. See also the license.txt file for *
- * additional informations. *
- * *
- ***************************************************************************/
-
-//*************************************************************************//
-// History of changes:
-//
-// 2003/01/12 - Pete
-// - added recording funcs
-//
-// 2002/05/15 - Pete
-// - generic cleanup for the Peops release
-//
-//*************************************************************************//
-
-#include "stdafx.h"
-
-#define _IN_DSOUND
-
-#include "externals.h"
-
-#ifdef _WINDOWS
-
-#include <dsound.h>
-
-#include "record.h"
-
-////////////////////////////////////////////////////////////////////////
-// dsound globals
-////////////////////////////////////////////////////////////////////////
-
-LPDIRECTSOUND lpDS;
-LPDIRECTSOUNDBUFFER lpDSBP = NULL;
-LPDIRECTSOUNDBUFFER lpDSB = NULL;
-DSBUFFERDESC dsbd;
-DSBUFFERDESC dsbdesc;
-DSCAPS dscaps;
-DSBCAPS dsbcaps;
-
-unsigned long LastWrite=0xffffffff;
-unsigned long LastPlay=0;
-
-////////////////////////////////////////////////////////////////////////
-// SETUP SOUND
-////////////////////////////////////////////////////////////////////////
-
-void SetupSound(void)
-{
- HRESULT dsval;WAVEFORMATEX pcmwf;
-
- dsval = DirectSoundCreate(NULL,&lpDS,NULL);
- if(dsval!=DS_OK)
- {
- MessageBox(hWMain,"DirectSoundCreate!","Error",MB_OK);
- return;
- }
-
- if(DS_OK!=IDirectSound_SetCooperativeLevel(lpDS,hWMain, DSSCL_PRIORITY))
- {
- if(DS_OK!=IDirectSound_SetCooperativeLevel(lpDS,hWMain, DSSCL_NORMAL))
- {
- MessageBox(hWMain,"SetCooperativeLevel!","Error",MB_OK);
- return;
- }
- }
-
- memset(&dsbd,0,sizeof(DSBUFFERDESC));
- dsbd.dwSize = 20; // NT4 hack! sizeof(dsbd);
- dsbd.dwFlags = DSBCAPS_PRIMARYBUFFER;
- dsbd.dwBufferBytes = 0;
- dsbd.lpwfxFormat = NULL;
-
- dsval=IDirectSound_CreateSoundBuffer(lpDS,&dsbd,&lpDSBP,NULL);
- if(dsval!=DS_OK)
- {
- MessageBox(hWMain, "CreateSoundBuffer (Primary)", "Error",MB_OK);
- return;
- }
-
- memset(&pcmwf, 0, sizeof(WAVEFORMATEX));
- pcmwf.wFormatTag = WAVE_FORMAT_PCM;
-
- if(iDisStereo) {pcmwf.nChannels = 1; pcmwf.nBlockAlign = 2;}
- else {pcmwf.nChannels = 2; pcmwf.nBlockAlign = 4;}
-
- pcmwf.nSamplesPerSec = 44100;
-
- pcmwf.nAvgBytesPerSec = pcmwf.nSamplesPerSec * pcmwf.nBlockAlign;
- pcmwf.wBitsPerSample = 16;
-
- dsval=IDirectSoundBuffer_SetFormat(lpDSBP,&pcmwf);
- if(dsval!=DS_OK)
- {
- MessageBox(hWMain, "SetFormat!", "Error",MB_OK);
- return;
- }
-
- dscaps.dwSize = sizeof(DSCAPS);
- dsbcaps.dwSize = sizeof(DSBCAPS);
- IDirectSound_GetCaps(lpDS,&dscaps);
- IDirectSoundBuffer_GetCaps(lpDSBP,&dsbcaps);
-
- memset(&dsbdesc, 0, sizeof(DSBUFFERDESC));
- dsbdesc.dwSize = 20; // NT4 hack! sizeof(DSBUFFERDESC);
- dsbdesc.dwFlags = DSBCAPS_LOCSOFTWARE | DSBCAPS_STICKYFOCUS | DSBCAPS_GETCURRENTPOSITION2;
- dsbdesc.dwBufferBytes = SOUNDSIZE;
- dsbdesc.lpwfxFormat = (LPWAVEFORMATEX)&pcmwf;
-
- dsval=IDirectSound_CreateSoundBuffer(lpDS,&dsbdesc,&lpDSB,NULL);
- if(dsval!=DS_OK)
- {
- MessageBox(hWMain,"CreateSoundBuffer (Secondary)", "Error",MB_OK);
- return;
- }
-
- dsval=IDirectSoundBuffer_Play(lpDSBP,0,0,DSBPLAY_LOOPING);
- if(dsval!=DS_OK)
- {
- MessageBox(hWMain,"Play (Primary)","Error",MB_OK);
- return;
- }
-
- dsval=IDirectSoundBuffer_Play(lpDSB,0,0,DSBPLAY_LOOPING);
- if(dsval!=DS_OK)
- {
- MessageBox(hWMain,"Play (Secondary)","Error",MB_OK);
- return;
- }
-}
-
-////////////////////////////////////////////////////////////////////////
-// REMOVE SOUND
-////////////////////////////////////////////////////////////////////////
-
-void RemoveSound(void)
-{
- int iRes;
-
- if(iDoRecord) RecordStop();
-
- if(lpDSB!=NULL)
- {
- IDirectSoundBuffer_Stop(lpDSB);
- iRes=IDirectSoundBuffer_Release(lpDSB);
- // FF says such a loop is bad... Demo says it's good... Pete doesn't care
- while(iRes!=0) iRes=IDirectSoundBuffer_Release(lpDSB);
- lpDSB=NULL;
- }
-
- if(lpDSBP!=NULL)
- {
- IDirectSoundBuffer_Stop(lpDSBP);
- iRes=IDirectSoundBuffer_Release(lpDSBP);
- // FF says such a loop is bad... Demo says it's good... Pete doesn't care
- while(iRes!=0) iRes=IDirectSoundBuffer_Release(lpDSBP);
- lpDSBP=NULL;
- }
-
- if(lpDS!=NULL)
- {
- iRes=IDirectSound_Release(lpDS);
- // FF says such a loop is bad... Demo says it's good... Pete doesn't care
- while(iRes!=0) iRes=IDirectSound_Release(lpDS);
- lpDS=NULL;
- }
-
-}
-
-////////////////////////////////////////////////////////////////////////
-// GET BYTES BUFFERED
-////////////////////////////////////////////////////////////////////////
-
-unsigned long SoundGetBytesBuffered(void)
-{
- unsigned long cplay,cwrite;
-
- if(LastWrite==0xffffffff) return 0;
-
- IDirectSoundBuffer_GetCurrentPosition(lpDSB,&cplay,&cwrite);
-
- if(cplay>SOUNDSIZE) return SOUNDSIZE;
-
- if(cplay<LastWrite) return LastWrite-cplay;
- return (SOUNDSIZE-cplay)+LastWrite;
-}
-
-////////////////////////////////////////////////////////////////////////
-// FEED SOUND DATA
-////////////////////////////////////////////////////////////////////////
-
-void SoundFeedStreamData(unsigned char* pSound,long lBytes)
-{
- LPVOID lpvPtr1, lpvPtr2;
- unsigned long dwBytes1,dwBytes2;
- unsigned long *lpSS, *lpSD;
- unsigned long dw,cplay,cwrite;
- HRESULT hr;
- unsigned long status;
-
- if(iDoRecord) RecordBuffer(pSound,lBytes);
-
- IDirectSoundBuffer_GetStatus(lpDSB,&status);
- if(status&DSBSTATUS_BUFFERLOST)
- {
- if(IDirectSoundBuffer_Restore(lpDSB)!=DS_OK) return;
- IDirectSoundBuffer_Play(lpDSB,0,0,DSBPLAY_LOOPING);
- }
-
- IDirectSoundBuffer_GetCurrentPosition(lpDSB,&cplay,&cwrite);
-
- if(LastWrite==0xffffffff) LastWrite=cwrite;
-
-/*
-// mmm... security... not needed, I think
- if(LastWrite<cplay)
- {
- if((cplay-LastWrite)<=(unsigned long)lBytes)
- {
- LastWrite=0xffffffff;
- return;
- }
- }
- else
- {
- if(LastWrite<cwrite)
- {
- LastWrite=0xffffffff;
- return;
- }
- }
-*/
-
- hr=IDirectSoundBuffer_Lock(lpDSB,LastWrite,lBytes,
- &lpvPtr1, &dwBytes1,
- &lpvPtr2, &dwBytes2,
- 0);
-
- if(hr!=DS_OK) {LastWrite=0xffffffff;return;}
-
- lpSD=(unsigned long *)lpvPtr1;
- dw=dwBytes1>>2;
-
- lpSS=(unsigned long *)pSound;
- while(dw) {*lpSD++=*lpSS++;dw--;}
-
- if(lpvPtr2)
- {
- lpSD=(unsigned long *)lpvPtr2;
- dw=dwBytes2>>2;
- while(dw) {*lpSD++=*lpSS++;dw--;}
- }
-
- IDirectSoundBuffer_Unlock(lpDSB,lpvPtr1,dwBytes1,lpvPtr2,dwBytes2);
-
- LastWrite+=lBytes;
- if(LastWrite>=SOUNDSIZE) LastWrite-=SOUNDSIZE;
- LastPlay=cplay;
-}
-
-#endif
-
-
-
+/*************************************************************************** + dsound.c - description + ------------------- + begin : Wed May 15 2002 + copyright : (C) 2002 by Pete Bernert + email : BlackDove@addcom.de + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. See also the license.txt file for * + * additional informations. * + * * + ***************************************************************************/ + +//*************************************************************************// +// History of changes: +// +// 2003/01/12 - Pete +// - added recording funcs +// +// 2002/05/15 - Pete +// - generic cleanup for the Peops release +// +//*************************************************************************// + +#include "stdafx.h" + +#define _IN_DSOUND + +#include "externals.h" + +#ifdef _WINDOWS + +#include <dsound.h> + +#include "record.h" + +//////////////////////////////////////////////////////////////////////// +// dsound globals +//////////////////////////////////////////////////////////////////////// + +LPDIRECTSOUND lpDS; +LPDIRECTSOUNDBUFFER lpDSBP = NULL; +LPDIRECTSOUNDBUFFER lpDSB = NULL; +DSBUFFERDESC dsbd; +DSBUFFERDESC dsbdesc; +DSCAPS dscaps; +DSBCAPS dsbcaps; + +unsigned long LastWrite=0xffffffff; +unsigned long LastPlay=0; + +//////////////////////////////////////////////////////////////////////// +// SETUP SOUND +//////////////////////////////////////////////////////////////////////// + +void SetupSound(void) +{ + HRESULT dsval;WAVEFORMATEX pcmwf; + + dsval = DirectSoundCreate(NULL,&lpDS,NULL); + if(dsval!=DS_OK) + { + MessageBox(hWMain,"DirectSoundCreate!","Error",MB_OK); + return; + } + + if(DS_OK!=IDirectSound_SetCooperativeLevel(lpDS,hWMain, DSSCL_PRIORITY)) + { + if(DS_OK!=IDirectSound_SetCooperativeLevel(lpDS,hWMain, DSSCL_NORMAL)) + { + MessageBox(hWMain,"SetCooperativeLevel!","Error",MB_OK); + return; + } + } + + memset(&dsbd,0,sizeof(DSBUFFERDESC)); + dsbd.dwSize = 20; // NT4 hack! sizeof(dsbd); + dsbd.dwFlags = DSBCAPS_PRIMARYBUFFER; + dsbd.dwBufferBytes = 0; + dsbd.lpwfxFormat = NULL; + + dsval=IDirectSound_CreateSoundBuffer(lpDS,&dsbd,&lpDSBP,NULL); + if(dsval!=DS_OK) + { + MessageBox(hWMain, "CreateSoundBuffer (Primary)", "Error",MB_OK); + return; + } + + memset(&pcmwf, 0, sizeof(WAVEFORMATEX)); + pcmwf.wFormatTag = WAVE_FORMAT_PCM; + + if(iDisStereo) {pcmwf.nChannels = 1; pcmwf.nBlockAlign = 2;} + else {pcmwf.nChannels = 2; pcmwf.nBlockAlign = 4;} + + pcmwf.nSamplesPerSec = 44100; + + pcmwf.nAvgBytesPerSec = pcmwf.nSamplesPerSec * pcmwf.nBlockAlign; + pcmwf.wBitsPerSample = 16; + + dsval=IDirectSoundBuffer_SetFormat(lpDSBP,&pcmwf); + if(dsval!=DS_OK) + { + MessageBox(hWMain, "SetFormat!", "Error",MB_OK); + return; + } + + dscaps.dwSize = sizeof(DSCAPS); + dsbcaps.dwSize = sizeof(DSBCAPS); + IDirectSound_GetCaps(lpDS,&dscaps); + IDirectSoundBuffer_GetCaps(lpDSBP,&dsbcaps); + + memset(&dsbdesc, 0, sizeof(DSBUFFERDESC)); + dsbdesc.dwSize = 20; // NT4 hack! sizeof(DSBUFFERDESC); + dsbdesc.dwFlags = DSBCAPS_LOCSOFTWARE | DSBCAPS_STICKYFOCUS | DSBCAPS_GETCURRENTPOSITION2; + dsbdesc.dwBufferBytes = SOUNDSIZE; + dsbdesc.lpwfxFormat = (LPWAVEFORMATEX)&pcmwf; + + dsval=IDirectSound_CreateSoundBuffer(lpDS,&dsbdesc,&lpDSB,NULL); + if(dsval!=DS_OK) + { + MessageBox(hWMain,"CreateSoundBuffer (Secondary)", "Error",MB_OK); + return; + } + + dsval=IDirectSoundBuffer_Play(lpDSBP,0,0,DSBPLAY_LOOPING); + if(dsval!=DS_OK) + { + MessageBox(hWMain,"Play (Primary)","Error",MB_OK); + return; + } + + dsval=IDirectSoundBuffer_Play(lpDSB,0,0,DSBPLAY_LOOPING); + if(dsval!=DS_OK) + { + MessageBox(hWMain,"Play (Secondary)","Error",MB_OK); + return; + } +} + +//////////////////////////////////////////////////////////////////////// +// REMOVE SOUND +//////////////////////////////////////////////////////////////////////// + +void RemoveSound(void) +{ + int iRes; + + if(iDoRecord) RecordStop(); + + if(lpDSB!=NULL) + { + IDirectSoundBuffer_Stop(lpDSB); + iRes=IDirectSoundBuffer_Release(lpDSB); + // FF says such a loop is bad... Demo says it's good... Pete doesn't care + while(iRes!=0) iRes=IDirectSoundBuffer_Release(lpDSB); + lpDSB=NULL; + } + + if(lpDSBP!=NULL) + { + IDirectSoundBuffer_Stop(lpDSBP); + iRes=IDirectSoundBuffer_Release(lpDSBP); + // FF says such a loop is bad... Demo says it's good... Pete doesn't care + while(iRes!=0) iRes=IDirectSoundBuffer_Release(lpDSBP); + lpDSBP=NULL; + } + + if(lpDS!=NULL) + { + iRes=IDirectSound_Release(lpDS); + // FF says such a loop is bad... Demo says it's good... Pete doesn't care + while(iRes!=0) iRes=IDirectSound_Release(lpDS); + lpDS=NULL; + } + +} + +//////////////////////////////////////////////////////////////////////// +// GET BYTES BUFFERED +//////////////////////////////////////////////////////////////////////// + +unsigned long SoundGetBytesBuffered(void) +{ + unsigned long cplay,cwrite; + + if(LastWrite==0xffffffff) return 0; + + IDirectSoundBuffer_GetCurrentPosition(lpDSB,&cplay,&cwrite); + + if(cplay>SOUNDSIZE) return SOUNDSIZE; + + if(cplay<LastWrite) return LastWrite-cplay; + return (SOUNDSIZE-cplay)+LastWrite; +} + +//////////////////////////////////////////////////////////////////////// +// FEED SOUND DATA +//////////////////////////////////////////////////////////////////////// + +void SoundFeedStreamData(unsigned char* pSound,long lBytes) +{ + LPVOID lpvPtr1, lpvPtr2; + unsigned long dwBytes1,dwBytes2; + unsigned long *lpSS, *lpSD; + unsigned long dw,cplay,cwrite; + HRESULT hr; + unsigned long status; + + if(iDoRecord) RecordBuffer(pSound,lBytes); + + IDirectSoundBuffer_GetStatus(lpDSB,&status); + if(status&DSBSTATUS_BUFFERLOST) + { + if(IDirectSoundBuffer_Restore(lpDSB)!=DS_OK) return; + IDirectSoundBuffer_Play(lpDSB,0,0,DSBPLAY_LOOPING); + } + + IDirectSoundBuffer_GetCurrentPosition(lpDSB,&cplay,&cwrite); + + if(LastWrite==0xffffffff) LastWrite=cwrite; + +/* +// mmm... security... not needed, I think + if(LastWrite<cplay) + { + if((cplay-LastWrite)<=(unsigned long)lBytes) + { + LastWrite=0xffffffff; + return; + } + } + else + { + if(LastWrite<cwrite) + { + LastWrite=0xffffffff; + return; + } + } +*/ + + hr=IDirectSoundBuffer_Lock(lpDSB,LastWrite,lBytes, + &lpvPtr1, &dwBytes1, + &lpvPtr2, &dwBytes2, + 0); + + if(hr!=DS_OK) {LastWrite=0xffffffff;return;} + + lpSD=(unsigned long *)lpvPtr1; + dw=dwBytes1>>2; + + lpSS=(unsigned long *)pSound; + while(dw) {*lpSD++=*lpSS++;dw--;} + + if(lpvPtr2) + { + lpSD=(unsigned long *)lpvPtr2; + dw=dwBytes2>>2; + while(dw) {*lpSD++=*lpSS++;dw--;} + } + + IDirectSoundBuffer_Unlock(lpDSB,lpvPtr1,dwBytes1,lpvPtr2,dwBytes2); + + LastWrite+=lBytes; + if(LastWrite>=SOUNDSIZE) LastWrite-=SOUNDSIZE; + LastPlay=cplay; +} + +#endif + + + diff --git a/win32/plugins/dfsound/winsrc/dsound.h b/win32/plugins/dfsound/winsrc/dsound.h index 0589cdbe..0589cdbe 100644..100755 --- a/win32/plugins/dfsound/winsrc/dsound.h +++ b/win32/plugins/dfsound/winsrc/dsound.h diff --git a/win32/plugins/dfsound/winsrc/psemu.c b/win32/plugins/dfsound/winsrc/psemu.c index 1451ea4a..63ec352e 100644..100755 --- a/win32/plugins/dfsound/winsrc/psemu.c +++ b/win32/plugins/dfsound/winsrc/psemu.c @@ -1,101 +1,101 @@ -/***************************************************************************
- psemu.c - description
- -------------------
- begin : Wed May 15 2002
- copyright : (C) 2002 by Pete Bernert
- email : BlackDove@addcom.de
- ***************************************************************************/
-
-/***************************************************************************
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. See also the license.txt file for *
- * additional informations. *
- * *
- ***************************************************************************/
-
-// These ancient stuff are still necessary for epsxe, so keep these but only for
-// Windows port -Whistler
-
-#include "stdafx.h"
-
-#define _IN_PSEMU
-
-#include "externals.h"
-#include "regs.h"
-#include "dma.h"
-
-////////////////////////////////////////////////////////////////////////
-// OLD, SOMEWHAT (BUT NOT MUCH) SUPPORTED PSEMUPRO FUNCS
-////////////////////////////////////////////////////////////////////////
-
-unsigned short CALLBACK SPUgetOne(unsigned long val)
-{
- if(spuAddr!=0xffffffff)
- {
- return SPUreadDMA();
- }
- if(val>=512*1024) val=512*1024-1;
- return spuMem[val>>1];
-}
-
-void CALLBACK SPUputOne(unsigned long val,unsigned short data)
-{
- if(spuAddr!=0xffffffff)
- {
- SPUwriteDMA(data);
- return;
- }
- if(val>=512*1024) val=512*1024-1;
- spuMem[val>>1] = data;
-}
-
-void CALLBACK SPUplaySample(unsigned char ch)
-{
-}
-
-void CALLBACK SPUsetAddr(unsigned char ch, unsigned short waddr)
-{
- s_chan[ch].pStart=spuMemC+((unsigned long) waddr<<3);
-}
-
-void CALLBACK SPUsetPitch(unsigned char ch, unsigned short pitch)
-{
- SetPitch(ch,pitch);
-}
-
-void CALLBACK SPUsetVolumeL(unsigned char ch, short vol)
-{
- SetVolumeR(ch,vol);
-}
-
-void CALLBACK SPUsetVolumeR(unsigned char ch, short vol)
-{
- SetVolumeL(ch,vol);
-}
-
-void CALLBACK SPUstartChannels1(unsigned short channels)
-{
- SoundOn(0,16,channels);
-}
-
-void CALLBACK SPUstartChannels2(unsigned short channels)
-{
- SoundOn(16,24,channels);
-}
-
-void CALLBACK SPUstopChannels1(unsigned short channels)
-{
- SoundOff(0,16,channels);
-}
-
-void CALLBACK SPUstopChannels2(unsigned short channels)
-{
- SoundOff(16,24,channels);
-}
-
-void CALLBACK SPUplaySector(unsigned long mode, unsigned char * p)
-{
-}
+/*************************************************************************** + psemu.c - description + ------------------- + begin : Wed May 15 2002 + copyright : (C) 2002 by Pete Bernert + email : BlackDove@addcom.de + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. See also the license.txt file for * + * additional informations. * + * * + ***************************************************************************/ + +// These ancient stuff are still necessary for epsxe, so keep these but only for +// Windows port -Whistler + +#include "stdafx.h" + +#define _IN_PSEMU + +#include "externals.h" +#include "regs.h" +#include "dma.h" + +//////////////////////////////////////////////////////////////////////// +// OLD, SOMEWHAT (BUT NOT MUCH) SUPPORTED PSEMUPRO FUNCS +//////////////////////////////////////////////////////////////////////// + +unsigned short CALLBACK SPUgetOne(unsigned long val) +{ + if(spuAddr!=0xffffffff) + { + return SPUreadDMA(); + } + if(val>=512*1024) val=512*1024-1; + return spuMem[val>>1]; +} + +void CALLBACK SPUputOne(unsigned long val,unsigned short data) +{ + if(spuAddr!=0xffffffff) + { + SPUwriteDMA(data); + return; + } + if(val>=512*1024) val=512*1024-1; + spuMem[val>>1] = data; +} + +void CALLBACK SPUplaySample(unsigned char ch) +{ +} + +void CALLBACK SPUsetAddr(unsigned char ch, unsigned short waddr) +{ + s_chan[ch].pStart=spuMemC+((unsigned long) waddr<<3); +} + +void CALLBACK SPUsetPitch(unsigned char ch, unsigned short pitch) +{ + SetPitch(ch,pitch); +} + +void CALLBACK SPUsetVolumeL(unsigned char ch, short vol) +{ + SetVolumeR(ch,vol); +} + +void CALLBACK SPUsetVolumeR(unsigned char ch, short vol) +{ + SetVolumeL(ch,vol); +} + +void CALLBACK SPUstartChannels1(unsigned short channels) +{ + SoundOn(0,16,channels); +} + +void CALLBACK SPUstartChannels2(unsigned short channels) +{ + SoundOn(16,24,channels); +} + +void CALLBACK SPUstopChannels1(unsigned short channels) +{ + SoundOff(0,16,channels); +} + +void CALLBACK SPUstopChannels2(unsigned short channels) +{ + SoundOff(16,24,channels); +} + +void CALLBACK SPUplaySector(unsigned long mode, unsigned char * p) +{ +} diff --git a/win32/plugins/dfsound/winsrc/record.c b/win32/plugins/dfsound/winsrc/record.c index 93c10b00..c78b7660 100644..100755 --- a/win32/plugins/dfsound/winsrc/record.c +++ b/win32/plugins/dfsound/winsrc/record.c @@ -1,188 +1,188 @@ -/***************************************************************************
- spu.c - description
- -------------------
- begin : Sun Jan 12 2003
- copyright : (C) 2003 by Pete Bernert
- email : BlackDove@addcom.de
- ***************************************************************************/
-
-/***************************************************************************
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. See also the license.txt file for *
- * additional informations. *
- * *
- ***************************************************************************/
-
-//*************************************************************************//
-// History of changes:
-//
-// 2003/03/01 - Pete
-// - added mono mode
-//
-// 2003/01/12 - Pete
-// - added recording funcs (win version only)
-//
-//*************************************************************************//
-
-#include "stdafx.h"
-
-#ifdef _WINDOWS
-
-#include <mmsystem.h>
-#include "resource.h"
-#include "externals.h"
-
-#define _IN_RECORD
-
-#include "record.h"
-
-////////////////////////////////////////////////////////////////////////
-
-int iDoRecord=0;
-HMMIO hWaveFile=NULL;
-MMCKINFO mmckMain;
-MMCKINFO mmckData;
-char szFileName[256];
-
-////////////////////////////////////////////////////////////////////////
-
-void RecordStart()
-{
- WAVEFORMATEX pcmwf;
-
- // setup header in the same format as our directsound stream
- memset(&pcmwf,0,sizeof(WAVEFORMATEX));
- pcmwf.wFormatTag = WAVE_FORMAT_PCM;
-
- if(iDisStereo)
- {
- pcmwf.nChannels = 1;
- pcmwf.nBlockAlign = 2;
- }
- else
- {
- pcmwf.nChannels = 2;
- pcmwf.nBlockAlign = 4;
- }
-
- pcmwf.nSamplesPerSec = 44100;
- pcmwf.nAvgBytesPerSec = pcmwf.nSamplesPerSec * pcmwf.nBlockAlign;
- pcmwf.wBitsPerSample = 16;
-
- // create file
- hWaveFile=mmioOpen(szFileName,NULL,MMIO_CREATE|MMIO_WRITE|MMIO_EXCLUSIVE | MMIO_ALLOCBUF);
- if(!hWaveFile) return;
-
- // setup WAVE, fmt and data chunks
- memset(&mmckMain,0,sizeof(MMCKINFO));
- mmckMain.fccType = mmioFOURCC('W','A','V','E');
-
- mmioCreateChunk(hWaveFile,&mmckMain,MMIO_CREATERIFF);
-
- memset(&mmckData,0,sizeof(MMCKINFO));
- mmckData.ckid = mmioFOURCC('f','m','t',' ');
- mmckData.cksize = sizeof(WAVEFORMATEX);
-
- mmioCreateChunk(hWaveFile,&mmckData,0);
- mmioWrite(hWaveFile,(char*)&pcmwf,sizeof(WAVEFORMATEX));
- mmioAscend(hWaveFile,&mmckData,0);
-
- mmckData.ckid = mmioFOURCC('d','a','t','a');
- mmioCreateChunk(hWaveFile,&mmckData,0);
-}
-
-////////////////////////////////////////////////////////////////////////
-
-void RecordStop()
-{
- // first some check, if recording is running
- iDoRecord=0;
- if(!hWaveFile) return;
-
- // now finish writing & close the wave file
- mmioAscend(hWaveFile,&mmckData,0);
- mmioAscend(hWaveFile,&mmckMain,0);
- mmioClose(hWaveFile,0);
-
- // init var
- hWaveFile=NULL;
-}
-
-////////////////////////////////////////////////////////////////////////
-
-void RecordBuffer(unsigned char* pSound,long lBytes)
-{
- // write the samples
- if(hWaveFile) mmioWrite(hWaveFile,pSound,lBytes);
-}
-
-////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////
-
-BOOL CALLBACK RecordDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam)
-{
- switch(uMsg)
- {
- //--------------------------------------------------// init
- case WM_INITDIALOG:
- {
- SetDlgItemText(hW,IDC_WAVFILE,"C:\\PEOPS.WAV"); // init filename edit
- ShowCursor(TRUE); // mmm... who is hiding it? main emu? tsts
- return TRUE;
- }
- //--------------------------------------------------// destroy
- case WM_DESTROY:
- {
- RecordStop();
- }break;
- //--------------------------------------------------// command
- case WM_COMMAND:
- {
- if(wParam==IDCANCEL) iRecordMode=2; // cancel? raise flag for destroying the dialog
-
- if(wParam==IDC_RECORD) // record start/stop?
- {
- if(IsWindowEnabled(GetDlgItem(hW,IDC_WAVFILE))) // not started yet (edit is not disabled):
- {
- GetDlgItemText(hW,IDC_WAVFILE,szFileName,255);// get filename
-
- RecordStart(); // start recording
-
- if(hWaveFile) // start was ok?
- { // -> disable filename edit, change text, raise flag
- EnableWindow(GetDlgItem(hW,IDC_WAVFILE),FALSE);
- SetDlgItemText(hW,IDC_RECORD,"Stop recording");
- iDoRecord=1;
- }
- else MessageBeep(0xFFFFFFFF); // error starting recording? BEEP
- }
- else // stop recording?
- {
- RecordStop(); // -> just do it
- EnableWindow(GetDlgItem(hW,IDC_WAVFILE),TRUE);// -> enable filename edit again
- SetDlgItemText(hW,IDC_RECORD,"Start recording");
- }
- SetFocus(hWMain);
- }
- }break;
- //--------------------------------------------------// size
- case WM_SIZE:
- if(wParam==SIZE_MINIMIZED) SetFocus(hWMain); // if we get minimized, set the foxus to the main window
- break;
- //--------------------------------------------------// setcursor
- case WM_SETCURSOR:
- {
- SetCursor(LoadCursor(NULL,IDC_ARROW)); // force the arrow
- return TRUE;
- }
- //--------------------------------------------------//
- }
- return FALSE;
-}
-
-////////////////////////////////////////////////////////////////////////
-#endif
+/*************************************************************************** + spu.c - description + ------------------- + begin : Sun Jan 12 2003 + copyright : (C) 2003 by Pete Bernert + email : BlackDove@addcom.de + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. See also the license.txt file for * + * additional informations. * + * * + ***************************************************************************/ + +//*************************************************************************// +// History of changes: +// +// 2003/03/01 - Pete +// - added mono mode +// +// 2003/01/12 - Pete +// - added recording funcs (win version only) +// +//*************************************************************************// + +#include "stdafx.h" + +#ifdef _WINDOWS + +#include <mmsystem.h> +#include "resource.h" +#include "externals.h" + +#define _IN_RECORD + +#include "record.h" + +//////////////////////////////////////////////////////////////////////// + +int iDoRecord=0; +HMMIO hWaveFile=NULL; +MMCKINFO mmckMain; +MMCKINFO mmckData; +char szFileName[256]; + +//////////////////////////////////////////////////////////////////////// + +void RecordStart() +{ + WAVEFORMATEX pcmwf; + + // setup header in the same format as our directsound stream + memset(&pcmwf,0,sizeof(WAVEFORMATEX)); + pcmwf.wFormatTag = WAVE_FORMAT_PCM; + + if(iDisStereo) + { + pcmwf.nChannels = 1; + pcmwf.nBlockAlign = 2; + } + else + { + pcmwf.nChannels = 2; + pcmwf.nBlockAlign = 4; + } + + pcmwf.nSamplesPerSec = 44100; + pcmwf.nAvgBytesPerSec = pcmwf.nSamplesPerSec * pcmwf.nBlockAlign; + pcmwf.wBitsPerSample = 16; + + // create file + hWaveFile=mmioOpen(szFileName,NULL,MMIO_CREATE|MMIO_WRITE|MMIO_EXCLUSIVE | MMIO_ALLOCBUF); + if(!hWaveFile) return; + + // setup WAVE, fmt and data chunks + memset(&mmckMain,0,sizeof(MMCKINFO)); + mmckMain.fccType = mmioFOURCC('W','A','V','E'); + + mmioCreateChunk(hWaveFile,&mmckMain,MMIO_CREATERIFF); + + memset(&mmckData,0,sizeof(MMCKINFO)); + mmckData.ckid = mmioFOURCC('f','m','t',' '); + mmckData.cksize = sizeof(WAVEFORMATEX); + + mmioCreateChunk(hWaveFile,&mmckData,0); + mmioWrite(hWaveFile,(char*)&pcmwf,sizeof(WAVEFORMATEX)); + mmioAscend(hWaveFile,&mmckData,0); + + mmckData.ckid = mmioFOURCC('d','a','t','a'); + mmioCreateChunk(hWaveFile,&mmckData,0); +} + +//////////////////////////////////////////////////////////////////////// + +void RecordStop() +{ + // first some check, if recording is running + iDoRecord=0; + if(!hWaveFile) return; + + // now finish writing & close the wave file + mmioAscend(hWaveFile,&mmckData,0); + mmioAscend(hWaveFile,&mmckMain,0); + mmioClose(hWaveFile,0); + + // init var + hWaveFile=NULL; +} + +//////////////////////////////////////////////////////////////////////// + +void RecordBuffer(unsigned char* pSound,long lBytes) +{ + // write the samples + if(hWaveFile) mmioWrite(hWaveFile,pSound,lBytes); +} + +//////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////// + +BOOL CALLBACK RecordDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam) +{ + switch(uMsg) + { + //--------------------------------------------------// init + case WM_INITDIALOG: + { + SetDlgItemText(hW,IDC_WAVFILE,"C:\\PEOPS.WAV"); // init filename edit + ShowCursor(TRUE); // mmm... who is hiding it? main emu? tsts + return TRUE; + } + //--------------------------------------------------// destroy + case WM_DESTROY: + { + RecordStop(); + }break; + //--------------------------------------------------// command + case WM_COMMAND: + { + if(wParam==IDCANCEL) iRecordMode=2; // cancel? raise flag for destroying the dialog + + if(wParam==IDC_RECORD) // record start/stop? + { + if(IsWindowEnabled(GetDlgItem(hW,IDC_WAVFILE))) // not started yet (edit is not disabled): + { + GetDlgItemText(hW,IDC_WAVFILE,szFileName,255);// get filename + + RecordStart(); // start recording + + if(hWaveFile) // start was ok? + { // -> disable filename edit, change text, raise flag + EnableWindow(GetDlgItem(hW,IDC_WAVFILE),FALSE); + SetDlgItemText(hW,IDC_RECORD,"Stop recording"); + iDoRecord=1; + } + else MessageBeep(0xFFFFFFFF); // error starting recording? BEEP + } + else // stop recording? + { + RecordStop(); // -> just do it + EnableWindow(GetDlgItem(hW,IDC_WAVFILE),TRUE);// -> enable filename edit again + SetDlgItemText(hW,IDC_RECORD,"Start recording"); + } + SetFocus(hWMain); + } + }break; + //--------------------------------------------------// size + case WM_SIZE: + if(wParam==SIZE_MINIMIZED) SetFocus(hWMain); // if we get minimized, set the foxus to the main window + break; + //--------------------------------------------------// setcursor + case WM_SETCURSOR: + { + SetCursor(LoadCursor(NULL,IDC_ARROW)); // force the arrow + return TRUE; + } + //--------------------------------------------------// + } + return FALSE; +} + +//////////////////////////////////////////////////////////////////////// +#endif diff --git a/win32/plugins/dfsound/winsrc/record.h b/win32/plugins/dfsound/winsrc/record.h index 7614e327..a264850e 100644..100755 --- a/win32/plugins/dfsound/winsrc/record.h +++ b/win32/plugins/dfsound/winsrc/record.h @@ -1,11 +1,11 @@ -#ifndef _RECORD_H_
-#define _RECORD_H_
-
-#ifdef _WINDOWS
-void RecordStart();
-void RecordBuffer(unsigned char* pSound,long lBytes);
-void RecordStop();
-BOOL CALLBACK RecordDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam);
-#endif
-
+#ifndef _RECORD_H_ +#define _RECORD_H_ + +#ifdef _WINDOWS +void RecordStart(); +void RecordBuffer(unsigned char* pSound,long lBytes); +void RecordStop(); +BOOL CALLBACK RecordDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam); +#endif + #endif
\ No newline at end of file diff --git a/win32/plugins/dfsound/winsrc/winmain.c b/win32/plugins/dfsound/winsrc/winmain.c index fb57bf6e..e050bc38 100644..100755 --- a/win32/plugins/dfsound/winsrc/winmain.c +++ b/win32/plugins/dfsound/winsrc/winmain.c @@ -1,34 +1,34 @@ -/***************************************************************************
- spuPeopsSound.c - description
- -------------------
- begin : Wed May 15 2002
- copyright : (C) 2002 by Pete Bernert
- email : BlackDove@addcom.de
- ***************************************************************************/
-
-/***************************************************************************
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. See also the license.txt file for *
- * additional informations. *
- * *
- ***************************************************************************/
-
-// winmain.c : Defines the entry point for the DLL application.
-//
-
-#include "stdafx.h"
-
-HINSTANCE hInst = NULL;
-
-BOOL APIENTRY DllMain( HANDLE hModule,
- DWORD ul_reason_for_call,
- LPVOID lpReserved
- )
-{
- hInst=(HINSTANCE)hModule;
- return TRUE;
-}
-
+/*************************************************************************** + spuPeopsSound.c - description + ------------------- + begin : Wed May 15 2002 + copyright : (C) 2002 by Pete Bernert + email : BlackDove@addcom.de + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. See also the license.txt file for * + * additional informations. * + * * + ***************************************************************************/ + +// winmain.c : Defines the entry point for the DLL application. +// + +#include "stdafx.h" + +HINSTANCE hInst = NULL; + +BOOL APIENTRY DllMain( HANDLE hModule, + DWORD ul_reason_for_call, + LPVOID lpReserved + ) +{ + hInst=(HINSTANCE)hModule; + return TRUE; +} + |
