2 questions about short mp3 files playback

I am installing a Snd simple class to encapsulate the sound effects, I can do this:

SND sound = new Snd ();

sound.throwSwitch ();   Plays a switch short audio mp3

So, after reviewing the RIM and other examples of Iam work try this:

import java.io.InputStream;
Javax.microedition.media import. *;

public class {Snd
   
Private player player;
   
Find the supported content types
public static final String types [] = Manager.getSupportedContentTypes (null);

public void throwSwitch() {}
Makes a click
for (cnt int = types.length - 1; cnt > = 0; cnt-) {}
If (types [cnt].equals("audio/mpeg")) {}
try {}
Get the MP3 file
Class clazz = Class.forName ("net.berrysoft.dib.sound");
InputStream is = clazz.getResourceAsStream ("switch.mp3");
InputStream is = getClass () .getResourceAsStream ("switch.mp3");
                   
Create an instance of the reader of the InputStream
Reader = javax.microedition.media.Manager.createPlayer (, "audio/mpeg" "");
Player.Realize ();
Player.prefetch ();
Player.Start ();            Start the player
Manager.playTone (0 x 45, 2000, 100);
} catch (Exception e) {}
e.printStackTrace ();
}
}
} / / end: for
}
   
}

but I don't get all the sounds.  I checked that the mp3 format is supported and loaded the sound of my press card and he played like a ring tone without problem.

What could I do it wrong?

Second question is that in the past (other languages), I had two ways to play a sound... one as a "one-shot" meaning not listened and streaming (used for sounds at large to hold entirely in memory).  In Java there is this distinction?  It seems that the above code transmissions my sound, but she is so short, she could be held entirely in memory.  It is played only once (at the start), but I wonder given it's such an effect short if there is a better way.

Patrick

Here is an example that works. In the example, the generated COD file is com_foo_Foobar, Foobar is the root for the COD file directory and Foobar.java is the main application class. The MP3 is at the root of the directory "/" the COD file. Notice the "Class.forName" call and how not intuitive that the root is specified in the parameter of this string. It took me quite a few tries until I thought about it.

    public void play()
    {
        if (m_player != null){
            stop();
        }

        try {
            Class cl = Class.forName("com.foo.Foobar.Foobar");
            InputStream input = cl.getResourceAsStream("/foonoise.mp3");
            m_player = Manager.createPlayer(input,"audio/mpeg");
            m_player.realize();
            m_volumeControl = getVolumeControl(m_player);
            if (m_volumeControl != null)
                m_volumeControl.setLevel(m_volume);
            m_player.prefetch();
            m_player.start();
        }
        catch (Exception e){
            System.out.println("ERR: " + e.toString());
        }
    }

Tags: BlackBerry Developers

