Not sure what you've done wrong, so I'll just describe what I've done:
1. GetFormatCount() returns 2 (I got 2 encoded custom formats).
2. GetFormat() returns with 2 corresponding formats. I set wForamtTag to WAVE_FORMAT_DOLBY_AC3_SPDIF and WAVE_FORMAT_WMASPDIF, and set cbSize = 0, meaning that I'm using WAVEFORMATEX, not WAVEFORMATEXTENSIBLE.
3. GetFormatRepresentation() returns 2 names.
4. IsOutputFormatSupported() directly returns S_OK if get called with those 2 custom formats, and call CBaseAudioProcessingObject::IsOutputFormatSupported() for every other cases.
5. In IsInputFormatSupported(), if pOutputFormat is the 2 custom formats, check pRequestedInputFormat and see if that's what you want. If not, suggest the proper one and return S_FALSE. If it's correct, directly return S_OK. For every other cases just call CBaseAudioProcessingObject::IsInputFormatSupported().
This works for me. Hope this helps!
_T
在 2007/2/13 的來信中,"William R. Huttel"
>I have implemented
GetFormatRepresentation(). wFormatTag is always
"WAVE_FORMAT_EXTENSIBLE" as in the sample code. For "SubFormat",
I've tried the KSDATAFORMAT_SUBTYPE_AC3 as in the sample (the GUID it
uses corresponds to MEDIASUBTYPE_DOLBY_AC3_SPDIF given in UUIDS.h).
I've also tried KSDATAFORMAT_SUBTYPE_AC3_AUDIO and
KSDATAFORMAT_SUBTYPE_DTS_AUDIO. I have managed to get the first value
(0x00000092 ... MEDIASUBTYPE_DOLBY_AC3_SPDIF) to appear in the
"Advanced" list, and, with proper handling of the IsInput and IsOutput
calls, it can be selected (any attempt to use the other formats results
in a "format not supported" message). However, if I try to start an
audio stream with e.g. MP I get a general failure message. My logs show
that IsOutputFormat() is succeeding having been called with the
0x00000092 format type. I see two calls to GetRegistrationProperties(),
then the GFX object is destroyed (destructor called). LockForProcess()
is not called. The data in sm_RegProperties seems fairly stock (this is
returned on the GetRegistrationProperties() call). I don't know what is
causing it not to get to the LockForProcess() call. Bill On Feb 12,
2007, at 7:11 PM, tachunir@xxxxxxxxxxxxxxxx wrote: > I don't see you
mention GetFormatRepresentation(). Did you do that? > What's the
value of "wFormatTag" and "SubFormat" you're using? If you > do
those correctly, you should be able to see the name of your custom >
formats (returned by GetFormatRepresentation() function call) in the
> Default Format drop down list of the Advanced page of the audio
> properties panel. > > _T > > $B:_(B 2007/2/12
$BE*PT?.Cf!$(B"William R. Huttel" $BDs5Z!'(B > > >Thanks
for the response. I have added the > IAudioSystemEffectCustomFormats
interface to my GFX. I do get calls to > GetFormatCount() and
GetFormat() at APO startup. I still get no calls > to
IsOutputFormatSupported() with anything other than float32 PCM, no >
matter what encoded format I return from GetFormat(). I've tried >
returning a PCM format (16 bit, 48K) just to see if I could write >
integral PCM samples out to the SPDIF device. I want to implement >
asymmetric formats in the GFX: float32 PCM in, and encoded SPDIF >
formats out. I thus want to make certain the float32-int16 converter
> mentioned in the "Data Formats" section of sysfx.doc is not
attached > to the output of the GFX by the graph builder, as it must
be bit-exact > to the device. The rest of "Data Formats" goes on to
say that the > IsInputFormatSupported() should return a float format
which matches > the sample rate and speaker config of the "decoded"
format (I'm > guessing the returned format should be a float32 pcm
variant of the > output side, which is the "encoded" format to me,
but should otherwise > match the output format in sample rate and
speaker mask (e.g. 48K and > 5.1)). I've found nothing more on
IAudioSystemEffectCustomFormats > except what is in the swap code
example, and the documentation in > audioenginebaseapo.idl (in the
DDK). If this interface is the key to > getting encoded formats
supported as output from the GFX, what more > needs to be done other
than returning the supported formats via > GetFormat(), and watching
for them on IsOutputFormatSupported()? > Cheers, Bill On Feb 11,
2007, at 9:42 PM, tachunir@xxxxxxxxxxxxxxxx > wrote: > I believe
you should first implement the GetFormatCount(), > GetFormat() >
and GetFormatRepresentation() functions in GFX. The > audio engine
will > use these to determine what custom format your GFX >
supports, and use > that in the IsOutputFormatSupported() calls. >
> > _T > > $B:_(B 2007/2/11 $BE*PT?.Cf!$(B"William R.
Huttel" > $BDs5Z!'(B > > >Hi, I need some help on
getting encoded formats > (such as AC3) > supported by a Vista
GFX. From the guidelines in > sysfx.doc, I have > removed
CBaseAudioProecessingObject as a base from > my GFX class, and >
instead added the 3 required interfaces, and > implemented my own
> versions of their methods. Under "Data Formats" > (in
sysfx.doc) it says > that a GFX may support "encoded" formats, >
though it must support > float32 PCM on the audio engine-facing side
> of the GFX. Regarding > "IsInputFormatSupported", the doc says
that > the GFX should return a > float format that has the sample
rate and > speaker configuration of the > "decoded" format (I'm
presuming from > context that this is returned on > the
IsInputFormatSupported() call > and not the IsOutput...). No matter
> what I try I'm unable to get an > IsOutputFormatSupported call
which has > anything other than a float32 > PCM data format. I can
suggest, AC3, > PCM, etc. to no avail. I have > modified the swap
example INF to install > a postmix effect (GFX) on > the SPDIF
device, and add a custom UI; the > installation appears >
successful. I have noticed that the "configure" > button (which
allows > setting the speaker configuration) is inactive > for the
device -- are > there presumed speaker configurations for SPDIF? >
is this expected > behaviour ("configure" is not allowed on the
SPDIF > device, unlike > "Speakers" and "Headphones")? In the
swap example, the > GFX exposes > the interface:
"IAudioSystemEffectsCustomFormats". I've > tried > exposing
this from my GFX, but the routines it adds are never > > called.
(There is an AC3 format in it, so this looked promising.) Are > >
there any further sources which would help me in adding an encoded >
> format as output for a GFX? While I'm here, though somewhat
unrelated, > > I've noticed a couple of things in the samples
that might be typos, > > perhaps others have encountered these and
can comment: spkrfill > > example (obtained from sysfxreuse.exe):
SpkrFillAPO.cpp, line 512: if > > (inFormat.fFramesPerSecond !=
inFormat.fFramesPerSecond) { MyLog( > "fps > mismatch");
inFormat.fFramesPerSEcond = > inFormat.fFramesPerSecond; > hrInput
= S_FALSE; } Is this meant to be > a comparison and set to the >
output if not a match? From sysfx.inf > (in the 6000 DDK audio
samples), > line 82: > [HdAudModel.PrimaryLineOutTopo.AddReg]
should this be > > [HdAudio.SysFx.PrimaryLineOutTopo.AddReg] to be
referenced by the > > preceding stanza? Bill ******************
WDMAUDIODEV addresses: Post > > message:
mailto:wdmaudiodev@xxxxxxxxxxxxx Subscribe: > >
mailto:wdmaudiodev-request@xxxxxxxxxxxxx?subject=subscribe > >
Unsubscribe: > >
mailto:wdmaudiodev-request@xxxxxxxxxxxxx?subject=unsubscribe > >
Moderator: mailto:wdmaudiodev-moderators@xxxxxxxxxxxxx URL to > >
WDMAUDIODEV page: http://www.wdmaudiodev.com/ > ******************
> WDMAUDIODEV addresses: Post message: > >
mailto:wdmaudiodev@xxxxxxxxxxxxx Subscribe: > >
mailto:wdmaudiodev-request@xxxxxxxxxxxxx?subject=subscribe > >
Unsubscribe: > >
mailto:wdmaudiodev-request@xxxxxxxxxxxxx?subject=unsubscribe > >
Moderator: mailto:wdmaudiodev-moderators@xxxxxxxxxxxxx URL to > >
WDMAUDIODEV page: http://www.wdmaudiodev.com/ > ******************
WDMAUDIODEV addresses: Post message: >
mailto:wdmaudiodev@xxxxxxxxxxxxx Subscribe: >
mailto:wdmaudiodev-request@xxxxxxxxxxxxx?subject=subscribe >
Unsubscribe: >
mailto:wdmaudiodev-request@xxxxxxxxxxxxx?subject=unsubscribe >
Moderator: mailto:wdmaudiodev-moderators@xxxxxxxxxxxxx URL to >
WDMAUDIODEV page: http://www.wdmaudiodev.com/