 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
chris Guest
|
Posted: Wed Nov 22, 2006 9:11 am Post subject: How to talk on mic and listen to it at the same time |
|
|
Hi
Is there a way to talk on the microphone and listen to own voice at the same
time on the speakers?
I don want to record the voice but merely acts as booster for the
announcement.
is there a way to do it?
please help
thanks
chris |
|
| Back to top |
|
 |
Tsviatko Jongov Guest
|
Posted: Thu Nov 23, 2006 8:00 pm Post subject: Re: How to talk on mic and listen to it at the same time |
|
|
Hi Chris,
Yes, you can do this with Microsoft GraphEdit application. GraphEdit is a free application. You have to create Default Sound Capture filter and Default Sound Renderer filter. Then select microphone as input of the Capture Filter.
Connect the two filters and start the graph.
All this can be done programaticaly.
Regards,
Tsviatko Jongov
http://tsviatko.jongov.com
"chris" <chris (AT) infologic (DOT) sg> wrote:
| Quote: | Hi
Is there a way to talk on the microphone and listen to own voice at the same
time on the speakers?
I don want to record the voice but merely acts as booster for the
announcement.
is there a way to do it?
please help
thanks
chris
|
|
|
| Back to top |
|
 |
chris Guest
|
Posted: Fri Nov 24, 2006 9:11 am Post subject: Re: How to talk on mic and listen to it at the same time |
|
|
Hi
Is there a component that does this function?
thanks
chris
"Tsviatko Jongov" <johngov (AT) yahoo (DOT) com> wrote in message
news:4565b779$1 (AT) newsgroups (DOT) borland.com...
| Quote: |
Hi Chris,
Yes, you can do this with Microsoft GraphEdit application. GraphEdit is a
free application. You have to create Default Sound Capture filter and
Default Sound Renderer filter. Then select microphone as input of the
Capture Filter.
Connect the two filters and start the graph.
All this can be done programaticaly.
Regards,
Tsviatko Jongov
http://tsviatko.jongov.com
"chris" <chris (AT) infologic (DOT) sg> wrote:
Hi
Is there a way to talk on the microphone and listen to own voice at the
same
time on the speakers?
I don want to record the voice but merely acts as booster for the
announcement.
is there a way to do it?
please help
thanks
chris
|
|
|
| Back to top |
|
 |
