Introduction
This wrapper class implements standard waveform APIs in object oriented way. It supports following features :
- Supports both wave_in and wave_out object in one class. You can indicate which type of stream to use by setting Direction.
- Use my own private stream device interface to abstract the real world stream behavior. This interface is still under development.
- All memory allocation and deallocation is managed by theobject itself. That is, the caller never worries about memory. This is achieved by using
IIDataSource
& IIDataSink
interface defined by myself.
- The use of callback functions instead of callback windows. This is especially suitable for drawing intensive programs.
- The use of the private
IIAdvise
interface, through which you can notify the client by window, thread ID, event and callback function. Very flexible. In my own project I use a separate thread to process the wave data.
- Support volume control on wave_in and wave_out stream.
- The use of
AddRef()
/Release()
to manage the object life cycle. (Similar to COM)
The package includes three files.
- CWaveForm.cpp
- CWaveForm.h
- Interface.h
How to use my classes:
- Create a wave object
new CWaveForm(...)
This contractor has couples parameters. Stream direction (in or out), wave in device id, wave out device id, wave in format, wave out format, wave in volume, wave out volume. Remember to call AddRef()
- Wave device operation sequence :
open()->start()->stop()->close()
.
- Whenever wave in data is incoming, the object itself will invoke, that is, callback to the client. Then client calls the
Read(ppData)
function to get data buffer. After processing, client calls ReadDone(pData)
to return data buffer.
- Whenever the client wants to send data to the wave out device, it can call
Write()
twice. The first call should provides an empty pointer, which will be filled with a valid buffer address. Then the client can write any data to this buffer, then call Write()
again to queue this buffer back to wave out object.
- Please call
Release()
to free wave object.
Example
- Create new wave object:
WaveForm = new CWaveForm
(
WAVE_FORM_FLOW_BOTH,
m_waveInDeviceID,
m_waveOutDeviceID,
&m_waveInFormatEx,
&m_waveOutFormatEx,
m_waveInVolume,
m_waveOutVolume
);
WaveForm->AddRef();
WaveForm->AddRef();
- Client advises call back interface:
WaveForm->Advise
(
(DWORD)m_hThread,
0,
WM_STREAM_NOTIFY,
CALLBACK_THREAD
);
- Whenever wave in data is coming:
Invoke(WM_STREAM_NOTIFY, SUB_EVENT_WAVE_IN, 0);
- Client reading data:
PWAVEFRAME pWaveFrame;
WaveForm->Read(&pWaveFrame);
.
.
.
.
WaveForm->ReadDone(pWaveFrame);
- Client write data to wave out device:
PWAVEFRAME pWaveFrame = NULL;
WaveForm->Write(&pWaveFrame);
.
.
.
.
WaveForm->Write(pWaveFrame);
- After using wave object:
WaveForm->Release();
WaveForm->Release();
Graduated from Shanghai Tongji university in 1997 with bachelor degree in computer science, Wenbin got his first job as a system engineer at Bell Alcatel Mobile Shanghai office responsible for telcom-class mobile system development and deployment. Since then, Wenbin has in turn worked for Intel and Microsoft both inside and outside China, first as senior engineer, later project manager and then senior product manager.
With 15-year experience working with the world top IT companies, Wenbin has developed solid skill in C/C++, C#, Java, software engineering, agile development, etc, and multiple talents in product management, public presentation and speech, etc. He has always been an active member at PMI (Project Management Institution) and a regular lecture at Intel Developer Forum, Microsoft TechED conference as well as many other world-class industrial conferences. His wide-ranged industrial practice and high-level personal maturity have made him one of the best in public speech and professional training.
Over the years, Wenbin has cultivated his very own style in public speech, which is considered informative, engaging and refined. Since last year, Wenbin has also taken new adventure in project and product management consulting business and has proven high capacity through his work with many local emergent IT firms. Wenbin’s specialty in management consulting is on project management methodologies and processes, project management tools (e.g. MS Project), and team recruitment, build, and motivation.
In addition, Wenbin has received many professional qualifications including MCSE (Microsoft Certified System Engineer), MCSD (Microsoft Certified System Developer), MCDBA (Microsoft Certified Database Administrator), SCJP 2 (Sun Certified Java Programmer 2), and PMP (PMI Certified Project Management Professional). On top of that, Wenbin has got several on-duty inventions and one of them was successfully patented by United States Patent and Trademark Office.