HumanVoiceContext

Objective-C


@interface HumanVoiceContext : NSObject

Swift

class HumanVoiceContext : NSObject

This class handles the sound.

  • Check if the online human voices content is preloaded. @details If the content is not cached locally a call to preloadContentWithCompletionHandler must be performed.

    Declaration

    Objective-C

    - (BOOL)isContentPreloaded;

    Swift

    func isContentPreloaded() -> Bool
  • Preload the online human voices content.

    Declaration

    Objective-C

    - (void)preloadContentWithCompletionHandler:(nonnull void (^)(BOOL))handler;

    Swift

    func preloadContent() async -> Bool
  • Returns the local human voices list.

    Declaration

    Objective-C

    - (nonnull NSArray<ContentStoreObject *> *)getLocalList;

    Swift

    func getLocalList() -> [ContentStoreObject]
  • Asynchronously returns the online human voices list.

    Declaration

    Objective-C

    - (void)getOnlineListWithCompletionHandler:
        (nonnull void (^)(NSArray<ContentStoreObject *> *_Nonnull))handler;

    Swift

    func onlineList() async -> [ContentStoreObject]
  • Start a download request for the given human voice identifier.

    Declaration

    Objective-C

    - (void)downloadVoiceWithIdentifier:(NSInteger)identifier
                   allowCellularNetwork:(BOOL)allow
                      completionHandler:(nonnull void (^)(BOOL))handler;

    Swift

    func downloadVoice(withIdentifier identifier: Int, allowCellularNetwork allow: Bool) async -> Bool

    Parameters

    identifier

    The voice identifier.

    allow

    The flag whether to allow charged networks.

    handler

    The block to execute asynchronously with the result.

  • Returns the human voice country image flag.

    Declaration

    Objective-C

    - (nullable UIImage *)getCountryFlagWithIsoCode:(nonnull NSString *)code
                                               size:(CGSize)size;

    Swift

    func getCountryFlag(withIsoCode code: String, size: CGSize) -> UIImage?

    Parameters

    code

    The country code.

    size

    The image size in pixels.

  • Returns the human voice gender.

    Declaration

    Objective-C

    - (HumanVoiceGender)getHumanVoiceGenderWithContentStoreObject:
        (nonnull ContentStoreObject *)object;

    Swift

    func getHumanVoiceGender(with object: ContentStoreObject) -> HumanVoiceGender

    Parameters

    object

    The content store item.

  • Returns the human voice country name.

    Declaration

    Objective-C

    - (nonnull NSString *)getCountryName:(nonnull NSString *)code;

    Swift

    func getCountryName(_ code: String) -> String

    Parameters

    code

    The country code.

  • Returns the human voice native language.

    Declaration

    Objective-C

    - (nonnull NSString *)getNativeLanguage:(nonnull ContentStoreObject *)object;

    Swift

    func getNativeLanguage(_ object: ContentStoreObject) -> String

    Parameters

    object

    The content store item.

  • Returns the human voice gender image.

    Declaration

    Objective-C

    - (nullable UIImage *)getGenderImage:(HumanVoiceGender)gender size:(CGSize)size;

    Swift

    func getGenderImage(_ gender: HumanVoiceGender, size: CGSize) -> UIImage?

    Parameters

    gender

    The human voice gender.

    size

    The image size in pixels.