Tsviatko Jongov Guest
|
Posted: Fri Nov 24, 2006 9:11 am Post subject: Re: How to talk on mic and listen to it at the same time |
|
|
Hi Chris,
I've created a little class that performs the microphone passthrough. I've developed this with DSPack 2.0, which you'll have to download from the net (http://www.progdigy.com)- it is free.
Just create the class.
unit AudioMicrophonePassthrough;
interface
uses
Windows, SysUtils, DirectShow, ActiveX;
type
TMicrophonePassThrough = class
private
FGraphBuilder : IGraphBuilder;
FMediaControl : IMediaControl;
FMediaFilter : IMediaFilter;
FReferenceClock : IReferenceClock;
FAudioCapture : IBaseFilter;
FAudioRenderer : IBaseFilter;
FCapturePin : IPin;
public
constructor Create;
destructor Destroy; override;
end;
implementation
function GetFirstAudioCaptureFilter(var Filter: IBaseFilter): Bool;
var
pSysDevEnum : ICreateDevEnum;
pEnumCat : IEnumMoniker;
pMoniker : IMoniker;
cFetched : ULONG;
HR : HRESULT;
begin
Result := False;
try
// Create the System Device Enumerator.
hr := CoCreateInstance(CLSID_SystemDeviceEnum, nil, CLSCTX_INPROC_SERVER, IID_ICreateDevEnum, pSysDevEnum);
if Failed(hr) then
Exit;
// Obtain a class enumerator for the video compressor category.
pEnumCat := nil;
hr := pSysDevEnum.CreateClassEnumerator(CLSID_AudioInputDeviceCategory, pEnumCat, 0);
if Failed(hr) then
Exit;
//Enumerate the monikers.
pMoniker := nil;
pEnumCat.Reset;
if (pEnumCat.Next(1, pMoniker, @cFetched) = S_OK) then
begin
// To create an instance of the filter, do the following:
pMoniker.BindToObject(nil, nil, IID_IBaseFilter, Filter);
// Clean up.
pMoniker := nil;
Result := True;
end;
pEnumCat := nil;
pSysDevEnum := nil;
pMoniker := nil;
pEnumCat := nil;
pSysDevEnum := nil;
except
OutputDebugString('Error in GetFirstAudioCaptureFilter call...');
end;
end;
{---------------------------- TMicrophonePassthrough --------------------------}
constructor TMicrophonePassthrough.Create;
var
Pin : IPin;
AIM : IAMAudioInputMixer;
begin
CoInitialize(nil);
//Create FilterGraph
CoCreateInstance(CLSID_FilterGraph, nil, CLSCTX_INPROC, IID_IGraphBuilder, FGraphBuilder);
//Get MediaControl so we can call Run and Stop
FMediaControl := FGraphBuilder as IMediaControl;
//Get MediaFilter so we can set graph's clock
FMediaFilter := FGraphBuilder as IMediaFilter;
//Create ReferenceClock
CoCreateInstance(CLSID_SystemClock, nil, CLSCTX_INPROC, IID_IReferenceClock, FReferenceClock);
FMediaFilter.SetSyncSource(FReferenceClock);
//Create Audio Capture Filter
GetFirstAudioCaptureFilter(FAudioCapture);
//Add audio capture filter to graph
FGraphBuilder.AddFilter(FAudioCapture, 'Audio Capture');
//Select Microphone as input.
if (FAudioCapture.FindPin('Microphone', Pin) = S_OK) and (Pin <> nil) then
begin
AIM := Pin as IAMAudioInputMixer;
AIM.put_Enable(True);
AIM := nil;
Pin := nil;
end;
//Create audio renderer.
CoCreateInstance(CLSID_DSoundRender, nil, CLSCTX_INPROC, IID_IBaseFilter, FAudioRenderer);
//Add audio renderer filter to graph.
FGraphBuilder.AddFilter(FAudioRenderer, 'Audio Renderer');
//Render graph
if (FAudioCapture.FindPin('Capture', FCapturePin) = S_OK) and (Pin <> nil) then
begin
FGraphBuilder.Render(FCapturePin);
end;
//Run the graph
FMediaControl.Run;
end;
destructor TMicrophonePassthrough.Destroy;
begin
//Stop the graph
FMediaControl.Stop;
//Disconnect filters
FGraphBuilder.Disconnect(FCapturePin);
//Remove both filters from graph
FGraphBuilder.RemoveFilter(FAudioCapture);
FGraphBuilder.RemoveFilter(FAudioRenderer);
//Destroy both filters
FAudioCapture := nil;
FAudioRenderer := nil;
FReferenceClock := nil;
FMediaControl := nil;
FMediaFilter := nil;
CoUninitialize;
inherited;
end;
end.
Regards,
Tsviatko Jongov
http://tsviatko.jongov.com
"chris" <chris (AT) infologic (DOT) sg> wrote:
| Quote: | Hi
Is there a component that does this function?
thanks
chris
"Tsviatko Jongov" <johngov (AT) yahoo (DOT) com> wrote in message
news:4565b779$1 (AT) newsgroups (DOT) borland.com...
Hi Chris,
Yes, you can do this with Microsoft GraphEdit application. GraphEdit is a
free application. You have to create Default Sound Capture filter and
Default Sound Renderer filter. Then select microphone as input of the
Capture Filter.
Connect the two filters and start the graph.
All this can be done programaticaly.
Regards,
Tsviatko Jongov
http://tsviatko.jongov.com
"chris" <chris (AT) infologic (DOT) sg> wrote:
Hi
Is there a way to talk on the microphone and listen to own voice at the
same
time on the speakers?
I don want to record the voice but merely acts as booster for the
announcement.
is there a way to do it?
please help
thanks
chris
|
|
|
| Back to top |
|
 |
