×

Discussion Board

Results 1 to 6 of 6
  1. #1
    Registered User
    Join Date
    Jan 2007
    Posts
    17

    Access to file with emulator

    Hi, I want to access to a audio file with carbide emulator but I'dont know where I must put it. I'm able to access to an image but with audio file don't work.

    The code for image:
    Code:
    FileConnection fileConn = (FileConnection)Connector.open(imgName, Connector.READ);
                // load the image data in memory
                // Read data in CHUNK_SIZE chunks
                InputStream fis = fileConn.openInputStream();
                long overallSize = fileConn.fileSize();
                int length = 0;
                byte[] imageData = new byte[0];
                while (length < overallSize) {
                    byte[] data = new byte[CHUNK_SIZE];
                    int readAmount = fis.read(data, 0, CHUNK_SIZE);
                    byte[] newImageData = new byte[imageData.length + CHUNK_SIZE];
                    System.arraycopy(imageData, 0, newImageData, 0, length);
                    System.arraycopy(data, 0, newImageData, length, readAmount);
                    imageData = newImageData;
                    length += readAmount;
                }
                fis.close();
                fileConn.close();
                if (length > 0) {
                    currentImage = Image.createImage(imageData, 0, length);
                }
                
                //currentImage=zoomIn(currentImage);
                repaint();

    Code for audio file:

    Code:
     String url = "file:///E:/folder/file.amr";
     player = Manager.createPlayer(url);
    All images and audio files are on C:\Nokia\Devices\Nokia_Prototype_SDK_4_0\devices\Prototype_4_0_S60_MIDP_Emulator\bin\Storage\Default\e\folder\
    This work fine on device but not on emulator.

    Thanks

  2. #2
    Super Contributor
    Join Date
    Oct 2005
    Location
    Hyderabad,India
    Posts
    1,156

    Re: Access to file with emulator

    Quote Originally Posted by zidia
    String url = "file:///E:/folder/file.amr";
    player = Manager.createPlayer(url);
    In the emulator E:\ is not present. Try placing the .amr file in c:\\nokia\\ and give this path onto your url.

    Hope that helps.

    Priju

  3. #3
    Registered User
    Join Date
    Jan 2007
    Posts
    17

    Re: Access to file with emulator

    Yes it is present into folder
    C:\Nokia\Devices\Nokia_Prototype_SDK_4_0\devices\Prototype_4_0_S60_MIDP_Emulator\bin\Storage\Default\e\

    This is the E:\\ on device.

    I think there is an error while taking the InputStream because the url is correct while displaying an image.
    Last edited by zidia; 2007-03-30 at 10:22.

  4. #4
    Regular Contributor
    Join Date
    Jan 2007
    Location
    Bangalore, India
    Posts
    100

    Re: Access to file with emulator

    I feel this thread has the solution u are looking for. Even i ahve worked with CcarbideJ and S60 Emulator

    http://discussion.forum.nokia.com/fo...d.php?t=102988
    with regards,
    Khalandar Pasha N
    (khalandar_p@yahoo.co.in)

  5. #5
    Registered User
    Join Date
    Jan 2007
    Posts
    17

    Re: Access to file with emulator

    Thanks but this thread didn't help me.

    I'putted both audio and image files into:
    C:\Nokia\Devices\Nokia_Prototype_SDK_4_0\devices\Prototype_4_0_S60_MIDP_Emulator\bin\Storage\Default\e\myFolder\
    and the urls are:

    Code:
    url="file:///E:/myFolder/a.amr"
    url="file:///E:/myFolder/a.jpg"
    but the emulator can create the InputStream only for images.
    For audio I tried with
    Code:
    player = Manager.createPlayer(url);
    and
    Code:
    FileConnection fileConn = FileConnection)Connector.open(url,Connector.READ);
    InputStream fis = fileConn.openInputStream();
    String ctype = "audio/amr";
    player = Manager.createPlayer(fis,ctype);
    and

    Code:
    InputStream is = this.getClass().getResourceAsStream(url);
    Player player = Manager.createPlayer(is, "audio/amr");
    but nothing.
    Thanks

  6. #6
    Regular Contributor
    Join Date
    Jan 2007
    Location
    Bangalore, India
    Posts
    100

    Re: Access to file with emulator

    Quote Originally Posted by zidia
    Code:
    InputStream is = this.getClass().getResourceAsStream(url);
    Player player = Manager.createPlayer(is, "audio/amr");
    What is the exception its giving here?
    Ur using Eclipse or Netbeans?
    I have the code for WTK2.5 if u want can share it with you??
    with regards,
    Khalandar Pasha N
    (khalandar_p@yahoo.co.in)

Similar Threads

  1. S60 theme questions
    By Nokian_Spb in forum Symbian Media (Closed)
    Replies: 3
    Last Post: 2006-08-17, 06:11
  2. Tips on using NDS 1.1
    By mitts in forum Symbian Tools & SDKs
    Replies: 7
    Last Post: 2006-01-18, 16:07
  3. 9210 emulator: Internet access advanced settings crashes
    By twaltari in forum Symbian Tools & SDKs
    Replies: 0
    Last Post: 2002-09-02, 07:37
  4. how can I open and test a compiled help file in the nokia 9210 emulator?
    By rubyyogaswara in forum Symbian Tools & SDKs
    Replies: 0
    Last Post: 2002-08-29, 05:09

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×