~ubuntu-branches/ubuntu/trusty/monodevelop/trusty-proposed

« back to all changes in this revision

Viewing changes to external/maccore/src/AVFoundation/AVAudioSettings.cs

  • Committer: Package Import Robot
  • Author(s): Jo Shields
  • Date: 2013-05-12 09:46:03 UTC
  • mto: This revision was merged to the branch mainline in revision 29.
  • Revision ID: package-import@ubuntu.com-20130512094603-mad323bzcxvmcam0
Tags: upstream-4.0.5+dfsg
ImportĀ upstreamĀ versionĀ 4.0.5+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// 
 
2
// AudioSettings.cs: Implements strongly typed access for AV audio settings
 
3
//
 
4
// Authors: Marek Safar (marek.safar@gmail.com)
 
5
//     
 
6
// Copyright 2012, Xamarin Inc.
 
7
//
 
8
// Permission is hereby granted, free of charge, to any person obtaining
 
9
// a copy of this software and associated documentation files (the
 
10
// "Software"), to deal in the Software without restriction, including
 
11
// without limitation the rights to use, copy, modify, merge, publish,
 
12
// distribute, sublicense, and/or sell copies of the Software, and to
 
13
// permit persons to whom the Software is furnished to do so, subject to
 
14
// the following conditions:
 
15
// 
 
16
// The above copyright notice and this permission notice shall be
 
17
// included in all copies or substantial portions of the Software.
 
18
// 
 
19
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 
20
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 
21
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 
22
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
 
23
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
 
24
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 
25
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
26
//
 
27
 
 
28
using System;
 
29
 
 
30
using MonoMac.Foundation;
 
31
using MonoMac.CoreFoundation;
 
32
using MonoMac.ObjCRuntime;
 
33
using MonoMac.AudioToolbox;
 
