I am completely baffled by the lack of documentation for the Windows Media Player ripping interface. Has anybody successfully used it before? I am creating a system for my car, very similar to sync, and would like to add the ability to programmatically rip music from the inserted CD then add it to the music database built in to the program.

The way I have it right now, it will only rip the cd about 5% of the time, the rest of the time the RipStatus stays at 'stopped' and the rippedprogress stays at 100. I'm in a serious state of WTF

WMPLib.IWMPCdrom x = axWindowsMediaPlayer2.cdromCollection.Item(0);
            iwmp = (WMPLib.IWMPCdromRip)x;
            iwmp.startRip();
            if (iwmp.ripState == WMPLib.WMPRipState.wmprsRipping)
            {
                //timer that polls for a progress bar
                pollRipState.Enabled = true;
                progressBar1.Visible = true;
            }            
            else
                MessageBox.Show("For some reason the cd could not be ripped");

Maybe it's the way I'm accessing the cdrom for the wmp components cdrom collection. But when i put a breakpoint in and step over that, it appears to load the correct cd info, complete with track list etc. I also thought maybe since the data was added to the Windows Media Player library that it deliberately didnt rip those songs. So i manually removed them from the library and still no go. ANY help would be appreciated.

I figuired it out. For some reason x (the cd rom interface) wasn't actually being loaded until it was used. So casting it to a CdromRip interface was actually casting a bunch of null values. Adding this code caused it to load:

x.Playlist.get_Item(0);

I'm sure there is a better way to grab a cdrom interface. Maybe someone here has some better ideas.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.