Solved

playing sound using direct sound

Posted on 2001-06-18
5
252 Views
Last Modified: 2013-12-03
hi,
im try to play wave file
in this format:
8 khz,16 bit (sampled at),mono.

in the lpDirectSound->CreateSoundBuffer() func
i supply WAVEFORMATEX structure with this parmeters:
    wf.wFormatTag = ; //i dont know
    wf.nChannels = 1;
    wf.nSamplesPerSec = 8000;
    wf.nBlockAlign = 2;
    wf.nAvgBytesPerSec =wf.nSamplesPerSec*wf.nBlockAlign;
    wf.wBitsPerSample = 16;

the sound that i receive is very slow
and with lot of noise.
(in very slow i mean that the voice
 is spread on long time)

the format of the sound file that i try to play,
is as codec output, before any manipulations (include pcm).

i dont know the correct parameter for field wf.wFormatTag in the WAVEFORMATEX structure.

is the direct sound is the good way for this task?
 
TIA.

///////////
19-6-01

the original file is not  pcm format, but now i convert it to pcm format, for using WAVE_FORMAT_PCM.
(Also, my code already based on Microsoft sample in direct sound documentation).
But the problem persists. (The sound spread on long time)

Its lock likes frequency mismatch,
May the hardware or driver translate the data as lowest sample rate so all sample take more time when playing it.
0
Comment
Question by:stern_b
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 14

Expert Comment

by:AlexVirochovsky
ID: 6202060
check out example in
http://msdn.microsoft.com/library/wcedoc/wcegmm/dsover_25.htm
About WAVEFORMATEX
see
http://msdn.microsoft.com/library/psdk/directx/DX8_VB/hh/directx8_vb/_dx_waveformatex_dxaudio_vb.htm
1-st parameter of WAVEFORMATEX
must be set to WAVE_FORMAT_PCM or WAVE_FORMAT_DRM.


0
 
LVL 23

Expert Comment

by:chensu
ID: 6205025
>i dont know the correct parameter for field wf.wFormatTag in the WAVEFORMATEX structure.

Use WAVE_FORMAT_PCM if it is in PCM format.

>is the direct sound is the good way for this task?

If you just want to simply play a wave file, using the PlaySound API function is much easier.
0
 
LVL 14

Accepted Solution

by:
AlexVirochovsky earned 200 total points
ID: 6248981
No reaction, I hope , my comment helps. Alex
0
 
LVL 1

Expert Comment

by:Moondancer
ID: 6697023
If this proposed answer has helped you, please accept it, grade it and close this question.  If it is not, reject it and add comments as to your progress and what else is needed.

Thanks,
Moondancer
Community Support Moderator @ Experts Exchange
0
 
LVL 1

Expert Comment

by:Moondancer
ID: 6791205
Zero response from Asker or expert(s) since my last follow up request, therefore can only assume that the Proposed Answer served the need.  Closing today.

I am sorry to see that Asker has not returned to update and finalize this question.  I am, therefore, force accepting this question.  In the event the Asker returns with additional needs related to this question, please respond and continue the collaboration process.
 
If there are questions in this regard, please comment and I'll return when I can.
 
The HELP DESK link on the left is informative, and includes this site's Guidelines and Member Agreement as well as assistance related to Questions and Answers.  Here is the QA link, as a reference.
 
http://www.experts-exchange.com/jsp/cmtyQuestAnswer.jsp

--->  While I'm here anyway, letting all know that we have added quite a number of new Topic Areas, as you'll see from the link below:

http://www.experts-exchange.com/jsp/zonesAll.jsp
 
Thank you,
Moondancer
Community Support Moderator @ Experts Exchange
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows how to make a Windows 7 gadget that accepts files dropped from the Windows Explorer.  It also illustrates how to give your gadget a non-rectangular shape and how to add some nifty visual effects to text displayed in a your gadget.…
With most software applications trying to cater to multiple user needs nowadays, the focus is to make them as configurable as possible. For e.g., when creating Silverlight applications which will connect to WCF services, the service end point usuall…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question