views:

134

answers:

1

Sitution: Newbie with interface for a music app. I have 2 large images, one the master 'up' or normal view, the other the complete 'down' view. (Buttons all pressed, lit, etc, LED's on, etc). Might have a couple smaller images as well to copy over.

In Carbon, and old Mac OS, I would load up 2 GWorlds with each image, then use Copybits to copy over whatever subrect for the button was clicked as needed, and blit as appropriate to the window.

While I gather that I could still use this approach in Cocoa, it's deprecated, time to go modern so:

Q: What to substitute this old Copybits approach with in Cocoa? (rather simple was the prior) : ) Restated, what would be among the best (and best for newbie) approaches for doing similar in Cocoa...for making an image and various subrects into graphical working buttons? Deal with the clicks?

Examples of goal here: similar to GarageBand, etc, or any nice looking VST instrument interface where they duplicate an analogue classic (Moog, etc) Basically, taking an image of a synth and making the 'buttons' and knobs work in Cocoa.

I was thinking I would be needing NSView and some Quartz, then reading here, came to think NSOpenGLView perhaps. Then I read about NSButtonCell perhaps? Make the image(s) a custom control? Needs to be relatively speedy, since a lot of MIDI I/O and processing may be going on at the same time.

+2  A: 

If you want to "go modern", go fully modern....

Specifically, lay out your interface with a bunch of NSButtons, NSSliders, etc.etc.etc... then see how far you can go by using custom on/off images for the buttons. For the sliders, you'll probably want to create a subclass and then override the drawing methods.

The various NSControl classes do a tremendous amount of the heavy lifting related to event tracking and user experience for you. Don't re-invent that wheel unless you really, really have to.

They are also designed to be subclassed and customized at whim.

As for performance, it will likely be just fine. The issue with audio apps is generally not one of raw CPU performance, but of latency. You'll want to push your audio processing off of the main event loop anyway.

Start simple, see how far you can get, then customize the UI as needed. As long as you are architecting your app intelligently, you shouldn't be throwing out much code as you do this.

bbum