iGetIt! Keyboard v0.000002
Here's the latest version of my keyboard component:
It looks and behaves much better now. I copied and pasted the code from Flex's Button class into a new class (KBButton) and hacked away everything that I didn't need, which was a lot. I then did the same with the Flex classes needed for programmatic skinning, so that I could draw the keyboard's buttons as I saw fit. The drawing isn't perfect by any means, but at least now I know how control-drawing works.
My next step is to move the sound-generation code out of the KBCanvas (which holds the KBButtons) and into a stand-alone Synth class. In effect, the KBCanvas and its KBButtons (and their KBButtonSkins, and so on) will know only about drawing things on the screen in response to NoteEvents, and the Synths will know only about playing sounds in response to NoteEvents. Importantly, that means that the KBCanvas and the Synth will *not* know about the other. I will be able to change the design and implementation of either one completely indepently of the other. The Flex application will act as the central controller, intercepting keypress events from the user's computer keyboard and re-packaging them as NoteEvents. The KBCanvas and Synth will listen for these events, changing their visual/sonic states, respectively, when such NoteEvents occur. The application will keep its current state in a data structure (the "model") that doesn't know about Synths or on-screen views, either. Hence, a nice clean separation of model, view, and controller (with the application as the controller, and the Synth as a sort of "sonic view").
My progress in implementing these custom controls has been glacially slow, by the standards of commercial software development. But right now, speed isn't the point. It's more important that I soak up Flex's design patterns, Actionscript's idioms, and eclipse's workflow, thereby increasing my overall efficiency, than to get these components done "yesterday." I expect that my efficiency will be improving rapidly from here on out (albeit from a still-low level).
It looks and behaves much better now. I copied and pasted the code from Flex's Button class into a new class (KBButton) and hacked away everything that I didn't need, which was a lot. I then did the same with the Flex classes needed for programmatic skinning, so that I could draw the keyboard's buttons as I saw fit. The drawing isn't perfect by any means, but at least now I know how control-drawing works.
My next step is to move the sound-generation code out of the KBCanvas (which holds the KBButtons) and into a stand-alone Synth class. In effect, the KBCanvas and its KBButtons (and their KBButtonSkins, and so on) will know only about drawing things on the screen in response to NoteEvents, and the Synths will know only about playing sounds in response to NoteEvents. Importantly, that means that the KBCanvas and the Synth will *not* know about the other. I will be able to change the design and implementation of either one completely indepently of the other. The Flex application will act as the central controller, intercepting keypress events from the user's computer keyboard and re-packaging them as NoteEvents. The KBCanvas and Synth will listen for these events, changing their visual/sonic states, respectively, when such NoteEvents occur. The application will keep its current state in a data structure (the "model") that doesn't know about Synths or on-screen views, either. Hence, a nice clean separation of model, view, and controller (with the application as the controller, and the Synth as a sort of "sonic view").
My progress in implementing these custom controls has been glacially slow, by the standards of commercial software development. But right now, speed isn't the point. It's more important that I soak up Flex's design patterns, Actionscript's idioms, and eclipse's workflow, thereby increasing my overall efficiency, than to get these components done "yesterday." I expect that my efficiency will be improving rapidly from here on out (albeit from a still-low level).
Labels: ActionScript 3, Flex 3, MVC, programming


3 Comments:
I love it, except that the pitches are way to high. Could you make a version that's, say, two octaves lower?
Good suggestion -- I appreciate your interest! :-)
I certainly could add a pair of octave buttons, or just extent the range of the "Pitch of Re" slider, or somesuch. I'm very focused on storyboarding the JIMS-based courseware right now, though, so I'm unlikely to get to it for weeks. Once I'm done with the first draft of the storyboard, then I'll have a better idea of what I want to have my Flex components "do," and I'll revise them -- including this keyboard component -- accordingly.
Fair enough?
The source code is available here: www.igetitmusic.com/blog/SWFs/TestApp1/srcview
...if that's of any help.
Good suggestion -- I appreciate your interest! :-)
I certainly could add a pair of octave buttons, or just extent the range of the "Pitch of Re" slider, or somesuch. I'm very focused on storyboarding the JIMS-based courseware right now, though, so I'm unlikely to get to it for weeks. Once I'm done with the first draft of the storyboard, then I'll have a better idea of what I want to have my Flex components "do," and I'll revise them -- including this keyboard component -- accordingly.
Fair enough?
The source code is available here: www.igetitmusic.com/blog/SWFs/TestApp1/srcview
...if that's of any help.
Post a Comment
Links to this post:
Create a Link
<< Home