http://bugs.winehq.org/show_bug.cgi?id=15060
Summary: MCI_WAVE_SET_SAMPLESPERSEC not implimented, patch (needs cleanup) Product: Wine Version: CVS/GIT Platform: PC OS/Version: Linux Status: UNCONFIRMED Severity: normal Priority: P3 Component: winmm&mci AssignedTo: wine-bugs@winehq.org ReportedBy: nospam@thenerdshow.com
I compiled the following using mingw32: http://msdn.microsoft.com/en-us/library/ms713226(VS.85).aspx
Description, From MSDN: "Uses the MCI_OPEN, MCI_RECORD, and MCI_SAVE commands to record and save a waveform-audio file."
Test Results: It builds with no errors and records a wav file! The resulting wav file, however is in the wrong format (44000 Hz), a rate which I can't see is defined anywhere. (winecfg is set at 48000 Hz) and can't be played back with MCI_PLAY. Nor can it be played back with aplay, totem or xine.
However, I converted the wav file into an mp3 and found that it is in fact correctly recorded, albeit in the wrong format, so I modified the example code and tried to set different parameters like so:
dwReturn = mciSendCommand( (MCIDEVICEID) &wDeviceID, // the above device ID MCI_WAVE_SET_SAMPLESPERSEC, // command to send MCI_SET | MCI_WAIT, // method of sending 22000 ); // set sample rate to 22000
Result: Again, it builds with no errors but the wav file is still being recorded at 44000 Hz! A look at the terminal output reveals an interesting discovery:
fixme:mci:MCI_MapMsgAtoW Message MCI_<<40000>> needs translation fixme:mci:mciSendCommandA message 40000 mapping failed
Looking at the wine source, 40000 mapping equates to this function: $ grep MCI_WAVE_SET_SAMPLESPERSEC /usr/include/wine/windows/mm*
#define MCI_WAVE_SET_SAMPLESPERSEC 0x00040000L
So you see, I can't proceed to change the recording format of my program except in windows.
So before I started fixing wine I asked google to see if I was just duplicating effort and got this patch (and possibly the related links), submitted in 2001 that provides this functionality, but it needs cleaned up:
http://www.winehq.org/pipermail/wine-patches/2001-April/000267.html
I will try to make this patch work and get it into the right format over the course of the next month, but I am on a very limited budget and need to spend time looking for work so if anyone else who has more time to devote to it, please do so.
http://bugs.winehq.org/show_bug.cgi?id=15060
Henry nospam@thenerdshow.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Difficulty|--- |Hours Keywords| |FIXME, patch, source
http://bugs.winehq.org/show_bug.cgi?id=15060
Henry nospam@thenerdshow.com changed:
What |Removed |Added ---------------------------------------------------------------------------- URL| |http://www.winehq.org/piperm | |ail/wine-patches/2001- | |April/000267.html Severity|normal |minor Keywords| |download, testcase
http://bugs.winehq.org/show_bug.cgi?id=15060
--- Comment #1 from Henry nospam@thenerdshow.com 2008-08-28 21:19:41 --- Well, it turns out that MCI_SETAUDIO is defiend in mci.c so I can use that instead.
Plus it looks like that patch was already applied and if we want to make MCI_WAVE_SET_SAMPLESPERSEC work, I think it needs to be added to the case switch (msg) in mci.c so I'm not sure whether to mark this bug as trivial or enhancement so we'll go with minor because "an easy workaround is present".
http://bugs.winehq.org/show_bug.cgi?id=15060
Vitaliy Margolen vitaliy@kievinfo.com changed:
What |Removed |Added ---------------------------------------------------------------------------- URL|http://www.winehq.org/piperm%7C |ail/wine-patches/2001- | |April/000267.html | Difficulty|Hours |--- Keywords|download, FIXME, patch |
--- Comment #2 from Vitaliy Margolen vitaliy@kievinfo.com 2008-08-28 21:53:13 --- There is no patch. As you said the one you pointed to already applied. And it's way way old anyway.
http://bugs.winehq.org/show_bug.cgi?id=15060
--- Comment #3 from Henry nospam@thenerdshow.com 2008-08-29 00:40:41 --- Created an attachment (id=15722) --> (http://bugs.winehq.org/attachment.cgi?id=15722) Sample test case in C, with Makefile for mingw and winegcc (zipped)
The included test case and Makefile in case I am doing something wrong here. It seems to work on Windows.
Ref: How To Set MCI Wave Audio Recording Format: http://support.microsoft.com/kb/152180
http://bugs.winehq.org/show_bug.cgi?id=15060
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Version|CVS/GIT |unspecified
--- Comment #4 from Austin English austinenglish@gmail.com 2009-01-20 02:40:13 --- Removing deprecated CVS/GIT version tag. Please retest in current git. If the bug is still present in today's wine, but was not present in some earlier version of wine, please update version field to earliest known version of wine that had the bug. Thanks!
http://bugs.winehq.org/show_bug.cgi?id=15060
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |download
--- Comment #5 from Austin English austinenglish@gmail.com 2009-07-21 13:14:38 --- Is this still an issue in current (1.1.26 or newer) wine?
http://bugs.winehq.org/show_bug.cgi?id=15060
Jörg Höhle hoehle@users.sourceforge.net changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |hoehle@users.sourceforge.ne | |t
--- Comment #6 from Jörg Höhle hoehle@users.sourceforge.net 2009-10-12 11:16:58 --- Your invocation of the MCI SET command in comment #0 seems bogus to me. Did you check the return code? Correct code should be dwret = mciSendCommand(wDeviceID, MCI_SET, MCI_WAVE_SET_FORMATTAG | MCI_WAVE_SET_xyz, &mciSetParmsStruct)
BTW, I recently came across http://support.microsoft.com/?scid=kb;en-us;152180 which asks to set all wave format parameters in a single SendCommand. (oops, you found that document long before me, yet the code in comment #3 does not follow this advice).
Anyway, my own bug #20232, starting from the same MSDN example as you, looks much like a duplicate of yours -- I'm confused didn't see yours earlier. To separate I propose: - to leave mine as is, i.e. about being able to record&play; - to focus on the SET params functionality here.
The problem with SET is that Wine calls waveOpen at MCIOpen time, fixing all wave format parameters. Changing settings afterwards would mean to close and reopen the wave device (alas, there's not SetFormat in winmm), or not open it at all at MCIOpen time and delay opening until the RECORD command.
BTW, the 44000Hz you saw is from mciwave.c, as I mention in bug #20232.
Nor can it be played back with aplay, totem or xine.
That may also be explained in bug #20232, comment #1: Please check if the length of the chunk named "data" is 00000000, which is incorrect. Finally, if your interest in saving only, remove the play command from your example, as it causes additional trouble, which bug #20232 is all about.
http://bugs.winehq.org/show_bug.cgi?id=15060
--- Comment #7 from Jörg Höhle hoehle@users.sourceforge.net 2009-10-12 11:31:45 --- Private E-mail from somebody providing test results from Win98 SE reinforces the idea that MS-Windows defers work until the RECORD command is issued. OPEN may succeed, RECORD fail. Maybe Wine really should delay WaveOpen until RECORD time?
http://bugs.winehq.org/show_bug.cgi?id=15060
--- Comment #8 from Jörg Höhle hoehle@users.sourceforge.net 2009-10-13 03:16:08 --- I was confused. mciwave already opens wave only at RECORD time, not OPEN NEW time.
http://bugs.winehq.org/show_bug.cgi?id=15060
--- Comment #9 from Jörg Höhle hoehle@users.sourceforge.net 2009-10-20 08:21:26 --- Patch and correct testcase was submitted to wine-patches. http://www.winehq.org/pipermail/wine-patches/2009-October/080186.html
Setting all wave format parameters as recommended by MSDN works. Setting individual ones works also, but the effect on the other parameters differs from MS behaviour.
http://bugs.winehq.org/show_bug.cgi?id=15060
--- Comment #10 from Jörg Höhle hoehle@users.sourceforge.net 2009-11-06 03:59:23 --- Fixed for 1.1.33 by commit de00535c13fba643c9c2bc178225be3cecafd92d MCI_SET of wave format parameters now works.
Please mark as resolved, fixed.
http://bugs.winehq.org/show_bug.cgi?id=15060
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution| |FIXED
--- Comment #11 from Austin English austinenglish@gmail.com 2009-11-06 14:41:22 --- Fixed.
http://bugs.winehq.org/show_bug.cgi?id=15060
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #12 from Alexandre Julliard julliard@winehq.org 2009-11-13 12:43:10 --- Closing bugs fixed in 1.1.33.