Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

6. Pd for iOS > Improving the User Interface - Pg. 104

Improving the User Interface While the current version is already enough to illustrate the way libpd handles the communication between Pd and our app, it is not yet terribly useful. After all, the pitch values go by so fast that is hard to read them, and even if we could follow the output, we would still need to know the meaning of MIDI note values by heart in order to make sense of them. For a more intuitive display, we create a custom view class, PitchView , that shows an analog representation of pitch values (see the code examples below). (In order to create the new class, open a context menu for the GuitarTuner group, select "New File... Objective-C Class" and choose UIView as the superclass.) The new view shows a neigh- borhood of the target pitch, with the target pitch marked by a green line down the center. If the measured pitch is within a few semitones of the target pitch, a blue line will indicate its current value. If it is outside the displayed range, the view will display a red bar on the left or on the right. Defining an analog display. @interface PitchView : UIView { } @property(nonatomic) float centerPitch; @property(nonatomic) float currentPitch; @end