[futurebasic] Re: [FB^3] Sound Tutor Code by R. W. Hommel

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : September 2001 : Group Archive : Group : All Groups

From: Richard Goodman <bhomme@...>
Date: Wed, 19 Sep 2001 08:44:09 -0700
Regarding Hommel's Sound Tutor modification that I posted a few days ago,
I've found some bugs in it resulting from the fact that Hommel used arrays
without element zero in FB^2.

The SELECT CASE structure that selects a note should be changed to:

 SELECT CASE cmd$
        CASE "O":octave=VAL(parm$):IF octave < 0 OR octave > 11 THEN octave = 1
        CASE "A":IF sharp THEN note=1 ELSE note=0
        CASE "B":note=2
        CASE "C":IF sharp THEN note=4 ELSE note=3
        CASE "D":IF sharp THEN note=6 ELSE note=5
        CASE "E":note=7
        CASE "F":IF sharp THEN note=9 ELSE note=8
        CASE "G":IF sharp THEN note=11 ELSE note=10
      END SELECT

Also, change:

      LONG IF note
        freq&=gMidi(octave,note)
        gsndErr= FN SndCmd(Chan&,_freqDurationCmd,dur,freq&)
        IF gsndErr THEN indx=LEN(Song$)+1
        'IF gsnErr THEN BEEP There was no beep
      END IF

to:

LONG IF note > -1 and note < 12
        freq&=gMidi(octave,note)
        gsndErr= FN SndCmd(Chan&,_freqDurationCmd,dur,freq&)
        IF gsndErr THEN indx=LEN(Song$)+1
        'IF gsnErr THEN BEEP There was no beep
      END IF

Without the above change, the note "A" will not be heard.