Tsviatko Jongov Guest
|
Posted: Fri Nov 24, 2006 4:29 pm Post subject: Re: How to talk on mic and listen to it at the same time |
|
|
Please add these two lines in the destructor
FCapturePin := nil;
FGraphBuilder := nil;
so the destructor will look like
destructor TMicrophonePassthrough.Destroy;
begin
//Stop the graph
FMediaControl.Stop;
//Disconnect filters
FGraphBuilder.Disconnect(FCapturePin);
//Remove both filters from graph
FGraphBuilder.RemoveFilter(FAudioCapture);
FGraphBuilder.RemoveFilter(FAudioRenderer);
FCapturePin := nil;
//Destroy both filters
FAudioCapture := nil;
FAudioRenderer := nil;
FReferenceClock := nil;
FMediaControl := nil;
FMediaFilter := nil;
FGraphBuilder := nil;
CoUninitialize;
end;
Without releasing capture pin and graph, it would generate memory leak after destruction.
Regards,
Tsviatko Jongov
http://tsviatko.jongov.com
"Tsviatko Jongov" <johngov (AT) yahoo (DOT) com> wrote:
| Quote: |
Hi Chris,
I've created a little class that performs the microphone passthrough. I've developed this with DSPack 2.0, which you'll have to download from the net (http://www.progdigy.com)- it is free.
Just create the class.
unit AudioMicrophonePassthrough;
interface
uses
Windows, SysUtils, DirectShow, ActiveX;
type
TMicrophonePassThrough = class
private
FGraphBuilder : IGraphBuilder;
FMediaControl : IMediaControl;
FMediaFilter : IMediaFilter;
FReferenceClock : IReferenceClock;
FAudioCapture : IBaseFilter;
FAudioRenderer : IBaseFilter;
FCapturePin : IPin;
public
constructor Create;
destructor Destroy; override;
end;
implementation
function GetFirstAudioCaptureFilter(var Filter: IBaseFilter): Bool;
var
pSysDevEnum : ICreateDevEnum;
pEnumCat : IEnumMoniker;
pMoniker : IMoniker;
cFetched : ULONG;
HR : HRESULT;
begin
Result := False;
try
// Create the System Device Enumerator.
hr := CoCreateInstance(CLSID_SystemDeviceEnum, nil, CLSCTX_INPROC_SERVER, IID_ICreateDevEnum, pSysDevEnum);
if Failed(hr) then
Exit;
// Obtain a class enumerator for the video compressor category.
pEnumCat := nil;
hr := pSysDevEnum.CreateClassEnumerator(CLSID_AudioInputDeviceCategory, pEnumCat, 0);
if Failed(hr) then
Exit;
//Enumerate the monikers.
pMoniker := nil;
pEnumCat.Reset;
if (pEnumCat.Next(1, pMoniker, @cFetched) = S_OK) then
begin
// To create an instance of the filter, do the following:
pMoniker.BindToObject(nil, nil, IID_IBaseFilter, Filter);
// Clean up.
pMoniker := nil;
Result := True;
end;
pEnumCat := nil;
pSysDevEnum := nil;
pMoniker := nil;
pEnumCat := nil;
pSysDevEnum := nil;
except
OutputDebugString('Error in GetFirstAudioCaptureFilter call...');
end;
end;
{---------------------------- TMicrophonePassthrough --------------------------}
constructor TMicrophonePassthrough.Create;
var
Pin : IPin;
AIM : IAMAudioInputMixer;
begin
CoInitialize(nil);
//Create FilterGraph
CoCreateInstance(CLSID_FilterGraph, nil, CLSCTX_INPROC, IID_IGraphBuilder, FGraphBuilder);
//Get MediaControl so we can call Run and Stop
FMediaControl := FGraphBuilder as IMediaControl;
//Get MediaFilter so we can set graph's clock
FMediaFilter := FGraphBuilder as IMediaFilter;
//Create ReferenceClock
CoCreateInstance(CLSID_SystemClock, nil, CLSCTX_INPROC, IID_IReferenceClock, FReferenceClock);
FMediaFilter.SetSyncSource(FReferenceClock);
//Create Audio Capture Filter
GetFirstAudioCaptureFilter(FAudioCapture);
//Add audio capture filter to graph
FGraphBuilder.AddFilter(FAudioCapture, 'Audio Capture');
//Select Microphone as input.
if (FAudioCapture.FindPin('Microphone', Pin) = S_OK) and (Pin <> nil) then
begin
AIM := Pin as IAMAudioInputMixer;
AIM.put_Enable(True);
AIM := nil;
Pin := nil;
end;
//Create audio renderer.
CoCreateInstance(CLSID_DSoundRender, nil, CLSCTX_INPROC, IID_IBaseFilter, FAudioRenderer);
//Add audio renderer filter to graph.
FGraphBuilder.AddFilter(FAudioRenderer, 'Audio Renderer');
//Render graph
if (FAudioCapture.FindPin('Capture', FCapturePin) = S_OK) and (Pin <> nil) then
begin
FGraphBuilder.Render(FCapturePin);
end;
//Run the graph
FMediaControl.Run;
end;
destructor TMicrophonePassthrough.Destroy;
begin
//Stop the graph
FMediaControl.Stop;
//Disconnect filters
FGraphBuilder.Disconnect(FCapturePin);
//Remove both filters from graph
FGraphBuilder.RemoveFilter(FAudioCapture);
FGraphBuilder.RemoveFilter(FAudioRenderer);
//Destroy both filters
FAudioCapture := nil;
FAudioRenderer := nil;
FReferenceClock := nil;
FMediaControl := nil;
FMediaFilter := nil;
CoUninitialize;
inherited;
end;
end.
Regards,
Tsviatko Jongov
http://tsviatko.jongov.com
"chris" <chris (AT) infologic (DOT) sg> wrote:
Hi
Is there a component that does this function?
thanks
chris
"Tsviatko Jongov" <johngov (AT) yahoo (DOT) com> wrote in message
news:4565b779$1 (AT) newsgroups (DOT) borland.com...
Hi Chris,
Yes, you can do this with Microsoft GraphEdit application. GraphEdit is a
free application. You have to create Default Sound Capture filter and
Default Sound Renderer filter. Then select microphone as input of the
Capture Filter.
Connect the two filters and start the graph.
All this can be done programaticaly.
Regards,
Tsviatko Jongov
http://tsviatko.jongov.com
"chris" <chris (AT) infologic (DOT) sg> wrote:
Hi
Is there a way to talk on the microphone and listen to own voice at the
same
time on the speakers?
I don want to record the voice but merely acts as booster for the
announcement.
is there a way to do it?
please help
thanks
chris
|
|
|
| Back to top |
|
 |
