lynx-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

LYNX-DEV How to get DJGPP to make sounds


From: JeffreyX Groves
Subject: LYNX-DEV How to get DJGPP to make sounds
Date: Thu, 13 Nov 97 14:00:00 PST

I'm trying to create a function that will generate sounds.  I've
written the following code, but it causes the system to lock
when it is executed.  Perhaps some of you can tell me
what is wrong:

PUBLIC int LYSound ARGS4(
        int,    volume,
        int,    pitch,                  /* frequency in Hertz */
        int,    duration,               /* in milliseconds */
        int,    off_time)               /* in milliseconds */
{
#ifdef DOSPATH

#define sound_int       0x7c    /* sound interrupt */

        struct _sound_param {
                unsigned char volume;
                short int pitch;
                short int duration;
                short int off_time;
        };

        struct _sound_param sound;
        int dos_addr;

        _go32_dpmi_seginfo seg_info;
        _go32_dpmi_registers regs;
        
        /*
        **  Set up sound parameters
        */
        sound.volume = (unsigned char) volume;
        sound.pitch = (short int) pitch;
        sound.duration = (short int) duration;
        sound.off_time = (short int) off_time;

        /*
        ** Set up DOS memory segment
        */
        _go32_dpmi_allocate_dos_memory(&seg_info);
        dos_addr = (seg_info.rm_segment << 4) + seg_info.rm_offset;

        /*
        **  Copy sound parameters to DOS memory
        */
        dosmemput(&sound, sizeof(sound), dos_addr);

        /*
        **  Set up DOS interrupt parameters
        */
        regs.x.cx = 0;
        regs.x.dx = 0;
        regs.x.ax = 0x64;       /* sound function */
        regs.x.es = seg_info.rm_segment;
        regs.x.bx = seg_info.rm_offset;

        /*
        **  Call interrupt and make the sound
        */
        _go32_dpmi_simulate_int(sound_int, &regs);

        /*
        **  Release DOS memory
        */
        _go32_dpmi_free_dos_memory(&seg_info);

#endif  /* DOSPATH */

}
;
; To UNSUBSCRIBE:  Send a mail message to address@hidden
;                  with "unsubscribe lynx-dev" (without the
;                  quotation marks) on a line by itself.
;

reply via email to

[Prev in Thread] Current Thread [Next in Thread]