Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Audio problem/API

Options
  • 23-06-2008 12:03pm
    #1
    Registered Users Posts: 161 ✭✭


    Hey all,

    Does anyone have an idea how I could implement the following?

    Im trying to write a program to queue and play music. My first idea was to have a database with a table of mp3 details (id, name, dir, etc) and a table called queue which would queue up the id's of the songs to be played. Then using the following code (java):
    try{
       final String launch = "cmd /c start " + filePath;
       (Runtime.getRuntime()).exec(launch);
    } catch (IOException e) ;
    

    which would run the song in the default audio player. One problem with this way is how do I know when a song is finished- to delete the first in the queue and play the next? Anybody have any ideas to overcome this?

    Or does someone know of an api to handle this section- you dont have to limit to java, I have a little experience in C# also and I'm willing to learn anything new to accomplish this.

    Hopefully someone can help me out,
    Thanks in advance...


Comments

  • Registered Users Posts: 2,931 ✭✭✭Ginger


    You could output the file list as a M3U file and pass that to the player. Then let the player let it handle it.

    Otherwise you will have to create a wrapper than integrates into your selected music players than can send notification that the song has finished and request a new song...


  • Registered Users Posts: 1,996 ✭✭✭lynchie


    Have a read of JMF. It has a mp3 plugin so no need to spawn a separate process to play it.


  • Registered Users Posts: 161 ✭✭ViperMAN


    Thanks guys-

    Had a quick look at the JMF- its looks like it does everything I need. Is there any C# APIs out there- I just want to keep all options open!


  • Closed Accounts Posts: 94 ✭✭Done and dusted


    C# API's Im not entirly sure, but i think I have seen some on the codeproject before (Some guy made his own version of winamp). If you cant find it post a message on the msdn forums in the c# section. If you do get an answer be sure to post the solution here in case someone else in the future finds themselfs in the same spot.


    Edit

    I found one of the articles on the codeproject about it: http://www.codeproject.com/KB/audio-video/mp3player.aspx its in C++ though. But it could give you a reason to go and learn a new language! I always find the that finding a solution which makes me go and learn some new technology always a good thing albeit very annoying :D

    MSDN : http://www.google.ie/search?hl=en&q=MP3+player+msdn+forums&btnG=Google+Search&meta= the first link should help too


  • Registered Users Posts: 161 ✭✭ViperMAN


    Thanks for you help done and dusted-

    I have found the following which might be of help:
    C#:

    Thread on C# MP3 player (sample code)

    C# C-Sharpecorner Example C# Example MP3 Player

    Sdl.NET MP3 player example code


  • Advertisement
  • Closed Accounts Posts: 94 ✭✭Done and dusted


    Cool, glad I could help!

    Let us know how ya get on plus if you want someone to test the app for you I would be more than happy to give a dig out!

    Happy Coding


Advertisement