Similar Questions

  • Question about playlists and file nav

    Research in get a rocket, or a variant of the Sansa, b/c I get lazy with the long method involved in duty sync w/iPod songs and their playlists, even with the Zune.

    I have read the manual for the rocket, and it seems that I can just drag and drop the files on the drive. My question is can I make records, as driving music, trance, etc. And then put different songs in every folder and then be able to go into that folder and shuffle the songs in that folder?

    Second issue (assuming that my answer is not), is on the creation of playlist. Looks like I have to do inside WMP playlists and then sync it to the top? Is there another way? I read an old thread on the use of other software to generate the playlist, but my playlist would be basically all the songs in a particular folder (the one I'm talking to the 2nd paragraph).

    Thank you for any input!

    eli2k wrote:

    I have read the manual for the rocket, and it seems that I can just drag and drop the files on the drive. My question is can I make records, as driving music, trance, etc. And then put different songs in every folder and then be able to go into that folder and shuffle the songs in that folder?

    Yes, with the most recent firmware, you can browse and read in folder.

  • Urgent question about loading image file to boot to a concentrator VPN 3030

    Hi Netpros,

    I really hope someone can help me with this URGENT matter. I have an upgrade in 12 hours. By reading the Cisco documentation, I also need to upgrade the boot image file. Here's my question... the cisco image file name is vpn30xxboot - 4.0.Rel.hex but the VPN concentrator would accept 8.3 file names i.e. BOOT file format. TXT... so the question is is it OK to just keep the same hexagonal extension without causing damage to the file... That is, name the file BOOT - 4.hex... your comments are very much appreciated...

    Fernando,

    Take it out '-' usage just and naming BOOT40.hex

    What type of hub? If it's a 3005, you wouldn't need an upgrade of startup code.

    There is enough of an upgrade of startup code if memory is upgraded from 256 to 512 MB - just an info.

    Good luck in your upgrade.

    See you soon

    Gilbert

  • Question about the password file

    Good afternoon

    In document s/n 2 days, she says:

    >
    When you call DBCA as part of the installation procedure for Oracle, DBCA database
    create a password with a single input file: the user SYS.
    >

    I created the database using DBCA and it must have created a file password for me since I was able to connect to the database remotely.

    The question is: I can't locate the created password THAT DBCA, I don't know what his name. Can someone give me the name of THAT DBCA is using the password file?

    Thanks a lot for help.

    John.

    ORACLE_HOME/dbs/orapw * IX and ORACLE_HOME/database / PWD.ora under windows

    Kind regards
    Uwe Hesse

    http://uhesse.WordPress.com

  • Satellite Pro L10: Question about saving the files on a CD

    Please can someone tell me how I can save a typed document (produced in Word or similar) on the CD? I don't have a floppy drive on my satellite pro L10 portable. Have 'saved' music using the immediate recording before, but now need to record your actual work on the hard disk for transport to a pc with access to a printer.

    When I tried it told me incorrect function, contact administrator (that's me!) I tried CD - R and CD - RW discs and neither would not let me save the file on it. would be grateful for any advice regarding this.

    Thank you

    Hi Roy,

    First of all, you will ned to ensure that you have enabled logging on oprical drive you. For this a right-click on the CD-ROM in my computer icon and then selecting "properties-> recording. Make sure that "Enable CD writing on this drive" is checked.

    Once you have done the above, you can simply drag the documents that you want to copy on the CD-ROM icon in my computer.

    Note that the burning process does not happen immediately. Windows caches the files to be placed on your hard drive first and then you can burn all documents cached only once.

    Alternatively, you may find that some third-party software has been bundled with your portable computer, which performs a similar function the standard Windows CD burn software.

    Kind regards

  • Question about a music file

    I have an audio file of 5 seconds which plays fine in Windows Media Player or QT. It's actually a file audio .wav. When it comes to an end after 5 seconds, and then it restarts as if he's stuck in a kind of 'loop' and it goes on ad infinitum.

    How to play only once, please? Do I need a sound/audio editor to edit the file?

    Thank you.

    Hi, Bluenose_ted,

    Have you created the file to embed in a web page?

    See the following article: how to create clips WAV (shows edition)

    http://www.ehow.com/how_5957935_create-WAV-clips.html

    See the code used for 'loop' (instant replay)

    http://www.boogiejack.com/add_sound.html

    Editors: Audacity, WavePad or Source Forge

  • Question about the .vmx file created on ESXi

    I'm trying to automate the creation of a virtual machine and take a snapshot. I use the vSphere SDK Perl.

    The problem I faced is if I create a virtual machine called TestVM, the .vmx file created on the ESXi is TestVM_1.vmx instead of TestVM.vmx due to which my snapshot creation fails.

    I faced the same problem, if I manually create the virtual computer. If there is no other computer virtual with the same name.

    A restart of the server ESXi fixed the problem.

  • OCP: Question about the critical files on control and collision

    Hello

    I am currently a student at OCP certification exam 1z0-053.

    To do this, I bought the all-in-one fixed Oracle Press (http://www.mcgrawhill.ca/professional/products/9780071629188/)

    During his studies, I would like to test, to prove things and simulate the operation to get more familiar as possible with important concepts.

    The study guide covers the fact that when a critical file is damaged or lost, the proceedings will end. The critical files listed are: all copies of the controlfile, a data file that belongs to the SYSTEM table, a data file which is part of the current tablespace undo.

    As said here's the quote:

    Some of the files are important. Damage to a critical file means that the database instance will end if it is open and cannot be reopened until the damage is repaired.

    [...]

    Practically the moment where that the damage occurs, the instance will end. As always, first reaction of the DBA to an instance crashed should be to attempt a start. It will fail in NOMOUNT mode, with an error message appropriate. The alert log will show what controlfile copy is missing and also - in the section list of parameters to initialize default - controlfile how many copies there are actually is and where they are.

    A self-test at the end of the chapter, it is:

    1. loss of these files will cause a database open failed? (Choose all good answers.)

    A. a controlfile multiplex

    B. A multiplexed log file online

    C. a multiplexed log file archive

    D. an undo tablespace datafile asset

    E. a tablespace temporary assets tempfile

    F. Since the SYSAUX tablespace data file

    G. a file of data space of SYSTEM tables

    H. a data file containing the user's critical data

    [...]

    Answer:

    1. A, D and G. damage to any copy controlfile put an end to the proceedings, as damage to critical tablespaces: SYSTEM and break current tablespace.

    So, under the 11.2.0.3 when I delete or corrupt a control file copy, the instance is not crashing and the database continue to work. Alerts log is only regularly notifynig controlfile missing:

    Fri Aug 30 10:16:02 2013

    Errors in the /u01/app/oracle/diag/rdbms/ocp1/ocp1/trace/ocp1_m000_26767.trc file:

    ORA-00210: could not open the specified control file

    ORA-00202: control file: ' / u01/app/oracle/oradata/ocp1/control03.ctl'

    ORA-27041: could not open the file

    Linux-x86_64 error: 2: no such file or directory

    Additional information: 3

    I'm not really knowledge.

    I have to stick to what is said in the book or the experienced facts?

    Thank you

    Bruno

    The information contained in the Guide of the exam are not correct as written.  The Oracle instance would end on the loss of a single control file.  Oracle documentation on the management of the control files is here:

    Management of control files

    It says: "If a control file is damaged due to a disk failure, the associated instance should be stopped. Once the drive is repaired, damaged control file can be restored using the intact copy of the control of the other disk file and the instance can be restarted. »

    "Stop" means that the instance has become unstable.  Unstable case act differently depending on the situation this way, the book is not (cannot) document the specific behavior that may occur.  While the loss of a control file means that the DBA should be abandoned to the instance, it is a very different thing from the instance to the destination of its own.

    The ultimate source is always the Oracle documentation. I checked the page of errata for this book to McGraw-Hill.  I only see an extra.  Submit this to them and get your name on the page as a contributor.

  • Question about error 1242 (file/folder expected)

    I have the following code:

    var myAmount = prompt ("how?");

    var = myDir "/photoshop_js_test/ f / [authority];

    myname = "testJPEG"; var

    var mySuffix = ".jpg";

    var myFile;

    for (var i = myAmount; I > 0; i--) {}

    myFile = myDir + MyName + i + mySuffix;

    var myJPEG = new JPEGSaveOptions();

    myJPEG.quality = 5;

    myJPEG.formatOptions = FormatOptions.STANDARDBASELINE;

    activeDocument.saveAs (myJPEG, myFile, false);

    activeDocument.close ();

    var j = i-1;

    var myNewFile = mySuffix; + j + MyName, myDir

    open (myNewFile);

    }

    But the interpreter gets stuck on this line:

    activeDocument.saveAs (myJPEG, myFile, false);

    and gives me error 1242 - improper argument... File/folder provided.

    I'm puzzled.  I don't know many Javascript and learn another (ActionScript) ECMA script, but I tried to create a code for someone who has posted in the forum of Photoshop.  I suggested Javascript it and am now trying to emulate the problem on what he posted.

    (the [authority] is a path on my computer that I put comment with supports to protect my file system.)

    Any help is greatly appreciated.

    Sincerely,

    -markerline

    You can try this...

    myDir var = '/photoshop_js_test/ Inv. [authority];

    Note the slash before the drive.

    You can also do a check if the file exists;

    {if (!) MyFile.Exists)}

    Alert ("file does not exist");

    return;

    }

  • Question about backup WRSP file

    Hello

    Work environment
    Consumption: WLP10.3
    Producer: websphere 6.0

    I have a file of storage attached to the remote portlets. I use the backup file to use a value (say x) of my property set and send it to my producer to display the content of y on the remote portlets.
    Everything works fine.

    But the producer is upgraded to websphere 7.0, so I had to register my producer through my PAT. But what is happening in the backup file? Currently remote portlets do not work I do not all exceptions.

    am I missing something? Help, please.

    Thank you.

    Hello

    The problem is that there is no way to attach a file to backup to a proxy portlet (representation on the side of the remote portlet consumer) through the PAT.

    If you use the IDE to record producer, to import the portlets and attach backup files, everything should work from there.

    Kevin

  • question about old ARC files in an Oracle 10 g database

    Hello

    We have Oracle Database 10 g, the database is in archivelog mode and we're cold backup of the database. We would like to know, if we must restore and recovery of the database if we have a problem, we would have to do so from the last ARc file or we must apply all ARC files, we see on the EIS from v$ archived_log?

    Kind regards
    Beatriz.

    We must apply all ARC files, we see on the EIS from v$ archived_log?

    N ° the recovery will require the ARC from the point of leaving, the backup files. V$ archived_log contains a "history" of the older archivelogs thus list.

    So, if you have daily backups and v$ archived_log shows the entries for 7 days
    If you restore the cold SUNDAY backup you ArchiveLogs on Sunday from
    If you restore the cold WEDNESDAY backup you frome ArchiveLogs Wednesday, even though the controlfile in Wednesday backup lists the previous 7 days (starting on Thursday!) ArchiveLogs in v$ archived_log.

  • How to play a series of mp3 files short?

    I have a series of short mp3 files that I want to play in order.  I create each one as it is own InputStream, but how can I concatenate the input stream for use in the javax.microedition.media.Manager.createPlayer method?

    I found a similar announcement the following location, but I did not understand the suggestion:

    Add the 2 input streams

    Any ideas?  A short code snippet would be useful.

    Thank you...

    Once I deleted the supply line and exchanged files wav of mp3 files it started working.  It looks like you can not combine wav files.

  • A few questions about FileConnection/JSR 75

    [I posted these issues some time ago, but got no response]

    I am writing an application that targets the 4.2.1 and upward. After reading everything I can find (api docs, forum, kb, guides, web search), I still have many questions about the BlackBerry file system:

    1. Are store / and SDCard / internal name of the memory and the SD card root on all BlackBerry devices?
    2. JSR 75 leaves open the question of whether an application sees the virtual roots that are private to itself or if all applications share the same roots. How does on BBs? I have seen many examples where the path name starts by "/ store/home/user/app_name /" or "/ SDCard/BlackBerry/app_name / '. Is this necessary, or can my request simply use "/ store /" or "/SDCard/" and add the file name? If the former, are there best practices documented anywhere to manage collisions between app names?
    3. If the files are visible in many applications, there are layers of security available to protect data (I think something similar to how a PersistentObject can be encapsulated in an object ControlledAccess using the PersistentStore) or do make us our own?
    4. I read on this forum somewhere that store / is not available when a device is connected via USB and mass storage is active. Is this and other information like this documented somewhere?
    5. May restrict the COMPUTER strategies how an application uses FileConnection, particularly to the store / and SDCard /? If so, is there any guidance on common restrictions that developers should know when you write applications for general use?
    6. What restrictions are there on the names of files (allowed characters, length, etc.)?

    Any guidance or pointers will be appreciated!

    Hi Ted,

    I'm not sure on your remaining questions, but I'll try to answer as best I can:

    1. did not have different names on the devices until today.

    2. you have no problem on SD card and you are allowed to save files anywhere it. Not quite sure

    shop around, but you should be able to save files on the file system visible and own created folders. There will be

    some folders inaccessible devices that require internal processing (installed Te of applications etc..).

    3. you can open files as readonly etc. but elsethere it is not the layers of security installed. If you have data

    issues of security, you must save this Te using the RuntimeStore class!

    4. I don't know, but it's a fact. But for this purpose, you can detect the toggling of mass storage

    programmatically.

    5 see point No. 3

    6 see restrictions as specified in JSR 75.

    Kind regards

    Jochen

  • question about indexing settings

    Hello

    I was looking through the release of Essbase and here's my question about the index file I deleted a populous cube and I see everthing reset to 0 except index Cache current value that remained the same when the cube is populated.

    Any help or a response in this regard is greately appericiated.

    Thank you

    No, it should not change to zero. As I said, the key cache takes the memory when the application starts and keeps it until the application is stopped even if there are no data in the cube. HE maintains that the memory for when there no are data. I've seen of many inplementations where the client has set the cache to be really fat git thought would only use what it takes, but instead, the amout set gets consumed. So, I'm called asking how they can possibly be out of memory on their server. Moral of the story, do no bigger that it must really be or you will expect a lot of the key cache memory

  • A few Questions about the creative cloud

    I read that the Creator Cloud connection will be released in the coming weeks, which is great. I have a few questions about the download file and the creative connection program of cloud.

    I have a file which I will download. The contents of this file will be updated periodically locally. I want to do the files in this folder to stay updated between my desktop and laptop. The Creative Cloud connection program will be able to do?

    If a file is changed, which is already in the cloud program will recognize the change and stay the cloud?

    I guess just a little more information on exactly what will be the program Creative Connection cloud would be nice.

    On the topic of storage I will be able to upgrade the standard 20 GB of storage that is available when / if needed? And how much will that be?

    Another question:

    When Lightroom 4 will be available via CC and why is it not available when it was released?

    Creative Cloud connection will keep files between your desktop and the Web site synchronized. You will be able to add, edit and delete files from each end and that the changes are reflected in both.

    To see the connection creative cloud in action, you can watch this video of evangelist Paul Trani Adobe http://tv.adobe.com/watch/adobe-creative-suite-6-creative-cloud-launch-week/adobe-creative - cloud - tour-/.

    There will be a way to get more than 20 GB of storage. Adobe Creative Cloud http://www.adobe.com/products/creativecloud/faq.html FAQ has a question and an answer about it down:

    Buy extra creative Cloud storage?

    Additional storage will be available for purchase later in 2012. If you have reached your storage limit, contact Adobe Customer Service.

    Lightroom 4 will be available in a few weeks. Jeff Veen also tweeted this https://twitter.com/#! / veen/status/200810541550288896. Other Articles of Jeff on what comes to the Adobe Creative cloud here in his blog of Adobe http://blogs.adobe.com/creativecloud/coming-soon-to-creative-cloud/.

