Board index » delphi » Re: Direct Sound

Re: Direct Sound


2004-05-25 11:16:07 PM
delphi277
Quote
Hello can anybody help me?

I'm not sure if I am programming using direct sound.
So can anybody tell me am I using direct sound??
If you're not sure, you're not. The WaveIn... and WaveOut... functions
are part of the Windows API. DirectSound is a part of DirectX, which is
not a part of Windows (at least not officially) and therefore you
cannot use it directly from Delphi - you have to download header
translations for the DirectX DLLs first. For the Windows API most
header translations are included with Delphi (most of them are in the
Windows unit).
 
 

Re: Direct Sound

Hello can anybody help me?
I'm not sure if I am programming using direct sound.
So can anybody tell me am I using direct sound??
This is what I do:
I've made a program that records audio from the line in of a sound card,
process it and play it directy to the line out of a soundcard, and it works
well, acept it needs a lot of buffer to store the audio data.
This is the part of the source code that I used to record the sound from
line in of the sound card:
Rate:=44100;
with WaveFormat do
begin
wFormatTag:=WAVE_FORMAT_PCM;
nChannels:=2;
nSamplesPerSec:=Rate;
nAvgBytesPerSec:=Rate*4;
nBlockAlign:=4;
wBitsPerSample:=16;
end;
Err:=waveOutOpen(@WaveOutHandle,WAVE_MAPPER,@WaveFormat,Handle,0,CALLBACK_WI
NDOW);
if Err<>0 then application.messagebox('Error', 'Problem creating play
handle', mb_OK);
Err:=WaveInOpen(@WaveInHandle,WAVE_MAPPER,@WaveFormat,Handle,0,CALLBACK_WIND
OW);
case Err of
MMSYSERR_NODRIVER : ShowMessage('The driver was not installed.');
MMSYSERR_BADDEVICEID : ShowMessage('Specified device ID is out of
range.');
MMSYSERR_ALLOCATED : ShowMessage('Specified resource is already
allocated.');
MMSYSERR_NOMEM : ShowMessage('Unable to allocate or lock memory.');
WAVERR_BADFORMAT : ShowMessage('Attempted to open with an unsupported
wave format.');
WAVERR_SYNC : ShowMessage('Attempted to open a synchronous driver
without specifying the WAVE_ALLOWSYNC flag.');
end;
end;
And use this to start recording:
Stop:=false;
Err:=WaveInStart(WaveInHandle);
if Err<>0 then
begin
stop:=true;
application.messagebox('In Start error di wim','error',mb_ok);
end;
So can anybody tell me whether I am programming with direct sound?
Thank You
Alain
 

Re: Direct Sound

Ok, Thank you.
So, if I want to learn about directX, where can I find about it on the net?
Does anybody know where I can find freeware program + source code that uses
DirectX?
Alain. NS
"Avatar Zondertau" <XXXX@XXXXX.COM>writes
Quote
>Hello can anybody help me?
>
>I'm not sure if I am programming using direct sound.
>So can anybody tell me am I using direct sound??

If you're not sure, you're not. The WaveIn... and WaveOut... functions
are part of the Windows API. DirectSound is a part of DirectX, which is
not a part of Windows (at least not officially) and therefore you
cannot use it directly from Delphi - you have to download header
translations for the DirectX DLLs first. For the Windows API most
header translations are included with Delphi (most of them are in the
Windows unit).
 

Re: Direct Sound

"Alain N.S" <XXXX@XXXXX.COM>wrote in
Quote
Ok, Thank you.

So, if I want to learn about directX, where can I find about it on the
net? Does anybody know where I can find freeware program + source code
that uses DirectX?
Take a look on
clootie.narod.ru/delphi/download_dx90.html
a number of samples along woth header translations.
regards
Yannis
 

Re: Direct Sound

Hello all,
Can anybody help me?
I need some help and information on:
1. How to record sound from the line in of a sound card using direct sound?
2. How to play sound from through the line out of a sound card using direct
sound?
If there is a simple source code that does this, would be very help full.
Thank you.
Alain.
 

Re: Direct Sound

Hello all,
For those who frequently works with direct sound,
Is it possible to capture sound from the line in of a soundcard, proces the
sound, and directly play it back through the line out of a soundcard?
All has to be done in real-time.
Is it possible?
Thanks
Alain
 

Re: Direct Sound

"Alain N.S" <XXXX@XXXXX.COM>writes
Quote
Hello all,

For those who frequently works with direct sound,

Is it possible to capture sound from the line in of a soundcard, proces
the
sound, and directly play it back through the line out of a soundcard?

All has to be done in real-time.

Is it possible?

Thanks
Alain
Yes, although I used the MultiMedia wav functions and not DS to do this.
One problem was that on at least one system the clock rates on the sound
card were not the same for input and output (e.g. 44100Hz, 44200Hz)
resulting in some buffers being dropped. All being well, that sort of
shoddy driver programming should not be encountered today!
Cheers,
David
 

Re: Direct Sound

Is there any example of a program that record sound from a soundcard using
direct sound that I can download?
If there is the source code, it would be very helpfull.
Thanks
Alain
"David J Taylor" <XXXX@XXXXX.COM>writes
Quote
"Alain N.S" <XXXX@XXXXX.COM>writes
news:XXXX@XXXXX.COM...
>Hello all,
>
>For those who frequently works with direct sound,
>
>Is it possible to capture sound from the line in of a soundcard, proces
the
>sound, and directly play it back through the line out of a soundcard?
>
>All has to be done in real-time.
>
>Is it possible?
>
>Thanks
>Alain

Yes, although I used the MultiMedia wav functions and not DS to do this.

One problem was that on at least one system the clock rates on the sound
card were not the same for input and output (e.g. 44100Hz, 44200Hz)
resulting in some buffers being dropped. All being well, that sort of
shoddy driver programming should not be encountered today!

Cheers,
David


 

Re: Direct Sound

using directsound is not that hard, first the headers (directx translations)
can be downloaded from:
clootie.narod.ru/delphi/download_dx90.html
then you can go to microsoft website and either convert or write code according
to the online help.
for delphi you got:
ACS at swiss.torry.net/mmpacks.htm
and some more on that page, ACS works fine.
let me know if you need some more help on this (or app specific questions)
--
Liran
www.com-n-sense.com
 

Re: Direct Sound

Ok, Thank You.
I will visit the web and learn from it.
Thanks again.
Alain
"Liran Shahar" <lirans AT com-n-sense DOT com>writes
Quote
using directsound is not that hard, first the headers (directx
translations)
can be downloaded from:
clootie.narod.ru/delphi/download_dx90.html

then you can go to microsoft website and either convert or write code
according
to the online help.

for delphi you got:
ACS at swiss.torry.net/mmpacks.htm
and some more on that page, ACS works fine.

let me know if you need some more help on this (or app specific questions)
--
Liran
www.com-n-sense.com