baash05
baash05

Reputation: 4516

Play an mp3 on a Pocket PC with VSC++ code

Does anyone know of some mp3 playing code for the pocket PC.
I have 3 mp3s that I want to play when my application loads up, depending on how you log in.

I've used VS2005 C++ to code what I've got now.

I think code to play mp3 for the desk might do the job. But I might not have access to the library, that's why I've been specific.

Upvotes: 3

Views: 972

Answers (2)

Geries Handal
Geries Handal

Reputation: 63

I know the question is in C++, but here is good point on this.. Also like you say, the code that works for your desk also can work on the Pocket PC.

So I worked Windows Mobile app don in C#, that had a reminder feature and we used the wmplib (Windows Media Player) Library to play songs (mp3 included).

First you need to add the wmp.dll to the references, found in c:\Windows\System32 (or what ever is your windows directory). Then you just need to code it like this:

private WMPLib.WindowsMediaPlayer player = new WMPLib.WindowsMediaPlayer();
// url is the path of the file
private void PlayFile(String url)
{

    player = new WMPLib.WindowsMediaPlayer();
    player.URL = url;
    player.settings.volume = 100;
    player.controls.play();
}

Here is the reference for this code

And for the C++ here you can find how to do it

Upvotes: 1

atzz
atzz

Reputation: 18010

You can use DirectShow. Here is an example (it plays a video file, but exactly the same code will work for audio). Unfortunately, Windows Mobile lacks a suitable splitter to decode plain .mp3 files, but there is a workaround: you can add a RIFF header to your MP3s (producing MPEG-compressed WAV files).

Upvotes: 1

Related Questions