Sound in a game!

Hi guys!
I'm writing a game for Sony Ericsson K700.
And i have a problem with a sound. Also i'm working with MIDP 2.0.
My problem is to play 2 sounds in a game. When i play first sound, it play good, then is playing second sound and i have exception.
However, can somebody write an example, how to play several sounds in a game.
Thanks!

Hi,
To overcome this problem you can go with multiplayer of Sounds. Multiplayer is like
creating an array of players.
Normally this is the way to create a single player
          InputStream is;
Player player;
          try
               is = "a".getClass().getResourceAsStream("/abc.mid");
               player = Manager.createPlayer(is, "audio/midi");
               Sounds are of different types. MIDI, WAV, AMR. The below is the code for creating players
               depending on their type.
               player = Manager.createPlayer(is, "audio/midi");
               player = Manager.createPlayer(is, "audio/wav");
               player = Manager.createPlayer(is, "audio/amr");
               player.realize();
               player.prefetch();
               is = null;
          catch(Exception e)
               System.out.println("Exception in loadsound"+e);
               return false;
void playSound(){
stopSounds(); // better to stop any sounds playing
player.start();
the above is the code for creating a single player. So, Instead of creating a single Player object ,
go for the array of Players.

Similar Messages

  • No sound when playing games

    hi  i  own an Hp pavilion 6135 dx entertaiment pc beats audio edition
    i have an issue i have recently done a hp factory reset to my laptop and now when i play games i get no audio . i get audio when playin videos and playing music but as soon as i open up a game such as METRO LAST NIGHT or CALL OF JUAREZ :GUNSLINGER i get no audio in neither games my IDT drivers are up to date i have done multiple updates to windows and search for all updates in my hp support assistant which says i am up to date on all drivers. i tried going into bios menu an reseting to default after uninstalinng IDT driver thenreinstall it ... did not work i tried all methods of troubleshooting like testing using headphones i rolling back IDT driver upgrading IDT driver but nothing seems to work... without gaming im lost i need some desperate helphere the games run fine just no audio.i need to fix this. have tried these methods and more
    system info 
    windows 7 64 bit home premium 
    i5 2nd generation 2.3 quad core  
    8 GB ram 
    dx 11

    Hey SorhanDarkOps, 
    I'm sorry you're running into this sound issue. It sounds like you've done a good job troubleshooting already. Let me know which product number you have. You may be able to find it by pressing FN + ESC (if you used the HP Recovery partition to reinstall Windows). You can also find the product number on an HP label on the bottom of the computer (possibly inside the battery compartment). 
    Also, it would be helpful to know which IDT Audio driver version you have. 
    Device Manager > Sound, video and game controllers > IDT > Properties > Driver tab > Driver version number
    When you have a game open, minimize it and check to see which sound device is the default. To do that:
    1. Right-click on the Speaker icon in the System Tray
    2. Click Playback Devices
    3. Let me know which (Speakers & Headphones, Communication Headphoens, etc.) device has the green checkmark on it.
    Do you get sound through headphones in games?

  • I dont get sound for videos, games and music but ringtone still works. When i press volume buttons on side of phone i only get the picture of the nell and no little dots underneath. This is on my iphone 4s and ipad. It happened at the same time.

    I dont get sound for videos, games and music but ringtone still works. When i press volume buttons on side of phone i only get the picture of the nell and no little dots underneath. This is on my iphone 4s and ipad. It happened at the same time.

    Recurring theme with the 4s losing alerts except for the phone ringing.  Most complaints seem to center on the 7.1 upgrade.  The fix is dodgy, putting in a charger, playing a you tube video then pulling out the charger and wiggling it until you get the sound back.  When you get the sound back, the volume buttons start to work again.  Alternate solutions involve cleaning the docking port with a toothbrush, running a pick over the electrodes etc.

  • Sound handling in (game) application

    As my previous question did not receive any answers, I'll try to rephrase it.
    I need to change the volume of sounds during the game (changing pitch would be nice too). I tried to use:
    double currentVolume, volumeGain=.01, newVolume;
    FloatControl gainControl = (FloatControl)clipP1.getControl(FloatControl.Type.MASTER_GAIN);
    currentVolume=Math.log(gainControl.getValue())*Math.log(10.0)/20.0;
    newVolume = currentVolume + volumeGain;
    gainControl.setValue((float)(Math.log(newVolume)/Math.log(10.0)*20.0));The volume increase/decrease itself worked, but it was always delayed about 0.4-1.0 seconds. That is not acceptable.
    Any workarounds or do I have to use another library to achieve this?
    Thank You!

    I know little about the sound library, but I have a chunk of code that was edited from someone else. It might be faster, but I don't know. It also needs to be supported (obviously), so it may not even work (my game's sound was kind of buggy).
    vol is an integer with linear scaling, I believe.
    if (soundClip.isControlSupported(FloatControl.Type.VOLUME)){
        FloatControl volumeControl = (FloatControl) soundClip.getControl(FloatControl.Type.VOLUME);
        volumeControl.setValue(vol);
    }

  • No Sound For Yahoo Games

    I am new to using the Beta version of Safari for Windows. Everything is working fine so far except when I try to play some games in Yahoo there is no sound. The game loads and plays fine, but no sound. I have installed all of the plug-ins as recommended by Apple. I even downloaded DirectX, but that did not help. So far this is the only situation I have encountered where the sound does not work.
    Thanks for all replies.

    wow. i can't even get the java to load right in yahoo games. I have to use the click here option and that takes quite a bit of time to load. I don't know about your sound issue though sorry.

  • I can't here the sounds of the games in my ipad2

    Some days ago when I was playing games in my ipad2 the sounds of the games was working just fine, but now I can't here a sound.
    any help wil be apreciated.

    Make sure the side switch is not set to silent, make sure you don't have a Bluetooth device that the sound is going to. If that's not the case then try restarting your iPad 2 by holding down the on/off and the home buttons at the same time until you see the Apple logo. 

  • No sound effects on games or keyboard sound since downloaded 8.1.3 this morning on iPad airanyone any ideas pl ? 

    no sound effects on games or keyboard click since downloading 8.1.3 this morn. At first no sound on anything then played about in setting and switched off and now no sound effects despite being on full volume. If I reset will I lose my games pl ?

    I Think you have system sounds muted. Don't reset anything just yet.
    System sounds can be muted and controlled two different ways. The screen lock rotation can be controlled in the same manner as well.
    Settings>General>Use Side Switch to: Mute System sounds. If this option is selected, the switch on the side of the iPad above the volume rocker will mute system sounds.
    If you choose Lock Screen Rotation, then the switch locks the screen. If the screen is locked, you will see a lock icon in the upper right corner next to the battery indicator gauge.
    If you have the side switch set to lock screen rotation then the system sound control is in the control center if you are running iOS 7 or 8. Swipe up from the bottom of the screen to get to control center . Tap on the bell icon and system sounds will return.
    If you are running iOS 5 or iOS 6, the system sound control is in the task bar at the bottom. Double tap the home button and swipe all the way to the right in the task bar to get to the speaker icon on the left side. Tap on that and the sounds will return.
    If you have the side switch set to mute system sounds, then the screen lock can be accessed in the same manner as described above.
    This support article from Apple explains how the side switch works.
    http://support.apple.com/kb/HT4085

  • Recently, I can't get any sound from my game applications.  Sound works fine with video, streaming, etc, but not my game applications.  I've tried powering down and re-booting, but the sound does not return.  Can anyone help me?

    Recently, I can't get any sound from my game applications.  Sound works fine with video, streaming, etc, but not my game applications.  I've tried powering down and re-booting, but the sound does not return.  Can anyone help me?

    Have you got notifications muted ? Only notifications (including games) get muted, so the Music and Videos apps, and headphones, still get sound.
    Depending on what you've got Settings > General > Use Side Switch To set to (mute or rotation lock), then you can mute notifications by the switch on the right hand side of the iPad above the volume switch, or via control centre : swipe up from the bottom edge of the screen and it's the right-most of the 5 icons in the middle of it (if the icon is white then it's 'on', tap it to turn it grey and 'off'). The function that isn't on the side switch is set via control centre instead : http://support.apple.com/kb/HT4085

  • TS1702 I lost all sound in my game apps why?

    I lost all sound on all my game apps why?

    Hi,
    Try the following.
    Download the IDT Audio installer on the link below and save it to your Downloads folder.
    IDT Audio Installer - Windows 7.
    When done, open windows Control Panel, open Device Manager and open up Sound, Video and Game Controllers.  Right click the IDT device and select Uninstall - you should also get a prompt to remove the current driver, tick the box to allow this and then proceed with the uninstall.
    When complete, shut down the notebook, unplug the AC Adapter and then remove the battery.  Hold  down the Power button for 30 seconds.  Re-insert the battery and plug in the AC Adapter.
    Tap away at the esc key as you start the notebook to launch the Start-up Menu and then select f10 to enter the bios menu.  Press f5 to load the defaults ( this is sometimes f9, but the menu at the bottom will show the correct key ), use the arrow keys to select 'Yes' and hit enter.  Press f10 to save the setting and again use the arrow keys to select 'Yes' and hit enter.
    Let Windows fully load - it will automatically load an audio driver, but just let this complete.  Then open your Downloads folder, right click on the IDT installer and select 'Run as Administrator' to start the installation.  When this has completed, right click the speaker icon in the Taskbar and select Playback Devices.  Left click 'Speakers and Headphones' once to highlight it and then click the Set Default button - check if you now have audio.
    Regards,
    DP-K
    ****Click the White thumb to say thanks****
    ****Please mark Accept As Solution if it solves your problem****
    ****I don't work for HP****
    Microsoft MVP - Windows Experience

  • Sound Blaster Audigy Gamer not being recogni

    Hi, I own the Sound Blaster Audigy Gamer. It had been working fine before I needed to update the drivers. When I tried to update the drivers it said that no Audigy Card was being detected and that the Setup would close. The first person at Creative I called told me that all I needed to do was to move the sound card to a different slot. I did, but the problem still occured. The second person told me to do a clean-sweep of the card, as persay of SID72, a KB article. I did that, but also it had the same problem. The third time I called he told me that I should try it in another computer, and I do not have any at the moment. What am I to do? I have checked the IRQ, it has IRQ#5 all to itself. I will try to move the PCI slot again though. Windows asks me every time I boot that I need to install the drivers. Should I do that?
    -Thanks
    Ibrahim

    Hi, I own the Sound Blaster Audigy Gamer. It had been working fine before I needed to update the drivers. When I tried to update the drivers it said that no Audigy Card was being detected and that the Setup would close. The first person at Creative I called told me that all I needed to do was to move the sound card to a different slot. I did, but the problem still occured. The second person told me to do a clean-sweep of the card, as persay of SID72, a KB article. I did that, but also it had the same problem. The third time I called he told me that I should try it in another computer, and I do not have any at the moment. What am I to do? I have checked the IRQ, it has IRQ#5 all to itself. I will try to move the PCI slot again though. Windows asks me every time I boot that I need to install the drivers. Should I do that?
    -Thanks
    Ibrahim

  • My ipad2 doesn't play sound on most games and apps, what did i do?

    I have no sound on most games and apps. But I have sound on pandora and a few others. What's going on here?

    Here's what happened to me, and how I resolved it. In my settings, (Settings->General), I had "Use the Slide Switch to:" set to the default, "Mute." I had the slide switch in the mute position when I went into settings and changed the control for the slide switch to "Lock Rotation." This caused the slide switch control to change to rotation locking, but it left the volume control in the muted state.
    This is where King_Penguin's response comes in: if the slide switch controls rotation locking, you have to use the home button to get to the mute setting. Double-tap the home button to reveal the application switcher bar at the bottom of the iPad. Then swipe from left to right in that bar to reveal the audio controls. The icon on the far left will be of a speaker. If it has a slash through it, audio is muted. Simply tap the icon to toggle it to a non-muted state. Also, you can verify that the volume level itself is not all the way to the lowest setting. The volume slider is on the right side, next to the Music icon.

  • TS1702 Why don't I have sound on my games on my iphone?

    Why don't I have sound on any games on my iphone5?

    Is the switch on the side turn to silent?
    Try shutting down all of the app currently running in the multitaking bar, then relaunch your game.
    Also, try a hard reset: http://support.apple.com/kb/HT1430

  • No sound output in games with "advanced effects"...Audigy 2 ZS...HEL

    <SPAN>Hi there.... I have a soundblaster audigy 2 ZS installed with the drivers and EAX console. I have noticed that if I enable "advanced EQ" in the "enable audio effects" menu, i get no sound output from games or other software, although windows noises and sound files play fine!!If i use other features from the "enable audio effects" menu such as "environment" then the sound works fine....Surely this is not meant to happen?Anyone else check this for me?

    *bump*

  • KeyListener, sound problems with game

    Hi All!
    I'm new to gaming.. I've developed a game called Puyo Puyo using Swings. But its got some problems...
    My game plays well for the first time but doesn't restart.
    Im unable to implement keyListeners.. they simply dont work..
    Can someone tell me how to add sounds to my game?
    When executed, a blank window appears first, then on maximising.. evrything else comes into picture.. how do i rectify this? Please help me out at the earliest wid all ur possible and favourable hints n replies..
    Take Care ya'll!

    Hello...
    I'm trying to develope Puyo Puyo(Variation of tetris) game through Java(Java Console Application). The game is like that we have to display 4 types of smiles & if 4 Similar smilies forms the row or Column then score is increased & that row/column will be removed from Application. Still now I'm abel in generation of random smilies & moving then left/ right.
    But how can I manage to create a array of images & detect whether they forming rows/columns. Plz give me Hints.
    Thanks in Advance

  • Re route sound from older game to usb heads

    I have a sound blaster li've 24 , and a plantronics usb headset. most of the games i play the?sound is play back thru the head set.one game does not, (panzer general)?it plays briefings thru the head set the game effects thru the analog jack on the sound card.older games like starcraft play thru the head set. is there a way to route all the sound from the analog jack to the usb port??TIA

    Migration Assistant via FireWire is the normal method. Details in Finder->Help->Mac Help->transfer files.

Maybe you are looking for