Audio Playback (WinCE)
Overview
This article demonstrates how audio can be played using program in C and C#.
Audio Playback in C
Using Waveform Audio Functions
- Waveform Audio Functions (WAF) can only play waveform (or uncompressed) files. For more information see MSDN.
- Demo project can be downloaded here.
- To build the project, navigate to Build menu in Visual studio and click Build Solution.
- If the project does not build, go to
Project Settings → Configuration Properties → Linker → Input
In the property
"Additional Dependencies", add the library "strmiids.lib".
- If the project does not build, go to
- Click Deploy solution in the Build menu to deploy the application. A sample WAV clip will also be deployed along with the executable demo file.
- Goto My Device > Program Files > vcpp_audio_playback_waf. Double click on the vcpp_audio_playback_waf.exe to run the application.
Using DirectShow
- DirectShow libraries can be used to play files with extensions .wav, .mp3, .wma, .ogg etc. For more information see MSDN.
- Demo project can be downloaded here.
- To build the project, navigate to Build menu in Visual studio and click Build Solution.
- If the project does not build, go to
Project Settings → Configuration Properties → Linker → Input
In the property
"Additional Dependencies", add the library "strmiids.lib".
- If the project does not build, go to
- Click Deploy solution in the Build menu to deploy the application. A sample MP3 clip will also be deployed along with the executable demo file.
- Goto My Device > Program Files > vcpp_audio_playback_ds. Double click on the vcpp_audio_playback_ds.exe to run the application.
Image shows the output window for both vcpp_audio_playback_waf and vcpp_audio_playback_ds demo applications.
Audio Playback in CSharp
Using DirectShow
- Demo application can be downloaded from here.
- Navigate to Solution Explorer in visual studio > Right Click on Solution > Properties > Devices.
- Uncheck "Deploy the Latest version of the .NET Compact Framework (including Service Packs)".
- Build and deploy the project on your WinCE device.
- Download and Install .NET Compact Framework directly to the FlashDisk of the device from here.
- Go to My Device > Program Files > vcsharp_audio_playback_demo and run the application vcsharp_audio_playback_demo.exe.
Following GUI will open with different controls.
Note: vcsharp_audio_plyback_demo uses DirectShow.net library functions from DirectShowLib-2005.dll from a third party. Microsoft does not provide a managed API for DirectShow. Documentation related to this library and its licence is given here.