AnaR
06/27/2018, 7:53 PMAnaR
06/27/2018, 8:29 PMsvyatoslav.scherbina
06/28/2018, 9:39 AMvar cfurl = CFBridgingRetain(url) as CFURLRef
This should work. Maybe your url
is null
?svyatoslav.scherbina
06/28/2018, 9:44 AMvar id:Int = 0
val status = AudioServicesCreateSystemSoundID(url, cValuesOf(id))
This wouldn’t work as expected, because you pass the value of id
variable instead of the pointer. So this call wouldn’t update your variable.
To get the id from AudioServicesCreateSystemSoundID
, you can use something like
val id = memScoped {
val idVar = alloc<SystemSoundIDVar>()
AudioServicesCreateSystemSoundID(cfurl, idVar.ptr)
idVar.value
}