diff options
Diffstat (limited to 'IvyAudioMon/MeterDlg.cpp')
-rw-r--r-- | IvyAudioMon/MeterDlg.cpp | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/IvyAudioMon/MeterDlg.cpp b/IvyAudioMon/MeterDlg.cpp index 2962d7b..1039fee 100644 --- a/IvyAudioMon/MeterDlg.cpp +++ b/IvyAudioMon/MeterDlg.cpp @@ -13,6 +13,8 @@ #undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
+
+
const char * CONVSTR( const CString& str )
{
#ifdef UNDER_CE
@@ -264,18 +266,22 @@ void CALLBACK CMeterDlg::recordCallBack(HWAVEIN hWaveIn, UINT uMsg, DWORD dwInst }
void CALLBACK CMeterDlg::recordCB(HWAVEIN hWaveIn, UINT uMsg, DWORD dwInstance, DWORD dwParam1, DWORD dwParam2)
{
+ WAVEHDR *waveHeader = (WAVEHDR*)dwParam1;
float lVal =0;
switch ( uMsg )
{
case WIM_OPEN:
- //TRACE("WIM_OPEN\n");
+ TRACE("WIM_OPEN\n");
break;
case WIM_DATA:
- for ( DWORD i = 0; i < WaveHeader.dwBytesRecorded; i++ )
- lVal += ( signed char )WaveHeader.lpData[i];
- lVal /= WaveHeader.dwBytesRecorded ;
- lVal += 127;
- //TRACE("WIM_DATA %d %d %f\n",WaveHeader.dwBufferLength,WaveHeader.dwBytesRecorded,lVal);
+ for ( DWORD i = 0; i < waveHeader->dwBytesRecorded; i++ )
+ {
+ //TRACE("WIM_DATA[%d]= %02x\n",i,waveHeader->lpData[i]);
+ lVal += abs( (float)( unsigned char )waveHeader->lpData[i] - 127.0f) ;
+ }
+ lVal /= waveHeader->dwBytesRecorded ;
+ lVal *= 2;
+ TRACE("WIM_DATA %d %d %f\n",waveHeader->dwBufferLength,waveHeader->dwBytesRecorded,lVal);
nb_buffers++;
peekValue = max( peekValue, lVal );
// moyenne sur 1 seconde
@@ -307,7 +313,7 @@ void CALLBACK CMeterDlg::recordCB(HWAVEIN hWaveIn, UINT uMsg, DWORD dwInstance, }
break;
case WIM_CLOSE:
- //TRACE("WIM_OPEN\n");
+ TRACE("WIM_CLOSE\n");
break;
}
}
|