How to play one clip multiple times at the same time?

I am writing a little game where a certain sound has to be played quite frequently. I load it as a Clip and play it with
myClip.setFramePosition(0);
myClip.loop(0);If the sound has to be played again but is still being played by another event, the setFramePosition() method resets the sound and the first playing instance is cut off.
A workaround would be that each object that needs to play this sound would get its own copy, but that is not feasible due to heavy memory consumption.
So here it goes: How can I play a single sound multiple times at the same time? Is that possible?
Edited by: andrasz on Feb 27, 2009 12:37 AM

If the sound has to be played again but is still being played by another event, the setFramePosition() method resets the sound and the first playing instance is cut off.
A workaround would be that each object that needs to play this sound would get its own copy, but that is not feasible due to heavy memory consumption.
So here it goes: How can I play a single sound multiple times at the same time? Is that possible?Ummmm, if you're using a clip, you'll have to maintain one copy per object that needs to play the sound concurrently. You could keep one master copy, and then create copies of the clip as necessary to play them, and then just dump the copies to decrease memory consumption.
A second idea would be to write your own Clip class. Esentially, all you would need to do is dump some sound data onto a TargetDataline to play it. It'll handle the buffering and playing at the correct speed itself. If that's all you did, you should be able to dump multiple times from the same instance and play it multiple times.
Obviously, that's just a theory. In practice, it may not work that way...

