Skip to content

[Feature] spcPause(), spcResume(), spcGetStartPos() #213

@malayli

Description

@malayli

Feature request

Creating these 2 functions will allow a better control on a music IT file:

  • spcPause(): This function pauses a played music (started with spcPlay(0))
  • spcResume(): This function resumes a paused music (paused with spcPause())

Advanced Feature request

Creating this function will help developers to simply get the current startPos value:

  • spcGetStartPos()

So they can pass it to spcPlay(startPos) after stopping a music with spcStop().

Notes

These are the explanation of KungFuFurby that might help you to implement this feature:

startpos refers to an orderlist ID. You can retrieve the orderlist ID directly from $2143/$F7... but of course, the ASM I ported over way back when didn't include this function for whatever reason on the 65816 side.

Copy over this snippet of code, giving it a different name:

;**********************************************************************
; read status register
;**********************************************************************
spcReadStatus:
ldx #5 ; read PORT2 with stability checks
lda REG_APUIO2 ;
@loop: ;
cmp REG_APUIO2 ;
bne spcReadStatus ;
dex ;
bne @loop ;
rts ;

Replace all instances of REG_APUIO2 with REG_APUIO3.
I'd say put your modified function somewhere in https://github.com/alekmaul/pvsneslib/blob/master/pvsneslib/include/snes/sound.h ...but I don't see a good return type example from here. I'm thinking a u8

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions