Bug 13153 - Missing Properties and Callbacks in AudioToolbox.AudioSession
Summary: Missing Properties and Callbacks in AudioToolbox.AudioSession
Status: VERIFIED FIXED
Alias: None
Product: iOS
Classification: Xamarin
Component: XI runtime ()
Version: 6.3.x
Hardware: PC Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Marek Safar
URL:
Depends on:
Blocks:
 
Reported: 2013-07-10 14:03 UTC by Andrew Fernandes
Modified: 2014-04-01 06:19 UTC (History)
3 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
VERIFIED FIXED

Description Andrew Fernandes 2013-07-10 14:03:56 UTC
For iOS 6.1 (have not been able to look at iOS 7 Developer Preview)
MonoTouch 6.3.7.164

One minor and one major issue.

(BTW - Very nice job with this binding, esp. for the audio route properties!)

MINOR ISSUE: the following callback notifications are not exposed "nicely" through MonoTouch:
 - kAudioSessionProperty_CurrentHardwareOutputVolume
 - kAudioSessionProperty_AudioInputAvailable
 - kAudioSessionProperty_InputGainAvailable
 - kAudioSessionProperty_InputGainScalar
 - kAudioSessionProperty_ServerDied
 - kAudioSessionProperty_InputSources
 - kAudioSessionProperty_OutputDestinations

All of these are trivial and can be listened for via 'PropertyListener' if you just do manual C# wrapping of the IntPtr. HOWEVER, the 'InputSources' and 'OutputDestination' are are ugly to use that way since they are both CFArrayRef types containing specific CFDictionaryRef objects (which are already wrapped by AudioToolbox.AccessoryInfo, but has no public constructor).

MAJOR ISSUE: the following are unimplemented in MonoTouch:
 - kAudioSessionProperty_InputSource
 - kAudioSessionProperty_OutputDestination

Both are used for routing over USB audio.

For giggles, here is a cross-ref of audio session properties that I just made:

// iOS 6.1 AudioSession Properties
//
// R - Readable
// W - Writeable
// C - Callback
//
// HAVE -> Implemented by Xamarin MonoTouch.AudioToolbox.AudioSession Version 6.3.7.164
// NEED -> Not Implmented (Verfied via 'monop -r:monotouch.dll MonoTouch.AudioToolbox.AudioSession')
//
//                                                                         HAVE   NEED
enum {
   kAudioSessionProperty_PreferredHardwareSampleRate          = 'hwsr', // RW- // ---
   kAudioSessionProperty_PreferredHardwareIOBufferDuration    = 'iobd', // RW- // ---
   kAudioSessionProperty_AudioCategory                        = 'acat', // RW- // ---
   kAudioSessionProperty_AudioRouteChange                     = 'roch', // --C // ---
   kAudioSessionProperty_CurrentHardwareSampleRate            = 'chsr', // R-- // ---
   kAudioSessionProperty_CurrentHardwareInputNumberChannels   = 'chic', // R-- // ---
   kAudioSessionProperty_CurrentHardwareOutputNumberChannels  = 'choc', // R-- // ---
   kAudioSessionProperty_CurrentHardwareOutputVolume          = 'chov', // R-C // --C
   kAudioSessionProperty_CurrentHardwareInputLatency          = 'cilt', // R-- // ---
   kAudioSessionProperty_CurrentHardwareOutputLatency         = 'colt', // R-- // ---
   kAudioSessionProperty_CurrentHardwareIOBufferDuration      = 'chbd', // R-- // ---
   kAudioSessionProperty_OtherAudioIsPlaying                  = 'othr', // R-- // ---
   kAudioSessionProperty_OverrideAudioRoute                   = 'ovrd', // -W- // ---
   kAudioSessionProperty_AudioInputAvailable                  = 'aiav', // R-C // --C
   kAudioSessionProperty_ServerDied                           = 'died', // --C // --C
   kAudioSessionProperty_OtherMixableAudioShouldDuck          = 'duck', // RW- // ---
   kAudioSessionProperty_OverrideCategoryMixWithOthers        = 'cmix', // RW- // ---
   kAudioSessionProperty_OverrideCategoryDefaultToSpeaker     = 'cspk', // RW- // ---
   kAudioSessionProperty_OverrideCategoryEnableBluetoothInput = 'cblu'  // RW- // ---
   kAudioSessionProperty_InterruptionType                     = 'type'  // R-- // ---
   kAudioSessionProperty_Mode                                 = 'mode', // RW- // ---
   kAudioSessionProperty_InputSources                         = 'srcs', // R-C // --C
   kAudioSessionProperty_OutputDestinations                   = 'dsts', // R-C // --C
   kAudioSessionProperty_InputSource                          = 'isrc', // RW- // RW-
   kAudioSessionProperty_OutputDestination                    = 'odst', // RW- // RW-
   kAudioSessionProperty_InputGainAvailable                   = 'igav', // R-C // --C
   kAudioSessionProperty_InputGainScalar                      = 'igsc', // RWC // --C
   kAudioSessionProperty_AudioRoute                           = 'rout', // R-- // --- // Deprecated in iOS 5
   kAudioSessionProperty_AudioRouteDescription                = 'crar', // R-- // ---
};
//
// public delegate void PropertyListener (AudioSessionProperty prop, int size, IntPtr data);
Comment 1 Marek Safar 2013-07-15 08:37:33 UTC
Implemented.
Comment 2 Andrew Fernandes 2013-07-15 12:29:08 UTC
You guys rock.
Comment 3 Ram Chandra 2014-04-01 06:19:29 UTC
I have checked this issue on following builds:

Mac OS X 10.7.5
Xamarin.iOS:Version: 7.2.2.14
Xamarin Studio: 4.2.3 (build 60)

Build Information
Release ID: 402030060
Git revision: 30c4afc300c2a39ec5300851357ce02e49dd217e
Build date: 2014-03-05 22:09:33+0000
Xamarin addins: f8a9589b57c2bfab2ccd73c880e7ad81e3ecf044

I observed that I am able to access the values of "AudioSessionProperty" enum and all the following values of "AudioSessionProperty" enum is exposed.

                        AudioSessionProperty.CurrentHardwareOutputVolume;
			AudioSessionProperty.AudioInputAvailable;
			AudioSessionProperty.InputGainAvailable;
			AudioSessionProperty.InputGainScalar;
			AudioSessionProperty.ServerDied;
			AudioSessionProperty.InputSources;
			AudioSessionProperty.OutputDestinations;

"XS intellisense" also shows these values and I am able to access these values.

I also observed that the major issue that is mentioned in bug description is also implemented and I can also access these values. ex.
                       AudioSessionProperty.InputSource;
		       AudioSessionProperty.OutputDestination;		

screencast: http://www.screencast.com/t/9JhFr4CZgu

This issue is working fine. Hence, I am closing this issue.