Forum     

Go Back   Digit Technology Discussion Forum > Software > Programming
Register FAQ Calendar Mark Forums Read

Programming The destination for developers - C, C++, Java, Python and the lot


Closed Thread
 
LinkBack Thread Tools Display Modes
Old 29-07-2008, 11:06 PM   #1 (permalink)
Kcots Hserf
 
trublu's Avatar
 
Join Date: Dec 2007
Posts: 170
Default Java project


I was thinking of making a multimedia player as a part of my Java project.It wud b a basic one,other features wud b added as i learn more.So,the question is,can it b done using Java only? Or do i need to study ne thing else?Pls suggest some useful resources too.
__________________
ASUS K53SM-SX0101D | Samsung Wave 525 | Canon EOS 1000D | 18-55 mm | 50mm f1.8

Registered Linux User #471793
trublu is offline  
Advertisements. Register and be a member of the community to get rid of them.
Advertisement

Old 29-07-2008, 11:11 PM   #2 (permalink)
CAFEBABE
 
chandru.in's Avatar
 
Join Date: Mar 2008
Location: Bangalore
Posts: 474
Default Re: Java project

Java alone is more than enough. You need to use JMF (Java Media Framework) for this.
__________________
Chandru

http://tuxychandru.blogspot.com
chandru.in is offline  
Old 30-07-2008, 12:31 AM   #3 (permalink)
prasath->loves(APPLE);
 
prasath_digit's Avatar
 
Join Date: Jul 2008
Location: Trichy, TamilNadu
Posts: 231
Thumbs up Re: Java project

Or check this out, this is source code for a bare-bone command-line Java mp3 player:-

http://www.javalobby.org/java/forums/t18465.html

I've modified the Command-line player with a JFrame window :-

Code:
import java.io.FileInputStream;
import java.io.IOException;
import javax.sound.sampled.*;

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.lang.Thread;

import Limit.*;
 
public class Jmp3 extends JFrame implements ActionListener
{    

    JButton open,close;
    JFileChooser jfc;      

    Jmp3()
    {
       super("Java MP3 Player");
       setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
       setLayout(new FlowLayout());
       setSize(400,300);
       setVisible(true);
       close = new JButton("Close");
       open = new JButton("Open");
       close.addActionListener(this);
       open.addActionListener(this);
       this.add(close);
       this.add(open);
  
       jfc = new JFileChooser();
       jfc.addChoosableFileFilter(new ImageFilter());       
    }

    public void actionPerformed(ActionEvent ae)
    {
       if(ae.getActionCommand() == "Close")
            System.exit(0);
       if(ae.getActionCommand() == "Open")
            play();
            
    }

    public void play()
    {
        if(jfc.showOpenDialog(this) == JFileChooser.APPROVE_OPTION)
        {
    AudioInputStream din = null;      
    try 
        {              
        FileInputStream file = new FileInputStream(jfc.getSelectedFile());
        AudioInputStream in = AudioSystem.getAudioInputStream(file);
        AudioFormat baseFormat = in.getFormat();
        AudioFormat decodedFormat = new AudioFormat(
                                        AudioFormat.Encoding.PCM_SIGNED,
                    baseFormat.getSampleRate(), 16, baseFormat.getChannels(),
                    baseFormat.getChannels() * 2, baseFormat.getSampleRate(),
                    false);
        din = AudioSystem.getAudioInputStream(decodedFormat, in);
        DataLine.Info info = new DataLine.Info(SourceDataLine.class, decodedFormat);
        SourceDataLine line = (SourceDataLine) AudioSystem.getLine(info);
        if(line != null) 
                {
            line.open(decodedFormat);
            byte[] data = new byte[4096];

            // Start

            line.start();
                
            int nBytesRead;

            while ((nBytesRead = din.read(data, 0, data.length)) != -1) 
                        {    
                line.write(data, 0, nBytesRead);
            }
                }
            
    }
    catch(Exception e) 
        {
        e.printStackTrace();
    }
    finally 
        {
        if(din != null) 
                {
            try 
                        { 
                                din.close(); 
                        }
                        catch(IOException e) 
                        {
                                // Nothing here
                        }
        }
    }
        }
    }

    public static void main(String[] args) 
    {
        new Jmp3();
    }
}
Code:
package Limit;

import java.io.File;
import javax.swing.*;
import javax.swing.filechooser.*;

public class ImageFilter extends FileFilter 
{
    public boolean accept(File f) 
    {
        String extension = Utils.getExtension(f);
        if (extension != null) 
        {
            if (extension.equals(Utils.bpt))
            {
                    return true;
            } 
            else 
            {
                return false;
            }
        }
        return false;
    }

    public String getDescription() 
    {
        return "MP3 Audio File (.mp3)";
    }
}

class Utils 
{
    public final static String bpt = "mp3";

