4 Replies Latest reply on Apr 27, 2007 12:53 PM by BrightSource

    Slow Downs in Playing Sound

    BrightSource
      I'm fooling around with the trial version of director. I wanted to be able to play sequenced music... (midi, trackers, etc...) and have control over the speed and other variables for having background music in games. I've come to the conclusion by searching the forums that you can load and control speed if you play quicktime files, or you can use rateshift. I prefer something sequenced so I only have to store the sequence and the samples and modify their period so it takes very little space. I also want to be able to act upon any line in the sequences to integrate it with game code. I first thought midi, but couldn't find any direct support for it so I turned to home grown code for tracker mods.

      I wrote a .net application last night that converts old amiga soundtracker/protracker/etc... mod files into structures and code that lingo can play. It does a good job playing the mods. They don't sound perfect, but they are acceptable. I use directsound if it is available in the list, otherwise I take the default. True to the amiga, I use four channels, two panned to the right speaker, and two panned to the left. Timings do great until some other process on the computer eats up enough cpu%, and then director starts dragging down as low as 2-3 frames per second throwing my timing out of whack. I've had my driver for the mod play code set by tempo, and also tried by using an endless loop with a check for 'the milliseconds' for sequence line advancing but I get the same results. As soon as that cpu gets hogged, director is a second class citizen. A shockwave example is here (It is some intro music to an old amiga game I wrote):
      ModPlayer Example

      My Questions:
      Is there a way to play midi files in director and control them and also know where they are at in the sequence or should I stick with my home grown solution?

      Is there a way to make director get a bigger slice of the cpu or rely on multimedia timers to do program looping?

      The play method for sound seems to eat way more cpu than it should. Is there some third party thing I should be looking at instead of relying on the built in play method?

      If there is a third party plugin etc... are they transparent to end user of a shockwave file? In essence, do they get that functionality automagically when they try to play a shockwave game or do they have to do a separate download?

      Am I barking up the wrong tree with director? Is Flash more suited to stuff like this? I've only been fooling with director for a couple of days so I am a blatant newb about all this. I'm assuming based on research that director is the way to go for the least limits on game creation in the web plugin world. I've always been able to synchronize timing on other development platforms and keep from being pre-empted (pc, pocket pc, linux, amiga, etc...) so I figure there must be a way to grab lingo by the neck and make it do my bidding.

      Finally, are these the kind of questions that are suitable for this forum, or do they belong in director-online or somewhere else?

      Thanks!
        • 1. Re: Slow Downs in Playing Sound
          Level 7
          You should check the list of available xtras (plugins) at
          < http://www.updatestage.com/external/mile-high-table-0products.html>
          Particularly the Sequence, CPS, Music and BASS Xtras

          > Finally, are these the kind of questions that are suitable for this forum

          Absolutely
          • 2. Re: Slow Downs in Playing Sound
            BrightSource Level 1
            Thanks for the resource! BassXtra seems to be pretty cool. It mixes and plays well without slowdowns, but doesn't support feedback of where it is in the sequence or allow modifications to anything other than pan, amplification, and volume. MusicXtra crashed IE.

            Regardless, is it true that all the 3rd party Xtras will prompt the user to do an additional download when they bring up the shockwave? Or is there some vetting process between macromedia and some 3rd parties so that doesn't have to occur?
            • 3. Re: Slow Downs in Playing Sound
              Level 7
              > Regardless, is it true that all the 3rd party Xtras will prompt the user to do
              > an additional download when they bring up the shockwave?

              Yes, and it can't be bypassed for security reasons. It's like installing
              an ActiveX control in the browser.
              • 4. Re: Slow Downs in Playing Sound
                BrightSource Level 1
                Bummer. I definately don't want to force the user to have to install anything besides shockwave.

                I just have some old games that I wanted to convert to shockwave that had the tempo of the music speed up as the gameplay got more intense.

                Is there anything native to director for having accurate timers that aren't preempted so heavily? For instance, in C/C++ I would make use of a high resolution multimedia timer callback.

                I've tried using timeout handlers, but they are also affected by system load (in addition to controlling tempo or calculating by the milliseconds). I'm beginning to think that playing music in director that is affected by the gameplay is out, but I can do a looping background wav or mp3 that has a static speed.