chris Guest
|
Posted: Sat Nov 25, 2006 3:35 pm Post subject: Re: How to talk on mic and listen to it at the same time |
|
|
hi
thanks very much for yr help
will try it out
thanks
chris
"Tsviatko Jongov" <johngov (AT) yahoo (DOT) com> wrote in message
news:4566d78d$1 (AT) newsgroups (DOT) borland.com...
| Quote: |
Please add these two lines in the destructor
FCapturePin := nil;
FGraphBuilder := nil;
so the destructor will look like
destructor TMicrophonePassthrough.Destroy;
begin
//Stop the graph
FMediaControl.Stop;
//Disconnect filters
FGraphBuilder.Disconnect(FCapturePin);
//Remove both filters from graph
FGraphBuilder.RemoveFilter(FAudioCapture);
FGraphBuilder.RemoveFilter(FAudioRenderer);
FCapturePin := nil;
//Destroy both filters
FAudioCapture := nil;
FAudioRenderer := nil;
FReferenceClock := nil;
FMediaControl := nil;
FMediaFilter := nil;
FGraphBuilder := nil;
CoUninitialize;
end;
Without releasing capture pin and graph, it would generate memory leak
after destruction.
Regards,
Tsviatko Jongov
http://tsviatko.jongov.com
"Tsviatko Jongov" <johngov (AT) yahoo (DOT) com> wrote:
Hi Chris,
I've created a little class that performs the microphone passthrough. I've
developed this with DSPack 2.0, which you'll have to download from the net
(http://www.progdigy.com)- it is free.
Just create the class.
unit AudioMicrophonePassthrough;
interface
uses
Windows, SysUtils, DirectShow, ActiveX;
type
TMicrophonePassThrough = class
private
FGraphBuilder : IGraphBuilder;
FMediaControl : IMediaControl;
FMediaFilter : IMediaFilter;
FReferenceClock : IReferenceClock;
FAudioCapture : IBaseFilter;
FAudioRenderer : IBaseFilter;
FCapturePin : IPin;
public
constructor Create;
destructor Destroy; override;
end;
implementation
function GetFirstAudioCaptureFilter(var Filter: IBaseFilter): Bool;
var
pSysDevEnum : ICreateDevEnum;
pEnumCat : IEnumMoniker;
pMoniker : IMoniker;
cFetched : ULONG;
HR : HRESULT;
begin
Result := False;
try
// Create the System Device Enumerator.
hr := CoCreateInstance(CLSID_SystemDeviceEnum, nil,
CLSCTX_INPROC_SERVER, IID_ICreateDevEnum, pSysDevEnum);
if Failed(hr) then
Exit;
// Obtain a class enumerator for the video compressor category.
pEnumCat := nil;
hr :=
pSysDevEnum.CreateClassEnumerator(CLSID_AudioInputDeviceCategory,
pEnumCat, 0);
if Failed(hr) then
Exit;
//Enumerate the monikers.
pMoniker := nil;
pEnumCat.Reset;
if (pEnumCat.Next(1, pMoniker, @cFetched) = S_OK) then
begin
// To create an instance of the filter, do the following:
pMoniker.BindToObject(nil, nil, IID_IBaseFilter, Filter);
// Clean up.
pMoniker := nil;
Result := True;
end;
pEnumCat := nil;
pSysDevEnum := nil;
pMoniker := nil;
pEnumCat := nil;
pSysDevEnum := nil;
except
OutputDebugString('Error in GetFirstAudioCaptureFilter call...');
end;
end;
{----------------------------
TMicrophonePassthrough --------------------------}
constructor TMicrophonePassthrough.Create;
var
Pin : IPin;
AIM : IAMAudioInputMixer;
begin
CoInitialize(nil);
//Create FilterGraph
CoCreateInstance(CLSID_FilterGraph, nil, CLSCTX_INPROC,
IID_IGraphBuilder, FGraphBuilder);
//Get MediaControl so we can call Run and Stop
FMediaControl := FGraphBuilder as IMediaControl;
//Get MediaFilter so we can set graph's clock
FMediaFilter := FGraphBuilder as IMediaFilter;
//Create ReferenceClock
CoCreateInstance(CLSID_SystemClock, nil, CLSCTX_INPROC,
IID_IReferenceClock, FReferenceClock);
FMediaFilter.SetSyncSource(FReferenceClock);
//Create Audio Capture Filter
GetFirstAudioCaptureFilter(FAudioCapture);
//Add audio capture filter to graph
FGraphBuilder.AddFilter(FAudioCapture, 'Audio Capture');
//Select Microphone as input.
if (FAudioCapture.FindPin('Microphone', Pin) = S_OK) and (Pin <> nil)
then
begin
AIM := Pin as IAMAudioInputMixer;
AIM.put_Enable(True);
AIM := nil;
Pin := nil;
end;
//Create audio renderer.
CoCreateInstance(CLSID_DSoundRender, nil, CLSCTX_INPROC,
IID_IBaseFilter, FAudioRenderer);
//Add audio renderer filter to graph.
FGraphBuilder.AddFilter(FAudioRenderer, 'Audio Renderer');
//Render graph
if (FAudioCapture.FindPin('Capture', FCapturePin) = S_OK) and (Pin
nil) then
begin
FGraphBuilder.Render(FCapturePin);
end;
//Run the graph
FMediaControl.Run;
end;
destructor TMicrophonePassthrough.Destroy;
begin
//Stop the graph
FMediaControl.Stop;
//Disconnect filters
FGraphBuilder.Disconnect(FCapturePin);
//Remove both filters from graph
FGraphBuilder.RemoveFilter(FAudioCapture);
FGraphBuilder.RemoveFilter(FAudioRenderer);
//Destroy both filters
FAudioCapture := nil;
FAudioRenderer := nil;
FReferenceClock := nil;
FMediaControl := nil;
FMediaFilter := nil;
CoUninitialize;
inherited;
end;
end.
Regards,
Tsviatko Jongov
http://tsviatko.jongov.com
"chris" <chris (AT) infologic (DOT) sg> wrote:
Hi
Is there a component that does this function?
thanks
chris
"Tsviatko Jongov" <johngov (AT) yahoo (DOT) com> wrote in message
news:4565b779$1 (AT) newsgroups (DOT) borland.com...
Hi Chris,
Yes, you can do this with Microsoft GraphEdit application. GraphEdit is
a
free application. You have to create Default Sound Capture filter and
Default Sound Renderer filter. Then select microphone as input of the
Capture Filter.
Connect the two filters and start the graph.
All this can be done programaticaly.
Regards,
Tsviatko Jongov
http://tsviatko.jongov.com
"chris" <chris (AT) infologic (DOT) sg> wrote:
Hi
Is there a way to talk on the microphone and listen to own voice at the
same
time on the speakers?
I don want to record the voice but merely acts as booster for the
announcement.
is there a way to do it?
please help
thanks
chris
|
|
|
| Back to top |
|
 |
Boian Mitov Guest
|
Posted: Sun Nov 26, 2006 2:11 am Post subject: Re: How to talk on mic and listen to it at the same time |
|
|
Hi Chris,
You can try AudioLab from www.mitov.com . It does that without the need
for any code , and is free for non commercial porpoises. You just
need to drop 2 components and to set some properties.
With best regards,
Boian Mitov
chris wrote:
| Quote: | Hi
Is there a component that does this function?
thanks
chris
|
|
|
| Back to top |
|
 |
Thack Guest
|
Posted: Sun Dec 10, 2006 6:53 am Post subject: Re: How to talk on mic and listen to it at the same time |
|
|
Maybe I've misunderstood something, but you don't need any software at all
to do this.
Just un-mute the 'Mic Volume' in the Windows Master Volume panel. Of
course, as soon as you turn up the volume you get feedback, which may be a
problem.
Thack |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|