How to discover midi keyboard in web midi api? - macos

reference: Browsers in 2013 with Web MIDI API?
I'm currently running Chrome 34.0.1847.116 on OS 10.9.2 and experimenting with the Web Midi API. After enabling chrome://flags/#enable-web-midi, I'm able to get a midiAccess object by pasting the following code from http://www.w3.org/TR/webmidi/ into the DevTools console.
var midi = null; // global MIDIAccess object
function onMIDISuccess( midiAccess ) {
console.log( "MIDI ready!" );
midi = midiAccess; // store in the global (in real usage, would probably keep in an object instance)
}
function onMIDIFailure(msg) {
console.log( "Failed to get MIDI access - " + msg );
}
navigator.requestMIDIAccess().then( onMIDISuccess, onMIDIFailure );
When I query midi.inputs() and midi.outputs(), the returned list contains only IAC Bus devices. My midi keyboard (connected with a Turtle Beach USB midi adapter) does not show up. In trying to diagnose the problem, I've so far found the following:
The adapter is visible in OS X's Audio/Midi Setup and the keyboard works correctly with Logic Pro as well as with homebrew CoreMidi code.
The web synth example at http://webaudiodemos.appspot.com/monosynth/index.html also fails to find the keyboard and does not make sound when keys are pressed.
The web synth example at http://djazz.se/lab/synth/ does make sound when I click on its virtual keys. DevTools shows that it's using an IAC Bus device.
What do I need to do to help Chrome find non-IAC MIDI devices?

The answer to the question (linked below) from developer cwilso explains the problem. The browser has to be rebooted to detect new connected devices (even if web-midi is already enabled). Doing caused my adapter to be detected and available as an input device
Detect if a MIDI interface is connected in Web MIDI API

Related

Mac OS X video capture device hot plug driver support

I'm developing driver for USB video capture device. First of all, I've started with CoreMediaIO sample:
https://developer.apple.com/library/content/samplecode/CoreMediaIO/Introduction/Intro.html
The kernel extension is based on IOVideoSample. It gets data from the USB device and sends to the assistant. Kext has IOKitPersonalities based on the USB device. So the device is real and should support HotPlug. Kext main class loads when the device is plugged in and unloads when the device is plugged out.
SampleAssistant was changed only to detect my kext class. PlugIn has NoCMIOHardwarePluginLazyLoadingInfo property.
When all video capture apps are closed - hotplug works well. Terminate function is being called from kext and kext object is being unloaded without any problem.
Even if you start video capture app with the stream from the device, then close it and plug out device - hotplug also works.
It works well with QuickTime player. It can find a stream and show an image, but there is one problem.
When QuickTime (or any other video capture app) works and show stream from the device - hotplug doesn't work. If you try to plug out the device it will remain in the system and USB port won't work until you reboot Mac. According to logs - terminate function wasn't called at all. Seems that something retains a link to the device.
I've started digging into the problem.
First of all, I figured out that SampleAssistant doesn't support hotplug by default. It has notification only for device arriving (DeviceArrived). I've added "interest" notification and handle only "kIOMessageSeviceIsTerminated" message - executing DeviceRemoved function and force deleting device object, but it didn't help.
There is also a file CMIO_DPA_Sample_Server_Stream.cpp. If you go to Stream::Start function and delete "mIOSAStream.Open;" and "mIOSAStream.Start();" lines - hotplug works.
Can you please advise what can be done to solve this problem?

creating media controls on android wear

I want to create a wear application that has 2 mode : the connected mode and the disconnected mode. The first mode is used when the watch is connected to the bluetooth : you can control a media player and have the basic controls on what's being played on the phone.
The second mode is used when the mobile is not paired to the watch : you can listen to content on the watch with a bluetooth headset.
My question is the following : on the connected mode, I created my own interface with the basic controls (play/pause/next/previous) and I can synchronize the controls with the phone sending messages via the message api.
Is there a better way to do? Like using the Notifications?
If you want to have the basic media controls on your wear device (controlling then playback of your media app on your phone), then you can use the MediaSessionCompat to handle that for you; take a look at the UniversalMusicPlayer for example; basically if your media app is using the MediaSessionCompat (or MediaSession if you are not concerned with earlier versions of Android), then the basic controls should appear on your watch and if you implement MediSessionComapt.Callback in your media app, framework will send the control commands to your app from your watch.

C++ detect Apple headphone buttons on Windows

