[comp.os.os2.programmer] if

zyx@milton.u.washington.edu (Bt Garner) (10/31/90)

as you may have guessed from the subject line, this *is* a plead for help.

I am currently in the process of converting a DOS app to OS/2, and the 
results have been very pleasing with one major exception:  the creation
of sounds.  Our App uses a fair amount of "sound" (in a fashion of turn on
the sound, go do something else, change the sound, then go do something
else, then turn off the sound) which just doesn't cut it using the DosBeep
function.

The Plea:  Is there a way to access the speaker without the use of DosBeep?
Examples would be greatly apprecited, any language will do.

I've read about 20 books on OS/2 programming and have yet to see anything
on this subject (or even any ideas, for that matter - gack!)

thanx,

bt garner

(apologies to those who get this as a re-post, the first NewsFeeder I used
 doesn't seem to want to send things outta 'Bama)

--
*  bt garner  *  230 Ross Hall  *  Auburn University  *  Alabama  *  36849   *
*  internet: bt@eng.auburn.edu  *  Opinions: Mine, don't blame (or flame) AU *
*  "'Reality' is the only word in the language that should always be used in *
*  quotes."      -TKK                                                        *

cfreas@eeserv1.ic.sunysb.edu (Terry Freas) (11/02/90)

In article <10312@milton.u.washington.edu> zyx@milton.u.washington.edu (Bt Garner) writes:
>The Plea:  Is there a way to access the speaker without the use of DosBeep?
>Examples would be greatly apprecited, any language will do.

In _Programming the OS/2 Presentation Mananger_ Petzold writes code for an
IOPL segment to perform exactly the "leave on, leave off" type of speaker
access that you want.  I believe the speaker turns on after receipt of
a WM_MOUSE1DOWN (or something) and turns off with a WM_MOUSE1UP (or
something).  Source code in C is provided.

-- 
oo            - I live for the day earth becomes a domain name -            oo
\/ Jeremy Wohl / wohl@max.physics.sunysb.edu / cfreas@csserv1.ic.sunysb.edu \/

jack@cscdec.cs.com (Jack Hudler) (11/02/90)

In article <10312@milton.u.washington.edu> zyx@milton.u.washington.edu (Bt Garner) writes:
>
>Our App uses a fair amount of "sound" (in a fashion of turn on
>the sound, go do something else, change the sound, then go do something
>else, then turn off the sound) which just doesn't cut it using the DosBeep
>function.
>
>The Plea:  Is there a way to access the speaker without the use of DosBeep?
>Examples would be greatly apprecited, any language will do.
>
Probably not, but don;t take my word for it. However, why don't you just start
a thread that handles the beeping.

-- 
Jack           Computer Support Corporation             Dallas,Texas
Hudler         Internet: jack@cscdec.cs.com

rommel@lan.informatik.tu-muenchen.dbp.de (Kai-Uwe Rommel) (11/05/90)

In article <10312@milton.u.washington.edu> zyx@milton.u.washington.edu (Bt Garner) writes:
>The Plea:  Is there a way to access the speaker without the use of DosBeep?
>Examples would be greatly apprecited, any language will do.

Some time ago I read Charles Petzold's "Programming PM" and I think it
contained a sample program called "organ" to produce some sound.
It uses a IOPL segment to access the speaker directly.

Kai Uwe Rommel

--
/* Kai Uwe Rommel
 * Munich
 * rommel@lan.informatik.tu-muenchen.dbp.de
 */

d9mikael@dtek.chalmers.se (Mikael Wahlgren) (11/07/90)

In article <81@cscdec.cs.com> jack@cscdec.cs.com (Jack Hudler) writes:
>In article <10312@milton.u.washington.edu> zyx@milton.u.washington.edu (Bt Garner) writes:

>>The Plea:  Is there a way to access the speaker without the use of DosBeep?
>>Examples would be greatly apprecited, any language will do.
>>
>Probably not, but don;t take my word for it. However, why don't you just start
>a thread that handles the beeping.

It is possible to do this if you have IOPL.  An example in Modula-2:

(*# call (iopl => on) *)
IMPLEMENTATION MODULE IOPsound;
IMPORT SYSTEM;
PROCEDURE BeepProc;
TYPE bs = SET OF [0..7};
CONST freq=3000; PPIport=60H; Timer=42H;
VAR m:bs; delay,j,interval:CARDINAL;
BEGIN
  interval := CARDINAL(1193181 DIV LONGVARD(freq));
  m := bs(SYSTEM.In(PPIport+1));
  IF m*bs{0,1} = bs{} THEN
    SYSTEM.Out(Timer+1,SHORTCARD(m+bs{0,1}));
    SYSTEM.Out(Timer+3,0B6H);
  END;
  SYSTEM.Out(Timer+3,SHORTCARD(interval MOD 256));
  SYSTEM.Out(Timer+2,SHORTCARD(interval DIV 256));
  FOR delay := 1 TO 10000 DO j := delay*delay END;
  m := bs(SYSTEM.In(PPIport+1));
  SYSTEM.Out(PPIport+1,SHORTCARD(m*bs{2,3,4,5,6,7}));
END BeepProc;
END IOPsound.

Example taken from the Modula-2 1.0 OS/2 supplemental documentation.

Mikael Wahlgren      d9mikael@dtek.chalmers.se