From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,c98f618755b0ddcc X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news2.google.com!news4.google.com!feeder.news-service.com!news2.euro.net!newsfeed.freenet.ag!news.netcologne.de!ramfeed1.netcologne.de!newsfeed.arcor.de!newsspool4.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: Thinking of using Ada for a job at home. Couple of questions first. Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: Date: Wed, 3 Mar 2010 20:17:28 +0100 Message-ID: NNTP-Posting-Date: 03 Mar 2010 20:17:28 CET NNTP-Posting-Host: f8e8d7e5.newsspool3.arcor-online.net X-Trace: DXC=6P0`YLmdBF6]E=H1Q9`787McF=Q^Z^V384Fo<]lROoR18kF[ On Wed, 03 Mar 2010 16:19:31 +0000, John McCabe wrote: > So the first question is do any of you know of any bindings to MS > Windows MIDI (presumably the multimedia system) functions that already > exist and are open source or something like that? I searched on Google > for "ada midi" but it looks like there's a product called that so it > came up with loads of stuff. I'm aware there are some binding to Win32 > from Ada but, as I've not been doing Ada in anger for a long time, I'm > not sure if there's something for Ada 2005. I vaguely remember that there is no proper API for that (either in Ada or in C). It is communicated over the Windows messages or worse at the process level. I don't remember. Anyway if there exists proper C API, there is no problem to convert it to Ada. It is a matter of a pair minutes of work. > So, in principle, would that be the way to do this, or would you be > able to suggest a better mechanism? In practice that usually does not work well. The approach I am using is reading the octet stream or else what is natural for the device or the protocol at hand, and then constructing the necessary Ada objects on the fly. I don't mess with representation clauses. If 100 nanoseconds overhead impose a serious performance problem to your program it won't work anyway. And under Windows we are talking about 1ms jitter at least. So no reason to worry about that. > Finally, is there a straightforward way to do that sort of thing using > tagged records? Yes, as above. This is the way I usually do it. > E.g. could I define a record which is the header > format, then extend that in a number of different tagged extensions to > create each individual message as a separate tagged record and use the > OO and dispatching facilities to work with them? No, why do you need message objects? What for? Once a message is received and interpreted there is no need to keep it in any form, so to have a Message type [or an hierarchy of]. Instead of that you create a tagged Connection type, with primitive higher-level operations invoked by the driver as it reads incoming messages. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de