BBS: Inland Empire Archive Date: 11-30-92 (21:18) Number: 378 From: RICH GELDREICH Refer#: NONE To: ALL Recvd: NO Subj: Mod Player/6 Conf: (2) Quik_Bas
'<<Part 6 Starts Here>> MixesTillRepeat& = (PL& * 256 - (r+256)) \ ((h * 256&) + l) 'If there is any remainder left, then add 1 to MixesTillRepeat. IF ( (PL& * 256 - (r+256)) MOD ((h * 256&) + l) ) THEN MixesTillRepeat&=MixesTillRepeat&+1 END IF IF MixesLeftToDo >= MixesTillRepeat& THEN MixesToDo = MixesTillRepeat& MixesLeftToDo = MixesLeftToDo - MixesToDo 'Mix whatever is left of the sample... GOSUB LowLevelMix 'Throw back our pointer to the loop start. IF C.LoopEnd(K) = C.Length(K) THEN'If first time,setup o = C.RepStart(K) 'for next loop. C.LoopEnd(K) = C.RepStart(K) + C.RepLength(K) ELSE o = o - C.RepLength(K) ENDIF ELSE EXIT DO END IF LOOP END IF 'Mix whatever is left. MixesToDo = MixesLeftToDo Gosub LowLevelMix 'Store back the offset and its remainder. C.Offset(K) = o C.Remainder(K) = r 'If sample doesn't loop, and the offset passed the end of the sample, 'then turn off the channel. IF C.RepLength(K) = 0 AND UnsignedComp(o, C.Length(K)) > 0 THEN C.InactiveFlag(K) = True END IF RETURN LowLevelMix: 'Copies the samples from the instruments to the mixing buffer. 'If this is the first copy (Tm=0), then just store the sample, 'otherwise add it into the buffer. If Tm=0 then 'Since most channels will have a volume of 64 (max), then only 'use the volume lookup table (which is slow) when needed... IF v <> 64 THEN FOR OffsetNow = OffsetNow TO OffsetNow + MixesToDo - 1 SampleBuffer(OffsetNow) = VolumeTable(v, PEEK(o)) o = o + h 'If remainder overflows, then increment the offset by 1 'and adjust the remainder back down. r = r + l: IF r => 0 THEN r = r - 256: o = o + 1 NEXT ELSE FOR OffsetNow = OffsetNow TO OffsetNow + MixesToDo - 1 SampleBuffer(OffsetNow) = PEEK(o) o = o + h r = r + l: IF r => 0 THEN r = r - 256: o = o + 1 NEXT END IF ELSE IF v <> 64 THEN FOR OffsetNow = OffsetNow TO OffsetNow + MixesToDo - 1 SampleBuffer(OffsetNow) = SampleBuffer(OffsetNow) + _ VolumeTable(v, PEEK(o)) o = o + h r = r + l: IF r => 0 THEN r = r - 256: o = o + 1 NEXT ELSE FOR OffsetNow = OffsetNow TO OffsetNow + MixesToDo - 1 SampleBuffer(OffsetNow)=SampleBuffer(OffsetNow)+PEEK(o) o = o + h r = r + l: IF r => 0 THEN r = r - 256: o = o + 1 NEXT END IF END IF RETURN '===================================================================== 'Process the MOD sliding commands... DoCommands: FOR A=0 TO 3 IF C.Command(A) THEN SELECT CASE C.Command(A) CASE 1 'Volume slide C.Volume(A)=C.Volume(A)+C.VolumeSpeed(A) IF C.Volume(A)<0 THEN C.Volume(A)=0 C.Command(A)=0 ELSEIF C.Volume(A)>64 THEN '<<-Continued On Next Message->> --- MsgToss 2.0b * Origin: Computer Co-Op - Voorhees, NJ | Ted Hare (1:266/29)
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