2011-03-11 4 views
5

iOS 시스템 사운드를 가리키는 상수 목록을 어디서 찾을 수 있는지 알고 계십니까? AudioServicesCreateSystemSoundID 메소드에 해당 사운드를 제공 할 수있게 해주시겠습니까?iPhone - 시스템 사운드 코드

답변

1

AudioServices.h에서이다 :이 도움이

//================================================================================================== 
#pragma mark AudioServices Constants 

/*! 
    @enum   AudioServices constants 
    @abstract  Constants for use with System Sound portion of the AudioServices APIs. 
    @constant  kSystemSoundID_UserPreferredAlert 
         Use this constant with the play sound APIs to 
         playback the alert sound selected by the User in System Preferences. 
    @constant  kSystemSoundID_Vibrate 
         Use this constant with the play sound APIs to vibrate the device 
         - iPhone only 
          - on a device with no vibration capability (like iPod Touch) this will 
          do nothing 
    @constant  kSystemSoundID_FlashScreen 
         Use this constant with the play sound APIs to flash the screen 
         - Desktop systems only 
*/ 
enum 
{ 
#if TARGET_OS_IPHONE 
    kSystemSoundID_Vibrate    = 0x00000FFF 
#else 
    kSystemSoundID_UserPreferredAlert = 0x00001000, 
    kSystemSoundID_FlashScreen   = 0x00000FFE, 
     // this has been renamed to be consistent 
    kUserPreferredAlert  = kSystemSoundID_UserPreferredAlert 
#endif   
}; 

희망.

+0

감사합니다.하지만 웹에 표시된 예에서 찾을 수있는 모든 이름은 다음과 같습니다 (https://developer.apple.com/library/ios/#samplecode/SysSound/Listings/Classes_SysSoundViewController_m.html). # // apple_ref/doc/uid/DTS40008018-Classes_SysSoundViewController_m-DontLinkElementID_6 – Oliver

+0

당신이 말하는 이름은 무엇입니까? – Viraj

+0

"TAP"in -> NSURL * tapSound = [[NSBundle mainBundle] URLForResource : @ "tap" withExtension : @ "aif"]; // CFURLRef 인스턴스와 URL을 저장 self.soundFileURLRef = (CFURLRef) tapSound가 유지]; // 사운드 파일을 나타내는 시스템 사운드 객체를 만듭니다. AudioServicesCreateSystemSoundID ( soundFileURLRef, 및 soundFileObject ); 나는 웹 예제에서 다른 많은 것들을 발견했다. – Oliver

0

제가 알고있는 유일한 사람은 AudioToolbox/AudioServices.h에있는 kSystemSoundID_Vibrate입니다.

관련 문제