Similar Messages

  • Can Express 9 play and record multiple instruments at the same time?

    I have logic express 9 and was told with my interface that I can play and record different instruments at the same time on Express 9. Is this true because I have spent a long time trying to figure out how.

    Hi,
    to record multiple Inputs at a time, open up the appropriate number of audio tracks. Now for each track, select the correct Input in the Channelstrip.
    Now, ARM all these tracks for recording by clicking the little red R in the track header or channelstrip. Now if you hit record, all these tracks should record simultaneously their respective inputs.
    All other existing tracks should playback while recording.
    Fox

  • How to play more than 2 audio at the same time in a page

    I worked for interactivity book's page in Hype and I inserted two audio in a page
    One is background music played when page opend, Other is effect audio that played when touch the object.
    i added this widget in ibooks author.
    In ibooks-author on mac, i can hear two sound well. but in ibooks on ipad i got the problem..
    When i touch the object and play effect sound, background audio is stopped.
    Moreover, after effect sound ended then bgm is not played.
    i hope to hear two sound at the same time on ibooks, if not, play bgm continue after effect audio over.
    plz answer this problem.. T.T

    I got the same problems! I can't play multi audio at the same time. Would you mind letting me know the detail of how to deal with this problems.
    Regards,

  • I have two expresses and I'm wondering how to be able to play one song through both at the same time.

    Im going to host a party before I deploy and I want to impress everyone. I even tried everything under the sun to try it with the two apple tvs i have. So if someone can guide me in the right direction, I would be thankful.

    If both AXs' are set up to play through iTunes simply select multiple speakers from the lower right hand corner.

  • How to acquire data from multiple dataports at the same time

    Hi,
    I studied the multithreading section of Labview, but still have no idea
    how to make it work. Let me briefly explain my situation. I need to
    develop a program that can control and acquire data from 4 serial
    ports. I have 4 buttons to control starting or stopping acquisation
    from the corresponding port. Every acquisation process is a while loop.
    How can I start a new acquisation loop (eg. from COM2) while the loop
    for COM1 is still running? In other words, I wish the 4 loops running
    independently, and are controlled by their corresponding buttons only.
    Thanks for any suggestion.
    Jin

    Hi Anonymous,
          If I were you, I'd create one VI (call it Port.vi) to listen to one port - then make it reentrant.  Drop 4 copies of Port.vi on your Main diagram.  Port.vi inputs could include a VISA reference, a "Start/Stop" notifier and maybe a "Quit" occurance.  Wire to each copy of Port.vi a unique VISA reference and a unique "Start/Stop" [boolean] notifier - let all the copies share the same Quit Occurance.
    In Main, have one event case for each of your stop buttons.  When a button is pressed, send the appropriate Start/Stop notifier!
    ... of course you could accomplish the same thing with four identical loops right in your main diagram, but the more complex the port-handling gets, the easier it will be to manage in one place instead of four.
    Cheers!
    When they give imbeciles handicap-parking, I won't have so far to walk!

  • How to play midi and update graphics at the same time?

    hello
    I want to begin playing a midi file and then immediately while the music is still playing I want to update the screen, for ex. panel.update();It now seems that that whole screen freezes until the music has finished. How can I simultaneously update UI and play midi. Please help. Thanx!
    -Wonderful-

    http://www.google.com/search?q=java+thread+tutorial
    Plenty of tutorials and examples out there.

  • How can I install one app on multiple iPads at the same time?

    We have a volume purchasing account, but when purchasing an app we get multiple serial numbers that all seem to need to be entered individually. The iPhone config Utility will not sync multiple iPads at the same time. Am I missing something? This cannot be the method for mass deployment, it seem too complicated.

    You can do a  backup of you iPad then restore the backup to many devices.
    How to use multiple iPods, iPads, or iPhones with one computer
    http://support.apple.com/kb/HT1495
    Mobile Device Management Solutions for iOS
    http://www.apple.com/iphone/business/integration/mdm/
    http://www.apple.com/ipad/business/resources/
    "iOS mobile device management (MDM)
    With an unmatched breadth of features, a Self Service console forover-the-air (OTA) distribution of in-house and app store apps, and integration with Apple's Volume Purchase Plan (VPP), the Casper Suiteallows administrators to easily achieve the four major tenets of iOSmobile device management: Inventory, Configuration, Security Management, and App Distribution."
    http://jamfsoftware.com/products/casper-suite/

  • How to support multiple users at the same time?

    Hi all,
    I have a Labview software which controls a analyzer via GPIB connector. When user A is using the software, user B has to wait until A is done. But actually, the analyzer is not very busy, when user A is using the software.
    I want user A, B, C and D can use the software at the same time. just like we can open Multiple websites at the same time.
    How can I program the software, so that the software can be open multiple times? Do you have any example?
    Thanks a lot.
    Steven
    Solved!
    Go to Solution.

    Are all the users going to be measuring the exact same thing from the same instrument?
    It would be possible to write a separate instrument server application that would handle all the direct interactions with the instrument. When one of the users needed to access the instrument, they would gain access to it through this server.
    The big, Big, BIG caveat is that each interaction with the instrument would need to be atomic. In other words each access would need to configure the instrument, initiate the reading, report the results, and then reset the instrument back to some known default value.
    As Dennis said, not a trivial process, but probably do-able...
    Mike...
    Certified Professional Instructor
    Certified LabVIEW Architect
    LabVIEW Champion
    "... after all, He's not a tame lion..."
    Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps

  • In Elements 7.0, how can I delete multiple photos at the same time?

    In Adobe Photoshop Elements 7.0, how can I delete multiple photos at the same time?   Please be a little specific so I can follow your instructions as I'm not real smart at computers; I'm an intermediate user.  Thank you.

    Shift-click the photos or Ctrl-click them to select them, then right-click one of them and choose Delete from Catalog. They will all go together.

  • How do you apply a master page to multiple documents at the same time?

    How do you apply a master page to multiple documents at the same time?

    Hi friends,
    Thank you for trying to help me out.
    Let me explain it a bit to remove the ambiguity.
    I have 10 documents nested under a book. Each of these documents have 'n' number of pages. I want to apply my custom made master page "First" to the first page of all these 10 documents in one go. The remaining pages of the documents have to be in default "Right" master page format. How will I do it?
    I tried selecting all the documents and importing the formats from another document with the custom made "First" master page. The master page format is getting imported but the first page of all the documents still remain with the default "Right" master page format.
    I think now my question is more clear...

  • How to display multiple reports at the same time

    Hi,
    I'm trying to display multiple reports at the same time, each one in separates tabs or windows using Forms 11g 11.1.1.6
    I have a button which has a call to a procedure which makes use of rp2rro library to show the specific reports, for example:
    call_report('report1');
    call_report('report2');
    call_report('report3');
    call_report('report4');
    The main problem is that, just the last report is been displayed.
    Is there some way to display report1, report2 etc in separate tabs or windows ??
    Regards
    Carlos

    You shouldn't have a problem calling different reports at once. As long as you're using Forms 11g they show up in different windows.
    The question is how you are calling the report.
    Here is how I manipulate it.
    After I pass parameters with the ADD_PARAMETER built-in I set some key values (destype, desformat, desname) with the RP2RRO's procedures.
    Finally calling RP2RRO.RP2RRO_RUN_PRODUCT and then WEB.SHOW_DOCUMENT passing the correct procedure parameters the report comes up in a window. If you repeat the above changing the appropriate variables (the report_name in the RP2RRO_RUN_PRODUCT and so on) you can get multiple reports in different windows.

  • How do I apply same adjustments to multiple photos at the same time?

    How do I apply same adjustments to multiple photos at the same time?

    You can't but you can copy the adjustments made on one photo and apply/paste it onto another by:
    1 - Control (right)-clicking one the edited photo in the Edit mode and selecting Copy Adjustsments
    2 - Control-clicking on the next photo and selecting Paste Adjustments.
    OT

  • How does iCal, or Calendar, order the display of multiple events for the same time?

    I can't for the life of me figure out how iCal orders the display of multiple items at the same time.  Does anyone have a clue?  It's not alphabetical.  It's not according the the order of the calendars in the left pane.  Is it just random?  Any help would be greatly appreciated.

    In the focus lost eventhandling start a thread which does
    the actual handling.
    the new thread waits for a little time (0.1 seconds)
    the click event of the button checks for a thread like the one above and tells it not to execute
    This way you execute the for the lost focus event only if
    the ok button isn't clicked in the same process ... not
    realy good, because it kind of relies on the ordering of threads ... but maybe it still works for you?

  • How do I delete multiple documents at the same time

    How do I delete several or multiple documents at the same time.  Do I have to delete each one individully?

    You can select multiple adjacent files or folders by clicking on the first one then shift-click on the last one.  Multiple non-adjacent files or folders can be selected one at a time by command clicking on each one.  Click on any selected file or folder then drag/drop to trash.

  • I was wondering if you could have one desktop audio playing through your speakers and the other one playing through your apple tv at the same time?

    i was wondering if you could have one desktop audio playing through your speakers and the other one playing through your apple tv at the same time?

    Problem here is you admit you cannot afford the service.
    And you want to blame Verizon for losing a job because you have no cell phone.
    If your job depends on that phone I would pay it on time every time if you need a job to pay your bill.
    No other service is going to treat you any different. And if you cannot afford Verizon's monthly invoice how are you going to afford new devices, activation fees, possible security deposits on any other cellular carrier? You can't.
    Also if you made an arraignment to pay and then decide you cannot do so, why should Verizon extend you service or credit, or why is it you want to use the service and data and not pay for it as agreed.
    Get a prepay phone. Its evident the cost is too high for you to afford on post pay.
    Good Luck

Maybe you are looking for

  • Automate creation of Pages documents from Numbers or delimited text file?

    I'm just trying to find a way of automating my processes a bit. Basically, you can assume I have information in a Number's document like this: File Name Headers 1-FileName Some Title with Capitlization I Need to Keep Subheading 1 Subheading 2 Subhead

  • HP DV 7 7050-SW

    Hello, have problem with my DV7. I've just bought second SSD drive to my laptop and install it on free place as a second and connect to second connector on mainboard. The problem is that i dont know how to forced windows to install OS on second drive

  • Vendor Master LSMW

    Dear Experts , While recording an LSMW for vendor master creation , the main address & communication screen is appearing to be very different . Also this doesn't have many of the fields which are normally available in a vendor master . Please tell me

  • Can I do a mail merge from Excel in Pages?

    I would like to use Pages to send out invoices and form letters to my membership database which is in Excel. Is there a way to do this? Thanks.

  • Updating sysdate in database against entries corresponding to chekboxes che

    i want to make entry of the system date in the database table corresponding to the rows in the grid which has been checked(using check boxes). so two problems: 1. how do i relate a row in a grid which has been fetched from the DB to a checked checkbo