Jump to content
IGNORED

U-235 SoundEngine released!


LinkoVitch

Recommended Posts

I've just updated to the latest version and it works, I'm using u235se-rel.bin file instead of the elf.

 

By the way, I've realised that when I run the game in NTSC the samples sounds a bit faster, I think that they sound sound the same. This is my init code.

 

_init_sound_system::
	lea u235se,a0
	move.w CONFIG,d0
	btst #VIDTYPE,d0
	bne.s .ntsc
	jsr 4(a0)		; pal
	bra.s .l0
.ntsc:
	jsr 2(a0)		; ntsc
.l0:

; clear sample bank
	lea samples_bank,a0
	lea end_samples_bank,a1
	move.l a0,U235SE_ptr_sample_bank
.loop:
	clr (a0)+
	cmp.l a0,a1
	bne.s .loop

; enable DSP

	move.w	#$100,JOYSTICK					; enable sound
	move.w 4+2(sp),U235SE_playbackmode
	move.l	#U235SE_24KHZ,U235SE_playback_rate
	move.l	#U235SE_24KHZ_PERIOD,U235SE_playback_period

	move.l #D_RAM,D_PC						; Set up D_PC (DSP's program counter)
	move.l #RISCGO,D_CTRL					; Run DSP
	rts

 

Link to comment
Share on other sites

You have said that they sound faster but also that they sound the same?  Sorry I am a bit confused by this.  Do you mean they are of a higher pitch or the module plays faster?

There should be no difference in pitch (assuming your code to detect PAL/NTSC is correct, and even then really slight).  There is possibly a slight bugette in the modinit routine that only sets up the mod interval to 50Hz for one system type (PAL/NTSC do have slightly different physical clocks, but the difference should be very very slight), of course if you are just using a 50/60Hz switch on a jag this could cause timing errors in the modplayer as the system clock speed won't be changed, so things may sounds a little off, both Pitch and timing.

Link to comment
Share on other sites

From that I guess you mean "Higher pitch" rather than "faster"?

 

Try hard coding your code to init the jag in PAL mode instead (I guess it's an actual PAL jag you have set to 60Hz?).  Internally a PAL jag will look like a PAL jag even if you flip the refresh to 60Hz I'd imagine.  So your code will always detect it as a PAL jag. (I've not tested this so could be wrong, but I imagine that is what's happening)

Link to comment
Share on other sites

  • 2 months later...

Which version are you using? The latest version made some changes to how things are setup.  There is included demo code for both the relocatable binary blob and also the static object versions.  These both init a mod and start it.

 

1) Yes, stopping a module call just sets a flag to say to stop the module.

2) usually the 68K won't be fast enough to have an issue to init a new mod right after a stop.  I have never added any waits in myself, but I have also never tried stopping and then starting a new mod immediately afterwards.

 

If you are not already I would recommend grabbing the latest version of the engine and using that.  There were various improvements in playback quality, performance and also stopping and starting modules.

 

HTH

Link to comment
Share on other sites

Sorry I forgot to say that I'm using 0.24 version with u235se-rel.bin file, not the elf version.

 

I've a label called u235se, and the binary file there. I call u235se to init the mod, to init the sound engine I call u235se+2 for NTSC and  u235se+4 for PAL systems but I've tried to call u235se+6 to init a mod file with a starting position(in d0 register) but it doesn't work.

 

Edited by swapd0
Link to comment
Share on other sites

_init_module::
	moveq #0,d0
	lea U235SE_modregdump,a0
	move.l d0,(a0)+
	move.l d0,(a0)+
	move.l d0,(a0)+
	move.l d0,(a0)+

	move.l 4(sp),a0
	move.w 4+4+2(sp),d0
	jsr u235se
	rts

This is my init_module(void *module, int16_t position) routine, it always plays the module from the first position, if I call u235se+6 I've no sound and no fx.

Link to comment
Share on other sites

Just now, swapd0 said:

No music and no fx. It looks that I hang the sound engine, but the game runs.

If you don't init the mod does the FX work as expected?

 

Just looked at the source and u235se+6 isn't correct for modinit.  modinit would be u235se+0

that however will always start with position 0, you need to get to U235SE_modinitpos, which unfortunately I haven't setup a branch to! doh!

 

Dirty hack for now :) if you modify the bra.s at the head of the binary blob to jump 1 word further it will go to modinitpos instead.  The code in the bin is:

 

