Announcement

Collapse
No announcement yet.

Question on wavs

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Question on wavs

    I found this in the forums for playing wav files. I was thrilled to hear a Cobra Mustang doing a burnout while my bitmapped tachometer climbed crazily through 8000 rpm! (with help from Perfect Sync's Grafix Tools. Love it)

    SUB PlayWave(BYVAL File$)
    LOCAL zWav AS ASCIIZ * 256
    zWav = File$
    CALL PlaySound(zWav, BYVAL NULL%, %SND_ASYNC)
    END SUB

    Anybody know how to let a wav file play, but in the middle of it, suddenly change the sampling rate without starting the wav over again? Would love to take a 2 or 3 second sound clip of an engine at a constant speed and change the sampling rate repeatedly while it's playing, to make the tone gradually change up and down. Is this possible? Flightsim 98 does this, I think. I'm new to the wav thing, so please, be gentle!
    Praying hard, Todd
    P.S. Would Charles Petzold's book have answers to this kind of thing?




    [This message has been edited by Todd Wasson (edited February 04, 2000).]
    Todd Wasson
    http://PerformanceSimulations.Com
    PowerBasic Racing Simulator (October 2007 clip - 15.1MB wmv file) http:http://www.performancesimulations.co...m-GenIV-12.wmv

  • #2
    To accomplish this, you'll probably need to access the low-level multimedia API's directly, such as the MCIxxxxxx API's. Check out MSDN http://msdn.microsoft.com and search for "Win32 Multimedia Programmer's Reference" or related phrases.



    ------------------
    Lance
    PowerBASIC Support
    mailto:[email protected][email protected]</A>
    Lance
    mailto:[email protected]

    Comment


    • #3
      I've been looking through the forums myself to find code for playing
      MP3's/WAV's. My questions are: when using MCISendString() and
      PlaySound(), is there any way to stop them from playing the sound
      files before they're at the end of the files? Will both functions
      play both MP3's and WAV's?

      I run a TriBBS 11.3 BBS system (16-bit DOS-based system), and
      for sysops running multinode setups under a multitasker (i.e.,
      32-bit Windows), I want to write a 32-bit EXE that will be a
      replacement for the sysop pager, and I want it to include the
      ability to play MP3's/WAV's for the sysop notification alert.
      Well, the sysops who use my program would probably be VERY
      annoyed if a whole 3- or 4-minute song played, when the normal
      sysop pager alert is 30 seconds in duration. 'Course, I *could*
      say in my docs to make SURE that the source sound files are no
      longer than 30 seconds in duration. But, still, I'd like to
      have the option.


      ------------------

      Comment


      • #4
        Disregard my last reply. I found most of the answers I needed by
        looking through the other topics on the subject. The answers I
        didn't find, I'm sure I can figure out myself via empirical
        testing.


        ------------------

        Comment


        • #5
          The sndPlaySound() API provides a way to halt playback... check it out at http://msdn.microsoft.com

          From memory, it goes somthing like:
          Code:
          CALL SndPlaySound(BYVAL %NULL, %NULL)
          Note that the sound would need to have been asynchronously played with the %SND_ASYNC parameter. http://msdn.microsoft.com/library/wc...r/uif_s_57.htm

          MciSendString also provides a STOP clause if I remember correctly. Search the BBS for "mcisendstring" and you should locate some discussions on this.


          ------------------
          Lance
          PowerBASIC Support
          mailto:[email protected][email protected]</A>
          Lance
          mailto:[email protected]

          Comment


          • #6
            todd --

            you can find what you want in petzold. you have to play the wav
            the hard way (using the waveout-api). for an example of wavout
            see forums/forum7/html/000446.html.
            i think i have an example of playing a wav-file (the hard way) somewhere.
            please mail me if you want me to look for it.

            regards
            peter

            ------------------

            Comment


            • #7
              Hi,
              Todd,Try the unlimited opportunities =dsound= (DirectSound).

              -- Vladimir

              ------------------
              Spherical Panorama Inc. Virtual Reality for: Real Estate, Tourism Advertisment.

              Comment


              • #8
                Vladimir and Peter,

                I abandoned the sound issues quite some time ago and have
                been developing a more complex physics engine for video game/simulation
                use. When the time is right for my own sim, FastGraph and DirectX
                may be the way to go. I've been reading up on DirectX and it doesn't seem
                quite the monster many folks have made it out to be, but of course,
                I haven't written anything with it yet. That'll have to be a
                VC++ thing (I'm MUCH better with PowerBasic, so that puts things in
                perspective). I do have DirectDraw for PowerBasic and have played
                a bit with that, but I don't know anybody that has converted the
                DirectSound, Direct3D, etc., headers to PowerBasic yet. Perhaps
                FastGraph 6.0 includes this? For now, I'm going with no sound and
                wrote a GUI based wireframe 3-D engine to test with. DirectSound
                will be my route eventually, although it would be nice to know how
                the low level functions work also.

                Getting closer...

                Thanks,
                Todd Wasson
                Performance Simulations
                Drag Racing and Top Speed Prediction Software http://PerformanceSimulations.Com

                ------------------




                [This message has been edited by Todd Wasson (edited August 17, 2000).]
                Todd Wasson
                http://PerformanceSimulations.Com
                PowerBasic Racing Simulator (October 2007 clip - 15.1MB wmv file) http:http://www.performancesimulations.co...m-GenIV-12.wmv

                Comment

                Working...
                X