Which is wrong with this reading of the audio files...! ???

Hi all

I try to read two different audio files with the following code piece. individually, they play well. When I try to play at the same time which is at the same time, it is give IllegalStateException and does not play any audio file.

When I play them separately, they play well. My requirement is to play 1 file as background music and another as foreground.

Audio playback code.

public class Audio implements Runnable//extends Thread
{
    private Class clazz;
    private InputStream is;
    public Player player;
    private String audiofile;
    private int fileType;
    private int mode;
    public Audio(String path, int type, int mode)
    {
     audiofile = path;
     fileType = type;
     this.mode = mode;
    }
    public void run()
    {
                   //this sample demonstrates playing an MP3 file that has been
                   //added as a resource to the project

                try
                   {
                      //retrieve the MP3 file
                      clazz = getClass();
                    //create an instance of the player from the InputStream
                      is = clazz.getResourceAsStream(audiofile);

                      // 1-- mpeg, 2-- wav audio files

                      if(fileType == 1)
                          player = javax.microedition.media.Manager.createPlayer(is, "audio/mpeg");
                      else if(fileType ==2)
                          player = javax.microedition.media.Manager.createPlayer(is, "audio/x-wav");
                      player.setLoopCount(mode);
                      player.realize();
                      player.prefetch();
                      player.start();

                    } catch (Exception ex)
                    {
                        UiApplication.getUiApplication().pushScreen(new CloseScreen("Hello"));
                    }
            }
}
// if call this, commenting section2 it works well
               //section1
    Audio at = new Audio("/neon1.wav",2, -1);
    Thread at1 = new Thread(at);
    at1.start();

// if call this, commenting section1 it works well
               //section2
        Audio at3 = new Audio("/neon1.wav",2, -1);
    Thread at2 = new Thread(at3);
    at2.start();

// when i uncomment both section1 and section2 and execute it is not playing giving an exception IllegalStateException.

all aid should be of great use.

Thank you and best regards,

PraveenG

On the storm, it is not possible to play 2 sounds loaded from a file at a time.  If you try this, the first sound stops and the second sound will be played.

You can, however, load and play a sound (background music) and play other sounds (sound effects) by using Alert.startAudio ().  The first noise not would be cut.  The only problem with this is that the Alert.startAudio sounds are not the best.

Tags: BlackBerry Developers

