Wednesday, 11 July 2012

Windows 8 CP acmFormatChoose Bug

Yesterday, I decided to take the plunge and install W8 CP on a VHD, as described by Ed Bott here

It took a good few tries, but the step I hadn’t counted on was when I created the VHD, it takes a very long time to complete, and the UI doesn’t show you much in the Disk Manager.

Eventually, the 64 bit version was all up and running, so I decided to try our program RIP Vinyl, and was pleasingly surprised that our custom built installer wrapper we use for all of our projects installed without a hitch.

So, I launched the program, and recorded a test stream from YouTube.  It worked straight away on Windows 8!

Unfortunately, when I went to change the recording format to MP3, I started to hit problems.  Pressing the format change buttons did nothing.

The code allows the user to change the recording format by selecting a format via the acmFormatChoose dialog, but unfortunately, no matter what I tried, I keep getting a return code of 0x0000000B, or MMSYSERR_INVALPARAM

I’ve now built a very simple test using VS2010 and an MFC dialog based app, which runs fine on everything but W8.

I haven’t yet tried on the 32 bit version of W8.

Here’s the code I run on a button press in my MFC app:

MMRESULT Cacmformatchoosetest10Dlg::CheckFormat()
int waveFormatExSizeMax;
TCHAR waveformatName[_MAX_PATH];
waveformatName[0] = 0;

acmMetrics(NULL, ACM_METRIC_MAX_SIZE_FORMAT, &waveFormatExSizeMax);

void *buffer = _alloca(2 * waveFormatExSizeMax);
WAVEFORMATEX &wfx = *( (WAVEFORMATEX *) buffer);

memset(&wfx, 0, sizeof(wfx));
wfx.cbSize = 0;
wfx.nChannels = 2;
wfx.wFormatTag = WAVE_FORMAT_PCM;

ZeroMemory(&acmfmtch, sizeof(acmfmtch));

acmfmtch.cbStruct = sizeof(acmfmtch);
acmfmtch.fdwStyle = 0;
acmfmtch.pfnHook = NULL;
acmfmtch.pszName = waveformatName;
acmfmtch.cchName = _MAX_PATH;
acmfmtch.pszTitle = _T("Title");
acmfmtch.hwndOwner = NULL;
acmfmtch.pwfx = &wfx;
acmfmtch.cbwfx = waveFormatExSizeMax;

acmfmtch.fdwEnum = ACM_FORMATENUMF_INPUT ;
acmfmtch.pwfxEnum = NULL;

return acmFormatChoose(&acmfmtch);

If anyone wants the entire project to try, please contact me via @WieserSoftware on twitter.

1 comment:

  1. This now appears to work correctly on Windows 8 RTM! Hooray!