On Mon, 22 Oct 2001, Christoph Reichenbach wrote:
> Hi,
>
> > > But then I hit a brick wall, hard. I don't know how KQ1's pcm samples
> > > are stored, and QFG2/etc uses SCI1 sound resources.
>
> 1A 00 01 00 00 ?? ?? ?? ?? ?? ?? ?? ?? ?? <sample rate (16-bit word)> FF
> 00 FF 2C 00 00 00 00 00 00 00 00 00 00 00 <sample length (16-bit word)> 00
> 00 00 00 00 00 00 00 00 00 <unsigned 8-bit sample data>
>
> This was sent to the list (or to me in PM, or maybe both) by Rickard (who,
> for those not in IRC ATM, pointed this out to me) almost two years ago.
> The bytes with the question marks might be meaningless here.
> The only problem is that you'll have to step through the entire MIDI track
> until you reach this header.
> Actually, I think it should be possible to scan for 0xfc, the header
> should follow (if we start at 33)- IIRC MIDI data only has the MSB set for
> commands, not parameters (and delta times in Sierra's format don't use
> 0xfc).
Just to clear things up a bit...
Some code VERY similar to kq1 soundblaster driver, es:si points at the
sound resource and es:[si]=2:
LoadSample proc near
mov ax,es:[si+1Fh]
xchg ah,al
or ax,ax ; Zero ?
jnz loc_12 ; Jump if not zero
add si,21h
loc_10:
inc si
cmp byte ptr es:[si],0FCh
jne loc_10 ; Jump if not equal
cmp byte ptr es:[si+1],0FCh
jne loc_11 ; Jump if not equal
inc si
loc_11:
jmp short loc_13
loc_12:
add si,ax
loc_13:
mov cx,es:[si+0Fh] ; Frequency
cmp cx,0F34h
jge loc_14 ; Jump if > or =
mov cs:SBC_TimeConst,0
jmp short loc_15
loc_14:
mov dx,0Fh
mov ax,4240h ; dx:ax=1000000
div cx ; ax,dx rem=dx:ax/reg
mov ah,0
sub ah,al
mov cs:SBC_TimeConst,ah
loc_15:
mov ax,es:[si+21h]
mov cs:data_8,ax
add si,2Dh
mov cs:data_6,es
mov cs:data_7,si
mov cs:data_34,si
mov bx,cs:SCI_StructPtr
mov [bx+0Ch],si
mov word ptr [bx+16h],0
mov ax,[bx+18h]
or al,al ; Zero ?
jz loc_16 ; Jump if zero
mov al,1
loc_16:
cmp cs:data_26,al
je loc_17 ; Jump if equal
mov cs:data_26,al
call sub_55
loc_17:
mov cs:data_25,1
mov cs:data_4,0
mov ax,1
retn
LoadSample endp
--
/Rickard Lind