    public static String getExtension(File f) 
    {
        String ext = null;
        String s = f.getName();
        int i = s.lastIndexOf('.');

        if (i > 0 &&  i < s.length() - 1)         
            ext = s.substring(i+1).toLowerCase();        

        return ext;
    }
}

Last edited by prasath_digit; 30-07-2008 at 07:00 PM. Reason: To provide source code
prasath_digit is offline  
Old 30-07-2008, 10:42 PM   #4 (permalink)
Kcots Hserf
 
trublu's Avatar
 
Join Date: Dec 2007
Posts: 170
Default Re: Java project

Thankx both of you.
@prasath_amd,thanx for the code.but i prefer to do it myself.

how do i add codec support?
__________________
ASUS K53SM-SX0101D | Samsung Wave 525 | Canon EOS 1000D | 18-55 mm | 50mm f1.8

Registered Linux User #471793

Last edited by trublu; 30-07-2008 at 11:15 PM. Reason: Automerged Doublepost
trublu is offline  
Old 30-07-2008, 11:29 PM   #5 (permalink)
prasath->loves(APPLE);
 
prasath_digit's Avatar
 
Join Date: Jul 2008
Location: Trichy, TamilNadu
Posts: 231
Default Re: Java project

Quote:
Originally Posted by trublu View Post
@prasath_amd,thanx for the code.but i prefer to do it myself.
I gave it only to give u some basic idea tats all.......

Quote:
Originally Posted by trublu View Post
how do i add codec support?
don know abt tat.....but i think JMF should do it.......

JMF:-

http://java.sun.com/javase/technolog.../jmf/index.jsp

This may be useful for u:-

http://www.javaranch.com/

Last edited by prasath_digit; 30-07-2008 at 11:33 PM. Reason: Automerged Doublepost
prasath_digit is offline  
Old 31-07-2008, 09:05 AM   #6 (permalink)
Kcots Hserf
 
trublu's Avatar
 
Join Date: Dec 2007
Posts: 170
Default Re: Java project

Quote:
Originally Posted by prasath_amd View Post
I gave it only to give u some basic idea tats all.......
I really appreciate your help.I just said dat i wanna do it myself.
__________________
ASUS K53SM-SX0101D | Samsung Wave 525 | Canon EOS 1000D | 18-55 mm | 50mm f1.8

Registered Linux User #471793
trublu is offline  
Old 02-08-2008, 09:48 PM   #7 (permalink)
Indidiot
 
Plasma_Snake's Avatar
 
Join Date: Dec 2007
Location: Rock Island
Posts: 1,416
Question Re: Java project

Sorry for budging in but I too have to give a Minor Project after my vacations. I know Core JAVA only and was thinking about making a Torrent Client. Is it possible to make one with my limited knowledge of the subject? Where can i get its exemplary Source Code?
Plasma_Snake is offline  
Old 09-08-2008, 09:41 PM   #8 (permalink)
In The Zone
 
bukaida's Avatar
 
Join Date: Jul 2005
Location: KOLKATA
Posts: 267
Default Re: Java project

Search here:-

http://java.codeproject.com/

BTW You must know how to write the project report too. It should follow a specified format.
__________________
Desktop: P-IV 2.4GHz, 512MB DDR, 865GBF Mother Board,
G-Force 5200FX, 17" Samsung flat, WinXp with SP2,
Kaspersky Internet Security 2009.
Laptop:LENOVO 3000 C100 D7 lappy with 2GB DDR2.
bukaida is offline  
Old 09-08-2008, 11:27 PM   #9 (permalink)
Right Off the Assembly Line
 
Join Date: Mar 2008
Posts: 18
Default Re: Java project

i also need to make a java project...i knw basic java programming till applets..i also want to giv it a interface....
shwetz is offline  
Old 10-08-2008, 05:45 AM   #10 (permalink)
Commander in Chief
 
QwertyManiac's Avatar
 
Join Date: Jul 2005
Posts: 6,658
Default Re: Java project

Learn AWT and then Swing for that.
__________________
Harsh J
www.harshj.com
QwertyManiac is offline  
Old 21-09-2008, 11:17 AM   #11 (permalink)
Right Off the Assembly Line
 
Join Date: Jul 2008
Posts: 1
Default Re: Java project

i need hrlp for search engine project on JAVA,,i m begnner for this,,,plzzzzzz
mahender_joshi is offline  
Closed Thread

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help me on a Java Project redhat Programming 7 01-11-2007 07:07 PM
java project help... Pragadheesh QnA (read only) 2 23-08-2007 10:50 PM
Project in C#.NET or Java ... manas QnA (read only) 1 01-02-2007 02:21 PM
Project in java dreamweaver9962 QnA (read only) 1 19-01-2006 05:48 PM
project in java shivi4 QnA (read only) 3 14-07-2005 05:40 PM

 
Latest Threads
- by Sujeet
- by clmlbx
- by Sujeet
- by icebags

Advertisement




All times are GMT +5.5. The time now is 11:07 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.

Search Engine Optimization by vBSEO 3.3.2