MIDL2020 : error generating type library : LayOut failed

Hi,

I'm compiling an IDL file into a type library but I get the error in the object:

midl\oleaut32.dll : error MIDL2020 : error generating type library : LayOut failed : IAudioDevice (0x80029C83)

The IAudioDevice interface is declared as:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
  typedef 
  [ 
    uuid(AB566C61-AF54-11DE-B5BE-00A0D15E9B20), 
    version(1.0),

    helpstring("")
  ]
  struct T_DeviceInfo 
  {
    VARIANT_BOOL      probed;           /*!< true if the device capabilities were successfully probed. */
    BSTR              name;             /*!< Character string device identifier. */
    short             outputChannels;   /*!< Maximum output channels supported by device. */
    short             inputChannels;    /*!< Maximum input channels supported by device. */
    short             duplexChannels;   /*!< Maximum simultaneous input/output channels supported by device. */
    VARIANT_BOOL      isDefaultOutput;  /*!< true if this is the default output device. */
    VARIANT_BOOL      isDefaultInput;   /*!< true if this is the default input device. */
    long              nativeFormats;    /*!< Bit mask of supported data formats. */
    SAFEARRAY(short)  sampleRates;      /*!< Supported sample rates (queried from list of standard rates). */
  } T_DeviceInfo;

//-----------------------------------------------------------------------

[
	object,
	uuid(AB566C6A-AF54-11DE-B5BE-00A0D15E9B20),
	oleautomation,
	nonextensible,
	helpstring("IFile Interface"),
	pointer_default(unique)
]
interface IFile : IUnknown
{
  [propget]HRESULT IsOpen([out, retval] VARIANT_BOOL*);
  [propget]HRESULT FilePosition([out, retval] long*);
  [propget]HRESULT FileLength([out, retval] long*);
  [propget]HRESULT FileEnd([out, retval] VARIANT_BOOL*);
  [propget]HRESULT FileFormatInfo([out, retval] T_AudioFormatInfo*);
  [propget]HRESULT FileSeek([in] long frames, 
                            [in] E_AUDIO_FILE_SEEK_METHOD method,
                            [out, retval] long*);
};


//-----------------------------------------------------------------------

[
	object,
	uuid(AB566C6B-AF54-11DE-B5BE-00A0D15E9B20),
	oleautomation,
	nonextensible,
	helpstring("IAudioMixer Interface"),
	pointer_default(unique)
]
interface IAudioMixer : IUnknown
{
  [propget]HRESULT MixerLines([out, retval] long*);
  [propget]HRESULT MixerLineName([in] long line, [out, retval] BSTR*);
  [propget]HRESULT MixerLineType([in] long line, [out, retval] long*);
  [propget]HRESULT SelectedMixerLine([out, retval] long*);
  [propget]HRESULT MixerLineVolume([out, retval] long*);
  [propput]HRESULT MixerLineVolume([in] long volume);

  HRESULT SelectMixerLine([in] long line, [out, retval] E_AUDIOLIB_RET_VAL*);
};

//-----------------------------------------------------------------------

[
	object,
	uuid(AB566C6C-AF54-11DE-B5BE-00A0D15E9B20),
	oleautomation,
	nonextensible,
	helpstring("IAudioDevice Interface"),
	pointer_default(unique)
]
interface IAudioDevice : IUnknown
{
  [propget]HRESULT DeviceId([out, retval] long*);
  [propget]HRESULT DeviceType([out, retval] E_AUDIO_DEV_TYPES*);
  [propget]HRESULT NumOfChannel([out, retval] long*);
  [propget]HRESULT SplitChannel([out, retval] VARIANT_BOOL*);
  [propget]HRESULT DebugMode([out, retval] VARIANT_BOOL*);
  [propput]HRESULT DebugMode([in] VARIANT_BOOL mode);
  [propget]HRESULT FileName([in, defaultvalue(0)] short channel, [out, retval] BSTR*);
  [propput]HRESULT FileName([in] BSTR file_name, [in, defaultvalue(0)] short channel);
  [propget]HRESULT NumBuffers([out, retval] short*);
  [propput]HRESULT NumBuffers([in] short value);
  [propget]HRESULT BufferTimeSize([out, retval] float*);
  [propput]HRESULT BufferTimeSize([in] float value);
  [propget]HRESULT SamplePerSec([out, retval] short*);
  [propput]HRESULT SamplePerSec([in] short value);
  [propget]HRESULT AudioFormat([in] E_AUDIO_FILE_FORMAT*);
  [propput]HRESULT AudioFormat([in] E_AUDIO_FILE_FORMAT value);
  [propget]HRESULT Volume([in, defaultvalue(0)] short channel, [out, retval] long*);
  [propput]HRESULT Volume([in] long, [in, defaultvalue(0)] short channel);
  [propget]HRESULT DeviceStatus([out, retval] E_DEVICE_STATE*);
  [propget]HRESULT ChannelStatus([in, defaultvalue(0)] short channel, [out, retval] E_DEVICE_STATE*);
  [propget]HRESULT AudioMixer([out, retval] IAudioMixer**);
  [propget]HRESULT AudioFile([in, defaultvalue(0)] short channel, [out, retval] IFile**);
  [propget]HRESULT DeviceInfo([out, retval] T_DeviceInfo*);

  //METHODS
  HRESULT InitDevice([in] long device_id,
                     [in, defaultvalue(API_UNSPECIFIED)] E_AUDIO_API audio_api,
                     [in, defaultvalue(0)] short num_of_channels,
                     [in, defaultvalue(0)] VARIANT_BOOL split_channel,
                     [out, retval] E_AUDIOLIB_RET_VAL*);

  //HRESULT ChangeDevice([out, retval] EAudioLibRetVal*, [in] long new_device_id);

  HRESULT CreateStream([in] BSTR key, 
                       [in, defaultvalue(0)] short channel,
                       [out, retval] IWaveStream**);

  HRESULT DeleteStream([in] BSTR key, 
                       [in, defaultvalue(0)] short channel);

  HRESULT GetActiveStream([in, defaultvalue(0)] short channel,
                          [out, retval] IWaveStream**);

  HRESULT SetActiveStream([in] BSTR key, 
                          [in, defaultvalue(0)] short channel);
};


I've searched around but I didn't have found a solution.
I'm using VS2008 with PSDK 6.1

Cheers,
Daniele.
Found it!

Like always it is a typing mistake:

Changed those lines:

[propget]HRESULT FileName([in, defaultvalue(0)] short channel, [out, retval] BSTR*);
[propput]HRESULT FileName([in] BSTR file_name, [in, defaultvalue(0)] short channel);

To

[propget]HRESULT FileName([in, defaultvalue(0)] short channel, [out, retval] BSTR*);
[propput]HRESULT FileName([in, defaultvalue(0)] short channel, [in] BSTR file_name);

make it works!
Daniele.
Topic archived. No new replies allowed.