Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. How to play a specific buffer,not a file?

How to play a specific buffer,not a file?

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialquestion
6 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • X Offline
    X Offline
    xiaochnegwx
    wrote on last edited by
    #1

    -

    D A K 3 Replies Last reply
    0
    • X xiaochnegwx

      -

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      How to play a buffer? Can you elaborate a bit more?

      X 1 Reply Last reply
      0
      • X xiaochnegwx

        -

        A Offline
        A Offline
        Alexander M
        wrote on last edited by
        #3

        ?? what kind of buffer?? sound? if sound-> copy it to a sound buffer and play it! Don't try it, just do it! ;-)

        1 Reply Last reply
        0
        • X xiaochnegwx

          -

          K Offline
          K Offline
          kochhar
          wrote on last edited by
          #4

          The functions you need are: waveOutOpen() waveOutPrepareHeader() waveOutWrite() waveOutClose()

          X 1 Reply Last reply
          0
          • D David Crow

            How to play a buffer? Can you elaborate a bit more?

            X Offline
            X Offline
            xiaochnegwx
            wrote on last edited by
            #5

            :confused: Well,now i am doing a web streamming project. Client receives data from the server via UDP protocol and plays the data buffer(wave). Now I have tried many methods,including MCI and DirectSound,but still haven't found a better solution. With MCI,I use waveOutWrite() to play the data buffer.But waveOutWrite() will spend about 0.2 second to send the data block to the playing device and then return.This is deal to that there is about 0.2s interval when playing the sound continually. I can't fix the problem. So now it is not smooth when playing the sound. (the sound buffer is about 800K). DirectSound is usually used for game,and it base on focus.This is meant that when the program loses focus it can't play the sound in the background. Now I need it to play the sound whenever the program loses focus or not. Now I am seeking a method to play the sound buffer(wave) without any delays. My current method that plays the sound buffer go as follows: when MCI(waveOutWrite()) finishs playing the current buffer,it singals the event. Thread receives this notification,then it fills in the buffer with new data. And then use waveOutWrite() playing it again. but waveOutWrite() has about 0.2s delay. Now I want to find a better method without any delays. Can anyone help me? You can contact me at this email address: xiaochengwx@163.com Hoping your replies.

            1 Reply Last reply
            0
            • K kochhar

              The functions you need are: waveOutOpen() waveOutPrepareHeader() waveOutWrite() waveOutClose()

              X Offline
              X Offline
              xiaochnegwx
              wrote on last edited by
              #6

              But it seams that waveOutWrite() has about 0.2 second delay before it returns to main program.

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups