Click here to Skip to main content
15,887,596 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
I have got following code:
C++
CImage local_image;
			CaptureWndShot(local_main_dialog->web_camera_dialog.m_hWnd,&local_image,ENGINE_WINDOWS_SIZE_CX/2,ENGINE_WINDOWS_SIZE_CY/2);

			IStream *local_stream;

			HRESULT local_create_IStream_result = CreateStreamOnHGlobal ( 0 , TRUE , &local_stream );

			HRESULT local_save_result = local_image.Save(local_stream, Gdiplus::ImageFormatJPEG);

I need to be able to compile following code:
C++
CAudioImage local_audio_image;
			CaptureAudioSampleShot(&local_audio_image);

			IStream *local_stream;

			HRESULT local_create_IStream_result = CreateStreamOnHGlobal ( 0 , TRUE , &local_stream );

			HRESULT local_save_result = local_audio_image.Save(local_stream, Gdiplus::ImageFormatPCM);

And
C++
CAudioImage local_audio_image;
			CaptureAudioSampleShot(&local_audio_image);

			IStream *local_stream;

			HRESULT local_create_IStream_result = CreateStreamOnHGlobal ( 0 , TRUE , &local_stream );

			HRESULT local_save_result = local_audio_image.Save(local_stream, Gdiplus::ImageFormatMP3);

Is it possable?

UPDATE:

I have got for example RAW PCM DATA and AM_MEDIA_TYPE of the RAW PCM DATA.
How can i write the wav file from RAW PCM DATA and AM_MEDIA_TYPE of the RAW PCM DATA?
Posted
Updated 23-Dec-15 20:35pm
v4
Comments
Сергей Козлов 23-Dec-15 20:46pm    
The CAudioImage class should be able to convert audio formats and should be able to save data to IStream.
[no name] 23-Dec-15 21:13pm    
What are your real objectives? If just "I need to be able to compile following code:" - well then start writing. There are many audio libraries available (Google will show them) for example OpenAL, FFMpeg. Which ones have you looked at and rejected?
Сергей Козлов 23-Dec-15 22:51pm    
I need the ATL class.
Сергей Козлов 23-Dec-15 22:56pm    
Does any ATL class already exist?
Сергей Козлов 23-Dec-15 22:54pm    
I write Skype, TeamViewer, Torrent in one project.

1 solution

The common and complete way to deal with audio streams and conversions is FFmpeg which I mentioned in a comment above. You will need to spend some time with it and I'm sure it will do all you require and plenty more: FFmpeg[^]
Using FFmpeg in Windows Applications | Building Apps for Windows[^]
audio types – FFmpeg[^]
 
Share this answer
 
v2
Comments
Сергей Козлов 24-Dec-15 7:10am    
Found writing wav header in the file "api-band-test.c" from ffmpeg-snapshot.tar.bz2 dating back to 2002 year.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900