summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfcolin2007-02-01 13:06:33 +0000
committerfcolin2007-02-01 13:06:33 +0000
commita61d8acda8ad5b3a5ec4971e8d4d5a42be459d35 (patch)
tree11e987ad45f02c8317c9015bba2212776dc8d15b
parented8f28e552ce1135a631ce78054124acb48d2df8 (diff)
downloadivy-cplusplus-a61d8acda8ad5b3a5ec4971e8d4d5a42be459d35.zip
ivy-cplusplus-a61d8acda8ad5b3a5ec4971e8d4d5a42be459d35.tar.gz
ivy-cplusplus-a61d8acda8ad5b3a5ec4971e8d4d5a42be459d35.tar.bz2
ivy-cplusplus-a61d8acda8ad5b3a5ec4971e8d4d5a42be459d35.tar.xz
Utilisateur : Fcolin Date : 27/02/04 Heure : 15:59 Archivé dans $/Bus/IvyAudioMon Commentaire: (vss 2)
-rw-r--r--IvyAudioMon/MeterDlg.cpp20
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;
}
}