Click here to Skip to main content
15,887,945 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I was able to resolve my original problem and I am getting the pointer back. It appears that I just had to send and IntPtr as a ref parameter and use that.

That leaves me with one other problem that I haven't yet found a clear answer to. Now that I have my pointer value, how do I use it to get to the actual interface? i have defined the C# interface to be able to access COM:
C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;

namespace CoreAudioApi.Interfaces
{
    [Guid("7FB7B48F-531D-44A2-BCB3-5AD5A134B3DC"),
     InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]

    public interface IAudioVolumeLevel : IPerChannelDbLevel { }
}

This coorsponds to the COM interface and is how my other interfaces are set up. The C++ example I am working from sends a pointer defined from the interface:
C#
IAudioVolumeLevel* pIaudioVolumeLevel;
getMicrophoneBoostVolumeLevel(defaultDevice, &pIaudioVolumeLevel);

On returning the volume setting for this particular part can be examined and set:
C#
pIaudioVolumeLevel->GetLevelRange(0, &fMinDb, &fMaxDb, &fStepDb);
pIaudioVolumeLevel->GetLevel(0, &pfCurrentDb);
pIaudioVolumeLevel->SetLevel(0, pfCurrentDb, NULL);

Assuming i am getting the correct value in the returned pointer, how do I now set the level through C#?

Thank you
Posted
Updated 13-Oct-14 10:26am
v3
Comments
Sergey Alexandrovich Kryukov 13-Oct-14 17:17pm    
Why not using, say, DirectSound with .NET?
—SA
CliffRat 13-Oct-14 20:33pm    
I am using C# to get to the DeviceTopology API to set microphone boost which isn't available through other means as far as I have been able to find.

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900