473,324 Members | 2,370 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

Audio Playback

79
I am trying to play a wave file in an MFC application and get the current position while it plays. I’m skeptical about going with DirectSound because I understand that MS has made changes to the DirectX layout in version 10 and I’m not sure how easily it will be to have this functionality work in XP and Vista. I’ve tried the simplified sndPlaySound function, but there doesn’t seem to be a way to ask for position status when playing asynchronously. I’ve also tried using MCI:



Expand|Select|Wrap|Line Numbers
  1. mciOpenParms.lpstrDeviceType = "waveaudio";
  2.  
  3. mciOpenParms.lpstrElementName = audioFile;
  4.  
  5. dwReturn = mciSendCommand(0, MCI_OPEN, MCI_OPEN_TYPE | MCI_OPEN_ELEMENT, (DWORD)(LPVOID) &mciOpenParms));
  6.  
  7.  
  8.  
  9. waveDeviceID = mciOpenParms.wDeviceID;


Then while it plays,

Expand|Select|Wrap|Line Numbers
  1. MCI_STATUS_PARMS params;
  2.  
  3. params.dwItem = MCI_STATUS_POSITION;
  4.  
  5. params.dwCallback = NULL;
  6.  
  7. params.dwReturn = NULL;
  8.  
  9. params.dwTrack = NULL;
  10.  
  11. sprintf(comm, "status %d position", waveDeviceID);
  12.  
  13. mciSendCommand(waveDeviceID, MCI_STATUS, MCI_STATUS_POSITION , (DWORD)(LPVOID) &params);


But there is no position information in the returned params.



What API should I use and how should I use it to play a wave file and track the play position.
Jun 22 '07 #1
0 1327

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Tal Sharfi | last post by:
hi all I need to playback two or more audio files ( .wav files) together. let's say it's a song and a person speaking. I need to control the volume of the two channels, so when the speaking...
0
by: conaito VoIP | last post by:
conaito VoIP ActiveX library for developers of VoIP audio applications, such as voice chat, conference, VoIP, providing real-time low latency multi-client audio streaming over UDP/IP networks....
1
by: Ron Provost | last post by:
Hello, I'm developing a piece of software to assist illiteraate adults to learn to read. I'm trying to figure out how, if possible, to make audio playback asynchrnous but still controllable. ...
1
by: Brett Hofer | last post by:
Does anyone know of a good component for audio(.WAV) playback that supports double-speed/normal/half-speed? I need to provide this control in an .aspx page and control it using C#. I have tried...
2
by: iwdu15 | last post by:
hi, im using the Direct X SDK AudioVideoPlayback to play back MP3s, and it worked fine in VB7, but when i try to use it in VB 8, it throws errors on this code //Global Declaration Private song...
2
by: hzgt9b | last post by:
Using VS2003, VB.NET, BACKGROUND I have a window forms based application that will be distributed and executed directly from CD media. The app contains a TreeView control and a WebBroswer...
2
by: hzgt9b | last post by:
Using VS 2003, VB.NET and/or ASP.NET 2.0, BACKGROUND I have a window forms based application that contains a TreeView control and a WebBroswer (AxSHDocVw.AxWebBrowser) control. The TreeView is...
4
by: hzgt9b | last post by:
Using VS 2003, VB.NET and/or ASP.NET 2.0, BACKGROUND I have a window forms based application that contains a TreeView control and a WebBroswer (AxSHDocVw.AxWebBrowser) control. The TreeView is...
0
by: krudonix | last post by:
Hey i've developed a call logging system that records to mono a-law wav files. now i want to add a feature to playback the audio as its being recorded an event fires when i recieve audio...
5
by: skip | last post by:
(I asked this on pythonmac-sig a couple days ago but got no response, so I'm casting a broader net.) Can I easily control audio record/playback from Python on my Mac? I know zip about audio...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.