BACKGROUND INFORMATION:
I've been trying to detect a button click from Apple headphone. The headphone is connected to MacBook Pro that is running Windows. Its not virtual machine. It is running windows normally with a complete windows driver from Apple through Boot Camp.
The headphone is a standard Apple headphone consisted of three buttons: a volume up, volume down, middle buttons and a Mic.
When I am using Mac Os, If the volume up button is presses on the ear phone, Mac Os would increase its volume by one. It also decreases its volume when the voulume down button is pressed on the ear phone.
Standard ear/headphone uses three conductive pins to receive(L/R speakers only) signals while the apple version is using four conductive pins to receive(L/R speakers) and send(buttons) signals. This headphone was made for iPhone but I was surprised when it worked on Mac Os.
This made me believe that the MacBook Pro hardware is built to support this four conductive pins earphone. It works on Mac Os but NOT on Windows. My goal is to develop a tiny software that will allow the apple headphone to function on Windows running on Apple hardware.
I know how to increase Windows volume using C++ and Win32 API but I am stuck on the part where I actually have to detect the button click from the headphone.
QUESTION:
1) what ways can I detect the Input(button clicks) from the headphone?
It looks like this person here was able to read it. He only did it while running on Mac Os
Detect hardware headphone presses in mac
2) If I compile the code this person got working on Mac OS as a DLL file and then call the function while running Windows, will it work?
3) Do I need to make my own driver to get this to work?
4) The code below is from the link I posted above. What windows API function, class is equivelent to the follwoing Mac Os code below?
id array = [[DDHidDevice allDevices] filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:#"productName == \"Apple Mikey HID Driver\""]];
DDHidDevice *mic = [array count] ? [array objectAtIndex:0] : nil;
// it isn't a keyboard
NSLog(#"%#", mic.primaryUsage);
assert(mic.usage==1 && mic.usagePage==12);
THINGS I'VE TRIED:
1) I tried using GetLastInputInfo() with LASTINPUTINFO from Windows API to sniff any hardware input but failed miserably. It worked on keyboard and mouse but nothing else.
2) I also tried to use RAWINPUTDEVICE to read a low level input from hardware but it only worked on keyboards, mouse and joystick input. It didn't detect the headphone button press.
I am running out of ideas. Anyone got any solution?
NOTE: This is not a duplicate question as I am asking how to do this on Windows not Mac.

How can i receive the hardware key button event On Windows phone 8?

How can i receive the hardware key button event On Windows phone 8 App?
I have many problem,
The WP 8 is available features are very limited.
The Windows CE / WM is a very different behavior.
I want to access the OS Layer by the API (Function)
Back button : Success. I found this key event.
Home button : ??? (I don't know)
Search button : ??? (I don't know)
Volume Up / Down : Just working volume.
Camera Key : Can i change the default camera app?
http://msdn.microsoft.com/en-us/library/windowsphone/develop/hh202963(v=vs.105).aspx
Power Key : Can i optionally lock the power key?
OEM Key (Barcode Key) : Push the button, I want to execute the My App?
[Additional]
Sorry. My Project information was too little provided.
I developed the WP8 App in the WP Device OEM Manufacturers.
So I can access to "OS, Device Driver, App".
But there are various MS documents, By First Time, The developement is too hard.
Have you ever used these methods can I?
- Named Event
- SendMessage / PostMessage
- Other Communication
I guess the Key-Point "How can i communicate Device driver <-> App"
I am studying now the following Function.
- Service Agent
- IPC
You cannot access the majority of those buttons, by design. By not allowing applications access, it means the end user has a consistent experience with the standard platform.
You can create a new "lens" to act as a replacement for the default camera application.
That's not to say though as an OEM, that Microsoft would not provide additional access that is not available to a standard "Store" application. That type of access is often protected by a non-disclosure statement however.

How do I detect if a bluetooth audio device is connected in Mac OS X?

I'm working on an application that plays audio on OsX. I'm able to list the available output devices with CodeAudio, but I have issues with a bluetooth headset; Even though the device is powered off and not connected, it's still listed in the OsX sound pref pane, and therefore picked up by CoreAudio as a valid output.
I'd like not to display bluetooth outputs if the corresponding device isn't connected already.
I've tried to check CoreAudio properties like those:
kAudioDevicePropertyDeviceIsAlive
kAudioDevicePropertyDeviceIsRunning
kAudioDevicePropertyDeviceIsRunningSomewhere
but there's no difference between the default output and the bluetooth output.
Is this kind of detection something doable with Coreaudio?
For the benefit of future searchers the way I've done it in the past is to:
Enumerate the detected devices
Query the kAudioDevicePropertyTransportType property for each AudioDeviceID
which will return a transport type ID constant.
Match for the
kAudioDeviceTransportTypeBluetooth or
kAudioDeviceTransportTypeBluetoothLE type
That way you can determine the type of connection the device is using (USB, Firewire etc). You can find the full list of transport types in AudioHardwareBase.h

Resources