Windows Phone - Audio Endpoint Device

2019-03-04 12:45发布

问题:

I can't seem to find this anywhere.

I want to build an Audio Endpoint device that plugs into the Windows Phone Headphone Jack.

I know I need to start with what the phone is capable of receiving and detecting.

Ultimately I would like to use already in existence libraries however I have no heartache about writing my own.

My problem is I can't find any examples of how people access the Audio input on the phone outside of the built in microphone.

Is there a library for this?

回答1:

You can detect when a headset is plugged in using the VOIP capabilities in Windows Phone 8.

First in the WMAppManifest.xml file, you need to enable ID_CAP_VOIP and ID_CAP_AUDIOROUTING

Then in the App, you need to capture the event

AudioRoutingManager.GetDefault().AudioEndpointChanged += AudioEndpointChanged;

public void AudioEndpointChanged(AudioRoutingManager sender, object args) 
{
  var AudioEndPoint = sender.GetAudioEndpoint();
  switch (AudioEndPoint)
  {
     case AudioRoutingEndpoint.WiredHeadset:
          MessageBox.Show("Headset connected");
          break;
  }
}

This will enumerate from this list (no custom endpoints allowed)

http://msdn.microsoft.com/en-us/library/windowsphone/develop/windows.phone.media.devices.audioroutingendpoint(v=vs.105).aspx

Sorry, but I can only answer the first part of your question about detecting the device, I'm not familiar with how the hardware device interfaces with the headphone jack to answer the rest.