34
 
 
35
namespace MonoMac.AVFoundation {
 
36
 
 
37
        // Should be called AVAudioSetting but AVAudioSetting has been already used by keys class
 
38
        [Since (6,0)]
 
39
        public class AudioSettings : DictionaryContainer
 
40
        {
 
41
#if !COREBUILD
 
42
                public AudioSettings ()
 
43
                        : base (new NSMutableDictionary ())
 
44
                {
 
45
                }
 
46
 
 
47
                public AudioSettings (NSDictionary dictionary)
 
48
                        : base (dictionary)
 
49
                {
 
50
                }
 
51
 
 
52
                public AudioFormatType? Format {
 
53
                        set {
 
54
                                SetNumberValue (AVAudioSettings.AVFormatIDKey, (int?) value);
 
55
                        }
 
56
                        get {
 
57
                                return (AudioFormatType?)GetInt32Value (AVAudioSettings.AVFormatIDKey);
 
58
                        }
 
59
                }
 
60
 
 
61
                public float? SampleRate {
 
62
                        set {
 
63
                                SetNumberValue (AVAudioSettings.AVSampleRateKey, value);
 
64
                        }
 
65
                        get {
 
66
                                return GetFloatValue (AVAudioSettings.AVSampleRateKey);
 
67
                        }
 
68
                }                       
 
69
 
 
70
                public int? NumberChannels {
 
71
                        set {
 
72
                                SetNumberValue (AVAudioSettings.AVNumberOfChannelsKey, value);
 
73
                        }
 
74
                        get {
 
75
                                return GetInt32Value (AVAudioSettings.AVNumberOfChannelsKey);
 
76
                        }
 
77
                }
 
78
 
 
79
                public int? LinearPcmBitDepth {
 
80
                        set {
 
81
                                if (!(value == 8 || value == 16 || value == 24 || value == 32))
 
82
                                        throw new ArgumentOutOfRangeException ("value must be of 8, 16, 24 or 32");
 
83
 
 
84
                                SetNumberValue (AVAudioSettings.AVLinearPCMBitDepthKey, value);
 
85
                        }
 
86
                        get {
 
87
                                return GetInt32Value (AVAudioSettings.AVLinearPCMBitDepthKey);
 
88
                        }
 
89
                }
 
90
 
 
91
                public bool? LinearPcmBigEndian {
 
92
                        set {
 
93
                                SetBooleanValue (AVAudioSettings.AVLinearPCMIsBigEndianKey, value);
 
94
                        }
 
95
                        get {
 
96
                                return GetBoolValue (AVAudioSettings.AVLinearPCMIsBigEndianKey);
 
97
                        }
 
98
                }
 
99
 
 
100
                public bool? LinearPcmFloat {
 
101
                        set {
 
102
                                SetBooleanValue (AVAudioSettings.AVLinearPCMIsFloatKey, value);
 
103
                        }
 
104
                        get {
 
105
                                return GetBoolValue (AVAudioSettings.AVLinearPCMIsFloatKey);
 
106
                        }
 
107
                }
 
108
 
 
109
                public bool? LinearPcmNonInterleaved {
 
110
                        set {
 
111
                                SetBooleanValue (AVAudioSettings.AVLinearPCMIsNonInterleaved, value);
 
112
                        }
 
113
                        get {
 
114
                                return GetBoolValue (AVAudioSettings.AVLinearPCMIsNonInterleaved);
 
115
                        }
 
116
                }
 
117
 
 
118
                public AVAudioQuality? AudioQuality {
 
119
                        set {
 
120
                                SetNumberValue (AVAudioSettings.AVEncoderAudioQualityKey, (int?) value);
 
121
                        }
 
122
                        get {
 
123
                                return (AVAudioQuality?) GetInt32Value (AVAudioSettings.AVEncoderAudioQualityKey);
 
124
                        }
 
125
                }
 
126
 
 
127
                public AVAudioQuality? SampleRateConverterAudioQuality {
 
128
                        set {
 
129
                                SetNumberValue (AVAudioSettings.AVSampleRateConverterAudioQualityKey, (int?) value);
 
130
                        }
 
131
                        get {
 
132
                                return (AVAudioQuality?) GetInt32Value (AVAudioSettings.AVSampleRateConverterAudioQualityKey);
 
133
                        }
 
134
                }
 
135
 
 
136
                public int? EncoderBitRate {
 
137
                        set {
 
138
                                SetNumberValue (AVAudioSettings.AVEncoderBitRateKey, value);
 
139
                        }
 
140
                        get {
 
141
                                return GetInt32Value (AVAudioSettings.AVEncoderBitRateKey);
 
142
                        }                       
 
143
                }
 
144
 
 
145
                public int? EncoderBitRatePerChannel {
 
146
                        set {
 
147
                                SetNumberValue (AVAudioSettings.AVEncoderBitRatePerChannelKey, value);
 
148
                        }
 
149
                        get {
 
150
                                return GetInt32Value (AVAudioSettings.AVEncoderBitRatePerChannelKey);
 
151
                        }                       
 
152
                }                       
 
153
 
 
154
                public int? EncoderBitDepthHint {
 
155
                        set {
 
156
                                if (value < 8 || value > 32)
 
157
                                        throw new ArgumentOutOfRangeException ("value is required to be between 8 and 32");
 
158
 
 
159
                                SetNumberValue (AVAudioSettings.AVEncoderBitDepthHintKey, value);
 
160
                        }
 
161
                        get {
 
162
                                return GetInt32Value (AVAudioSettings.AVEncoderBitDepthHintKey);
 
163
                        }                       
 
164
                }
 
165
 
 
166
                public AudioChannelLayout ChannelLayout {
 
167
                        set {
 
168
                                SetNativeValue (AVAudioSettings.AVChannelLayoutKey, value == null ? null : value.AsData ());
 
169
                        }
 
170
                }
 
171
 
 
172
#endif
 
173
        }
 
174
}
 
175