Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
617 views
in Technique[技术] by (71.8m points)

c# - Windows Phone - Audio Endpoint Device

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...