KNGuide_Voice
INFO
This English reference is based on Directions SDK 1.12.8-hotfix02. For the latest version, see the Korean reference.
Provides voice guidance.
Example code — KNGuide_Voice
class KNGuide_VoiceConstructor
Example code — Initialization
// <init>
KNGuide_Voice(voiceCode: KNVoiceCode, voiceDist: KNVoiceDist, guideObj: Any?, data: List<ByteArray>)Properties
| Name | Description | Type |
|---|---|---|
duration | Voice length (unit: seconds) | var duration: Int |
voiceCode | Voice code | var voiceCode: KNVoiceCode |
voiceDist | Guidance reference distance code | var voiceDist: KNVoiceDist |
guideObj | Guidance object Exists when voiceCode is KNVoiceCode_Turn or KNVoiceCode_Safety. Otherwise, the value null is returned.KNVoiceCode_Turn: KNDirectionKNVoiceCode_Safety: KNSafetyKNVoiceCode_CheckingRouteChange, KNVoiceCode_RouteChanged, KNVoiceCode_RouteUnchanged, KNVoiceCode_OutOfRoute: NSString[Route request reason] • Route deviation: DEVIATION • User reroute: USER • Re-search due to GPS Error: GPS_ERROR • Add Waypoint: WAYPOINT_ADD • Delete Waypoint: WAYPOINT_DEL | val guideObj: Any? |
data | List of guidance voice data | var data: List<ByteArray> |
Methods
setVolume
Sets the voice volume.
fun setVolume( volume: Float ): UnitParameters
| Name | Description |
|---|---|
volume | Voice volume (range: 0f–1f) |
setUsage
Sets the usage of audio attributes when playing voice guidance. Android AudioAttributes Uses constants defined in the class. The default is AudioAttributes.USAGE_MEDIA.
Example code — ABI filter
// Example
setUsage(AudioAttributes.USAGE_MEDIA)fun setUsage( usage: Int )Parameters
| Name | Description |
|---|---|
usage | Audio usage |
getUsage
Gets the currently set Audio usage. The return value is a constant defined in the Android AudioAttributes class (e.g. AudioAttributes.USAGE_MEDIA) and is provided as an integer value.
Example code — getUsage
fun setUsage(usage: Int) {
kn_usage = usage
}
fun getUsage() = kn_usagesetContentType
Sets the audio content type when playing voice guidance. Uses the constants defined in the Android AudioAttributes class; the default value is AudioAttributes.CONTENT_TYPE_MUSIC.
fun setContentType( contentType: Int )Parameters
| Name | Description |
|---|---|
contentType | Audio content type |
getContentType
Gets the currently set Audio content type. The return value is a constant defined in the Android AudioAttributes class (e.g. AudioAttributes.CONTENT_TYPE_MUSIC) and is provided as an integer value.
Example code — getContentType
fun setContentType(contentType: Int) {
kn_contentType = contentType
}
fun getContentType() = kn_contentType