Angenommen, Sie haben die ID der Eingabe- und Ausgabegeräte, können Sie wie folgt die entsprechenden Mixer-IDs verwenden. Wenn beide gleich sind, sind beide an den gleichen Mischer angeschlossen und höchstwahrscheinlich Teil derselben physischen Hardware.
/// <summary>
/// Get the ID of the mixer associated with the given input device ID
/// Returns -1 if no such mixer can be found
/// </summary>
static public int GetMixerIdInput(int inputId)
{
int mixerId = -1;
int result = MmeMixerApi.mixerGetID(inputId, ref mixerId, MIXER_OBJECTFLAG.WAVEIN);
if (((MMError)result != MMError.MMSYSERR_NOERROR) &&
((MMError)result != MMError.MMSYSERR_NODRIVER))
{
throw new MmeException((MMError)result);
}
return mixerId;
}
/// <summary>
/// Get the ID of the mixer associated with the given output device ID
/// Returns -1 if no such mixer can be found
/// </summary>
static public int GetMixerIdOutput(int outputId)
{
int mixerId = -1;
int result = MmeMixerApi.mixerGetID(outputId, ref mixerId, MIXER_OBJECTFLAG.WAVEOUT);
if (((MMError)result != MMError.MMSYSERR_NOERROR) &&
((MMError)result != MMError.MMSYSERR_NODRIVER))
{
throw new MmeException((MMError)result);
}
return mixerId;
}
Wenn Sie nur den Namen für das Eingabegerät haben, können Sie so etwas wie die folgenden finden Sie die Geräte-ID verwenden:
/// <summary>
/// Find the ID of the input device given a name
/// </summary>
static public int GetWaveInputId(string name)
{
int id = MmeWaveApi.WAVE_MAPPER;
int devCount = MmeWaveApi.waveInGetNumDevs();
WAVEINCAPS caps = new WAVEINCAPS();
for (int dev = 0; (dev < devCount) && (id == MmeWaveApi.WAVE_MAPPER); dev++)
{
int result = MmeWaveApi.waveInGetDevCaps(dev, ref caps, Marshal.SizeOf(caps));
if ((MMError)result == MMError.MMSYSERR_NOERROR)
{
if (string.Compare(name, 0, caps.szPname, 0, Math.Min(name.Length, caps.szPname.Length)) == 0)
{
id = dev;
}
}
}
return id;
}
Könnten Sie Ihre Frage ein wenig näher erläutern? Besitzen Sie die Handles zu diesen Geräten oder werden diese von einer anderen Komponente weitergegeben, deren Quellen Sie nicht besitzen? Was haben Sie mit Lautsprecher und Mikrofon vor? Die Audio-Platine analogen Ausgang und nur Eingang oder analog/digital hat Bedeutung? – Manuel