WaveAudioの出力情報を取得 <TOP>
ウェーブオーディオの出力に関する情報を取得します。
waveOutGetNumDevs システムに存在するWave出力デバイスの数を取得
waveOutGetDevCaps ウエーブオーディオ出力デバイスの性能を取得
左:WindowsXP機 中:Windows200機 右:WindowsVista機
'================================================================
'= WaveAudioの出力情報を取得
'= (waveOutGetDevCaps.bas)
'================================================================
#include "Windows.bi"
Type WAVEOUTCAPS
wMid As Integer '機器のメーカーのメーカー識別子
wPid As Integer '機器の製品識別子
vDriverVersion As Long '機器のバージョン番号
szPname As String * 32 '製品名
dwFormats As Long 'サポートされる標準のフォーマット(WAVE_FORMAT_...)
wChannels As Integer 'オーディオのチャンネルの数(1:Mono 2:Stereo)
dwSupport As Long 'オプションの機能
End Type
' システムに存在するWave出力デバイスの数を取得
Declare Function Api_waveOutGetNumDevs& Lib "winmm" Alias "waveOutGetNumDevs" ()
' ウェーブフォームオーディオ出力デバイスの性能を取得
Declare Function Api_waveOutGetDevCaps& Lib "winmm" Alias "waveOutGetDevCapsA" (ByVal uDeviceID&, lpCaps As WAVEOUTCAPS, ByVal uSize&)
#define WAVE_MAPPER -1
#define WAVE_FORMAT_1M08 &H1 '11.025 kHz Mono 8-bit
#define WAVE_FORMAT_1M16 &H4 '11.025 kHz Mono 16-bit
#define WAVE_FORMAT_1S08 &H2 '11.025 kHz Stereo 8-bit
#define WAVE_FORMAT_1S16 &H8 '11.025 kHz Stereo 16-bit
#define WAVE_FORMAT_2M08 &H10 '22.050 kHz Mono 8-bit
#define WAVE_FORMAT_2M16 &H40 '22.050 kHz Mono 16-bit
#define WAVE_FORMAT_2S08 &H20 '22.050 kHz Stereo 8-bit
#define WAVE_FORMAT_2S16 &H80 '22.050 kHz Stereo 16-bit
#define WAVE_FORMAT_4M08 &H100 '44.100 kHz Mono 8-bit
#define WAVE_FORMAT_4M16 &H400 '44.100 kHz Mono 16-bit
#define WAVE_FORMAT_4S08 &H200 '44.100 kHz Stereo 8-bit
#define WAVE_FORMAT_4S16 &H800 '44.100 kHz Stereo 16-bit
#define WAVECAPS_LRVOLUME &H8 '左右2チャンネル
#define WAVECAPS_PITCH &H1 '
#define WAVECAPS_PLAYBACKRATE &H2 '
#define WAVECAPS_SYNC &H10 '
#define WAVECAPS_VOLUME &H4 '
#define WAVECAPS_SAMPLEACCURATE &H20 '
'メーカー識別子
#define MM_ANTEX 31 'Antex Electronics Corporation
#define MM_APPS 42 'APPS Software
#define MM_APT 56 'Audio Processing Technology
#define MM_ARTISOFT 20 'Artisoft, Inc.
#define MM_AST 64 'AST Research, Inc.
#define MM_ATI 27 'ATI Technologies, Inc.
#define MM_AUDIOFILE 47 'Audio, Inc.
#define MM_AUDIOPT 74 'Audio Processing Technology
#define MM_AURAVISION 80 'Auravision Corporation
#define MM_AZTECH 52 'Aztech Labs, Inc.
#define MM_CANOPUS 49 'Canopus, Co., Ltd.
#define MM_CAT 41 'Computer Aided Technology, Inc.
#define MM_COMPUSIC 89 'Compusic
#define MM_COMPUTER_FRIENDS 45 'Computer Friends, Inc.
#define MM_CONTROLRES 84 'Control Resources Corporation
#define MM_CREATIVE 2 'Creative Labs, Inc.
#define MM_DIALOGIC 93 'Dialogic Corporation
#define MM_DOLBY 78 'Dolby Laboratories, Inc.
#define MM_DSP_GROUP 43 'DSP Group, Inc.
#define MM_DSP_SOLUTIONS 25 'DSP Solutions, Inc.
#define MM_ECHO 39 'Echo Speech Corporation
#define MM_EPSON 50 'Seiko Epson Corporation, Inc.
#define MM_ESS 46 'ESS Technology, Inc.
#define MM_APT_ACE100CD 1 'ACE 100 CD
#define MM_ARTISOFT_SBWAVEIN 1 'Artisoft Sounding Board In
#define MM_ARTISOFT_SBWAVEOUT 2 'Artisoft Sounding Board Out
#define MM_AZTECH_AUX_CD 401 'Aztech Auxiales CD-Audio
#define MM_AZTECH_AUX_LINE 402 'Aztech Auxialer Line In
#define MM_AZTECH_AUX_MIC 403 'Aztech Auxialer Microphone In
#define MM_AZTECH_AUX 404 'Aztech Auxialer In
#define MM_AZTECH_DSP16_WAVEIN 65 'Aztech DSP 16 Wave In
#define MM_AZTECH_DSP16_WAVEOUT 66 'Aztech DSP 16 Wave Out
#define MM_AZTECH_DSP16_FMSYNTH 68 'Aztech DSP 16 FM Synthesizer
#define MM_AZTECH_DSP16_WAVESYNTH 70 'Aztech DSP 16 Wave Synthesizer
#define MM_AZTECH_NOVA16_WAVEIN 71 'Aztech Nova 16 Wave In
#define MM_AZTECH_NOVA16_WAVEOUT 72 'Aztech Nova 16 Wave Out
#define MM_AZTECH_NOVA16_MIXER 73 'Aztech Nova 16 Mixer
#define MM_AZTECH_PRO16_WAVEIN 33 'Aztech Pro 16 Wave In
#define MM_AZTECH_PRO16_WAVEOUT 34 'Aztech Pro 16 Wave Out
#define MM_AZTECH_WASH16_WAVEIN 74 'Aztech Wash 16 Wave In
#define MM_AZTECH_WASH16_WAVOUT 75 'Aztech Wash 16 Wave Out
#define MM_AZTECH_WASH16_MIXER 76 'Aztech Wash 16 Mixer
#define MM_AZTECH_MIDIOUT 3 'Aztech Midi Out
#define MM_AZTECH_MIDIIN 4 'Aztech Midi In
#define MM_AZTECH_WAVEIN 17 'Aztech Wave In
#define MM_AZTECH_WAVEOUT 18 'Aztech Wave Out
#define MM_AZTECH_FMSYNTH 20 'Aztech FM Synthesizer
#define MM_AZTECH_MIXER 21 'Aztech Mixer
#define MM_CAT_WAVEOUT 1 'Comuter Aided Technologies Wave Out
#define MM_CREATIVE_AUX_CD 401 'Creative Labs Soundblaster Pro CD In
#define MM_CREATIVE_AUX_LINE 402 'Creative Labs Soundblaster Pro Line In
#define MM_CREATIVE_AUX_MIC 403 'Creative Labs Soundblaster Pro Microphone In
#define MM_CREATIVE_AUX_MASTER 404 'Creative Labs Soundblaster Pro Master
#define MM_CREATIVE_AUX_PCSPK 405 'Creative Labs Soundblaster Pro PC-Speaker
#define MM_CREATIVE_AUX_WAVE 406 'Creative Labs Soundblaster Pro Wave
#define MM_CREATIVE_AUX_MIDI 407 'Creative Labs Soundblaster pro Midi Synthesizer
#define MM_CREATIVE_SB15_WAVEIN 1 'Creative Labs Soundblaster 1.5 Wave In
#define MM_CREATIVE_SB15_WAVEOUT 101 'Creative Labs Soundblaster 1.5 Wave Out
#define MM_CREATIVE_SB16_MIXER 409 'Creative Labs Soundblaster Pro 16 Mixer
#define MM_CREATIVE_SB20_WAVEIN 2 'Creative Labs Soundblaster 2.0 Wave In
#define MM_CREATIVE_SB20_WAVEOUT 102 'Creative Labs Soundblaster 2.0 Wave Out
#define MM_CREATIVE_SBP16_WAVEIN 4 'Creative Labs Soundblaster Pro 16 Wave In
#define MM_CREATIVE_SBP16_WAVEOUT 104 'Creative Labs Soundblaster Pro 16 Wave Out
#define MM_CREATIVE_SBPRO_WAVEIN 3 'Creative Labs Soundblaster Pro Wave In
#define MM_CREATIVE_SBPRO_WAVEOUT 103 'Creative Labs Soundblaster Pro Wave Out
#define MM_CREATIVE_SBPRO_MIXER 408 'Creative Labs Soundblaster Pro Mixer
#define MM_CREATIVE_MIDIOUT 201 'Creative Labs Soundblaster MIDI Out
#define MM_CREATIVE_MIDIIN 202 'Creative Labs Soundblaster MIDI In
#define MM_CREATIVE_FMSYNTH_MONO 301 'Creative Labs Soundblaster MONO FM Synthesizer
#define MM_CREATIVE_FMSYNTH_STEREO 302 'Creative Labs Soundblaster STEREO FM Synthesizer
#define MM_CREATIVE_MIDI_AWE32 303 'Creative Labs Soundblaster AWE 32 MIDI
#define MM_DSP_GROUP_TRUESPEECH &H1 'DSP Group True Speech
#define MM_DSP_SOLUTIONS_WAVEOUT 1 'DSP Solutions Wave Out
#define vbCrLf (chr$(13) & chr$(10)) 'キャリッジリターンとラインフィード(\r\n)
Var Shared List1 As Object
Var Shared Button1 As Object
List1.Attach GetDlgItem("List1") : List1.SetFontSize 12
Button1.Attach GetDlgItem("Button1") : Button1.SetFontSize 14
'================================================================
'=
'================================================================
Declare Sub Button1_on edecl ()
Sub Button1_on()
Var woc As WAVEOUTCAPS
Var MajorVer As Long
Var MinorVer As Long
Var Ret As Long
List1.Resetcontent
For i = WAVE_MAPPER To Api_waveOutGetNumDevs
Ret = Api_waveOutGetDevCaps(i, woc, Len(woc))
If Ret <> 0 And i = WAVE_MAPPER Then
List1.AddString "Wave Mapper はありません!"
List1.AddString "-------------------------------------" & vbCrLf & vbCrLf
Else
MajorVer = (woc.vDriverVersion And &HFF00) / &H100
MinorVer = woc.vDriverVersion And &HFF
List1.AddString "製品名: " & woc.szPname
List1.AddString "Driver Version: " & Str$(MajorVer) & "." & Str$(MinorVer)
List1.AddString "Audio Channel: " & Str$(woc.wChannels)
If woc.wPid = MM_CREATIVE_SBP16_WAVEOUT Then
List1.AddString "Type: Soundblaster Pro 16 WaveOut Compatible"
End If
If woc.wMid = MM_CREATIVE Then
List1.AddString "メーカー: Creative Labs, Inc."
End If
If CInt(woc.dwFormats And WAVE_FORMAT_4S16) <> 0 Then
List1.AddString "Format (01): 44.100 kHz - 16 Bit in Stereo"
End If
If (woc.dwSupport And WAVECAPS_LRVOLUME) = 0 Then
List1.AddString "2チャンネルステレオをサポート"
End If
List1.AddString "-------------------------------------" & vbCrLf
End If
Next i
End Sub
'================================================================
'=
'================================================================
While 1
WaitEvent
Wend
Stop
End