My game sounds are played with noticable delay!

hi.
i'm writing a graphical game by java2D API .
i have many threads to run,so when i use an AudioClip
object to play my desirable sounds (.wav files),it would play
with a noticable delay.
i decided to use windows APIs through the JNI.
but i must first write a c++ code (.h file)then convert it to a
.dll .
i don't know how i can call "sndPlaySound" function of "winmm.dll"
library in C++ code.
can you help me please?
or another recommendation!
thanks a lot.
bye.

i decided to use windows APIs through the JNI.
but i must first write a c++ code (.h file)then
convert it to a
.dll .
i don't know how i can call "sndPlaySound" function of
"winmm.dll"
library in C++ code.You might try posting this in the JNI forum.
Generally it is not hard to do such things. sndPlaySound takes apparently a string and an int to specify the sound and how to play it. You would simply define a native method in your class, use javap to create the native header file and then make an implementation for that native method. The method would take a string and an int and convert them to the format expected by the sndPlaySound function, then just call it and you are done.
I'd suggest passing an array of bytes rather than a Java string. Since a C string is really an array of bytes it is easier to work with it this way. You can do things like converting a Java string to bytes and adding the required NULL terminator from Java code where it is easier to do.
Unless you don't know any C++ coding at all, in which case this could be hard to accomplish.

Similar Messages

  • Movies which are played with itunes are missing 2nd line of subtitles therefore apple tv 2 misses these also. How so?

    Movies converted from MKV via Handbrake which are played with itunes are missing 2nd line of subtitles therefore apple tv 2 misses these also. Funny is that Quicktime and Ipad 2 handles subtitles correctly on the same moviefile.
    (please note that the subtitles are not burned into movie)
    What can be the problem?
    Has anyone suggestions?
    Thanks in advance
    Kr
    KJS

    i am experiencing this issue as well...
    any tips or resolution would be greatly appreciated...
    thanking you kindly...

  • I've installed Flip4Mac WMV in Lion and when I try to listen to audio in some sites, it starts playing and after about 0.5 seconds it starts playing again. So, I have the same thing playing with a delay... What is happening and how to fix it?

    I've installed Flip4Mac WMV in Lion and when I try to listen to audio in some sites, it starts playing and after about 0.5 seconds it starts playing again. So, I have the same thing playing with a delay... What is happening and how to fix it? Is there any other way to play theese kinds of files without using Flip4Mac WMV?

    Use Flash Media Server to stream the files.......set up a timer and have all three of them play at once....and have a button switch the streams depending upon which stream you want to play.....and wallah......
    you can also capture the stream.time from the video playing and resume from that point on the other videos as well....havent done this theoretically so I dont know how smooth the transistion between streams will be....but it can be done....
    plus u may have to use double buffering techniques to make sure it starts up right away......
    thelegendaryghost

  • Why the game: Injustice, when play with the challenge will direct close the game? Please fix it.

    Why the game: Injustice, when play with the challenge will direct close the game? Please fix it.

    You need to speak to the developer. They should have some sort of contact link on their iTunes page.  This is just a user to user tech support forum, no one here has any sort of control over apple or what developers do.
    The game developer may also have some sort of fix on their site, so look there.

  • Windows Media Player: all the DVDs are played with cilyndrical distortion in pictures

    Hi
    I have Windows 7 (but hte issue I got also on XP in a different PC)
    When I play DVDs with Window Media Player (not mater if the 9 or the 10 or the 11, the issue still exist), all the movies are player with pictures that are distorted.
    I mean: they look compressed in, the center of the screen, and expanded in the sides. Like if the images are wotched through a cylinder.
    It happens only with DVDs. If I play an .MP4 or an .WMV, this issue doesn't occur.
    Is there any settings to prevent this please?
    If I use VLC this doesn't happen. Thus there should be something else that I don't know.
    Please can you help me?

    Hi Tormy ,
    Except for running the troubleshoot tool to have a diagnostic ,please take the following steps to have a diagnostic.
    1.If you got another DVD player application in the machine , this issue can occur because different DVD players install different software that is used to decode the DVD video so that it can play back. Please try to remove the other
    DVD player application to have a check.
    2.Considering the other formats will play well ,there is a possibility that the format of these DVD are not supported by the Windows Media Player. It`s recommend to download the codec you need from the website to have a check .
    For the codec questions ,here is a link for reference:
    Codecs: frequently asked questions
    http://windows.microsoft.com/en-hk/windows/codecs-frequently-asked-questions#codecs-frequently-asked-questions=windows-8
    3.Sometimes the antivirus software may cause this issue, please turn off the antivirus software temporarily to have a check.
    4.Apart from all the above suggestions, please ensure you have got the latest video card driver or reinstall it from the device manager.
    Best regards

  • HT4623 What game apps  are compatible with ipod 2?

    What game apps are available for ipod 2?

    To more easily find compatible apps:
    iOSSearch - search the iTunes store for compatible apps.
    Apple Club - filter apps by iOS version.
    Starting when iOS 7 was released, Apple now allows downloading the last compatible version of some apps (iOS 4.2.1 and later only)
    App Store: Downloading Older Versions of Apps on iOS - Apple Club
    App Store: Install the latest compatible version of an app
    You first have to download the non-compatible version on your computer. Then when you try to purchase the version on your iPod you will be offered a compatible version if one exists.

  • Have lost sounds for some games e.g. Solitaire. Others are ok but keyboard sounds have also gone. Sounds are ok with earphones. Have checked settings and they seem ok. Any ideas, please?

    Lost sounds In some games

    Have you got notifications muted ? That will mute notifications (including games), so the Music and Videos apps, and headphones, will still get sound.
    If its an iPad Air 2 then notification mute and rotation lock are controlled via Control Centre : Turn on Mute and Orientation Lock on iPad Air 2 - Apple Support
    If it's the first gen iPad Air then 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 : About the iPad Side Switch - Apple Support

  • Are there any games I can play with my friends on thier ipod and macbook?

    I also have a macbook and the three of us would like to find a game to play. any ideas? 2 Macbooks and one 4g IPOD...

    Hi,
    See Here:
    Download Past Purchases
    http://support.apple.com/kb/HT2519

  • Pause before sounds are played

    I just noticed that I posted *[an iMac question|http://discussions.apple.com/thread.jspa?threadID=2054360]* in the wrong forum. I didn't get anywhere in that forum. Here's updated question text for the iMac folks:
    I have a 24" iMac6,1, late 2006, plastic case, 2.16 GHz Core 2 Duo, 2 GB memory.
    If no sound has been played in the last 30 seconds or so then there's about one second delay before a sound can be played. This is bad enough but the delay also holds up whatever app is causing the sound. This is really annoying.
    The problem has been around a long time: see [here|http://discussions.apple.com/thread.jspa?messageID=6689782] and also [here|http://discussions.apple.com/thread.jspa?messageID=3479343] but I haven't found a solution.
    For example, I use the terminal a lot (unix sw development etc.). Filename and command completion using the tab key are pretty important to being able to work fast. The shell beeps if there's an ambiguity in the attempted completion. That's a normal part of work. But when it inserts 1 second delay in your typing, that's really annoying.
    Similar problems in Xcode. System beeps are common. And typing stops while Xcode waits for the sound HW to wake up.
    There's a really old app called "keep sound awake" (or something like that) designed to deal with this problem. It plays a silent sound periodically to stop the sound device from entering sleep mode. But it also prevents the system from sleeping, which is not good, is ancient and buggy. I can't use it.
    It's still driving me nuts. Does anyone have a clue what to do about it?

    Try zapping the P-RAM
    http://support.apple.com/kb/HT1379
    also are you using external speakers?

  • Captivate created file playing with time delay

    I have an issue with some machines in the Company where Adobe Captivate files are not playing as created via Flash Player  ie where a slide should move onto another slide after a 3 seconds interval , this interval takes over 15 seconds. 
    I am not getting any error messages and the files play as required but with the serious time delay  between slides.
    The files created from Captivate are exe files.
    The strange thing is that this issue only occurs in some machines in the Company and I am unable to determine a pattern as to this issue.
    I have updated the Codec driver and the Graphic drivers on the affected machine but did not solve the issue.
    I have tested an affected file on 2 of the same model machines  (HP Desktop machines) both running Windows XP SP3 with Adobe Flash Player 10.3  and IE8.0 .
    The file played successfully on one of the machines but on the other machine there was a 10 second time lag between slides.
    I have checked Task Manager and the process is only using 2-3% of the CPU so the machine has enough CPU to run the file .
    I updated to Flash 11.1 on one of the machines and IE 9 but still encountered the same issue.
    I have disabled the Anti Virus software (McAfee) while testing on one of the affected machines and this did not solve the issue.
    All Machines have the latest approved Microsoft updates installed as required.
    The files are created using Adobe Captivate 3 and are stored locally on the affected machines
    The files created were created in captivate with a standard 30 fps option
    Can you please advise on this issue

    Welcome to our community
    As I understand things, when you launch an EXE file created by Captivate, it decompresses and temporarily installs a runtime version of the Flash Player. So I'm wondering if perhaps on these machines where the delay is occurring, if it would help to perform the following steps:
    1. Clear all temporary files
    2. Perform a defragmentation of the hard drive
    I'd try step one first and see if anything improves. Perhaps that's all that is needed. The second step is simply a good habit to get into.
    Cheers... Rick
    Helpful and Handy Links
    Captivate Wish Form/Bug Reporting Form
    Adobe Certified Captivate Training
    SorcerStone Blog
    Captivate eBooks

  • HT4314 if i get a new iphone, will i keep the progress made on games that i play with  my current iphone?

    i want to get a new iphone....will i keep the progress ive made on my games with my current phone?

    Some do and some don't. Best ask the developer of the app.

  • No sound when song's are playing

    The earphones work on on other ipods and my computer and the song's are playing with volume turned up to the max, but NO Sound is coming out of the ipod.

    Is this with all songs or just a couple?

  • No sound when playing burned DVD with Windows Media Player

    Hello!
    I made a 10 minute movie which I burned , tested and delivered today.
    But it turns out that when playing the DVD with WMP, there is no sound.
    I had tested the movie playing it with powerDVD, and it worked as it should. When playing it with a normal DVD player and TV it works allright.
    But I had not tested it with WMP. And sure enough, when playing it with WMP there is no sound!
    The ones who will show the DVD will do it from a computer to a video projector, and maybe they don't have a "proper" DVD program installed. But I heard that there was sound when playing with "VLC" which is a relief.
    But I feel the need to get to the bottom of why there is no sound with WMP? Any clues?

    In NTSC-land, one has but two choices: PCM/WAV or DD AC3, which is a particular "flavor" of MPEG. In PAL-land, one does have the option of MPEG (not DD AC3) as an option, but that seems to be falling out of favor.
    When MS was re-tooling WMP, they wanted to add back the functionality of commercial (pressed/replicated) DVD's, but sought to limit any burned DVD's. Do not know what the mindset is now, so much could have changed with a few iterations of WMP. I have to admit that I just do not reach for it that often.
    In the Project, or Disc, menus, one can tell En which Audio Transcoding to use. As John T, suggests, I would definitely do a test with PCM/WAV, and X my fingers.
    If your client(s) is/are set on WMP as the player, there is hopefully a scheme that you can get to work. Also, remember that some older versions of WMP might not play the DVD at all, unless one finds the right plug-in, that basically hacked the intended setup in those older versions. Just like when delivering to a client, and not knowing their systems' calibration, or setup, trying to cover every base in a particular player software might involve a lot of work, and prayer.
    Good luck,
    Hunt

  • Why won't sound play with YouTube video on my iPad

    How do I get sound to play with video? I was trying to play YouTube video from a Facebook post (using app). Video plays, but no sound. How do I fix it?

    I am also having this problem, and its confusing the crap out of me when I try to fix it. Between the general settings for "use side switch to:" and the sound settings for ringer and alerts and the lock sound option, I can not figure out the combination to get the sound to work normally. All of a sudden it just had no sound. I think I have tried all the options, changed all of them and there is still no sound, on anything. No Ipad sounds, no keyboard sounds, no video sound, nothing. When I push the volume button up, I get a box in the middle of the screen with a bell that says "sound effects" but there is no bar at the bottom of the box that would usually show the volume going up and down. I click the volume to go up a few times and it just shows me that bell box for sound effects. I have reset the Ipad, and that didn't help. What's even more strange is that in the last few weeks, it has had volume a few times, and then it just stops again. No damage has occurred, no water damage, or dropped at all. Please, someone give me clear step by step directions on how all the settings need to be set. Please?? Thanks.

  • Scratchy sound when playing a .mov file in QuickTime

    I just got a new camcorder (Insignia NS-DV1080P) and took a video that is about 33 minutes long. I uploaded it to my mac, into iphoto, and when I try and play it in QuickTime, the picture is great, but it is very scratchy sounding. When I plug the camcorder directly into my tv, the sound is fine. When I play it back from the camcorder, the sound is fine. Please help with what I am doing wrong and how I can fix this.

    What I have always done is to add a Build In of Start Movie automatically after transition. Then add a Build Out of Stop Movie and adjust the delay to fit the timing of the movie. There are two problems with this technique.
    First, the delay can only go up to 60 seconds. So if you have a longer movie, you need to add a shape, set the fill and line to none and then add build ins and build outs (or actions) to equal the time needed to fit the length of the movie. For example, if you have a 3 minute movie, you can set the build out for 60 seconds, but then need to add 2 minutes worth of other actions to fill the time, so the build out happens at the end of the movie.
    The other problem is that if your movie is exactly 96 seconds and you have 96 seconds of builds, it might not still quite end right at the same time. There seems to be a bit of difference in the time from the movie and the builds. So you might have to play with the delays a little to get it to work just right.
    Hope that helps.

Maybe you are looking for

  • PSU and Video card upgrade for HP e9280t

    Hello, I wanted to upgrade my PSU and video card. The PSU I would like to get is the SeaSonic S12II 620 Bronze 620W (http://www.newegg.com/Product/Product.aspx?Item=N82E16817151096&Tpk=17-151-096) but I wasn't sure if my computer could handle and hol

  • How do I remove a small line at the bottom of the page?

    Hello! I'm formatting some work for a client and I can't seem to find out how to remove this line at the bottom of the screen. It's on every page. It's not a line that was drawn in because I can't click to remove it. Has anyone seen this before? Than

  • Error in creating IAC iviews

    Dear All, We are trying to create IAC iviews but getting error. Environment details: OS: AIX 5.3 DB Oracle 10.2.0.2(UC) Application EP7.0 (SPS14) Backend ECC 6.0 SR3 We followed the below mentioned steps: 01) Created one Internet Service ziactest in

  • RFC status in  R3 system "Service: SAP_ECC5 not found in CPACache"

    Hi experts, When the above error is noted in R3 . Itested INTEGRATION_DIRECTORY_HMI in Xi server there the following errors came. Response from Webserver contains Cookies accept? I gave response no For that Response: Response_line : HTTP/1.1 500 inte

  • Leopard compatibility on older G4 macs

    I have 5 macs of various vintages. 2 G4 cubes, 1 G4 Titanium notebook, 1 G4 tower that all came with OS X 10.1 and one 17" iMac that came with OS X 10.2 Jaguar. It would seem that according to the specs on Leopard, my Macs will not run 10.5. So what