![](https://csdnimg.cn/release/download_crawler_static/2486369/bg4.jpg)
西。在有些情况下,你可以将一条线路想象成一路 MIDI。一路 MIDI 连接着两个组件,但是可以有多个声道同时通过这路 MIDI。这个情况与线
路一样。
总之,我们的样例声卡有 6 个源线路和 2 个目标线路。4 个标为“Internal CD Audio”、“Synth”、“DAC Wave Out”和“Microphone Input”的
源线路连接到 Speaker Out 目标线路。2 个标为“Microphone Input”和“Line In”的源线路连接到 ADC Wave Input 目标线路。
线路 ID 和类型
混音器中的每个线路必须有一个唯一的 ID。每个线路还有一个类型值。这仅仅是一个描述线路类型的数值。这些都定义在头文件
MMSYSTEM.H 中。例如,一个类型值为 MIXERLINE_COMPONENTTYPE_SRC_SYNTHESIZER 的线路表明它是来自内部声音模块的信号。
可用的源线路类型值如下:
MIXERLINE_COMPONENTTYPE_SRC_DIGITAL A digital source, for example, a SPDIF input jack.
MIXERLINE_COMPONENTTYPE_SRC_LINE A line input source. Typically used for a line input jack, if there is a separate microphone
input (ie, MIXERLINE_COMPONENTTYPE_SRC_MICROPHONE).
MIXERLINE_COMPONENTTYPE_SRC_MICROPHONE Microphone input (but also used for a combination of Mic/Line input if there isn't a
separate line input source).
MIXERLINE_COMPONENTTYPE_SRC_SYNTHESIZER Musical synth. Typically used for a card that contains a synth capable of playing MIDI.
This would be the audio out of that built-in synth.
MIXERLINE_COMPONENTTYPE_SRC_COMPACTDISC The audio feed from an internal CDROM drive (connected to the sound card).
MIXERLINE_COMPONENTTYPE_SRC_TELEPHONE Typically used for a telephone line's incoming audio to be piped through the computer's
speakers, or the telephone line in jack for a built-in modem.
MIXERLINE_COMPONENTTYPE_SRC_PCSPEAKER Typically, to allow sound, that normally goes to the computer's built-in speaker, to instead
be routed through the card's speaker output. The motherboard's system speaker connector
would be internally connected to some connector on the sound card for this purpose.
MIXERLINE_COMPONENTTYPE_SRC_WAVEOUT Wave playback (ie, this is the card's DAC).
MIXERLINE_COMPONENTTYPE_SRC_AUXILIARY An aux jack meant to be routed to the Speaker Out, or to the ADC (for WAVE recording).
Typically, this is used to connect external, analog equipment (such as tape decks, the
audio outputs of musical instruments, etc) for digitalizing or playback through the sound
card.
MIXERLINE_COMPONENTTYPE_SRC_ANALOG May be used similiarly to MIXERLINE_COMPONENTTYPE_SRC_AUXILIARY
(although I have seen some mixers use this like
MIXERLINE_COMPONENTTYPE_SRC_PCSPEAKER). In general, this would be
some analog connector on the sound card which is only accessible internally, to be used
to internally connect some analog component inside of the computer case so that it plays
through the speaker out.
MIXERLINE_COMPONENTTYPE_SRC_UNDEFINED Undefined type of source. If none of the others above are applicable.
可用的目标线路类型值如下:
MIXERLINE_COMPONENTTYPE_DST_DIGITAL A digital destination, for example, a SPDIF output jack.
MIXERLINE_COMPONENTTYPE_DST_LINE A line output destination. Typically used for a line output jack, if there is a separate
speaker output (ie, MIXERLINE_COMPONENTTYPE_DST_SPEAKERS).
MIXERLINE_COMPONENTTYPE_DST_MONITOR Typically a "Monitor Out" jack to be used for a speaker system separate from the main
speaker out. Or, it could be some built-in monitor speaker on the sound card itself, such
as a speaker for a built-in modem.
MIXERLINE_COMPONENTTYPE_DST_SPEAKERS The audio output to a pair of speakers (ie, the "Speaker Out" jack).
MIXERLINE_COMPONENTTYPE_DST_HEADPHONES Typically, a headphone output jack.
MIXERLINE_COMPONENTTYPE_DST_TELEPHONE Typically used to daisy-chain a telephone to an analog modem's "telephone out" jack.
MIXERLINE_COMPONENTTYPE_DST_WAVEIN The card's ADC (to digitize analog sources, for example, in recording WAVE files of
such).
MIXERLINE_COMPONENTTYPE_DST_VOICEIN May be some sort of hardware used for voice recognition. Typically, a microphone source
line would be attached to this.
MIXERLINE_COMPONENTTYPE_DST_UNDEFINED Undefined type of destination. If none of the others above are applicable.
控件 ID 和类型
每个线路都有一个或多个可调整的“声音控件”。(但是,一个线路也可能连一个控件都没有)。例如,“Synth”线路可以有一个音量控件和一
个静音开关。每个控件都有一个类型值。这些都在 MMSYSTEM.H 中定义。例如:
音量控件的类型为 MIXERCONTROL_CONTROLTYPE_VOLUME。
静音控件的类型为 MIXERCONTROL_CONTROLTYPE_MUTE。
每个控件都有它自己唯一的 ID,任何两个控件都不会有相同的 ID,即使它们属于不同的线路。
控件类型被分为几个种类。这些种类是大略的根据控件所调整的值的类型来划分,因此它基本决定了你提供什么样的图形界面给用户来调整
控件的值。例如,你可以提供一个滑动条给用户调整类型为 MIXERCONTROL_CONTROLTYPE_VOLUME 的控件的值。另外一方面,你可以提
供一个图形按钮(代码标记)给用户调整类型为 MIXERCONTROL_CONTROLTYPE_MUTE 的控件的值(因为那个控件只有两个可能的值或状态)。
可用的控件类的值如下: