diff options
author | fcolin | 2007-02-01 13:06:33 +0000 |
---|---|---|
committer | fcolin | 2007-02-01 13:06:33 +0000 |
commit | cd1cfc6a390e796e9f4aeb85a53ae8ec886aef27 (patch) | |
tree | 4ea4024e7880bef6f7ad4a8bf1ad33d7a382d4a6 /Bus/IvyAudioMon/MeterDlg.cpp | |
parent | 85e64210846bf3db60294db0a73cb929df107b56 (diff) | |
download | ivy-cplusplus-cd1cfc6a390e796e9f4aeb85a53ae8ec886aef27.zip ivy-cplusplus-cd1cfc6a390e796e9f4aeb85a53ae8ec886aef27.tar.gz ivy-cplusplus-cd1cfc6a390e796e9f4aeb85a53ae8ec886aef27.tar.bz2 ivy-cplusplus-cd1cfc6a390e796e9f4aeb85a53ae8ec886aef27.tar.xz |
Utilisateur : Fcolin Date : 27/02/04 Heure : 15:59 Archivé dans $/Bus/IvyAudioMon Commentaire: (vss 2)
Diffstat (limited to 'Bus/IvyAudioMon/MeterDlg.cpp')
-rw-r--r-- | Bus/IvyAudioMon/MeterDlg.cpp | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/Bus/IvyAudioMon/MeterDlg.cpp b/Bus/IvyAudioMon/MeterDlg.cpp index 2962d7b..1039fee 100644 --- a/Bus/IvyAudioMon/MeterDlg.cpp +++ b/Bus/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;
}
}
|