-
Notifications
You must be signed in to change notification settings - Fork 517
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[AVFoundation] Add missing APIs up to Xcode 16.2.
- Loading branch information
1 parent
570dd82
commit 1cc1ec4
Showing
36 changed files
with
4,373 additions
and
4,235 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
src/AVFoundation/AVAudioVoiceProcessingOtherAudioDuckingConfiguration.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
using System; | ||
using System.Runtime.InteropServices; | ||
using ObjCRuntime; | ||
|
||
#if !TVOS | ||
|
||
namespace AVFoundation { | ||
[SupportedOSPlatform ("ios17.0")] | ||
[SupportedOSPlatform ("macos14.0")] | ||
[UnsupportedOSPlatform ("tvos")] | ||
[SupportedOSPlatform ("maccatalyst17.0")] | ||
public struct AVAudioVoiceProcessingOtherAudioDuckingConfiguration { | ||
byte enableAdvancedDucking; | ||
#pragma warning disable CS0169 // The field 'AVAudioVoiceProcessingOtherAudioDuckingConfiguration.duckingLevel' is never used | ||
nint duckingLevel; | ||
#pragma warning restore CS0169 | ||
|
||
public bool EnableAdvancedDucking { | ||
get => enableAdvancedDucking != 0; | ||
set => enableAdvancedDucking = value.AsByte (); | ||
} | ||
|
||
#if !COREBUILD | ||
public AVAudioVoiceProcessingOtherAudioDuckingLevel DuckingLevel { | ||
get => (AVAudioVoiceProcessingOtherAudioDuckingLevel) (long) duckingLevel; | ||
set => duckingLevel = (nint) (long) value; | ||
} | ||
#endif | ||
} | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
using System; | ||
using System.ComponentModel; | ||
using System.Diagnostics.CodeAnalysis; | ||
using System.Runtime.Versioning; | ||
using System.Threading.Tasks; | ||
|
||
using Foundation; | ||
using ObjCRuntime; | ||
|
||
#nullable enable | ||
|
||
namespace AVFoundation { | ||
/// <summary>This enum is used to select how to initialize a new <see cref="AVSpeechSynthesisMarker" /> instance.</summary> | ||
[SupportedOSPlatform ("ios17.0")] | ||
[SupportedOSPlatform ("maccatalyst17.0")] | ||
[SupportedOSPlatform ("macos14.0")] | ||
[SupportedOSPlatform ("tvos17.0")] | ||
public enum AVSpeechSynthesisMarkerRangeOption { | ||
/// <summary>The <c>range</c> parameter passed to the constructor is a word range.</summary> | ||
Word, | ||
/// <summary>The <c>range</c> parameter passed to the constructor is a sentence range.</summary> | ||
Sentence, | ||
/// <summary>The <c>range</c> parameter passed to the constructor is a paragraph range.</summary> | ||
Paragraph, | ||
} | ||
|
||
/// <summary>This enum is used to select how to initialize a new <see cref="AVSpeechSynthesisMarker" /> instance.</summary> | ||
[SupportedOSPlatform ("ios17.0")] | ||
[SupportedOSPlatform ("maccatalyst17.0")] | ||
[SupportedOSPlatform ("macos14.0")] | ||
[SupportedOSPlatform ("tvos17.0")] | ||
public enum AVSpeechSynthesisMarkerStringOption { | ||
/// <summary>The <c>value</c> parameter passed to the constructor is a phoneme.</summary> | ||
Phoneme, | ||
/// <summary>The <c>value</c> parameter passed to the constructor is a bookmark name.</summary> | ||
Bookmark, | ||
} | ||
|
||
public partial class AVSpeechSynthesisMarker { | ||
/// <summary>Create a new <see cref="AVSpeechSynthesisMarker" /> instance for the specified range and byte offset.</summary> | ||
/// <param name="range">The range of the marker.</param> | ||
/// <param name="byteSampleOffset">The byte offset into the audio buffer.</param> | ||
/// <param name="option">Use this option to specify how to interpret the <paramref name="range" /> parameter.</param> | ||
public AVSpeechSynthesisMarker (NSRange range, nint byteSampleOffset, AVSpeechSynthesisMarkerRangeOption option) | ||
: base (NSObjectFlag.Empty) | ||
{ | ||
switch (option) { | ||
case AVSpeechSynthesisMarkerRangeOption.Word: | ||
InitializeHandle (_InitWithWordRange (range, byteSampleOffset)); | ||
break; | ||
case AVSpeechSynthesisMarkerRangeOption.Sentence: | ||
InitializeHandle (_InitWithSentenceRange (range, byteSampleOffset)); | ||
break; | ||
case AVSpeechSynthesisMarkerRangeOption.Paragraph: | ||
InitializeHandle (_InitWithParagraphRange (range, byteSampleOffset)); | ||
break; | ||
default: | ||
throw new ArgumentOutOfRangeException (nameof (option), option, "Invalid enum value."); | ||
} | ||
} | ||
|
||
/// <summary>Create a new <see cref="AVSpeechSynthesisMarker" /> instance for the specified string value.</summary> | ||
/// <param name="value">The phoneme or bookmark name of the marker.</param> | ||
/// <param name="byteSampleOffset">The byte offset into the audio buffer.</param> | ||
/// <param name="option">Use this option to specify how to interpret the <paramref name="value" /> parameter.</param> | ||
public AVSpeechSynthesisMarker (string value, nint byteSampleOffset, AVSpeechSynthesisMarkerStringOption option) | ||
: base (NSObjectFlag.Empty) | ||
{ | ||
switch (option) { | ||
case AVSpeechSynthesisMarkerStringOption.Phoneme: | ||
InitializeHandle (_InitWithPhonemeString (value, byteSampleOffset)); | ||
break; | ||
case AVSpeechSynthesisMarkerStringOption.Bookmark: | ||
InitializeHandle (_InitWithBookmarkName (value, byteSampleOffset)); | ||
break; | ||
default: | ||
throw new ArgumentOutOfRangeException (nameof (option), option, "Invalid enum value."); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
using System; | ||
using System.ComponentModel; | ||
using System.Diagnostics.CodeAnalysis; | ||
using System.Runtime.Versioning; | ||
using System.Threading.Tasks; | ||
|
||
using AudioUnit; | ||
using Foundation; | ||
using ObjCRuntime; | ||
|
||
#nullable enable | ||
|
||
namespace AVFoundation { | ||
public partial class AVSpeechSynthesisProviderAudioUnit { | ||
/// <summary>Create a new <see cref="AVSpeechSynthesisProviderAudioUnit" /> instance.</summary> | ||
/// <param name="componentDescription">A description of the component to create.</param> | ||
/// <param name="options">Any options for the returned audio unit.</param> | ||
/// <param name="error">The error if an error occurred, null otherwise.</param> | ||
/// <returns>A new <see cref="AVSpeechSynthesisProviderAudioUnit" /> instance if successful, null otherwise.</returns> | ||
public static AVSpeechSynthesisProviderAudioUnit? Create (AudioComponentDescription componentDescription, AudioComponentInstantiationOptions options, out NSError? error) | ||
{ | ||
var rv = new AVSpeechSynthesisProviderAudioUnit (NSObjectFlag.Empty); | ||
rv.InitializeHandle (rv._InitWithComponentDescription (componentDescription, options, out error), string.Empty, false); | ||
if (rv.Handle == IntPtr.Zero) { | ||
rv.Dispose (); | ||
return null; | ||
} | ||
return rv; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
using System; | ||
using System.ComponentModel; | ||
using System.Diagnostics.CodeAnalysis; | ||
using System.Runtime.Versioning; | ||
using System.Threading.Tasks; | ||
|
||
using Foundation; | ||
using ObjCRuntime; | ||
|
||
#nullable enable | ||
|
||
namespace AVFoundation { | ||
/// <summary>This enum is used to select how to initialize a new <see cref="AVSpeechUtterance" /> instance.</summary> | ||
public enum AVSpeechUtteranceInitializationOption { | ||
/// <summary>The <c>string</c> parameter passed to the constructor is a plain text string.</summary> | ||
PlainText, | ||
/// <summary>The <c>string</c> parameter passed to the constructor is an SSML (Speech Synthesis Markup Language) string.</summary> | ||
[SupportedOSPlatform ("ios16.0")] | ||
[SupportedOSPlatform ("maccatalyst16.0")] | ||
[SupportedOSPlatform ("macos13.0")] | ||
[SupportedOSPlatform ("tvos16.0")] | ||
SsmlRepresentation, | ||
} | ||
|
||
public partial class AVSpeechUtterance { | ||
/// <summary>Create a new <see cref="AVSpeechUtterance" /> instance for the specified string.</summary> | ||
/// <param name="string">The text to speak.</param> | ||
public AVSpeechUtterance (string @string) | ||
: this (@string, AVSpeechUtteranceInitializationOption.PlainText) | ||
{ | ||
} | ||
|
||
/// <summary>Create a new <see cref="AVSpeechUtterance" /> instance for the specified string.</summary> | ||
/// <param name="string">The text to speak.</param> | ||
/// <param name="option">Use this option to specify how to interpret the <paramref name="string" /> parameter.</param> | ||
public AVSpeechUtterance (string @string, AVSpeechUtteranceInitializationOption option) | ||
: base (NSObjectFlag.Empty) | ||
{ | ||
switch (option) { | ||
case AVSpeechUtteranceInitializationOption.PlainText: | ||
InitializeHandle (_InitWithString (@string)); | ||
break; | ||
case AVSpeechUtteranceInitializationOption.SsmlRepresentation: | ||
InitializeHandle (_InitWithSsmlRepresentation (@string)); | ||
break; | ||
default: | ||
throw new ArgumentOutOfRangeException (nameof (option), option, "Invalid enum value."); | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.