[FORMATTING] SndRec32 patch by Marco Pagliaricci, bug #4978.

svn path=/trunk/; revision=44387
This commit is contained in:
Dmitry Gorbachev 2009-12-03 19:00:41 +00:00
parent f558c83b1c
commit 99f27439b5
18 changed files with 2053 additions and 2045 deletions

View file

@ -25,6 +25,7 @@
#define _AUDIO_NAMESPACE_START_ namespace snd { #define _AUDIO_NAMESPACE_START_ namespace snd {
#define _AUDIO_NAMESPACE_END_ }; #define _AUDIO_NAMESPACE_END_ };
// //
// Platform depend stuff // Platform depend stuff
// //

View file

@ -6,7 +6,6 @@
* PROGRAMMERS: Marco Pagliaricci <ms_blue (at) hotmail (dot) it> * PROGRAMMERS: Marco Pagliaricci <ms_blue (at) hotmail (dot) it>
*/ */
#include "stdafx.h" #include "stdafx.h"
#include "audio_format.hpp" #include "audio_format.hpp"

View file

@ -9,6 +9,8 @@
#include "stdafx.h" #include "stdafx.h"
#include "audio_membuffer.hpp" #include "audio_membuffer.hpp"
_AUDIO_NAMESPACE_START_ _AUDIO_NAMESPACE_START_
@ -20,7 +22,7 @@ _AUDIO_NAMESPACE_START_
void void
audio_membuffer::alloc_mem_( unsigned int bytes ) audio_membuffer::alloc_mem_( unsigned int bytes )
{ {
// //
@ -70,7 +72,7 @@ void
void void
audio_membuffer::free_mem_( void ) audio_membuffer::free_mem_( void )
{ {
if ( audio_data ) if ( audio_data )
@ -83,7 +85,7 @@ void
void void
audio_membuffer::resize_mem_( unsigned int new_size ) audio_membuffer::resize_mem_( unsigned int new_size )
{ {
@ -173,7 +175,7 @@ void
void void
audio_membuffer::truncate_( void ) audio_membuffer::truncate_( void )
{ {
// //
@ -250,7 +252,7 @@ void
void void
audio_membuffer::clear( void ) audio_membuffer::clear( void )
{ {
free_mem_(); free_mem_();
@ -261,7 +263,7 @@ void
void void
audio_membuffer::reset( void ) audio_membuffer::reset( void )
{ {
@ -285,7 +287,7 @@ void
} }
void void
audio_membuffer::alloc_bytes( unsigned int bytes ) audio_membuffer::alloc_bytes( unsigned int bytes )
{ {
alloc_mem_( bytes ); alloc_mem_( bytes );
@ -296,7 +298,7 @@ void
void void
audio_membuffer::alloc_seconds( unsigned int secs ) audio_membuffer::alloc_seconds( unsigned int secs )
{ {
alloc_mem_( aud_info.byte_rate() * secs ); alloc_mem_( aud_info.byte_rate() * secs );
@ -305,7 +307,7 @@ void
void void
audio_membuffer::alloc_seconds( float secs ) audio_membuffer::alloc_seconds( float secs )
{ {
alloc_mem_(( unsigned int )(( float ) aud_info.byte_rate() * secs )); alloc_mem_(( unsigned int )(( float ) aud_info.byte_rate() * secs ));
@ -316,7 +318,7 @@ void
void void
audio_membuffer::resize_bytes( unsigned int bytes ) audio_membuffer::resize_bytes( unsigned int bytes )
{ {
resize_mem_( bytes ); resize_mem_( bytes );
@ -326,7 +328,7 @@ void
void void
audio_membuffer::resize_seconds( unsigned int secs ) audio_membuffer::resize_seconds( unsigned int secs )
{ {
resize_mem_( aud_info.byte_rate() * secs ); resize_mem_( aud_info.byte_rate() * secs );
@ -335,7 +337,7 @@ void
void void
audio_membuffer::resize_seconds( float secs ) audio_membuffer::resize_seconds( float secs )
{ {
resize_mem_(( unsigned int ) resize_mem_(( unsigned int )
@ -360,7 +362,7 @@ void
void void
audio_membuffer::audio_receive audio_membuffer::audio_receive
( unsigned char * data, unsigned int size ) ( unsigned char * data, unsigned int size )
{ {
@ -442,7 +444,7 @@ void
unsigned int unsigned int
audio_membuffer::read( BYTE * out_buf, unsigned int bytes ) audio_membuffer::read( BYTE * out_buf, unsigned int bytes )
{ {
// //
@ -497,7 +499,7 @@ unsigned int
bool bool
audio_membuffer::finished( void ) audio_membuffer::finished( void )
{ {
if ( bytes_played_ < bytes_received ) if ( bytes_played_ < bytes_received )
return false; return false;
@ -505,4 +507,5 @@ bool
return true; return true;
} }
_AUDIO_NAMESPACE_END_ _AUDIO_NAMESPACE_END_

View file

@ -9,16 +9,18 @@
#include "stdafx.h" #include "stdafx.h"
#include "audio_resampler_acm.hpp" #include "audio_resampler_acm.hpp"
_AUDIO_NAMESPACE_START_ _AUDIO_NAMESPACE_START_
///////////////////////////////////////// /////////////////////////////////////////
/////// Private Functions //////// /////// Private Functions ////////
///////////////////////////////////////// /////////////////////////////////////////
void void
audio_resampler_acm::init_( void ) audio_resampler_acm::init_( void )
{ {
@ -90,7 +92,7 @@ _AUDIO_NAMESPACE_START_
void void
audio_resampler_acm::open( void ) audio_resampler_acm::open( void )
{ {
@ -199,7 +201,7 @@ void
void void
audio_resampler_acm::close( void ) audio_resampler_acm::close( void )
{ {
@ -336,7 +338,7 @@ void
void void
audio_resampler_acm::audio_receive( unsigned char * data, unsigned int size ) audio_resampler_acm::audio_receive( unsigned char * data, unsigned int size )
{ {
MMRESULT err; MMRESULT err;
@ -393,4 +395,5 @@ void
} }
_AUDIO_NAMESPACE_END_ _AUDIO_NAMESPACE_END_

View file

@ -1,10 +1,10 @@
/* /*
* PROJECT: ReactOS Sound Record Application * PROJECT: ReactOS Sound Record Application
* LICENSE: GPL - See COPYING in the top level directory * LICENSE: GPL - See COPYING in the top level directory
* FILE: base/applications/sndrec32/audio_wavein.cpp * FILE: base/applications/sndrec32/audio_wavein.cpp
* PURPOSE: Audio WaveIn * PURPOSE: Audio WaveIn
* PROGRAMMERS: Marco Pagliaricci <ms_blue (at) hotmail (dot) it> * PROGRAMMERS: Marco Pagliaricci <ms_blue (at) hotmail (dot) it>
*/ */
#include "stdafx.h" #include "stdafx.h"
#include "audio_wavein.hpp" #include "audio_wavein.hpp"
@ -14,8 +14,8 @@
_AUDIO_NAMESPACE_START_ _AUDIO_NAMESPACE_START_
void void
audio_wavein::init_( void ) audio_wavein::init_( void )
{ {
ZeroMemory(( LPVOID ) &wave_format, ZeroMemory(( LPVOID ) &wave_format,
sizeof( WAVEFORMATEX )); sizeof( WAVEFORMATEX ));
@ -34,7 +34,7 @@ _AUDIO_NAMESPACE_START_
void void
audio_wavein::alloc_buffers_mem_( unsigned int buffs, float secs ) audio_wavein::alloc_buffers_mem_( unsigned int buffs, float secs )
{ {
@ -105,7 +105,7 @@ void
void void
audio_wavein::free_buffers_mem_( void ) audio_wavein::free_buffers_mem_( void )
{ {
@ -128,7 +128,7 @@ void
void void
audio_wavein::init_headers_( void ) audio_wavein::init_headers_( void )
{ {
@ -173,7 +173,7 @@ void
void void
audio_wavein::prep_headers_( void ) audio_wavein::prep_headers_( void )
{ {
MMRESULT err; MMRESULT err;
bool error = false; bool error = false;
@ -210,7 +210,7 @@ void
} }
void void
audio_wavein::unprep_headers_( void ) audio_wavein::unprep_headers_( void )
{ {
MMRESULT err; MMRESULT err;
bool error = false; bool error = false;
@ -247,7 +247,7 @@ void
void void
audio_wavein::add_buffers_to_driver_( void ) audio_wavein::add_buffers_to_driver_( void )
{ {
MMRESULT err; MMRESULT err;
bool error = false; bool error = false;
@ -286,7 +286,7 @@ void
void void
audio_wavein::close( void ) audio_wavein::close( void )
{ {
@ -357,7 +357,7 @@ void
void void
audio_wavein::open( void ) audio_wavein::open( void )
{ {
MMRESULT err; MMRESULT err;
@ -519,7 +519,7 @@ void
void void
audio_wavein::start_recording( void ) audio_wavein::start_recording( void )
{ {
MMRESULT err; MMRESULT err;
@ -611,7 +611,7 @@ void
void void
audio_wavein::stop_recording( void ) audio_wavein::stop_recording( void )
{ {
@ -697,7 +697,7 @@ void
DWORD WINAPI DWORD WINAPI
audio_wavein::recording_procedure( LPVOID arg ) audio_wavein::recording_procedure( LPVOID arg )
{ {

View file

@ -6,7 +6,6 @@
* PROGRAMMERS: Marco Pagliaricci <ms_blue (at) hotmail (dot) it> * PROGRAMMERS: Marco Pagliaricci <ms_blue (at) hotmail (dot) it>
*/ */
#include "stdafx.h" #include "stdafx.h"
#include "audio_waveout.hpp" #include "audio_waveout.hpp"
@ -886,4 +885,5 @@ audio_waveout::playing_procedure( LPVOID arg )
return 0; return 0;
} }
_AUDIO_NAMESPACE_END_ _AUDIO_NAMESPACE_END_

View file

@ -10,6 +10,10 @@
_AUDIO_NAMESPACE_START_ _AUDIO_NAMESPACE_START_
enum audio_waveout_status { WAVEOUT_NOTREADY, WAVEOUT_READY, enum audio_waveout_status { WAVEOUT_NOTREADY, WAVEOUT_READY,
WAVEOUT_PLAYING, WAVEOUT_ERR, WAVEOUT_PLAYING, WAVEOUT_ERR,
WAVEOUT_PAUSED, WAVEOUT_STOP WAVEOUT_PAUSED, WAVEOUT_STOP
@ -17,6 +21,9 @@ enum audio_waveout_status { WAVEOUT_NOTREADY, WAVEOUT_READY,
}; };
class audio_waveout class audio_waveout
{ {

View file

@ -1,12 +1,10 @@
/* /*
* PROJECT: ReactOS Sound Record Application * PROJECT: ReactOS Sound Record Application
* LICENSE: GPL - See COPYING in the top level directory * LICENSE: GPL - See COPYING in the top level directory
* FILE: base/applications/sndrec32/sndrec32.cpp * FILE: base/applications/sndrec32/sndrec32.cpp
* PURPOSE: Application Startup * PURPOSE: Application Startup
* PROGRAMMERS: Marco Pagliaricci <ms_blue (at) hotmail (dot) it> * PROGRAMMERS: Marco Pagliaricci <ms_blue (at) hotmail (dot) it>
*/ */
#include "stdafx.h" #include "stdafx.h"
#include "sndrec32.h" #include "sndrec32.h"
@ -59,6 +57,7 @@ snd::audio_wavein * AUD_IN;
BOOL s_recording; BOOL s_recording;
int APIENTRY _tWinMain(HINSTANCE hInstance, int APIENTRY _tWinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance, HINSTANCE hPrevInstance,
LPTSTR lpCmdLine, LPTSTR lpCmdLine,
@ -75,12 +74,6 @@ int APIENTRY _tWinMain(HINSTANCE hInstance,
InitCommonControls(); InitCommonControls();
butbmps[0] = LoadBitmap( hInstance, MAKEINTRESOURCE( IDB_BITMAP2_START )); butbmps[0] = LoadBitmap( hInstance, MAKEINTRESOURCE( IDB_BITMAP2_START ));
butbmps[1] = LoadBitmap( hInstance, MAKEINTRESOURCE( IDB_BITMAP2_END )); butbmps[1] = LoadBitmap( hInstance, MAKEINTRESOURCE( IDB_BITMAP2_END ));
butbmps[2] = LoadBitmap( hInstance, MAKEINTRESOURCE( IDB_BITMAP2_PLAY )); butbmps[2] = LoadBitmap( hInstance, MAKEINTRESOURCE( IDB_BITMAP2_PLAY ));
@ -120,7 +113,6 @@ int APIENTRY _tWinMain(HINSTANCE hInstance,
isnew = TRUE; isnew = TRUE;
samples_max = AUD_buffer.total_samples(); samples_max = AUD_buffer.total_samples();
@ -197,17 +189,17 @@ ATOM MyRegisterClass(HINSTANCE hInstance)
wcex.cbWndExtra = 0; wcex.cbWndExtra = 0;
wcex.hInstance = hInstance; wcex.hInstance = hInstance;
wcex.hIcon = LoadIcon( hInstance, MAKEINTRESOURCE( IDI_SNDREC32 )); wcex.hIcon = LoadIcon( hInstance, MAKEINTRESOURCE( IDI_SNDREC32 ));
wcex.hCursor = LoadCursor(NULL, IDC_ARROW); wcex.hCursor = LoadCursor( NULL, IDC_ARROW );
wcex.hbrBackground = (HBRUSH)(16); wcex.hbrBackground = (HBRUSH)( 16 );
wcex.lpszMenuName = MAKEINTRESOURCE(IDR_MENU1); wcex.lpszMenuName = MAKEINTRESOURCE( IDR_MENU1 );
wcex.lpszClassName = szWindowClass; wcex.lpszClassName = szWindowClass;
wcex.hIconSm = LoadIcon( wcex.hInstance, MAKEINTRESOURCE( IDI_SNDREC32 )); wcex.hIconSm = LoadIcon( wcex.hInstance, MAKEINTRESOURCE( IDI_SNDREC32 ));
return RegisterClassEx(&wcex); return RegisterClassEx( &wcex );
} }
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow) BOOL InitInstance( HINSTANCE hInstance, int nCmdShow )
{ {
HWND hWnd; HWND hWnd;
@ -279,7 +271,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
buttons[i] = CreateWindow( buttons[i] = CreateWindow(
TEXT("button"), TEXT("button"),
TEXT(""), TEXT(""),
WS_CHILD|WS_VISIBLE| BS_BITMAP, WS_CHILD|WS_VISIBLE|BS_BITMAP,
BUTTONS_CX + ( i * (BUTTONS_W+((i == 0)?0:BUTTONS_SPACE))), BUTTONS_CX + ( i * (BUTTONS_W+((i == 0)?0:BUTTONS_SPACE))),
BUTTONS_CY, BUTTONS_W, BUTTONS_H, hWnd, BUTTONS_CY, BUTTONS_W, BUTTONS_H, hWnd,
(HMENU)i, hInst, 0 (HMENU)i, hInst, 0
@ -376,7 +368,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
// //
slider_pos = SendMessage(slider, TBM_GETPOS, 0, 0); slider_pos = SendMessage( slider, TBM_GETPOS, 0, 0 );
AUD_BUF->set_position( AUD_BUF->set_position(
@ -400,10 +392,10 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
case WM_COMMAND: case WM_COMMAND:
wmId = LOWORD(wParam); wmId = LOWORD( wParam );
wmEvent = HIWORD(wParam); wmEvent = HIWORD( wParam );
if (( wmId >= 0 ) && ( wmId < 5 ) && (butdisabled[wmId] == TRUE)) if (( wmId >= 0 ) && ( wmId < 5 ) && ( butdisabled[wmId] == TRUE ))
break; break;
switch (wmId) switch (wmId)
@ -638,7 +630,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
stopped_flag = FALSE; stopped_flag = FALSE;
} }
SendMessage(slider, TBM_SETPOS, (WPARAM) TRUE, (LPARAM) slider_pos); SendMessage( slider, TBM_SETPOS, (WPARAM) TRUE, (LPARAM) slider_pos );
@ -718,6 +710,20 @@ VOID disable_but( DWORD id )
} }
BOOL open_wav( TCHAR * f ) BOOL open_wav( TCHAR * f )
{ {
@ -734,8 +740,6 @@ BOOL open_wav( TCHAR * f )
DWORD is_read = 0; DWORD is_read = 0;
file = CreateFile( file = CreateFile(
f, f,
GENERIC_READ, GENERIC_READ,
@ -757,7 +761,6 @@ BOOL open_wav( TCHAR * f )
); );
return FALSE; return FALSE;
} }
@ -774,7 +777,6 @@ BOOL open_wav( TCHAR * f )
CloseHandle( file ); CloseHandle( file );
return FALSE; return FALSE;
} }
@ -783,7 +785,6 @@ BOOL open_wav( TCHAR * f )
if ( !b ) if ( !b )
{ {
MessageBox( MessageBox(
main_win, main_win,
TEXT("Cannot read WAVE header."), TEXT("Cannot read WAVE header."),
@ -793,7 +794,6 @@ BOOL open_wav( TCHAR * f )
CloseHandle( file ); CloseHandle( file );
return FALSE; return FALSE;
} }
@ -802,7 +802,6 @@ BOOL open_wav( TCHAR * f )
if ( !b ) if ( !b )
{ {
MessageBox( MessageBox(
main_win, main_win,
TEXT("Cannot read WAVE subchunk."), TEXT("Cannot read WAVE subchunk."),
@ -812,7 +811,6 @@ BOOL open_wav( TCHAR * f )
CloseHandle( file ); CloseHandle( file );
return FALSE; return FALSE;
} }
bytes_recorded_in_wav = r.chunksize - 36; bytes_recorded_in_wav = r.chunksize - 36;
@ -829,7 +827,6 @@ BOOL open_wav( TCHAR * f )
CloseHandle( file ); CloseHandle( file );
return FALSE; return FALSE;
} }
@ -858,7 +855,6 @@ BOOL open_wav( TCHAR * f )
if (( !b ) || ( is_read != bytes_recorded_in_wav )) if (( !b ) || ( is_read != bytes_recorded_in_wav ))
{ {
MessageBox( MessageBox(
main_win, main_win,
TEXT("Cannot read file. Error reading audio data."), TEXT("Cannot read file. Error reading audio data."),
@ -870,7 +866,6 @@ BOOL open_wav( TCHAR * f )
AUD_BUF->reset(); AUD_BUF->reset();
return FALSE; return FALSE;
} }
CloseHandle( file ); CloseHandle( file );
@ -892,7 +887,7 @@ BOOL open_wav( TCHAR * f )
BOOL BOOL
write_wav( TCHAR * f ) write_wav( TCHAR * f )
{ {
HANDLE file; HANDLE file;