M README.md +5 -0
@@ 53,6 53,11 @@ Usage:
Options:
+ * `/l` Number of playback loops. Default: 1.
+
+ How many times the sample should be repeated. The amount is specified like
+ `/L15`. Use `/L` or `/L0` to loop infinitely.
+
* `/q` Suppress messages and visualisation.
Completely prevents any visual output, except for errors.
M src/Application.asm +1 -0
@@ 56,6 56,7 @@ Application_Construct:
call Application_GetCLI_IY
ld a,(iy + CLI.disableVisualization)
cpl
+ ld b,(iy + CLI.loops)
call Application_GetPlayer
pop de
call Player_Construct
M src/CLI.asm +9 -0
@@ 8,6 8,8 @@ CLI: MACRO
db 1
fileInfoBlockReference:
dw 0
+ loops:
+ db 1
quiet:
db 0
disableVisualization:
@@ 102,6 104,8 @@ CLI_ParseOption: PROC
inc de
ld a,(de)
and 11011111B ; upper-case
+ cp "L"
+ jr z,OptionLoops
cp "Q"
jr z,OptionQuiet
cp "V"
@@ 114,6 118,11 @@ CLI_ParseOption: PROC
jr z,OptionUnsignedPCM
ld hl,CLI_unknownOptionError
call System_ThrowExceptionWithMessage
+OptionLoops:
+ inc de
+ call CLI_ParseNumber
+ ld (ix + CLI.loops),c
+ jr Next
OptionQuiet:
ld (ix + CLI.quiet),-1
ld (ix + CLI.disableVisualization),-1
M src/Player.asm +21 -1
@@ 7,6 7,8 @@ Player_PAGE_BASE: equ 8000H
Player: MACRO
driver:
dw 0
+ loops:
+ db 1
enableVisualization:
db 0
sequence:
@@ 24,12 26,14 @@ PlayerSequence: MACRO
ENDM
; a = enable visualisation
+; b = loops (0: infinite)
; de = driver
; ix = this
Player_Construct:
ld (ix + Player.driver),e
ld (ix + Player.driver + 1),d
ld (ix + Player.enableVisualization),a
+ ld (ix + Player.loops),b
push ix
ld bc,Player_MAX_SEQUENCE_SIZE
ld ix,Heap_main
@@ 119,7 123,7 @@ Player_Play:
out (0A1H),a
ld a,14
out (0A0H),a
- call Player_PlaySequence
+ call Player_PlaySequenceLoops
ld a,0
out (VDP_PORT_1),a
ld a,15 | VDP_REGISTER
@@ 132,6 136,22 @@ Player_Play:
ret
; ix = this
+Player_PlaySequenceLoops: PROC
+ ld b,(ix + Player.loops)
+Loop:
+ push bc
+ call Player_PlaySequence
+ pop bc
+ ret c
+ ld a,b
+ add a,-1
+ jr nc,Loop
+ ld b,a
+ jr nz,Loop
+ ret
+ ENDP
+
+; ix = this
; f <- c: playback aborted
Player_PlaySequence: PROC
exx