Mod Player/5

 BBS: Inland Empire Archive
Date: 11-30-92 (21:17)             Number: 377
From: RICH GELDREICH               Refer#: NONE
  To: ALL                           Recvd: NO  
Subj: Mod Player/5                   Conf: (2) Quik_Bas
'<<Part 5 Starts Here>>
            CASE 1              'Port Down
                C.Command(A)   = 2
                C.PortSpeed(A) = O
            CASE 2              'Port Up
                C.Command(A)   = 3
                C.PortSpeed(A) = O
            CASE 3              'Port to Note
                IF C.Period(A) > C THEN
                    C.Command(A) = 4
                    C.Command(A) = 5
                END IF
                C.PortSpeed(A) = o
                C.PortDest(A)  = C
            CASE 10             'Volume Slide
                C.Command(A) = 1
                IF O AND 15 THEN
                    C.VolumeSpeed(A) = -(O AND 15)
                    C.VolumeSpeed(A) = O\16
                END IF
            CASE 11             'Position Jump
                IF o<T.Length THEN
                    T.Pos = o
                    T.Line = 1
                END IF
            CASE 13             'Pattern Skip
                T.Line = 1
            END SELECT
        END IF
        T.Offset = T.Offset + 2
    T.ClicksLeft = T.Tempo
    T.Line = T.Line - 1:IF T.Line = 0 THEN GOTO NewPattern
    T.Pos = T.Pos + 1:IF T.Pos >= T.Length THEN T.Pos = 0
    GOSUB StartNewPattern
    LOCATE ,1
    PRINT USING "Playing:###"; (T.Pos*100&)\T.Length;
    PRINT "%";
    T.Line              = 64
    PatternSegment      = PatternSegment(T.Pos)
    T.Offset            = 0
'Main mixer follows. While the assembly routine is playing one buffer,
'this routine mixes the other.
    BufferOffset = BufferOffset XOR 512

    FOR K = 0 TO 3
        IF C.InactiveFlag(K)=False AND ChannelOn(K) THEN
            GOSUB Mix
            Tm = 1
        END IF
    If Tm=0 then 'If all channels inactive then just clear buffer to
        FOR B = BufferOffset TO BufferOffset + IntsPerClick-1
            SampleBuffer(B) = 0
    END IF

    T.ClicksLeft = T.ClicksLeft - 1
    'If not time for a new line the process slide commands, if any.
    IF T.ClicksLeft = 0 THEN GOSUB DoLine ELSE GOSUB DoCommands
    MixesLeftToDo   = IntsPerClick
    OffsetNow       = BufferOffset

    'Preload all needed variables for speed.
    DEF SEG = C.Segment(K)
    o = C.Offset(K)                     'current offset into sample
    r = C.Remainder(K)                 'current remainder(0-255) at
    v = C.Volume(K)                     'volume(0-64)

    h = C.HighStep(K)                   'integer step
    l = C.LowStep(K)                    'remainder step(0-255)

    IF C.RepLength(K) THEN
         'If sample loops the calculate the number of mixes left until
         'we must loop...

         'Thanks to QB's lack of unsigned ints, we must do this...
            IF PL&<0 THEN PL&=PL&+65536

'<<-Continued On Next Message->>

--- MsgToss 2.0b
 * Origin: Computer Co-Op - Voorhees, NJ | Ted Hare (1:266/29)
Outer Court
Echo Basic Postings

Books at Amazon:

Back to BASIC: The History, Corruption, and Future of the Language

Hackers: Heroes of the Computer Revolution (including Tiny BASIC)

Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution

The Advent of the Algorithm: The Idea that Rules the World

Moths in the Machine: The Power and Perils of Programming

Mastering Visual Basic .NET