Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Audio problem/API

  • 23-06-2008 12:03PM
    #1
    Registered Users, Registered Users 2 Posts: 165 ✭✭


    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, Registered Users 2 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, Registered Users 2, Paid Member Posts: 2,032 ✭✭✭lynchie


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


  • Registered Users, Registered Users 2 Posts: 165 ✭✭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, Registered Users 2 Posts: 165 ✭✭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