Jump to content
IGNORED

Music experience


karri

Recommended Posts

Music and the Lynx. A thread requested by Der Luchs.

 

ABCmusic was an attempt to write music in ASCII.

 

The problem was that it did not sound good. For some reason the math was wrong and everything was out of tune. But it may still have a future now as Chipper works as intended. Writing an ABCmusic frontend to the Chipper run-time would probably be fairly easy.

Link to comment
Share on other sites

Yes, that's what I need to work out - how to play two effects on different channels, when the first has already started playing. If you 'pause' sound playing on channel 1 and then start channel 2 it hangs, and I think its because of init code, but I've barely looked at it yet.

 

Looping is also something I could do with pointers on. I guess I could stick some asm in the sound file to update a flag at end end, and then poll that flag from main code but it seems there must be an easier way.

Edited by GadgetUK
Link to comment
Share on other sites

I believe that you have to stop the play on one channel before you play a new track on it.

 

void __fastcall__ lynx_snd_stop_channel (unsigned char channel);
void __fastcall__ lynx_snd_play (unsigned char channel, unsigned char *music);

 

Interrupting a channel and resuming is probably not possible.

 

One thing I would like to have is a good way to find out the beat of the music. The simplest way of doing this may be to have a beat counter that shares the sound interrupt and counts 1,2,3,4,1,2,3,4... in case of 4/4 music. This would allow to write music games like Bust a Groove from PSX. where you have to tap X or O at every 4 in the music.

Link to comment
Share on other sites

I believe that you have to stop the play on one channel before you play a new track on it.

 

void __fastcall__ lynx_snd_stop_channel (unsigned char channel);
void __fastcall__ lynx_snd_play (unsigned char channel, unsigned char *music);

 

Interrupting a channel and resuming is probably not possible.

 

One thing I would like to have is a good way to find out the beat of the music. The simplest way of doing this may be to have a beat counter that shares the sound interrupt and counts 1,2,3,4,1,2,3,4... in case of 4/4 music. This would allow to write music games like Bust a Groove from PSX. where you have to tap X or O at every 4 in the music.

 

 

Didn't see this until now, thanks very much, I will try this shortly!

 

Edited by GadgetUK
Link to comment
Share on other sites

I managed to get that working by compiling lynx-snd.s myself and adding headers into lynx.h, but...

 

I've noticed some wierd things, channel 1 and 2 work fine, but sounds I have on 3 and 4 do not play on real hardware - yet they are fine in Handy. Not sure if its a memory leak or something at this stage, it's very strange indeed.

Link to comment
Share on other sites

I think there's a bug or something somewhere, it's behaving very oddly. I've ruled out memory leaks in my code, its the same version out there already (0.9) albeit with version number incremented and a couple of minor changes which I know are OK. In Handy all 4 channels work fine for sounds. On the Lynx 2 channels 2 and 3 do nothing - nada, not even a click, yet channels 0 and 1 are fine. I changed the code back to stop all channels and just play the sound on one channel and sound effects work again, but obviously only one at once. I even went as far as removing the pattern enviros that proceeds each sound effect (basically because channels have already been init with same settings):-

 

;ENVIROS:

;SETPLAYERFREQ $9D,129

;DEF_VOLENV 2,TREMOLO_1

;SET_STEREO $00

;SET_ATT_ON $FF

;DELAY 3

;RETURN

 

 

 

That made no difference at all.

 

This is the code:-

 

lynx_snd_stop_channel:

tax

lda SndActive,x

_IFNE

dec SndReqStop,x

lda #1

sta SndDelay,x

stopc1: lda SndActive,x

bne stopc1

_ENDIF

rts

 

Does anyone else have the lynx_snd_stop_channel function available to them to test? I am not sure if its something to do with that SndActive flag being wrong for some reason. I tried checking the

_lynx_snd_active result earlier and it was always 0.

Link to comment
Share on other sites

I've sorted it - woohoo!!!

 

If you stop music or sounds earlier using the lynx_snd_stop(), you 'may' get problems later when stopping and starting individual channels.

 

After I stop the title music I now re-init the sound engine:-

 

lynx_snd_init();

 

Then it works fine on actual hardware. Strange how it works in Handy but then again since when was Handy sound emulation very accurate ;)

  • Like 1
Link to comment
Share on other sites

Looping is also something I could do with pointers on. I guess I could stick some asm in the sound file to update a flag at end end, and then poll that flag from main code but it seems there must be an easier way.

 

indeed. Its called "DO" and "LOOP"

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...