tailieunhanh - extremetech Hacking BlackBerry phần 9

Các từ khóa mở rộng là cơ sở để thừa kế trong Java. Vì vậy, về cơ bản với các dòng đầu tiên này, bạn đang nói, "Tôi tuyên bố một HelloBlackBerry lớp mới, và tôi muốn nó kế thừa tất cả những hành vi được tìm thấy trong UIApplication | 214 Part II Advanced BlackBerry Hacks public void run Play a B note private Menuitem CItem new MenuItem C 2 0 public void run Play a C note private Menuitem Dbitem new MenuItem Db 2 0 public void run Play a Db note private Menuitem Ditem new Menuitem D 2 0 public void run Play a D note private Menuitem Ebitem new Menuitem Eb 2 0 public void run Play an Eb note private Menuitem Eitem new Menuitem E 2 0 public void run Play an E note private Menuitem FItem new Menuitem F 2 0 public void run Play an F note private Menuitem Gbitem new Menuitem Gb 2 0 public void run Chapter 13 A Toy Piano in the Palm of Your Hand 215 Play a Gb note private Menuitem GItem new MenuItem G 2 0 public void run Play a G note private Menuitem Abitem new MenuItem Ab 2 0 public void run Play an Ab note You ll note that in the run code for each menu handler I have not yet added the actual code to play the corresponding note. For that you need to define a tune structure for each note as well as call the function to play the note. Playing Notes Using In order to have your PianoBerry menu items actually play their corresponding note you need to call the BlackBerry function . takes two parameters one that represents the tune to be played and another that represents the percent volume you want to play the tune at. The tune parameter is actually an array of integer pairs that use the following format frequency duration . Each pair thus plays a note of a given frequency for the length of time you specify. In this pair of integers the frequency is expressed in MHz while the duration is expressed as milliseconds. Although the tune parameter is an array and can contain an actual sequence of notes to be played for the purposes of PianoBerry you are interested in playing only a single note at a time. So what you need to do is to figure out the frequency value for each of the 12 notes in your scale and then create pairs of integers that .

TỪ KHÓA LIÊN QUAN
crossorigin="anonymous">
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.