Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# .NET
Hi,
 
I want to write a program to record the calls made by the communicator.
 
I tried many places and find this NAudio Assembly. But even that is not helping since I can't initialize audioclient using loopback in Naudio.
 
If any one knows any alternative please help,
 
Thanks
Posted 15-Feb-11 22:17pm
Comments
Abdul Quader Mamun at 16-Feb-11 5:08am
   
Where is your code?
johannesnestler at 16-Feb-11 10:09am
   
What was the question?
SAKryukov at 16-Feb-11 11:09am
   
Do you mean Lync (formerly Microsoft Office Communicator)?
Any effort on your side?
--SA
KingsKnight at 16-Feb-11 21:32pm
   
For both communicator and Lync.
Marcus Kramer at 17-Feb-11 19:26pm
   
As the others have asked, show us what you have and where it went wrong for you. We can't really help a whole lot without some information.

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NAudio.Mixer;
using NAudio.Wave;
using NAudio.CoreAudioApi;
using NAudio.Midi;
using System.Threading;
using System.Management;
using System.Diagnostics;
namespace ConsoleApplication1
{
    class RecordSound
    {
        public void TestSoundCapture()
        {
            MMDeviceEnumerator mEn = new MMDeviceEnumerator();
 
            MMDeviceCollection deviceCol = mEn.EnumerateAudioEndPoints(DataFlow.Capture, DeviceState.Active);
 
            Console.WriteLine("All listed Devices are");
            Console.WriteLine("*----------------------*");
            foreach (MMDevice m in mEn.EnumerateAudioEndPoints(DataFlow.All, DeviceState.All))
            {
                Console.WriteLine(m.FriendlyName);
            }
 
            Console.WriteLine("\nAll active Devices are");
            Console.WriteLine("*----------------------*");
            foreach (MMDevice m in deviceCol)
            {
                Console.WriteLine(m.FriendlyName);
            }
 
            MMDevice mmDevice = mEn.GetDefaultAudioEndpoint(DataFlow.Capture, Role.Communications);
            Console.WriteLine("\nDefault device is " + mmDevice.FriendlyName.ToString());
 
            //mmDevice.AudioClient.Start();
            //Console.WriteLine(mmDevice.AudioClient.BufferSize.ToString());
            AudioClient ac = mmDevice.AudioClient;
            
            if (mmDevice.State == DeviceState.Active)
            {
                int x = mmDevice.AudioEndpointVolume.Channels.Count;
                Console.WriteLine(x.ToString());
            }
            WaveFormat wf = ac.MixFormat;
 

           ac.Initialize(AudioClientShareMode.Shared, AudioClientStreamFlags.Loopback, 10000000, 0, wf, Guid.Empty)
            
            DirectSoundOut dso = new DirectSoundOut();
            WaveIn wavIn = new WaveIn();
            WaveOut wout = new WaveOut();
            WaveMixerStream32 wm = new WaveMixerStream32();
                                                       
            WaveFileWriter WFR = new WaveFileWriter("C://NVIDIA//TEST.WAV", wm.WaveFormat);
            
 
            Console.ReadLine();
        }
 
    }
}
 

Above is the code I tried using Nvideo assembly. I marked it as bold(sorry ,don't know how to change color ,tried but color comes in other location than intented Smile | :) )
 
I want to record as Loopback then it will save both mic and speaker sound together. There in ac.Initialize method AudioClientStreamFlags.Loopback throws exception. No other values cause any issues...
 
Thanks.
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Nirav Prabtani 304
1 OriginalGriff 237
2 Sergey Alexandrovich Kryukov 196
3 Mika Wendelius 185
4 CPallini 170
0 Nirav Prabtani 284
1 OriginalGriff 217
2 Sergey Alexandrovich Kryukov 196
3 Mika Wendelius 185
4 CPallini 170


Advertise | Privacy | Mobile
Web04 | 2.8.140721.1 | Last Updated 14 Feb 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100