Maybe you are looking for

  • Stor.E Basics 500 GB HARD drive corrupt

    This disc has been used twice, once to make a complete up to the computer, and then a second time to add two files. Yesterday, I logged in to download a number of files and got the message that it has been tampered... How the hell is this happened wh

  • Lenovo black screen randomly Y50-70 times

    Hi everyone I have a very strange problem with my laptop. Here's the Specs (copy-pasted from amazon because I'm lazy): Lenovo Y50-70 39.6 cm (15.6 Zoll UHD IPS)Intel Core i7-4710HQ, 3.5 GHz12 GB OF RAMHybrid SSHD 1 TB (8GB) NVIDIA GeForce GTX 860 M /

  • 6 of WSUS on Windows server 2012

    Hello I am trying to configure SCCM 2012 (painfully) I get a lot of error messages. WSUS does not work: can not synchronize updates. wsusservice (in services.msc) will not start (error 193 oxc1) If wsus works 50% (you can see some Update Manager wsus

  • Is there a program to make my hard drive HITACHI_DK23EA-30 run faster?

    I do a virus on Microsoft Safety Scanner - 1.0.30001.0 scan.  It has been almost twenty minutes and it's not even a 1/4.

  • Error "The user32.dll system DLL has been moved in memory" when you try to open certain programs.

    lllegal System 32 relocation DLL user32.dll system was moved in memory. The application will not work correctly. The move took place as C:\WINDOWS\system32\SHELL32.dll DLL occupied an area of address reserved for Windows system DLLS. The vendor suppl