ETHZ_Logo RAMSES_Logo_Right   RAMSES   RAMSES_Logo_Left Systems Ecology  
Start    search button      Modules:   A-Z   Function   Layer        QuickRefs:   DM   AuxLib   AuxLibE   SciLib   EasyMW   MW   ISIS   RMSLib

DEFINITION MODULE SoundDriver;

  (*******************************************************************

    Module  SoundDriver     (Version 1.0)

      Copyright (c) 1986-2006 by Christian Pfister, Andreas Fischlin and
      ETH Zurich.

    Purpose   Synthesize sounds.

    Remarks   SetSoundVol not implemented.


    Programming

      o Design
        Christian Pfister         30/08/1986

      o Implementation
        Christian Pfister         30/08/1986
        Andreas Fischlin          28/06/1988


    ETH Zurich
    Systems Ecology
    CHN E 35.1
    Universitaetstrasse 16
    8092 Zurich
    SWITZERLAND

    URLs:
        <mailto:RAMSES@env.ethz.ch>
        <http://www.sysecol.ethz.ch>
        <http://www.sysecol.ethz.ch/SimSoftware/RAMSES>


    Last revision of definition:  28/06/1988  AF

  *******************************************************************)


  FROM SYSTEM IMPORT ADDRESS;

  CONST
    swMode = -1; (* square-wave synthesizer *)
    ftMode =  1; (* four-tone synthesizer *)
    ffMode =  0; (* free-form synthesizer *)

  TYPE
    Ptr          = ADDRESS;
    ProcPtr      = Ptr;
    Byte         = CHAR;
    Fixed        = LONGINT;

    (* for square-wave synthesizer *)

    Tone = RECORD
            count: CARDINAL;    (* 783360/frequency [Hz] *)
            amplitude: INTEGER; (* [0..255] *)
            duration: INTEGER;  (* in ticks *)
           END;

    Tones = ARRAY [0..5000] OF Tone;

    SWSynthPtr = POINTER TO SWSynthRec;
    SWSynthRec = RECORD
                   mode: INTEGER;
                   triplets: Tones;
                 END;

    (* for four-tone synthesizer *)

    FTSynthPtr = POINTER TO FTSynthRec;
    FTSndRecPtr = POINTER TO FTSoundRec;
    WavePtr = POINTER TO Wave;

    FTSynthRec = RECORD
                  mode: INTEGER;
                  sndRec: FTSndRecPtr;
                 END;

    FTSoundRec = RECORD
                  duration: INTEGER;
                  sound1Rate: Fixed;
                  sound1Phase: LONGINT;
                  sound2Rate: Fixed;
                  sound2Phase: LONGINT;
                  sound3Rate: Fixed;
                  sound3Phase: LONGINT;
                  sound4Rate: Fixed;
                  sound4Phase: LONGINT;
                  sound1Wave: WavePtr;
                  sound2Wave: WavePtr;
                  sound3Wave: WavePtr;
                  sound4Wave: WavePtr;
                 END;

    Wave = ARRAY [0..255] OF Byte;


  PROCEDURE StartSound(synthRec:      Ptr;
                       numBytes:      LONGINT;
                       completionRtn: ProcPtr);

  PROCEDURE StopSound;

  PROCEDURE SoundDone(): BOOLEAN;

  PROCEDURE GetSoundVol(VAR level: INTEGER);

  PROCEDURE SetSoundVol(level: INTEGER);


END SoundDriver.

  Contact RAMSES@env.ethz.ch Last updated: 25-Jul-2011 [Top of page]