Re: [hatari-devel] 8 runes of aerillion doesn't have sound |
[ Thread Index | Date Index | More lists.tuxfamily.org/hatari-devel Archives ]
Maybe this can help.
I use a variable : "music_sequence_index" to keep the current sample index.
I've traced my code and I see that "music_sequence_index" goes from
0(*8) to 2(*8) immediately at the beginning of the music,
which means there's an interrupt played immediately after the beginning
of the music.
The VHS intro plays a sample without interrupts.
I stop the music between the VHS screen and the intro of the demo.
The sample is bigger than the effect length, so, I stop it, load the 1st
music sample into memory and start to play the music.
In the music_start code, I add #8 to "music_sequence_index" because I
read this value at the beginning of the interrupt code to load the next
sample.
I also increment by #8 this variable during each interrupt in the
interrupt code.
The traced value of 2(*8) for the variable means that there's a first
interrupt triggered.
When I switch from the VHS screen (blue background cassette) to the demo
intro, I do the following :
; Stop the music
bsr.w music_stop
; Load the first sample pack into the sound buffer
bsr.w music_load_sample_1
; Start the music
bsr.w music_start
; music_stop
; Stop the sound
;
music_stop: ; Stop the current playing music
clr.w $ffff8900.w ; Stop the DMA
music (no interrupt, no loop)
rts
; music_start
; Configure the crossbar
; start to play the music
;
music_start:
; Set the 1st sample adress to the DMA
lea.l music_samples_table,a0
move.l music_buffer_adr,d6
move.l d6,d7
add.l (a0)+,d6 ; Start adress of
the sample
add.l (a0),d7 ; End adress of
the sample
bsr.w music_set_sample_adress
; Next sample
addq.w #8,music_sequence_index
; Start the music
move.w #$101,$ffff8900.w ; Set a
MFP-15 IRQ-7 interruption + Start the DMA music
rts
; music_set_sample_adress
; Set the sample begin and end adress to the DMA sound
; input: d6 = begin adress
; d7 = end adress
;
music_set_sample_adress: ; Set sound begin / sound end to the DMA
move.b d6,$ffff8907.w
lsr.l #8,d6
move.b d6,$ffff8905.w
lsr.l #8,d6
move.b d6,$ffff8903.w
move.b d7,$ffff8913.w
lsr.l #8,d7
move.b d7,$ffff8911.w
lsr.l #8,d7
move.b d7,$ffff890f.w
rts
; --------------------------------------------------------------
; MFP IRQ7 Dma sound interrupt
; --------------------------------------------------------------
; music_mfp_i7_interrupt
; The music MFP interruption
;
music_mfp_i7_interrupt:
movem.l d5-a0,-(sp)
; Get the current music sample index to play
lea.l music_samples_table,a0
move.w music_sequence_index,d5
addq.w #8,music_sequence_index
add.w d5,a0
cmp.w #70*8,d5
bge.s .demo_is_over
; Play the next sample
move.l music_buffer_adr,d6
move.l d6,d7
add.l (a0)+,d6 ; Start adress of
the sample
add.l (a0),d7 ; End adress of
the sample
bsr.w music_set_sample_adress
; Start the music
move.w #$101,$ffff8900.w ; Set a
MFP-15 IRQ-7 interruption + Start the DMA music
movem.l (sp)+,d5-a0
; Allow the interruptions again
bclr #7,$fffffa0f.w ; Interrupt
In-service A - Mono done
rte
.demo_is_over: ; The demo is over, don't reload another sample
; Stop the music
clr.w $ffff8900.w ; Stop the DMA
play
; Allow to quit the demo, to the end part
addq.w #1,demo_is_finished
movem.l (sp)+,d5-a0
; Allow the CPU interruptions again
bclr #7,$fffffa0f.w ; Interrupt
In-service A - Mono done
rte
Hope this helps.
Regards
Laurent
Le 09/03/2024 à 23:44, Laurent Sallafranque a écrit :
> And for the good news, the sound is back in 8 runes too ;)
>
> Thanks Nicolas.
>
> If you need some tests for the first sample not played in electric
> night, just ask
>
> Regards
>
> Laurent
>
>
>
> Le 09/03/2024 à 23:36, Laurent Sallafranque a écrit :
>> Hi
>>
>>
>> That's better, but not perfect.
>>
>> There's a problem, it seems that there's a first sample that is
>> forgotten (everything is out of sync), the first sample should repeat
>> once, but the music goes directly to the 2nd sample.
>>
>> After the blue intro magneto cassette screen, the sequence should run
>> like this :
>>
>>
>> dc.l 193548*0,193548*1 ; 01 -
>> 00.raw 1st half Dune logo appears // 2nd half logo removed
>> dc.l 193548*0,193548*1 ; 02 -
>> 00.raw Torus appears
>> dc.l 193548*1,193548*1+193548/2 ; 03 -
>> 01.raw Logo Thadoss appears
>>
>>
>> And it runs like this :
>>
>> ; dc.l 193548*0,193548*1 ; 01 - 00.raw
>> not played
>> dc.l 193548*0,193548*1 ; 02
>> -00.raw 1st half : Background // 2nd half garbage + Torus
>> appears
>> dc.l 193548*1,193548*1+193548/2 ; 03 -
>> 01.raw Logo Thadoss display
>>
>> It seems that the 1st sample is not played and the interrupt start at
>> the 2nd one.
>>
>>
>> I've tested with the "HEAD-100" version of hatari and it runs
>> perfectly (if needed, I can bisect).
>>
>> (git bisect start HEAD HEAD~100)
>>
>>
>> A youtube video of the demo :
>> https://www.youtube.com/watch?v=aow302WXZak
>>
>>
>> Ask mr if you need more explanations
>>
>> Regards
>>
>> Laurent
>>
>>
>>
>>
>> Le 09/03/2024 à 22:26, Nicolas Pomarède a écrit :
>>> Le 09/03/2024 à 11:29, Laurent Sallafranque a écrit :
>>>> I was pretty sure of it, but I've bisected electric night (the
>>>> problem is certainly the same for 8 runes as it uses the same sound
>>>> engine).
>>>
>>> Hi
>>>
>>> this is fixed now ; I forgot to update crossbar.SNDINT_Signal value
>>> after it was changed, making GPIP7 value always 1, which prevented
>>> the GPIP7 interrupt :(
>>>
>>> Also, that's a good example of the "end of frame" interrupt that can
>>> be set in $FF8901, it's useful to validate the recent changes in
>>> crossbar.c
>>>
>>> Nicolas
>>>
>>>
>>>
>>
>>
>
>
Mail converted by MHonArc 2.6.19+ | http://listengine.tuxfamily.org/ |