dosware
asked on
FAST SERIOUS QUESTION: Need to detect default WaveOut device!
Hi All,
I need to know what WaveOut device Windows uses as default... I need it for automatical setting device number for function:
WaveOutOpen(@FWaveOutHandl e, 0, @FFormat.Format, FOutHandle, 0, CALLBACK_WINDOW or WAVE_MAPPED);
second 0 is device ID, I need to know default device ID... Because device 0 sometimes does not work properly.
Thanks.
I need to know what WaveOut device Windows uses as default... I need it for automatical setting device number for function:
WaveOutOpen(@FWaveOutHandl
second 0 is device ID, I need to know default device ID... Because device 0 sometimes does not work properly.
Thanks.
use WAVE_MAPPER instead of 0 , it'll set the device id to the device id which windows uses as default
control panel->Audio->Sound Playback Default Device
control panel->Audio->Sound Playback Default Device
ASKER
But WAVE_MAPPER defined as -1?! Are you think that it will work?
Ok, thanks for answer, I will try it now.
Ok, thanks for answer, I will try it now.
WaveOutOpen(@FWaveOutHandl e, WAVE_MAPPER, @FFormat.Format, FOutHandle, 0, CALLBACK_WINDOW or WAVE_MAPPED);
first 0 is device id no second 0
you should use WAVE_MAPPER instead of first 0
you should use WAVE_MAPPER instead of first 0
ASKER
As I understand I should use same constant for WaveInOpen also?
WaveInOpen(@FWaveInHandle, WAVE_MAPPER, @FFormat.Format, FInHandle, 0, CALLBACK_WINDOW or WAVE_MAPPED);
WaveInOpen(@FWaveInHandle,
ASKER
Unfortunately it does not work :(
I can not hear voice stream when I use WAVE_MAPPER
I can not hear voice stream when I use WAVE_MAPPER
ASKER
It normally works when I use:
WaveInOpen(@FWaveInHandle, WAVE_MAPPER, @FFormat.Format, FInHandle, 0, CALLBACK_WINDOW);
WaveOutOpen(@FWaveOutHandl e, WAVE_MAPPER, @FFormat.Format, FOutHandle, 0, CALLBACK_WINDOW);
Is it correct code?
WaveInOpen(@FWaveInHandle,
WaveOutOpen(@FWaveOutHandl
Is it correct code?
yes it is...for more explanation take a look at the WIndows SDK help (that comes with delphi)...
from there:
MMRESULT waveInOpen(LPHWAVEIN phwi, UINT uDeviceID, LPWAVEFORMATEX pwfx,
DWORD dwCallback, DWORD dwCallbackInstance, DWORD fdwOpen);
phwi
Address filled with a handle identifying the open waveform-audio input device. Use this handle to identify the device when calling other waveform-audio input functions. This parameter can be NULL if WAVE_FORMAT_QUERY is specified for fdwOpen.
uDeviceID
Identifier of the waveform-audio input device to open. It can be either a device identifier or a handle of an open waveform-audio input device.You can use the following flag instead of a device identifier:
WAVE_MAPPER
The function selects a waveform-audio input device capable of recording in the specified format.
[...]
***
MMRESULT waveOutOpen(LPHWAVEOUT phwo, UINT uDeviceID,
LPWAVEFORMATEX pwfx, DWORD dwCallback, DWORD dwCallbackInstance,
DWORD fdwOpen);
MMRESULT waveOutOpen(LPHWAVEOUT phwo, UINT uDeviceID,
LPWAVEFORMATEX pwfx, DWORD dwCallback, DWORD dwCallbackInstance,
DWORD fdwOpen);
phwo
Address filled with a handle identifying the open waveform-audio output device. Use the handle to identify the device when calling other waveform-audio output functions. This parameter might be NULL if the WAVE_FORMAT_QUERY flag is specified for fdwOpen.
uDeviceID
Identifier of the waveform-audio output device to open. It can be either a device identifier or a handle of an open waveform-audio input device.You can use the following flag instead of a device identifier:
WAVE_MAPPER
The function selects a waveform-audio output device capable of playing the given format.
[...]
from there:
MMRESULT waveInOpen(LPHWAVEIN phwi, UINT uDeviceID, LPWAVEFORMATEX pwfx,
DWORD dwCallback, DWORD dwCallbackInstance, DWORD fdwOpen);
phwi
Address filled with a handle identifying the open waveform-audio input device. Use this handle to identify the device when calling other waveform-audio input functions. This parameter can be NULL if WAVE_FORMAT_QUERY is specified for fdwOpen.
uDeviceID
Identifier of the waveform-audio input device to open. It can be either a device identifier or a handle of an open waveform-audio input device.You can use the following flag instead of a device identifier:
WAVE_MAPPER
The function selects a waveform-audio input device capable of recording in the specified format.
[...]
***
MMRESULT waveOutOpen(LPHWAVEOUT phwo, UINT uDeviceID,
LPWAVEFORMATEX pwfx, DWORD dwCallback, DWORD dwCallbackInstance,
DWORD fdwOpen);
MMRESULT waveOutOpen(LPHWAVEOUT phwo, UINT uDeviceID,
LPWAVEFORMATEX pwfx, DWORD dwCallback, DWORD dwCallbackInstance,
DWORD fdwOpen);
phwo
Address filled with a handle identifying the open waveform-audio output device. Use the handle to identify the device when calling other waveform-audio output functions. This parameter might be NULL if the WAVE_FORMAT_QUERY flag is specified for fdwOpen.
uDeviceID
Identifier of the waveform-audio output device to open. It can be either a device identifier or a handle of an open waveform-audio input device.You can use the following flag instead of a device identifier:
WAVE_MAPPER
The function selects a waveform-audio output device capable of playing the given format.
[...]
ASKER
I know it, but are you seeing differences between two codes?
WaveInOpen(@FWaveInHandle, WAVE_MAPPER, @FFormat.Format, FInHandle, 0, CALLBACK_WINDOW or WAVE_MAPPED);
WaveInOpen(@FWaveInHandle, WAVE_MAPPER, @FFormat.Format, FInHandle, 0, CALLBACK_WINDOW);
First variant does not work! Why?
WaveInOpen(@FWaveInHandle,
WaveInOpen(@FWaveInHandle,
First variant does not work! Why?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
OK, this is what I wanted to know! Thanks!
For WaveInOpen it's the same...the only differece is the function to get the waveform-audio output devices number that is waveInGetNumDevs
ASKER
Thanks bud! You really have helped me!
Glad to have helped you. :)
Good work.
F68 ;-)
Good work.
F68 ;-)
FOutHandle must be WAVE_MAPPER