Similar Questions

  • Which is wrong with this query?

    SELECT THE PRODUCT. PRODUCT_ID PRODUCT. PRODUCT_DESCRIPTION, PRODUCT. PR_CURRENT_YEAR_SALES_GOAL, (ORDER_QUANTITY * PRODUCT_PRICE) AS sales so far
    ORDER, ORDER_LINE, PRODUCT, PRODUCT_LINE
    WHERE TO ORDER. ORDER_NUMBER = ORDER_LINE. ORDER_NUMBER
    AND THE PRODUCT. PRODUCT_ID = ORDERED_PRODUCT. PRODUCT_ID
    AND THE PRODUCT. PRODUCT_ID = PRODUCT_LINE. PRODUCT_ID
    AND THE PRODUCT. PRODUCT_LINE_NAME = 'Home Office ';

    There is something wrong with this request, but I don't see what it is. Anyone know whats wrong with it and perhaps what would be the correct way to request program?

    There is another thing that I noticed:

    You seem to have used a Table name: "ORDERED_PRODUCT. PRODUCT_ID' in your WHERE clause that is not in your FROM clause

    See you soon-

  • Which is wrong with this code? 1180 error.

    I get error 1180:Call to undefined method getURL possible

    var jscommand:String = "window.open ('www.adobe.com', 'victory ',' height = 1024, width is 768, toolbar = no, scrollbars = yes')"; getURL ("javascript:" + jscommand + "void (0);");

    Any help would be appreciated.

    Thank you guys.

    getURL is AS2, AS3 code no.

  • What is wrong with this sequence, it does not work when, after 3 inserts, I add a new record with the trigger it gives an error.

    Mr President.

    What is wrong with this sequence, it does not work when, after 3 inserts, I add a new record with the trigger it gives an error.

    --SL_CUSTOMERS table data
    
    
    INSERT INTO SL_CUSTOMERS VALUES(1,'Kamrul Hasan',NULL,NULL,'Moghbazar', 'Dhaka','0456789123',NULL,NULL,NULL,'Y',NULL);
    INSERT INTO SL_CUSTOMERS VALUES(2,'Rabiul Alam',NULL,NULL,'Motijheel', 'Dhaka','0567891234',NULL,NULL,NULL,'Y',NULL);
    INSERT INTO SL_CUSTOMERS VALUES(3,'Shahed Hasan',NULL,NULL,'2-G/1,2-2,Mirpur', 'Dhaka','0678912345',NULL,NULL,NULL,'Y',NULL);
    
    
    
    

    CREATE SEQUENCE  "ALIZA"."SL_CUSTOMERS_SEQ"  MINVALUE 1 MAXVALUE 9999999999999999999999999999 INCREMENT BY 1 START WITH 1 NOCACHE NOORDER  NOCYCLE ;
    
    
    CREATE OR REPLACE TRIGGER SL_CUSTOMERS_TRG 
    BEFORE INSERT ON "ALIZA"."SL_CUSTOMERS"   
    FOR EACH ROW   
    BEGIN   
    IF :NEW.CUSTOMER_ID IS NULL OR :NEW.CUSTOMER_ID < 0 THEN  
      SELECT SL_CUSTOMERS_SEQ.nextval   
        INTO :NEW.CUSTOMER_ID  
        FROM DUAL;   
      END IF;   
    END;   
    /
    
    
    
    

    When I try to insert several records with the seq.nextval it gives error

    violation of primary key.

    INSERT INTO "ALIZA"."SL_CUSTOMERS" (CUSTOMER_NAME) VALUES ('sdfsd')
    ORA-00001: unique constraint (ALIZA.SL_CUSTOMERS_PK) violated
    ORA-06512: at line 1
    
    
    
    
    One error saving changes to table "ALIZA"."SL_CUSTOMERS":
    Row 4: ORA-00001: unique constraint (ALIZA.SL_CUSTOMERS_PK) violated
    ORA-06512: at line 1
    
    
    
    
    
    
    
    

    Concerning

    Mr President.

    I find the solution by creating a function before the triiger

    as below

    CREATE SEQUENCE  "ALIZA"."SL_CUSTOMERS_SEQ"  MINVALUE 1 MAXVALUE 9999999999999999999999999999 INCREMENT BY 1 START WITH 1 NOCACHE NOORDER  NOCYCLE ;
    
    CREATE OR REPLACE FUNCTION get_SL_CUSTOMERS_vId RETURN VARCHAR2 AS
    BEGIN
       RETURN SL_CUSTOMERS_SEQ.NEXTVAL;
    
    END;
    /
    
    CREATE OR REPLACE TRIGGER SL_CUSTOMERS_TRG
    BEFORE INSERT ON "ALIZA"."SL_CUSTOMERS"
    FOR EACH ROW
    DECLARE
    dummy VARCHAR2(200);
    BEGIN
      dummy := get_SL_CUSTOMERS_vId();
      :NEW.CUSTOMER_ID := dummy;
    END;
    /  
    

    It works very well

    Thank you all for the suggestions.

    Concerning

  • Had to reformat my hard drive, now when I try to reinstall Windows XP I get a blue screen with this code at the end 0x0000007b.

    has had to reformat my hard drive now when he star0x0000007b (0x78d663c, 0xc0000034, 0x00000000, 0x00000000)

    has had to reformat my hard drive, now when I try to reinstall windows xp, I get a blue screen with this code at the end 0x0000007b (0x78d663c, 0xc0000034, 0x00000000, 0x00000000) how to solve this problem

    Hello

    I saw the 0x0000007B BSOD caused by trying to install XP on a disk hard while the BIOS is designating the reader as AHCI instead of IDE. XP has no native AHCI drivers, resulting in a stop 7B. Unless the PC had originally Vista or Win 7, but it might be useful to check that it is not likely.

    If the BIOS is set to AHCI, you could do one of three things (depending on whether your PC has a floppy drive)...

    1 find the Setup F6 disk on AHCI support at installation time (start with the manufacturer's website if you do not already have such a thing). Watch the very hit F6 prompt early in the installation process.

    2. change the setting in BIOS on IDE / ATA

    3. create a new "slipstreaming" installation disc drivers AHCI in the existing installation disc, see http://www.nliteos.com/index.html

    After the back if your BIOS is IDE / ATA

    Tricky

  • I had windows 7 and it has been updated to windows 10. After the update, I opened a PDF with adobe reader. The sign economy is idle. When I click on save slot, it is said that he can save a blank document. Earlier, I have not any problem to save a pdf d

    I had windows 7 and it has been updated to windows 10. After the update, I opened a PDF with adobe reader. The sign economy is idle. When I click on save slot, it is said that he can save a blank document. Earlier, I have not a problem to save a pdf document with adobe reader on my hard drive. I found no updates available for my adobe reader software. Is adobe still to make the drive compatible with windows 10?

    Govind B S

    Bernd, these rights are not necessary to the reader XI. Unless the file has been secured, then it should be savable.

    I recommend that upgrade you to the latest version of the XI player that is available and if this does not work, try to run a repair installation (or upgrade to DC).

  • my computer will not install itunes 10.5, it tells me "Setup has encountered an unexpected error installing this package. This may indicate a problem with this package. The error code is 2330.

    original title: Itunes problem

    my computer will not install itunes 10.5, it tells me "Setup has encountered an unexpected error installing this package. This may indicate a problem with this package. The error code is 2330. "What should I do?

    Contact the manufacturer (Apple) of the application (iTunes) you are having problems with.

    Uninstall all previous versions, try to download (re-record not running) and then do a right click on it and RUN AS ADMINISTRATOR.

    (Vista 32-bit or 64-bit)?

  • "Information MS cannot open this file. The file may be corrupt or incompatible with this version of the information system. »

    Original title:

    MS Info

    I need to send a file Ms Info to Wb tech support so that they can help me with the game on steam download. Whenever they open the file it says it gives the following message "information MS cannot open this file. The file may be corrupt or incompatible with this version of the information system. "I tried to open it too and had the same error message how can I send a file not corrupted for them?

    Information MS cannot open this file.

    They should use Notepad to open the file when it is a txt file.

    Another way to create a portable system information file is to select the hotkey Win + R, type msinfo32 , and press ENTER . Click file, Save and name the file. This method creates a file with an extension of nfo file. Perhaps the recipient expects the file in this format.

  • In the face of "the device associated with this extension or the dial number is not valid" when you use DX80 telepresense phones

    Hi team,

    We have EX and DX series telepresence as endpoints agent. But DX series phones are facing issue "the device associated with this extension or the dial number is not valid" when checking in the agent. EX works very well. Both phones are properly recorded in CUCM.

    Can you please help me out here to solve the problem.

    Thanks in advance,

    Sisi.

    In my case, we tried to do a few different modifications here and there on the DX650 but never managed to do work.  Randomly, I was able to connect to the fineness with the DX650 as my camera, then my colleague could not connect to the Finesse with his 9971 as his camera - (keep in mind this was in an environment of model and it was just her and me as agents).  Since I saw this strange behavior and doesn't do not sense, we rebooted the server CCX. Once she is back to the top, we were also well able to connect successfully and had not had the problem since.

    Thank you

    EK

  • Please help im trying to import pictures from a SD card and get this set up the following files were not imported because it couldn't be read items 1-100 101-200 201-300 itmes points

    Please help im trying to import images from the SD card and get this set up the following files were not imported because it couldn't be read items 1-100

    "Could not be read" indicates that the Destination Directory has no WRITE permission in your operating system.

    To resolve this problem, you must

    1. Determine the Destination folder - it's on the right side of your import under Destination dialog box
    2. Change permissions in your operating system on this particular file have WRITE permission (or switch the destination to one that has the WRITE permission)
  • Models of DW: 'this document uses the following files not in this site.

    I recently started using DW templates in CS6. It was a bit frustrating at first, but seems well wouth it. I've created quite a few pages in the folder root of hares and have no problems there. However, I created a new folder to a different section of my site (mysite.com/new_folder/new_page.htm), and then went to save a new page of the model and got the message "this document uses the following files not in this site. Its the same site, just a new folder which is placed at the root.  When I save the page in the new folder there to make a copy of duplicant images, css scripts and place them in the new folder to work? Must be a way to do it and have DW know where to find the original files surely?

    Thank you

    I downloaded a test page... It turns out that the 'message' was just misleading and all the Info page has correct links. Everything is good

  • I use creative cloud of Adobe Premiere Pro and it does not allow me to drag. In the line of time, only the audio files of the video MXF files. Plays in the video source, but does not allow me to change on the time line with the. MXF files.

    I use creative cloud of Adobe Premiere Pro and it does not allow me to drag. In the line of time, only the audio files of the video MXF files. Video plays in the source window, but does not to drag me and thenedit on the time line with the. MXF files. audio will slide to the time line, but not the video. Interestingly, not later than end of December 2015 it allowed me to change with .mxf files, but no, it won't. Any help out there?

    Neil, get it fixed, I do not have the video channels set correctly on the left

    side of the line of the time. Learn the new adobe; Thank you

    Monday, February 15, 2016 13:20, R Neil Haugen [email protected]>

  • Determine the audio files and corresponding slide # in presenter

    This is a great challenge to edit audio files.  Presenter costs number not in the order of the audio files, they seem to be random.  This means that you have to hunt and peck to find the right audio file to change to the appropriate slide.  Any fix for that?

    See, now, we're getting somewhere!

    When I wrote this line after publication of audio files (ex: a24x [some] .mp3), I was referencing the .mp3 files, you get following the publication , the bridge using the card presenter PPT in.

    However, as you wrote:

    "... Each of these mp3 files also has a *.lthmb file (for example 1088225537.mp3 a 1088225537.lthmb) correspondent... »

    what you're watching is the folder that Presenter creates the moment you start to integrate audio using the recording feature which offers presenter (the same would be true if you have imported audio files using Presenter as well.)  And, as you have discovered, trying to get a handle which audio file will w / a particular slide is horrible at best.

    Okay, may I suggest another tactic?

    Let's try this: bridge to publish the PPT you have.  What you'll end up with is a set of files and folders, but I want you are looking for the data folder that is created as a result of the publication process. (Unless you specify where you publish, presenter will publish in a folder named "My Adobe Presentations" by default, so you will need to get there on your hard drive)  Inside the data folder will be a list of mp3 files, which, if all goes well, should make it much easier to see what audio is used by a specific slide.

    Here's what I mean: for example, after the publication, I have a folder of data and inside, I found the following file: a24x9x3.mp3 I double click the mp3 file (making it play using Windows Media on my laptop), I hear that it matches my slide 9 in my PPT game.  And it's corresponding mp3 files for each slide, I have in my game.  I'm clicking on another file (wouldn't be nice to see what I'm doing?) a24x20x3.mp3 and this file is the contents of my 20 slide in PowerPoint.

    Yet once, give a publication in PowerPoint and see if it makes easier.  Well... not nearly as easy as recording in Soundbooth/Audition/Audacity, but it's pretty close I hope so dig you out of this hole you now.

    Rob

    http://www.robrode.com/YaBB

  • Want the audio file, click on the box to play when you click

    Hi all

    I would like to have a click box that plays a short audio file when you click it, much the way you can have a view of the legend and a playing audio file with a bearing. It seems that there is no way to get the 'success on click' action to be 'read the audio file '. I can associate an audio file with the box click on the Audio tab, but this makes the audio file play automatically when the click box, not display when clicked.

    If someone was able to get an audio file to play when the user clicks on a click box, as I describe it, without connection to another slide and without the help of a button? I don't want to use a button because the real object that is clicked is a box of nail on something else. The highlight box means that there is more information about the highlighted item.

    In addition, I don't want to create a branch to another slide, because they are really short texts of audio presentation bit, and I have three of them. I prefer to have interactivity on a slide, rather that force the user to navigate around.

    If anyone did what I describe and has ideas, I welcome them. At this point, I think a bearing with legend and play on the mouse on an audio file can be the best thing, except if the user moves the mouse out of the hotspot, the sound stops. Maybe it's not bad anyway, but thought I'd check here everything first before resorting to a reversal.

    Thank you very much!
    Lisa

    Hi Rick!

    Thanks a lot for your answer. Hmm... I think in my situation, workaround to reread the previous slide to reset the box click doesn't work. Before arriving at these interactive click boxes, the slide has other text and audio playback. Start the slide would re-read everything until the blade stops, then display the interactive elements. However, I think that something like that might work for a project where the interactive stuff "starts" immediately on the slide. It's simply not how mine is set up at this stage. I think that the legend of attached with audio reversal will probably be my best option right now.

    Thanks again for your response!
    Lisa

  • Clicking or stutter during playback of the audio file on Sansa Clip

    I'm having a problem similar to that described in the following thread:

    http://forums.SanDisk.com/Sansa/board/message?board.ID=sansafuse&message.ID=2785&query.ID=219379#M2785

    Only I have the problem on a 4 GB Sansa Clip.

    The audio file is a DRM WMA to NetLibrary, 165MB, 32 Kbps and 11:48:01 in length.

    I am currently at 05:21 mark in the file and the stuttering arrived at a point where it is difficult to listen to the file.

    I had filled the files of devices (especially the music, a few podcasts) and then deleted, filled again, etc., so there may be some fragmentation that is either the problem.

    I'm reformatting of the clip using the internal format of the device function and allows you to copy only the audio book on the device at the beginning to see if the problem goes away (this * should * minimise, if not eliminate the fragmentation).  Then I resync the rest of the music files to the player using Windows Media Player, and then see if the problem comes back.

    I'll post my results here.

    Reformat the device worked very well.  The audio file sounds fine and the file is read immediately when you rewind or fast forward through the file (before it should pause a few seconds once you wanted to before play).

Maybe you are looking for

  • HP Envy enter password administrator or power on password

    error code is 55680695

  • . HP Photosmart 5514 will not print black

    I changed my black ink cartridge in my HP Photosmart 5514 (CQ183A product number, serial # {Private Information Removed}) and now it won't print black.  The colors work fine, just no black. I have cleaned the print heads, made the secondary allignmen

  • VPN - Tunnel of Split

    -Start ciscomoderator note - the following message has been changed to remove potentially sensitive information. Please refrain from publishing confidential information about the site to reduce the risk to the security of your network. -end of the no

  • Add UN tercer rigid SATA II in the SAN

    Hola todos tengo the siguiente consulta,Tengo than add one third rigid the San in place are SATA II 2 t cada discotiene alguna donde revisar los pasos o one can documents the menos las minima recommandations al instalar el tercer attachmentaprovechan

  • How to merge my contract number with my existing profile of VMware?

    Hi allMy company gave me a contract number for more communication with the VMware technical support calls. I just want to know how to add the number of this contract with my existing profile. It would be great, if someone give me a step by step proce