Help!
I’m writing an ACM driver for a 4:1 audio compression algorithm. The owner
of the algorithm has supplied me with a DLL which does the 4:1 Encode and
the 1:4 Decode and I need to wrap an ACM driver around it so that ACM-aware
Win apps can transparently play these files…
I got the Win Device Developer’s Kit and studied one of the ACM samples and
got down to writing my driver. Now it’s coming together but I’m observing
strange things under debugging. To test, I use:
Windows SoundRecorder app to create my compressed files (using save as…)
and also to play them back, Windows Media Player and WinAmp to play back
compressed files and CoolEdit to save and playback.
I observe different behaviour for all of these ACM clients and I need to
tidy up my code to address these differences. Here’s what happens:
1 I open a PCM wav file in SoundRecorder and do a Save As…, setting up
my driver as the codec to use.
2 I observe that the compressed file (.wav with a WAVEFORMATEX header)
looks good, right size, channels, blockalign, bit depth etc.
3 SoundRecorder plays this back way too fast - the “playhead location”
slider just rips through at major speed and playback sounds like, well a
file being played too fast (not pitched up, just that e.g. 99 out of every
100 samples are missed)
4 The same file plays fine on WinAmp and Windows Media player, suggesting
that my real-time decode is fine in the driver (although I do hear some pops
etc. in WinMedia Player)
5 When I import the compressed file, CoolEdit uses the drivers decoder to
convert to PCM and does this fine for the first second or so or audio, then
rubbish…
From debugging these ACM clients, my hunch is that I need to pay more
attention to my response to the ACM D_STREAM_SIZE message and that I need
proper “reporting” of the cbSrcLengthUsed and cbDstLength used in response
to the ACMD_STREAM_CONVERT message (I say this because a restriction on me
is to process audio in blocks of 2048 bytes, the client (Win SoundRecorder)
gives me way too much but when I report back that I’ve only processed 2048 ,
it continues to throw the same number at me; then after, say 200 attempts,
it properly starts to give “count down” the bytes that I’m actually
processing…
Help! Please excuse the specific question - the way I see it, if you
understand the question, you’re likely to be able to help, if you don’t
please ignore.
Culann.