How to play sounds on Simulator?

As title, I have speakers on my computer.

I want to test my application with the playback of sounds.

How to debug these things like playing a sound.

I don't like to build and sign and load to the device each time.

Thank you

Visit this link: http://today.java.net/pub/a/today/2005/09/27/j2me4.html

Tags: BlackBerry Developers

Similar Questions

  • How to play sound headphone only

    Hey guys and girls

    recently, I bought a new headset, and it seems that windows won't play sounds only in the helmet as long as the speakers are turned on.

    in other words, music plays in the two headphones and speakers and not just in the headphones i unless:
    Unplug the speakers
    Turn them off
    disable them with a ridiculous amount of clicks. funny, is that I always forget how I did the last time >.

    So what I want to do, is make headphones have priority on the speakers without turn it off or unplugged.

    I also can't use the connectors on the front panel for a reason even if they appear in the ' Manager high definition realtek audio.

    Hello

    Method 1:

    I suggest to go to sound settings and turn off the speaker device for the only sound from the earpiece. To do so follow the steps below.

    1. click on Start

    2. go to Control Panel then hardware and audio.

    3. click on sound, it will open a window with all audio devices it contained therein.

    4 turn off the speaker by right-clicking on the " speaker " icon and select disable .

    Method 2:

    To make the helmet of your default audio device, follow the procedure below.

    1. Click Start and click on Control Panel.
    2. click on sound, then a new window will open.
    3. in the new window click on the "Playback" tab and right-click in the window and click disabled devices onShow.
    4. now check if headphone is listed there and right-click on it and choose activate.
    5. highlight this headset and click "set as default".

    It will be useful.

  • How to play sounds (rightly) in games?

    Hello

    What is the correct way to play a sound effect in a game (or any application using a wire loop). I use a method that works very well on 99% of the phones, but it seems to cause a small number of phones for my client to freeze after a few sounds in game (I guess it's sort of leak memory). I also noticed that it creates an error in my event log (StreamingException: not logged in net.rim.device.internal.streamingnatives), even if the game continues to function normally.

    Obviously something is wrong, but I can't understand what it is. Here is the code I use:

    SoundObject.java:

    public class SoundObject {
        Player player;
        VolumeControl vc;
    
        public SoundObject(String res) {
            Class cl = null;
            try {
                cl = Class.forName("my class path goes here");
            } catch (ClassNotFoundException e) {
                e.printStackTrace();
            }
    
            InputStream input = null;
            try {
                input = cl.getResourceAsStream(res);
                player = Manager.createPlayer(input,"audio/mpeg");
                player.realize();
                player.prefetch();
                vc = (VolumeControl) player.getControl("VolumeControl");
            } catch (Exception e) {
                e.printStackTrace();
            }finally{
                try {
                    if(input != null){
                        input.close();
                        input = null;
                    }
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    
        public void setVolume(int val){
            try{
                if(this.vc != null){
                    vc.setLevel(val);
                }
            }catch(Exception e){
                e.printStackTrace();
            }
        }
    
        public void Play(){
            if(Settings.getSoundVolume() == 0) return;
            try {
                if(player != null){
                    player.stop();
                }
                player.start();
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }
    

    To load the sound I do the following:

    public static SoundObject sound_boing = new SoundObject("/boing.mp3");
    sound_boing.setVolume(50);
    

    And in the thread of my game, I play the sound like this:

    sound_boing.Play();
    

    Can someone tell me what I'm doingwrong? Copy the following code causes a memory leak? Y at - it a particular format of the audio file I should avoid? This could be the cause of the StreamingException: Session not open error?

    Thank you!

    Hi Dekerta!

    If I read your code correctly you are creating an InputStream to a sound file, and then close the stream before playing what seems to be the problem.  Calling prefetch below will read the InputStream and pre-load the player with data - if the file is small enough (which I am assuimg that yours is) then it can indeed read the entire file in the stream.

    The essential point that you don't know, is that this loading is made asynchronously.  As you close the stream your finally block you introduce a race condition - if it finally is executed before the player is first read then you will get the Exception you see (the stream is not open because you closed it).  If the player completes the preloading before closing the flow then the sound will play, which seems to be the case for 99% of the time .

    Rather than close the stream immediately, why not keep it open until the player becomes closed in this way it is always available for the player and is no longer available when you can be sure that the player no longer has need you can save it to a field in your SoundObject and close in a PlayerListener implementation when you get the event PlayerListener.CLOSED

    As alternative approach to play 'unique' sounds, check on the sample inthe pos , it is optimized for work for the CDMA and GSM-based devices universally, all keeping as minimal as possible use of the resources and the most effective cleaning possible.  The only other approach I've used that works well is to mix your own sounds, but I won't get it here since it is a topic all by itself (although the DEV04 session of the Conference DevCon2010 in recent years tells you how... just saying ' ).

  • How to play sound loop

    Hello

    How can I play looping sound? Is it just well SoundChannel class responsible for this or I have to write my own function?

    With the help of the sound object, there is a property, you can move that asks the number of loops of

    Play (StartPosition:Number, Loops:int, SoundTransform)

    or you can create your own method who listens SoundComplete and then starts playing again.  which in my opinion is the best thing to do because when you play a sound with a loop and choose to have is to start at a different position of 0 so the loop will play from where you set the position.

  • How to play sound in AS3

    In AS2, you can listen to sound through s.loadSound("mysound.mp3",true) where the second loadSound parameter indicates that you want the sound.
    How do you do this in AS3?
    Thanks for your help.
    Ken

    When you run your load(), the audio file begins to download. who will continue unless you run a close() method.

    your sound will start playing when you run, you're your play() method or after the bufferTime is met, the first of the two prevailing.

    the real question is how do you keep streaming in as3. and who is easy to aid sound complete event to trigger the play() method. If the play() method is executed while loading is complete AND bufferTime is lower than the charging time, your sound will flow.

  • How to play a sound on a button to the bottom of the State?

    Hello

    That is my question. How to play sound on CLICK or down state of the button? I don't know how to slap a sound on the timeline, but not how to put specifically for the button and that's down from the State.

    Thanks for the help in advance.

    go to the scenario of the button and attach a sound to its low chassis.   You probably want the sync event property.

  • How to play audio through the headphones and computer speakers, at the same time.

    Hey I just need to know how to play sounds through the headphones and speakers. Help

    Depends on your audio device.

    If its edge, while normally when you plug the headset switch will cut off the speakers.

    If you have a USB or Firewire pro device you can listen to your headphones as the signal played through your speakers.

    See you soon,.
    Jerry

  • Play sounds in the order using MediaPlayer

    Hello. How to play sounds in order?

    For now, here are my code.

    I have a MediaPlayer component as an attached object

    http://developer.BlackBerry.com/native/reference/Cascades/bb__multimedia__mediaplayer.html

    attachedObjects :[
        MediaPlayer{
           id: sound
           sourceUrl: "asset:///sounds/sound1.mp3"
        }
    ]
    

    Then I have a button. Here is what my code for it

    Button{
       id: play
       text: "Play Sequence"
    
       onClicked :{
    
          sound.sourceUrl = "asset:///sounds/sound1.mp3"
          sound.play();
          sound.sourceUrl = "asset:///sounds/sound2.mp3"
          sound.play();
          sound.sourceUrl = "asset:///sounds/sound3.mp3"
          sound.play();
    
       }
    }
    

    What goes wrong.

    The code runs after 1 second about, cut the next sound. I'm doing his next game, after the end of his previous.

    The sounds are not finished because play() is not a call blocking. Once you call the play() function it will start playing the sound and return immediately to the following line of code in the QML. If the next line is a call to the play() still it will have precedence over previous sound, i.e. If you think logically about what you need in an application, you would not have the sound of a doorbell 2 seconds later, play just because you play already a sound, you would stop, as it does.

    My suggestion to use a selection intended to use the MediaPlayer playlist function, that you implemented will obviously suffer from the same problem for the above reason. A playlist is a separate file that contains a list of media you want to play and can be in different formats.

    My other suggestion of using onPlaybackCompleted does not seem to have been followed by you, but is probably the easiest to implement.

    MediaPlayer {
        id: mediaPlayer
    
        onPlaybackCompleted: {        count = count + 1;
            var s = count;
            mediaPlayer.setSourceUrl("asset:///sounds/sound" + s + ".mp3");
            mediaPlayer.play();
        }
    
    }
    

    Where count is a comprehensive, defined property to 1 in your QML file and you have some relaxation (onCreationCompleted or clicking a button) to start the first play().

  • How can I get iPhone play sound of favorite when text DND?

    Hello

    How can I get iPhone play sound of favorite when text DND?

    It plays the ringtone for a call when DND of a favorite but not identified a favorite texts me

    Thanks in advance

    You do not have. Notifications for all the messages are deleted when DND is turned on.

  • How can I configure preview only play sounds when it's over?

    I want to set up as the old RAM Preview. I see no button sound"but that completely stops the sound all the while. I want it to be silent until he finished all the frames loading in the cache then audio playback is possible. I have change the settings drawer, check that each bock checked all icons that makes sense to me. I just set it is like the old RAM Preview. NO noise until it is all caching and then executives play sounds subsequently.

    Check the 'Cache before reading.

  • Headphones plugged, but the speakers are still playing sound - HP ENVY M7 - J020DX

    had plgged earphones in, but again his spell of the speakers. Ive got pregnant by default everything, and Yes, they are completely plugged in its really annoying...

    Hello lee522,

    Welcome to the HP Forums!

    I understand there is sound coming from the speakers and the headphones. To resolve the problem, try the following basic steps:

    1. go to control panel, and then sound.
    2. look for the recording tab.
    3. Select your headset as default device, then press OK.

    If these steps do not work, this Microsoft forum has some other suggestions: How to stop sound play through the headphones and speakers

    Please let me know your results. Thank you!

    Mario

  • How to play music through the bluetooth earpiece/headset

    Original title:
    I HAVE CONNECTED MY HEADPHONE BLUEDIO AV890 WITH MY PC... BUT HOW CAN I HEAR MUSIC FORM MY PC THROUGH IT...

    I CANNECT THE BT HEADSET USING PASSKEY... BUT I DON'T KNOW HOW TO PLAY SONGS VIA HEADPHONE BLUETOOTH, SOMEONE CAN HELP ME

    Hello

    T

    Hank you for the display of the query in the Microsoft community!
    We will guide you through this issue.

    You receive an error message?

    You can try the following steps and check if you are able to hear the music from your computer

    Method 1:

    You can configure Bluetooth headset as default Audio Device.
    a. click Start, click run, type mmsys.cpl and then click OK.
    b. click on the Audio tab.
    c. in the sound playback section, select the headset and set it as your default device.

    Method 2:
    You can update the latest drivers for the Bluetooth drivers on the manufacturer's Web site.
    How to manage devices in Windows XP
    http://support.Microsoft.com/kb/283658

    Just reply with the results. I'd be happy to help you further.

  • How to play two audio tracks together?

    Original title: Please give me an answer as soon as possible.

    How to play two audio files.

    Is English spoken numbers and another with Hindi spoken numbers. These files are read on a single system after robin its mix of figures.

    How can I do?

    Hello

    You want to play both audio files simultaneously?

    If you want to play two music files at the same time, you need to use 2 media players. You will then be able to hear the two pieces of music at the same time of the machine.

    However, if you want to play the 2 files in such a way that for a moment plays English and then for a few minutes the other plays, you will need to use some sound capture software to cut clips from the original files and merge them accordingly and play.

    Microsoft doesn't have any audio/video capture software. However, you can use your favorite search engine to download any software cutting.

    Note: This response contains a reference to third party World Wide Web site. Microsoft provides this information as a convenience to you. Microsoft does not control these sites and no has not tested any software or information found on these sites; Therefore, Microsoft cannot make any approach to quality, security or the ability of a software or information that are there.

    Hope the helps of information. Please post back and we do know.
    Concerning
    Joel S
    Microsoft Answers Support Engineer
    Visit our Microsoft answers feedback Forum and let us know what you think.

  • AVI video files play sound but no video in Windows Media Player 7

    My video files avi play sound but no video in Windows Media Player 7. Video files avi are since 2002 and has played very well until I'm a new PC with Windows 7 so I know that the files are not corrupt. All my other files and videos play fine in Media Player. I checked online and seen the posts in other forums on the codecs being the problem. Does anyone know how to fix this? Based on the other forums I found it seems that it is not uncommon that a problem with Win7.

    Also, is it possible to convert audio and video files in different formats with Media Player? Or do I need any other software to do this?

    My video files avi play sound but no video in Windows Media Player 7. Video files avi are since 2002 and has played very well until I'm a new PC with Windows 7 so I know that the files are not corrupt. All my other files and videos play fine in Media Player. I checked online and seen the posts in other forums on the codecs being the problem. Does anyone know how to fix this? Based on the other forums I found it seems that it is not uncommon that a problem with Win7.

    Also, is it possible to convert audio and video files in different formats with Media Player? Or do I need any other software to do this?

    It is not that there is a problem in Windows 7, it is more likely that you don't have just the installed CODEC the video file is saved with.  You will need to find a source, download and install any CODEC no MS yourself. You can use GSpot to identify CODECs used in AVI files. An alternative to downloading of many individual CODECs is to install FFDSHOW instead. Some media players like VLC and Media Player Classic also have internal CODECS and support for a wide variety of video and audio file types.

    http://www.headbands.com/GSpot/

    http://ffdshow-tryout.sourceforge.NET/

  • Media Player 12 on windows 7 is unable to play sounds on mpg file created using arcsoft total media 3.5

    in question .mpg files use the audio codec of arcsoft. These same files play with sound on wmp 11 Vista ultimate on another machine. Both have total media 3.5 installed.

    These .mpg files also do not play in the computer of windows 7 using win 7 media center or film maker.

    WMP 12 shows that the arcsoft audio codec is installed.

    In addition, some .mpg files created by ArcSoft show no video or audio in wmp 12, but work correctly on vista with wmp 11 system.

    a noticeable difference in technical support for windows media information is the presence of Microsoft MPEG-1hd Audio decoder under the mpeg/dvd filters in the list for wmp11 but not wmp12. I am unable to find this codec for installation.

    any suggestions on how to find sound would be greatly appreciated. Thank you.

    Addendum: other mpg which were extracted independently of Arcsoft files also do not play sound in wmp 12. The property indicates the same audio codec association of arcsoft. Tried to uninstall and install the window media components but no change.

    Thank you!

    I had the same problem one solved it just by setting filter audio decoder arcsoft merit for 0 x 600000 with Gspot.

    JDCR

Maybe you are looking for