start:
		moveq	#0,d0					; If modinit has been called the default song position will be 0
		
modinitpos::
U235SE_modinitpos::
		movem.l	d0-d7/a0-a6, -(sp)
		; If we were called by modinitpos then d0 should hold the desired position to start playing the song from
		and.l	#$ff,d0		

start is the label where the modinit call normally jumps to, if you modify that bra.s to jump to the movem.l after it, it will be hitting modinitpos and d0 will behave as you want.  I'll add this bug to the todo list for my next release.  Sorry for the cockup

  • Like 1
Link to comment
Share on other sites

  • 3 months later...

I think that the module player has some bugs, If I remove the play module call it works, but with the module player it hangs but not always on the same place, it's weird, and I've run out of ideas to find the bug.

 

Later I'll try with an older version.

 

False alarm... now it also hangs without the music, f*ck!

Edited by swapd0
Link to comment
Share on other sites

  • 3 months later...

There's  a typo in the docs. The value should be 10010010 = $92, isn't it?

 

Voice Status Register (U235SE_voice_status)

Represents the current sample processing status of each voice.  If a voice is currently processing a sample (even if that sample is silence), then its corresponding bit will be set.  If the voice is idle and has no sample to play then the bit will be clear.

For example, if there were samples playing on voices 1,4 and 7 only, then the voice status register would be $4a (binary 01001010 – remember voices start at 0)

 

  • Like 1
Link to comment
Share on other sites

19 hours ago, swapd0 said:

There's  a typo in the docs. The value should be 10010010 = $92, isn't it?

 


Voice Status Register (U235SE_voice_status)

Represents the current sample processing status of each voice.  If a voice is currently processing a sample (even if that sample is silence), then its corresponding bit will be set.  If the voice is idle and has no sample to play then the bit will be clear.

For example, if there were samples playing on voices 1,4 and 7 only, then the voice status register would be $4a (binary 01001010 – remember voices start at 0)

 

OOPS! Looks like I had a brain fart whilst I was writing that part :D  Cheers for the heads up (fixed).  Sorry not responding too quickly, very busy with work of late.

RE Crashes, the mod player does have bugs, but these are mostly around effect playback and not lockups.  Make sure the mod/samples are correctly aligned in your game, if the alignment is word and not long it can cause issues.

Link to comment
Share on other sites

On 3/17/2020 at 5:08 PM, swapd0 said:

I think that the module player has some bugs, If I remove the play module call it works, but with the module player it hangs but not always on the same place, it's weird, and I've run out of ideas to find the bug.

 

Later I'll try with an older version.

 

False alarm... now it also hangs without the music, f*ck!

 

Had a look in my backlog and there is an active bug in 0.24 that if there isn't a mod playing, the pad read/RNG doesn't run!

 

This may be related to the "hang" you are experiencing.  If you don't want to have music, a hacky work around would be to have a mod with a single blank pattern, no instruments and set this playing.  Also if you start and immediately stop playing a module, this works too. (thanks for update CJ)

 

I clearly need to update my testing to include situations where there is no music.  I've not looked into this bug further, but it will be fixed in the next release (whenever that happens :) )

 

Edited by LinkoVitch
Adding additional info
  • Like 3
Link to comment
Share on other sites

  • 3 weeks later...
On 3/17/2020 at 5:08 PM, swapd0 said:

I think that the module player has some bugs, If I remove the play module call it works, but with the module player it hangs but not always on the same place, it's weird, and I've run out of ideas to find the bug.

 

Later I'll try with an older version.

 

False alarm... now it also hangs without the music, f*ck!

Quick update for you and anyone else hitting this bug.  There is a patched version available now:

 

https://www.u-235.co.uk/se/files/u235se-2020-07-20.zip

 

This resolves the need to have a mod to use the pads/RNG

  • Like 2
Link to comment
Share on other sites

  • 2 months later...
  • 2 months later...

Hi LinkoVitch!

 

I've got a strange behavior and I don't know why... maybe it just me...

 

I can setup and play a module using those lines:

jsr         U235SE_initNTSC ; (or U235SE_initPAL)

 

    ; play some tunes   

    lea     title_mod,a0

    jsr     U235SE_modinit  

    move.l  #U235SE_PLAYSTEREO, U235SE_playmod

 

It works great but I can't stop the replay with this line:

move.l #U235SE_NOMOD,U235SE_playmod

 

Is there something obvious I don't see?

 

Thanks!

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...