W jaki sposób można pobrać nazwę i zmienić domyślną kartę dźwiękową dla nagrywania i odtwarzania?
0
0
Wywołanie okna ustawień dźwięku:
WinExec('rundll32.exe shell32.dll,Control_RunDLL mmsys.cpl,,2',SW_SHOWNORMAL);
Pobieranie nazwy:
// note: DevicesNames must be created before calling this procedure
uses mmsystem;
procedure GetWaveOutDevices(DeviceNames: TStrings);
var
DNum: Integer;
i: Integer;
Caps: TWaveOutCapsA;
begin
DNum := waveOutGetNumDevs; // Number of Devices
for i := 0 to DNum - 1 do // Query Devicenames
begin
waveOutGetDevCaps(i, @Caps, SizeOf(TWaveOutCapsA));
DeviceNames.Add(string(Caps.szPname));
end;
end;
A tu troche lektury do przeczytania może ci pomoże ten problem rozwiązać:
Windows Multimedia SDK
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/multimed/htm/_win32_waveoutopen.asp
A i jeszcze coś takiego znalazłem w google:
//I found this snipplet on google... which uses the API WaveOutOpen routine
//Don't know if it works .... I did not test it
// changes output wave device.
Procedure TForm1.WaveOutDev(DeviceNr:Integer);
var OutCaps: TWaveOutCaps;
HMO: HWaveOut;
R: cardinal;
fFormat: TWaveFormatEx;
begin
fFormat.wFormatTag := etRecord1.Source.Format.Tag;
fFormat.nChannels := etRecord1.Source.Format.Channels;
fFormat.nSamplesPerSec := etRecord1.Source.Format.SamplesPerSec;
fFormat.nAvgBytesPerSec := etRecord1.Source.Format.AvgBytesPerSec;
fFormat.nBlockAlign := etRecord1.Source.Format.BlockAlign;
fFormat.wBitsPerSample := etRecord1.Source.Format.BitsPerSample;
R:=WaveOutGetDevCaps(DeviceNR,@OutCaps,Sizeof(OutCaps));
if R=MMSYSERR_NOERROR then
R:=WaveOutOpen(@HMO,DeviceNR,@fFormat,0,0,0);
end;
UnSysApps
Powodzenia