Skip to content

[Speech] Implement Xcode 16.0 beta 1-6 changes. #21077

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 28 additions & 19 deletions src/speech.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ namespace Speech {

/// <summary>Enumerates the states of a <see cref="T:Speech.SFSpeechRecognitionTask" />.</summary>
[Native]
[MacCatalyst (13, 1)]
[MacCatalyst (13, 1), TV (18, 0)]
public enum SFSpeechRecognitionTaskState : long {
Starting = 0,
Running = 1,
Expand All @@ -35,7 +35,7 @@ public enum SFSpeechRecognitionTaskState : long {
}

[Native]
[MacCatalyst (13, 1)]
[MacCatalyst (13, 1), TV (18, 0)]
public enum SFSpeechRecognitionTaskHint : long {
Unspecified = 0,
Dictation = 1,
Expand All @@ -45,27 +45,28 @@ public enum SFSpeechRecognitionTaskHint : long {

/// <include file="../docs/api/Speech/SFSpeechRecognizerAuthorizationStatus.xml" path="/Documentation/Docs[@DocId='T:Speech.SFSpeechRecognizerAuthorizationStatus']/*" />
[Native]
[MacCatalyst (13, 1)]
[MacCatalyst (13, 1), TV (18, 0)]
public enum SFSpeechRecognizerAuthorizationStatus : long {
NotDetermined,
Denied,
Restricted,
Authorized,
}

[Mac (14, 0), iOS (17, 0), MacCatalyst (17, 0)]
[Mac (14, 0), iOS (17, 0), MacCatalyst (17, 0), TV (18, 0)]
[Native]
[ErrorDomain ("SFSpeechErrorDomain")]
public enum SFSpeechErrorCode : long {
InternalServiceError = 1,
AudioReadFailed = 2,
UndefinedTemplateClassName = 7,
MalformedSupplementalModel = 8,
}

/// <summary>Abstract base class for speech recognition requests (see <see cref="T:Speech.SFSpeechAudioBufferRecognitionRequest" /> and <see cref="T:Speech.SFSpeechUrlRecognitionRequest" />).</summary>
///
/// <related type="externalDocumentation" href="https://developer.apple.com/reference/Speech/SFSpeechRecognitionRequest">Apple documentation for <c>SFSpeechRecognitionRequest</c></related>
[MacCatalyst (13, 1)]
[MacCatalyst (13, 1), TV (18, 0)]
[DisableDefaultCtor]
[Abstract] // no docs (yet) but it has no means (init*) to create it, unlike its subclasses
[BaseType (typeof (NSObject))]
Expand All @@ -82,6 +83,7 @@ interface SFSpeechRecognitionRequest {

[Deprecated (PlatformName.iOS, 15, 0)]
[Deprecated (PlatformName.MacCatalyst, 15, 0)]
[Deprecated (PlatformName.MacOSX, 12, 0)]
[NullAllowed, Export ("interactionIdentifier")]
string InteractionIdentifier { get; set; }

Expand All @@ -102,7 +104,7 @@ interface SFSpeechRecognitionRequest {
/// <summary>A <see cref="T:Speech.SFSpeechRecognitionRequest" /> whose audio source is specified in a URL</summary>
///
/// <related type="externalDocumentation" href="https://developer.apple.com/reference/Speech/SFSpeechURLRecognitionRequest">Apple documentation for <c>SFSpeechURLRecognitionRequest</c></related>
[MacCatalyst (13, 1)]
[MacCatalyst (13, 1), TV (18, 0)]
[BaseType (typeof (SFSpeechRecognitionRequest), Name = "SFSpeechURLRecognitionRequest")]
[DisableDefaultCtor]
interface SFSpeechUrlRecognitionRequest {
Expand All @@ -118,7 +120,7 @@ interface SFSpeechUrlRecognitionRequest {
/// <summary>An <see cref="T:Speech.SFSpeechRecognitionRequest" /> that takes its input from an audio buffer.</summary>
///
/// <related type="externalDocumentation" href="https://developer.apple.com/reference/Speech/SFSpeechAudioBufferRecognitionRequest">Apple documentation for <c>SFSpeechAudioBufferRecognitionRequest</c></related>
[MacCatalyst (13, 1)]
[MacCatalyst (13, 1), TV (18, 0)]
[BaseType (typeof (SFSpeechRecognitionRequest))]
interface SFSpeechAudioBufferRecognitionRequest {

Expand All @@ -141,7 +143,7 @@ interface SFSpeechAudioBufferRecognitionRequest {
/// <see cref="T:Speech.SFSpeechRecognitionResult" />contain a <see cref="T:Speech.SFTranscription" /> in<see cref="P:Speech.SFSpeechRecognitionResult.BestTranscription" /> that is the highest-confidence transcription. Additionally, the <see cref="P:Speech.SFSpeechRecognitionResult.Transcriptions" /> may contain additional <see cref="T:Speech.SFTranscription" /> objects that the developer may search for more domain-appropriate results.</para>
/// </remarks>
/// <related type="externalDocumentation" href="https://developer.apple.com/reference/Speech/SFSpeechRecognitionResult">Apple documentation for <c>SFSpeechRecognitionResult</c></related>
[MacCatalyst (13, 1)]
[MacCatalyst (13, 1), TV (18, 0)]
[BaseType (typeof (NSObject))]
interface SFSpeechRecognitionResult : NSCopying, NSSecureCoding {

Expand All @@ -163,7 +165,7 @@ interface SFSpeechRecognitionResult : NSCopying, NSSecureCoding {
/// <summary>Object that holds state and provides control of an asynchronous speech recognition task.</summary>
///
/// <related type="externalDocumentation" href="https://developer.apple.com/reference/Speech/SFSpeechRecognitionTask">Apple documentation for <c>SFSpeechRecognitionTask</c></related>
[MacCatalyst (13, 1)]
[MacCatalyst (13, 1), TV (18, 0)]
[BaseType (typeof (NSObject))]
interface SFSpeechRecognitionTask {

Expand Down Expand Up @@ -197,7 +199,7 @@ interface ISFSpeechRecognitionTaskDelegate { }
/// <summary>Delegate object whose members are called in reaction to speech-recognition events.</summary>
///
/// <related type="externalDocumentation" href="https://developer.apple.com/reference/Speech/SFSpeechRecognitionTaskDelegate">Apple documentation for <c>SFSpeechRecognitionTaskDelegate</c></related>
[MacCatalyst (13, 1)]
[MacCatalyst (13, 1), TV (18, 0)]
[Protocol, Model]
[BaseType (typeof (NSObject))]
interface SFSpeechRecognitionTaskDelegate {
Expand All @@ -219,6 +221,10 @@ interface SFSpeechRecognitionTaskDelegate {

[Export ("speechRecognitionTask:didFinishSuccessfully:")]
void DidFinishSuccessfully (SFSpeechRecognitionTask task, bool successfully);

[iOS (18, 0), Mac (10, 15), TV (18, 0)]
[Export ("speechRecognitionTask:didProcessAudioDuration:")]
void DidProcessAudioDuration (SFSpeechRecognitionTask task, double duration);
}

/// <summary>Interface representing the required methods (if any) of the protocol <see cref="T:Speech.SFSpeechRecognizerDelegate" />.</summary>
Expand All @@ -232,7 +238,7 @@ interface ISFSpeechRecognizerDelegate { }
/// <summary>Delegate object for <see cref="T:Speech.SFSpeechRecognizer" />.</summary>
///
/// <related type="externalDocumentation" href="https://developer.apple.com/reference/Speech/SFSpeechRecognizerDelegate">Apple documentation for <c>SFSpeechRecognizerDelegate</c></related>
[MacCatalyst (13, 1)]
[MacCatalyst (13, 1), TV (18, 0)]
[Protocol, Model]
[BaseType (typeof (NSObject))]
interface SFSpeechRecognizerDelegate {
Expand All @@ -242,7 +248,7 @@ interface SFSpeechRecognizerDelegate {
}

/// <include file="../docs/api/Speech/SFSpeechRecognizer.xml" path="/Documentation/Docs[@DocId='T:Speech.SFSpeechRecognizer']/*" />
[MacCatalyst (13, 1)]
[MacCatalyst (13, 1), TV (18, 0)]
[BaseType (typeof (NSObject))]
interface SFSpeechRecognizer {

Expand Down Expand Up @@ -290,7 +296,7 @@ interface SFSpeechRecognizer {
NSOperationQueue Queue { get; set; }
}

[iOS (14, 5), Mac (11, 3)]
[iOS (14, 5), Mac (11, 3), TV (18, 0)]
[MacCatalyst (14, 5)]
[BaseType (typeof (NSObject))]
[DisableDefaultCtor]
Expand All @@ -315,7 +321,7 @@ interface SFSpeechRecognitionMetadata : NSCopying, NSSecureCoding {
/// <summary>A conversion of speech into text.</summary>
///
/// <related type="externalDocumentation" href="https://developer.apple.com/reference/Speech/SFTranscription">Apple documentation for <c>SFTranscription</c></related>
[MacCatalyst (13, 1)]
[MacCatalyst (13, 1), TV (18, 0)]
[BaseType (typeof (NSObject))]
interface SFTranscription : NSCopying, NSSecureCoding {

Expand All @@ -330,6 +336,7 @@ interface SFTranscription : NSCopying, NSSecureCoding {
[Deprecated (PlatformName.iOS, 14, 5)]
[MacCatalyst (13, 1)]
[Deprecated (PlatformName.MacCatalyst, 14, 5)]
[Deprecated (PlatformName.TvOS, 14, 5)]
[Advice ("Use 'SpeakingRate' from 'SFSpeechRecognitionMetadata' instead.")]
double SpeakingRate { get; }

Expand All @@ -338,12 +345,13 @@ interface SFTranscription : NSCopying, NSSecureCoding {
[Deprecated (PlatformName.iOS, 14, 5)]
[MacCatalyst (13, 1)]
[Deprecated (PlatformName.MacCatalyst, 14, 5)]
[Deprecated (PlatformName.TvOS, 14, 5)]
[Advice ("Use 'AveragePauseDuration' from 'SFSpeechRecognitionMetadata' instead.")]
double AveragePauseDuration { get; }
}

/// <related type="externalDocumentation" href="https://developer.apple.com/reference/Speech/SFTranscriptionSegment">Apple documentation for <c>SFTranscriptionSegment</c></related>
[MacCatalyst (13, 1)]
[MacCatalyst (13, 1), TV (18, 0)]
[BaseType (typeof (NSObject))]
interface SFTranscriptionSegment : NSCopying, NSSecureCoding {

Expand All @@ -370,12 +378,13 @@ interface SFTranscriptionSegment : NSCopying, NSSecureCoding {
[Deprecated (PlatformName.iOS, 14, 5)]
[MacCatalyst (13, 1)]
[Deprecated (PlatformName.MacCatalyst, 14, 5)]
[Deprecated (PlatformName.TvOS, 14, 5)]
[Advice ("Use 'VoiceAnalytics' from 'SFSpeechRecognitionMetadata' instead.")]
SFVoiceAnalytics VoiceAnalytics { get; }
}

[iOS (13, 0)]
[MacCatalyst (13, 1)]
[MacCatalyst (13, 1), TV (18, 0)]
[BaseType (typeof (NSObject))]
[DisableDefaultCtor]
interface SFAcousticFeature : NSCopying, NSSecureCoding {
Expand All @@ -388,7 +397,7 @@ interface SFAcousticFeature : NSCopying, NSSecureCoding {
}

[iOS (13, 0)]
[MacCatalyst (13, 1)]
[MacCatalyst (13, 1), TV (18, 0)]
[BaseType (typeof (NSObject))]
[DisableDefaultCtor]
interface SFVoiceAnalytics : NSCopying, NSSecureCoding {
Expand All @@ -406,7 +415,7 @@ interface SFVoiceAnalytics : NSCopying, NSSecureCoding {
SFAcousticFeature Voicing { get; }
}

[Mac (14, 0), iOS (17, 0), MacCatalyst (17, 0)]
[Mac (14, 0), iOS (17, 0), MacCatalyst (17, 0), TV (18, 0)]
[BaseType (typeof (NSObject))]
interface SFSpeechLanguageModelConfiguration : NSCopying {
[Export ("initWithLanguageModel:")]
Expand All @@ -422,7 +431,7 @@ interface SFSpeechLanguageModelConfiguration : NSCopying {
NSUrl Vocabulary { get; }
}

[Mac (14, 0), iOS (17, 0), MacCatalyst (17, 0)]
[Mac (14, 0), iOS (17, 0), MacCatalyst (17, 0), TV (18, 0)]
[BaseType (typeof (NSObject))]
[DisableDefaultCtor]
interface SFSpeechLanguageModel {
Expand Down
1 change: 0 additions & 1 deletion tests/cecil-tests/ApiAvailabilityTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,6 @@ public void FindMissingObsoleteAttributes ()
"System.String PassKit.PKShareablePassMetadata::LocalizedDescription()",
"System.String PassKit.PKShareablePassMetadata::OwnerDisplayName()",
"System.String PassKit.PKShareablePassMetadata::TemplateIdentifier()",
"System.String Speech.SFSpeechRecognitionRequest::InteractionIdentifier()",
"System.String StoreKit.SKProduct::ContentVersion()",
"System.String UserNotifications.UNMutableNotificationContent::SummaryArgument()",
"System.String UserNotifications.UNNotificationContent::SummaryArgument()",
Expand Down
4 changes: 4 additions & 0 deletions tests/cecil-tests/Documentation.KnownFailures.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18077,6 +18077,7 @@ F:SoundAnalysis.SNErrorCode.OperationFailed
F:SoundAnalysis.SNErrorCode.UnknownError
F:SoundAnalysis.SNTimeDurationConstraintType.Enumerated
F:SoundAnalysis.SNTimeDurationConstraintType.Range
F:Speech.SFSpeechErrorCode.AudioReadFailed
F:Speech.SFSpeechErrorCode.InternalServiceError
F:Speech.SFSpeechErrorCode.MalformedSupplementalModel
F:Speech.SFSpeechErrorCode.UndefinedTemplateClassName
Expand Down Expand Up @@ -46010,6 +46011,7 @@ M:Speech.ISFSpeechRecognitionTaskDelegate.DidDetectSpeech(Speech.SFSpeechRecogni
M:Speech.ISFSpeechRecognitionTaskDelegate.DidFinishRecognition(Speech.SFSpeechRecognitionTask,Speech.SFSpeechRecognitionResult)
M:Speech.ISFSpeechRecognitionTaskDelegate.DidFinishSuccessfully(Speech.SFSpeechRecognitionTask,System.Boolean)
M:Speech.ISFSpeechRecognitionTaskDelegate.DidHypothesizeTranscription(Speech.SFSpeechRecognitionTask,Speech.SFTranscription)
M:Speech.ISFSpeechRecognitionTaskDelegate.DidProcessAudioDuration(Speech.SFSpeechRecognitionTask,System.Double)
M:Speech.ISFSpeechRecognitionTaskDelegate.FinishedReadingAudio(Speech.SFSpeechRecognitionTask)
M:Speech.ISFSpeechRecognitionTaskDelegate.WasCancelled(Speech.SFSpeechRecognitionTask)
M:Speech.ISFSpeechRecognizerDelegate.AvailabilityDidChange(Speech.SFSpeechRecognizer,System.Boolean)
Expand All @@ -46027,12 +46029,14 @@ M:Speech.SFSpeechRecognitionTaskDelegate_Extensions.DidDetectSpeech(Speech.ISFSp
M:Speech.SFSpeechRecognitionTaskDelegate_Extensions.DidFinishRecognition(Speech.ISFSpeechRecognitionTaskDelegate,Speech.SFSpeechRecognitionTask,Speech.SFSpeechRecognitionResult)
M:Speech.SFSpeechRecognitionTaskDelegate_Extensions.DidFinishSuccessfully(Speech.ISFSpeechRecognitionTaskDelegate,Speech.SFSpeechRecognitionTask,System.Boolean)
M:Speech.SFSpeechRecognitionTaskDelegate_Extensions.DidHypothesizeTranscription(Speech.ISFSpeechRecognitionTaskDelegate,Speech.SFSpeechRecognitionTask,Speech.SFTranscription)
M:Speech.SFSpeechRecognitionTaskDelegate_Extensions.DidProcessAudioDuration(Speech.ISFSpeechRecognitionTaskDelegate,Speech.SFSpeechRecognitionTask,System.Double)
M:Speech.SFSpeechRecognitionTaskDelegate_Extensions.FinishedReadingAudio(Speech.ISFSpeechRecognitionTaskDelegate,Speech.SFSpeechRecognitionTask)
M:Speech.SFSpeechRecognitionTaskDelegate_Extensions.WasCancelled(Speech.ISFSpeechRecognitionTaskDelegate,Speech.SFSpeechRecognitionTask)
M:Speech.SFSpeechRecognitionTaskDelegate.DidDetectSpeech(Speech.SFSpeechRecognitionTask)
M:Speech.SFSpeechRecognitionTaskDelegate.DidFinishRecognition(Speech.SFSpeechRecognitionTask,Speech.SFSpeechRecognitionResult)
M:Speech.SFSpeechRecognitionTaskDelegate.DidFinishSuccessfully(Speech.SFSpeechRecognitionTask,System.Boolean)
M:Speech.SFSpeechRecognitionTaskDelegate.DidHypothesizeTranscription(Speech.SFSpeechRecognitionTask,Speech.SFTranscription)
M:Speech.SFSpeechRecognitionTaskDelegate.DidProcessAudioDuration(Speech.SFSpeechRecognitionTask,System.Double)
M:Speech.SFSpeechRecognitionTaskDelegate.FinishedReadingAudio(Speech.SFSpeechRecognitionTask)
M:Speech.SFSpeechRecognitionTaskDelegate.WasCancelled(Speech.SFSpeechRecognitionTask)
M:Speech.SFSpeechRecognizer.Dispose(System.Boolean)
Expand Down

This file was deleted.

2 changes: 0 additions & 2 deletions tests/xtro-sharpie/api-annotations-dotnet/iOS-Speech.todo

This file was deleted.

4 changes: 0 additions & 4 deletions tests/xtro-sharpie/api-annotations-dotnet/macOS-Speech.todo

This file was deleted.

2 changes: 0 additions & 2 deletions tests/xtro-sharpie/iOS-Speech.todo

This file was deleted.

4 changes: 0 additions & 4 deletions tests/xtro-sharpie/macOS-Speech.todo

This file was deleted.