Skip to content

Commit

Permalink
Fixed Hankin sound
Browse files Browse the repository at this point in the history
  • Loading branch information
volkenborn committed Dec 19, 2023
1 parent a677493 commit 9cecc7c
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/wpc/hnks.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ static struct {
int channel;

UINT8 iBuffer;
INT8 samples[2][32];
} hnks_locals;

MEMORY_READ_START(hnks_readmem)
Expand All @@ -69,19 +70,17 @@ static void hnks_irq(int state) {

void start_samples(void)
{
INT8 samples[2][32];

int i;
const unsigned char* adr = memory_region(HNK_MEMREG_SCPU) + 0xf000 + (hnks_locals.actSamples*0x20);

hnks_locals.iBuffer = 1-hnks_locals.iBuffer;
for (i=0; i<0x20; i++)
samples[hnks_locals.iBuffer][i] = (INT8)((((*adr++)<<4)-0x80) * hnks_locals.volume);
hnks_locals.samples[hnks_locals.iBuffer][i] = (INT8)((((*adr++)<<4)-0x80) * hnks_locals.volume);

// looks strange? (cond?32:1), thats ok!
mixer_play_sample(
hnks_locals.channel,
samples[hnks_locals.iBuffer],
hnks_locals.samples[hnks_locals.iBuffer],
!hnks_locals.counterReset?0x20:1,
BASE_FREQUENCY/(hnks_locals.counterSpeed/((1-hnks_locals.div2)+1)+1),
1
Expand Down Expand Up @@ -195,8 +194,7 @@ static void hnks_init(struct sndbrdData *brdData)
}

static int hnks_sh_start(const struct MachineSound *msound) {
hnks_locals.channel = mixer_allocate_channel(15);
mixer_set_volume(hnks_locals.channel,0xff);
hnks_locals.channel = mixer_allocate_channel(25);
return 0;
}

Expand Down

0 comments on commit 9cecc7c

Please sign in to comment.