TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Phil Higgins
NA
1
0
Playing mp3 via MCI
Jun 16 2007 9:44 PM
Hi there,
I've been trying to get mp3's to play using MCI in C#, however, no matter what I do they don't seem to play. I can play wav files fine using the same code, but the mciSendString() function returns the error "A problem occured ininitializing MCI" if i try to use mp3 files.
Here are the relevant parts of the code:
public void Open( String fileName, String alias, MM_TYPE type )
{
     bool alreadyExists = false;
     foreach( String s in aliases )
     {
          if( s.Equals( alias ) )
          {
               alreadyExists = true;
          }
     }
     if( !alreadyExists )
     {
          switch( type )
          {
               case MM_TYPE.CD_AUDIO:
               command = "open cdaudio!" + fileName + " alias " + alias ;
               break;
               case MM_TYPE.MIDI_AUDIO:
               command = "open sequencer!" + fileName + " alias " + alias ;
               break;
              m case MM_TYPE.WAVE_AUDIO:
               command = "open waveaudio!" + fileName + " alias " + alias ;
               break;
               case MM_TYPE.MP3_AUDIO:
               command = "open MPEGVideo!" + fileName + " alias " + alias;
               break;
          }
          SendString();
          aliases.Add( alias );
     }
}
private void SendString()
{
     StringBuilder errorBuffer = new StringBuilder( 128, 128 );
     int error= mciSendString( command, errorBuffer, 128, 0 );
     if( error != 0 )
     {
          int retval = mciGetErrorString( error, errorBuffer, 128 );
     }
}
Any suggestions on why this isn't working would be appreciated very much!
Thanks :)
Reply
Answers (
0
)
Can I group items for alignment in Visual Studio?
How can I make a "Play Again" button restart application from a custom dialog box?