Author Topic: MML: What are people's actual complaints with the damn thing  (Read 7437 times)

Bonknuts

  • Hero Member
  • *****
  • Posts: 3292
Re: MML: What are people's actual complaints with the damn thing
« Reply #120 on: December 11, 2016, 05:27:43 AM »
Folks, can we all get on the same page with music-theory?  :-k

Tempo is the basic timing for a tune, it says how often a "beat" happens per second.

A "note length" is just a way of specifying relative (and not absolute) timings for events, so a note, a 1/2 note, a 1/4 note, or the wonderful British names, a semibreve, a minim and a crotchet.

These are further modified by having "dotted" notes that adds another fraction of the note to the lengths.

See https://en.wikipedia.org/wiki/Note_value
See https://en.wikipedia.org/wiki/Tempo

The point is ... the note lengths specify time relative to other note lengths, and NOT in terms of absolute fractions of a second.

It is the time-signature and tempo that define the link between the note length and absolute time in beats-per-minute (BPM).

A "beat" is commonly defined as 1/4 note (especially in videogames), but that isn't an absolute rule.

But I'll use that 1/4 note = 1 beat convention for the rest of this.

Once you realize that note length are just a notation for relative time, you can see that changing the tempo (BPM) is just another way of saying that you're changing how long a 1/4 note is.

Here are the common "conventional" timings for running a music-driver on a console/old-computer ...

NTSC

Base Tempo = 5/60s per 1/16th  = 20/60s per 1/4 note  = 180.0 bpm  (60 * 60/20)
Base Tempo = 6/60s per 1/16th  = 24/60s per 1/4 note  = 150.0 bpm  (60 * 60/24)
Base Tempo = 7/60s per 1/16th  = 28/60s per 1/4 note  = 128.6 bpm  (60 * 60/28)
Base Tempo = 8/60s per 1/16th  = 32/60s per 1/4 note  = 112.5 bpm  (60 * 60/32)
Base Tempo = 9/60s per 1/16th  = 36/60s per 1/4 note  = 100.0 bpm  (60 * 60/36)

PAL50

Base Tempo = 4/50s per 1/16th  = 16/50s per 1/4 note  = 187.5 bpm  (60 * 50/16)
Base Tempo = 5/50s per 1/16th  = 20/50s per 1/4 note  = 150.0 bpm  (60 * 50/20)
Base Tempo = 6/50s per 1/16th  = 24/50s per 1/4 note  = 125.0 bpm  (60 * 50/24)
Base Tempo = 7/50s per 1/16th  = 28/50s per 1/4 note  = 107.1 bpm  (60 * 50/28)
Base Tempo = 8/50s per 1/16th  = 32/50s per 1/4 note  =  93.8 bpm  (60 * 50/32)



The table above shows that you can achieve a number of different "tempo" settings and still run your music driver in the vsync interrupt.

It also shows that speeding-up a tune (i.e. in a boss-attack) just involves changing the delay-per-quarter-note.

That's how games used to do it ... not by changing the number of times-per-second that the music driver was called!!!  :roll:

***************************

Now, practically, in videogame music-drivers, the programmer has to make a decision about how to encode the note-lengths.


The simplest choice is just to use the tune's BPM to calculate the length of a note (in terms of 1/60s aka the number of "calls" to the music-driver) when you build the game.

For example, on an NTSC console (i.e. America/Japan and the PC Engine), if your tune is playing back at 128 BPM (which is your closest approximation for 120 BPM), then you'd store the length of a quarter-note as "28", meaning that you call the music-driver 28 times before the next note (see the table above).

That's the fastest-to-process when playing back the music, but it means that you can't easily change the tempo during playback.

Once the timing is baked into the tune data like that, the only way to change the tempo is to change how often the music-driver itself is called per second.

Now, most games do NOT change the tempo during playback, and so that's a common way to store the note-lengths.

The System Card Player can store tune data in this way, and it calls it the "Direct" length mode.

This appears to be the method that Arkhan and TheOldMan have chosen to use for Squirrel, and it's why they can't change the tempo of a song without changing how often the Squirrel Player is called per second.

It is not the only way to encode tune data, and it is not even the only way that the System Card Player supports.


Another way to store the length of a note is to store it in the original terms, for-example the length as a number 1..16 in terms of 1/16th notes, or the number 1..32 in terms of 1/32nd notes.

If you do things this way, then you can trivially change the tempo during playback by changing the length of 1/16th note from being 7/60s (a delay of 7 calls to the music-driver), to 5/60s or 8/60s.

The System Card Player can also store tune data in this way, and it calls it the "Time Base" length mode.

This is how most games work that change the tempo during playback.

This is also effectively how most trackers work, if they allow the musician to set the delay-time for each row/line in the pattern.

If you consider each row/line as the time of 1/32nd note, then you can get all of those 4, 5, 6, 7, etc 1/60s timings just by changing the delay times of even and odd rows/lines.

Deflemask does this, for example, when you to set the "Speed" to 4 & 3 ticks for the even/odd rows, resulting in 4+3=7 1/60s ticks per 1/16th note ... for 112.5 BPM (close-enough to a nominal 120 BPM).

One issue with using the System Card Player in this way is that it only stores notes in multiples of 1/16th note, which means that it cannot play 1/32nd notes without resorting to doubling the tempo and calling the driver twice-as-often (i.e. 120 times-per-second).

That's a limitation of the System Card Player's encoding of the tune data ... trackers don't have the same issue.


The System Card Player supports one one final way of storing the tune data, and that is to store the note length in terms of multiples of 1/64th of a note, then multiplied by 3. It calls this the "Tempo Method" length data. For this to work, the System Card Player *must* be called from a timer interrupt where the driver changes the length of the timer depending upon what BPM tempo you want to play back the music at.

The downside of this is that the more times you call the music-driver per second, the more CPU-time you're throwing away.


Hopefully that's all reasonably clear.  :pray:

 Ok. We're on the same page. This is exactly how I know music engines on 60hz to work.

elmer

  • Hero Member
  • *****
  • Posts: 2153
Re: MML: What are people's actual complaints with the damn thing
« Reply #121 on: December 11, 2016, 06:02:02 AM »
PS: I like the wall of text :D

Me, too ... I certainly write enough of them!  :wink:


I can't define the tempo. Tempo is how fast the song plays (not how fast the irq tick is). If a song is at 120 BPM ( a popular tempo), that means it plays 120 whole notes in 1 minute. Or 20 in 1 second.

See my message above on the basic theory.


I -can- define how  many down counts are used before the psg player is called. So yes, in 1 second I can get as many calls as
needed. But I still only get 1 call per group of counts.
In order to change the *tempo*, I have to change the counter limit, which the psg player does, by changing the timer interval.

See my message above on the basic theory.

Your "problem" as-such is that you're hard-coding the note-length in Squirrel, either as "Direct" mode or as "Tempo" mode (which are basically, from a programming POV, the same thing).

By doing that, then "yes" you need to change the timer interval in order to change the tempo.

That's a design-choice that you guys made with Squirrel ... it's not a limitation of the System Card Player, or a basic limitation of other music-drivers.

So, in "practical" terms, I do see where you're coming from.


How would you deal with interrupts in such a situation? (Remember we are getting 6991 of them every second) There's no guarantee that
an irq won't occur while the player is updating. Do those interrupts count towards the next psg call?
And at 6991 timer irqs / sec, do we even have enough time to handle this? And run a game? At 60 fps?

Those are the things I don't understand about how this would work. (And keep in mind, irq problems are a real thing, as rovers problem shows)

The whole point of any well-designed interrupt scheme is to keep the interrupt handling predicatable and usually short and fast.

Handling interrupts from within other interrupts just requires a careful design.

Bonknuts gave the basic code for a timer interrupt for handling the 6991Hz sample playback and music-driver calling.

Yes, interrupts need to be counted if you were to run a sound driver from a timer IRQ at the same time as you were outputting samples with the same IRQ.

For example ... take your 120 BPM.

120 BPM, with a beat being 1/4 note, and using the PSG Player's convention of 48 calls per 1/4 note, means that you'd want to call it 96 times per second.

With a 6991Hz timer interrupt, that means that you'd call the PSG Player once every 6991/96 = 73 timer interrupts ... which would give you an actual rate of 119.7 BPM.


*IF* you are limited to -only- vsync, 1/32nd notes are impossible. They require a fraction of a frame. But, if you use the timer irq, you can update at  less than 1 frame. That was the point.
So the timer -is- needed. And without using the timer, There's no way to get 1/32 notes.

You can do then in the System Card Player by using the Direct length mode of encoding the data stream, and setting the time to 3 or 4 ticks at 1/60th and 128 BPM.

But then you lose the ability to change the Tempo, and you'd have to worry keeping track of the overall time.

That's a limitation of the operation of the System Card Player, deflemask is quite happy to do them, taking either 3 or 4 ticks at 128 BPM using a 60Hz update.


(And. as an aside, 1/32 notes are possible to play in the player. They just take 1 tick, instead of the 1.5 they should be,
causing them to de-sync. Which is probably why they aren't supported. And how we found the trick below, thanks to a bug in squirrel during development.)

Sure, call the System Card Player at 120Hz, and suddenly you have a 7/120ths instead of 3.5/60ths.

Computers like integers!


How would you deal with interrupts in such a situation? (Remember we are getting 6991 of them every second) There's no guarantee that an irq won't occur while the player is updating. Do those interrupts count towards the next psg call?
And at 6991 timer irqs / sec, do we even have enough time to handle this? And run a game? At 60 fps?

Of course another interrupt would occur while the sound driver was doing it's slow processing.

That's fairly easy to handle, and "yes", of course you have to keep counting the timer interrupts while the sound driver is processing.

As for whether there would be enough time, Bonknuts has already said that single-channel 7KHz sample playback takes approx 11% of the CPU cycles.

So there's time ... it's just that even trying to do a countdown like that wastes 928 cycles per frame for the dec-zero-page+branch instructions.


Which is part of the reason I was asking about running it from HSync.
*IF* it can run off of hsync...
1) you could do a quick sample update  (lda  [samples],x / sta )
2) it would be at a decent rate (15 Khz, right?)
3) It could be hooked in via the user hsync hook.

You could do that, but you've just doubled the CPU cost for those samples, and the hsync processing is slower anyway, which costs even more cycles.


Quote
The question is ... is the System Card Player, and the IRQ handling in both the System Card and HuC smart enough to handle not only timer-followed-by-vblank, but also vblank-follow-by-timer???
For the player, it is. Once the player starts processing, it locks itself out from further calls until it is done.

Yes, but that's not the problem that I'm worried about. The problem is "what happens if the vsync interrupt triggers, and then the timer interrupt triggers one scanline later on".

Is the entire vblank interrupt processed with interrupts disabled?

If so, then you're delaying interrupts for a long time, and introducing a delay/error in the sample playback.

If not, then a timer interrupt can occur with a complete call to the sound driver, which would delay the time-critical processing that's going on in the vblank.

It all depends upon just how much stuff is being processed in the vblank interrupt.

TheOldMan

  • Hero Member
  • *****
  • Posts: 958
Re: MML: What are people's actual complaints with the damn thing
« Reply #122 on: December 11, 2016, 09:57:41 AM »
Elmer:
 Got it. I'm not sure if the mml compiler supports "Time base" mode or not (that's the packed format, iirc). In any case, you would need as assembler call (and knowledge of where the variable is at) to do tempo changes that way from HuC. Something the psg bios doesn't (natively) have, afaik.

So, here's what I think I'm gonna do:
I already have the patch in to add the underscore to the register name. I haven't exhaustively checked it yet, but I'm fairly confident it works.
I'll 'extend' the MML parser, so that upper-case notes will be direct mode, while lower case notes will be time-base mode (which will have the happy side-effect of allowing for shrinking the output).
I'll probably add a simple psg-bios call to change the time base.
Then we can start discussing in detail how to alter the timer/hsync irq to get things working right for samples.

One question for you and tom, though. How much worse will mapping alternate pages make the timer stuff?  IF we add sample support, I believe it's going to need extra space for the samples; some of them are going to be quite long, and the mml player is currently limited to 2 pages. Sort of. (That's a whole different discussion.)

..........................
Tom:
 You're the only leftover hardware guru afaik. Do you know when the hsync irq actually occurs? Is it at the end of the active scan-line display (ie, start of the back porch), in the middle of the hblank area, or at the beginning of active display?
More specifically for what I'm thinking: How long do I have between an hsync irq triggering and the actual start of active display? The entire hb;ank period, or 0 cycles?

...........................
Everyone else:
 Stay tuned. This could get interesting, and we may actually hash out how to add samples to the psg player.....

Arkhan

  • Hero Member
  • *****
  • Posts: 14142
  • Fuck Elmer.
    • Incessant Negativity Software
Re: MML: What are people's actual complaints with the damn thing
« Reply #123 on: December 11, 2016, 10:26:25 AM »
I would like to think/assume we're all on the same page with music theory, and are maybe misspeaking/typing due to wall-of-text/excited/not proofreading, lol.

Am I the only one here with a real music background, out of curiosity?  (I minored in music.  I've been doing music theory / lessons / crap since I was a kid).

I'll openly admit I get all jumbled up with regards to implementing these sort of things on goony old machines though, since fractions piss me off.


Nope, with the System Card Player, vsync does support changing the tempo. You've just got to encode the note length data in the "Time Base" length mode.

Doing so comes with the limitation that you can't specify 1/32nd notes, but that wasn't seen as a show-stopper problem by the programmer that wrote the driver, or by Hudson apparently.

Now, if your Squirrel compiler doesn't support that mode, then that's your choice.
IIRC, the CD version will work fine with the vsync stuff.  I can't remember though because I haven't touched the CD PSG stuff since Pyramid Plunder.   

It's the HUCARD version that for sure won't.   That's the pain in the ass I spoke of.  We're all aware that the capability does actually exist.  Hell, it's in the documentation in Develo, Hu7, and some notepad file IIRC.

but some of that stuff we did could be wrong.  As stated, we did this stuff by experimenting and looking around.  If we did something wrong, nobody is exactly there to correct it. 

It definitely did what was needed to make music in 4 games, though.  So it can't be too far off if some of the timing and such isn't implemented "how games used to do it *insert eyeroll here*"

also, those britspeak words for musical things are so dumb.  I always hated those in music classes.  We all made fun of them, and put on British accents and acted like a$$holes.

Can we agree to not use them anymore in these forums?  lolol

I don't know about anyone else but semi quaver cross stitch tea and crumpet demi semi loopdeedoo whatever just sounds like nonsense.

:)

now I just need to convince OldMan to not use case sensitivity in MML.  we need a better way to do that.


at least we've got the sample-ideas stirring again.  the idea came up awhile ago, there was no time to do it, we got sidetracked,  (and it was still barely important), but now would be a good time to worry about it.



EDIT:  Oh btw: Squirrel already has things for modifying the timebase, but they might not be right (that's what the ^D# commands do).

So, instead of adding something, we probably just need to look at what is already there. :)

« Last Edit: December 11, 2016, 12:11:58 PM by Arkhan »
[Fri 19:34]<nectarsis> been wanting to try that one for awhile now Ope
[Fri 19:33]<Opethian> l;ol huge dong

I'm a max level Forum Warrior.  I'm immortal.
If you're not ready to defend your claims, don't post em.

Gredler

  • Guest
Re: MML: What are people's actual complaints with the damn thing
« Reply #124 on: December 11, 2016, 12:41:57 PM »
Hell yeah let's make that cat purr with sampled sfx :P

elmer

  • Hero Member
  • *****
  • Posts: 2153
Re: MML: What are people's actual complaints with the damn thing
« Reply #125 on: December 11, 2016, 12:57:42 PM »
I'll probably add a simple psg-bios call to change the time base.

That would be a "questionable" thing to do unless you make a whole bunch of other underlying changes.

The capability that's in the System Card Player is pretty-obviously to allow for tunes themselves to speed up ... i.e. you bake the command to change the Time Base into the tune data, so that the 2nd repetition of the loop is faster than the 1st, and the 3rd faster than the 2nd, and so on.

If you do it externally, you're going to have problems with channels losing sync because you change the Time Base while some channels are still playing notes with durations calculated using the old Time Base.

You'd have to sync any change to the start of a measure (or whatever the musical folks want to call it) when you retrigger every channel on the same frame.

P.S. trackers don't have this problem!


Everyone else:
Stay tuned. This could get interesting, and we may actually hash out how to add samples to the psg player.....

It's a race!  :wink:

My sound driver is now re-written in 6280 assembly language, and the next step is to implement some GameBoy emulation features on the PCE (just so that I actually have tune data to test it with).

BTW ... this is a chance to say just how wonderfully *nice* Hu6280 assembly language can be compared to the Z80-ish that the GameBoy uses.

The GameBoy code is hideous in order to deal with some of the limitations of its not-actually-a-Z80 processor, where the Hu6280 code is simple and readable.

Arkhan

  • Hero Member
  • *****
  • Posts: 14142
  • Fuck Elmer.
    • Incessant Negativity Software
Re: MML: What are people's actual complaints with the damn thing
« Reply #126 on: December 11, 2016, 03:33:15 PM »
”simple and readable" to an extent, due to 6502isms.

:)

I don't think OldMan intended to do what you think with regards to changing the time base.   Maybe he does.  I don't know, lol.     As I said, we already support time base commands when setting up channels, but the tempo/vsync stuff may not be there, or right.  I am thinking we might not be as far off as we think, though, in terms of work.


Now, isn't the reason a tracker avoids this issue because of the fact that the tracker style tends to sort of "lock" things together, so everything is running simultaneously?

I'm not sure on the technical way of explaining that.  Things are sort of guaranteed and synced up.

EDIT: Also, should I envy you old goobers and your copious amounts of free time ?   I try to slot out free time so I can get Inferno/etc. done, and still PLAY games.  My backlogs kind of falling out of a cabinet right now.   -_-;

[Fri 19:34]<nectarsis> been wanting to try that one for awhile now Ope
[Fri 19:33]<Opethian> l;ol huge dong

I'm a max level Forum Warrior.  I'm immortal.
If you're not ready to defend your claims, don't post em.

Bonknuts

  • Hero Member
  • *****
  • Posts: 3292
Re: MML: What are people's actual complaints with the damn thing
« Reply #127 on: December 11, 2016, 04:15:06 PM »
GBz80..wooh.. no good. I haven't written GBz80 in a long time, and I have recently looked back on it - yeah, no. To a lesser extent, real z80 too. When I code on the z80, and GBz80, I feel restricted by the force use of smaller register-register operations (and 90% of them still have to be done through one reg: "A" reg). I miss the direct memory access of the 65x, and the labels you get to use (keeping everything in regs instead of direct memory with labels, made the code harder to read IMO).

 Old Man: From what I remember my tests showing me, when the VDC transitions from "hsync" (or more accurately; the period/window where the VDC waits for VCE to trigger it to move onto "back porch" area) to the actual blanking line (blanking level), is when the VDC will generate an interrupt for the cpu. You can test this, because while the VDC is setup for a "waiting window" for the VCE to trigger it, the VCE trigger itself ALWAYS moves the VDC back to "front porch" area - no matter where it is in the scanline (the VDC's front porch, which when unaligned is not always the VCE's front porch). This is how you can get the VDC to show two individual lines of graphic data on the same VCE NTSC line. Does this make sense?

Maybe this pic will help:


 The VDC enters a mode where it waits for the VCE to trigger the start of the next scanline. In the pic, that would be the "sync tip" area. And where you see the line going back up to 0 IRE, that would be the position in VDC "world" where the H-interrupt is generated. That "sync tip" is what the VDC manuals refer to as "horizontal sync pulse width". But since the VDC is in subordinate mode (requiring external interrupts to provide the image frame work), this is just a wait delay. It's set in segments of 8 "VDC" pixels wide, but if the VCE trigger in the middle it, then the VCD immedialely transitions into the next phase. So it's not going to actually be 8 pixels long. You could set it to be 24 pixels long; it won't matter. The VDC also immediately reads the X and Y position buffers and works out the logic for how to process the current line (sprites positions, BG positions, etc). I doubt you'd be able to get a fast enough routine to update these regs in time anyway, so that's why changes to regs happen on the following line. That way, if the H-int routine gets delayed then it should be affected. But that all depends on how close the reg updates happen relative to the start of the H-int routine. 

tl;dr: H-int happens at the very start of the back porch, when sync level goes to 0 IRE (right before the color burst in the pic). And if I remember correctly, the VCE adds a 8 pixel delay from what the VDC is displaying to what you actually see on screen. But that probably shouldn't effect what you're doing unless you're trying to change VCE regs per scanline.

 It's a little bit confusing in understanding the VDC in relation to the VCE. The VDC on the PCE doesn't generate hsync pulse or the color burst area, because it's in subordinate mode, but the regs will always be setup as if you're defining a real line. So I used the term "back porch" to keep things relative in talking about where in the line stuff happens on the VDC.



 So, I didn't really follow along of what you're trying to solve. What timing issue are you trying to work out?

TheOldMan

  • Hero Member
  • *****
  • Posts: 958
Re: MML: What are people's actual complaints with the damn thing
« Reply #128 on: December 11, 2016, 05:06:31 PM »
Quote
So, I didn't really follow along of what you're trying to solve.

Not a timing issue, yet. I'm trying to get a feel for how quick and hsync routine would have to be to avoid the active display area.

So, if I'm understanding it correctly, I have about 5us after hsync before color burst and active display....That's gonna be tight.
......................................
Edit:  My bad. I misunderstood. I had to go read it about 3 more times before what was where on the diagram clicked.

Hsync is gonna be triggered after the color burst, and very shortly before active display starts.
That actually explains some of the color tearing i've seen.

Thx.
« Last Edit: December 11, 2016, 05:22:22 PM by TheOldMan »

elmer

  • Hero Member
  • *****
  • Posts: 2153
Re: MML: What are people's actual complaints with the damn thing
« Reply #129 on: December 11, 2016, 05:24:11 PM »
Now, isn't the reason a tracker avoids this issue because of the fact that the tracker style tends to sort of "lock" things together, so everything is running simultaneously?

I'm not sure on the technical way of explaining that.  Things are sort of guaranteed and synced up.

The whole "pattern" abstraction with its even and odd 1/32nd-note rows does make it visibly-clear exactly how each of the channels are synced up to each other, and forces the musician into placing notes in such a way that the "patterns" that run on different channels never go out-of-sync (which *can* be a problem with MIDI-to-MML).

But ... IMHO, at the end-of-the-day, it's really just a case of when the "note length" values get converted into ticks (i.e. the number of 1/60s music-driver calls before the next note).

The standard music-driver convention (which I believe that the System Card Player follows), is that you calculate the length of a note as-soon-as you see that note on the stream of data (i.e. what the MML gets converted into so that the System Card Player can understand it).

That means that if you change the Base Time, i.e. the number of music-driver calls per 1/16 note, then the next note that you process on a different channel will see a different multiplier, and calculate a perfectly-correct delay count for it's own channel, but the other channel with the old note will drift out of sync by a few frames.

Repeat that enough times and it's all going to sound like cr*p.

The "tracker" model gets around this by redefining a note length as a certain number of rows/lines.

That way, the number of 1/60th ticks delay that each row/line takes up can change at any time.

From a programming POV, it's using 2 counters per note (1 for Base Time, and 1 for # rows) instead of a single counter in the traditional model.

That has its cost in processing terms ... but it's a tiny cost, and the flexibility that you gain from it is well-worth-it (IMHO).

Of course ... as a programmer, you'll realize that you can do exactly the same thing with MIDI or MML data that's converted into a command-string format and fed into some music driver, just like you do with the System Card Player ... but the actual System Card Player itself doesn't support that particular abstraction.

It's another thing on the (long) list of reasons why the System Card Player (and therefore the Squirrel Player) need to be taken out back behind the wood shed and put out of their misery.

I have no vested-interest in what data-format my music-driver plays (except for absolute-efficency).

Converting Deflemask files is no easier (or more difficult) than converting MIDI or MML files.

A "sane" music-driver uses some form of "processed" version of the tune data that is totally-optimized for it's own capabilities and the target platform.


EDIT: Also, should I envy you old goobers and your copious amounts of free time ?   I try to slot out free time so I can get Inferno/etc. done, and still PLAY games.  My backlogs kind of falling out of a cabinet right now.   -_-;

Being as-old-as-the-hills has to come with some (pitifully-few) advantages!  :wink:


I miss the direct memory access of the 65x, and the labels you get to use (keeping everything in regs instead of direct memory with labels, made the code harder to read IMO).

That's the issue, exactly!  :)

It's the difference between sta mz_volume,x, where "X" is the channel number, and the GBZ80 code that's full of ld hl,sp+VOLUME and ld (hli),a instructions, with very, very, very careful ordering of the variables in order to keep on using the (hld) or (hli) addressing modes for speed.

It's practically undecipherable except for the idiot that wrote the mess in the first place!  ](*,)

The Amiga and ST versions are much clearer (with the ST version supporting sample-playback), but I chose to work from the GameBoy version because that was the final version of the code.

Strange to be revisiting such old code and re-targeting it to a new platform!


So, I didn't really follow along of what you're trying to solve. What timing issue are you trying to work out?

Hahaha!  :lol:

That's one brilliantly OCD post full of wonderful information, before finally getting around to the "what was your question, again?"  :wink:

I *think* that the information that TheOldMan is looking for is that the hsync timing doesn't really matter very much.

The VDC chip make copies of the scroll-registers that it will use for the next line of video at the start of an hsync, and doesn't read them again until the start of the next hsync.

So you actually set the hync interrupt to trigger on the line *above* where you want to change the scroll value, and then you have an entire scanline (433 cycles) to set the new scroll values before the VDC reads them again to set them for the next line that it's going to display (and where you want the actual scroll region to change).

The PCE is not like a lot of the old home-computers where you absolutely-must change the scroll-register values *during* the few microseconds of the hblank.

Arkhan

  • Hero Member
  • *****
  • Posts: 14142
  • Fuck Elmer.
    • Incessant Negativity Software
Re: MML: What are people's actual complaints with the damn thing
« Reply #130 on: December 12, 2016, 05:39:57 AM »
Some MML playing engines (I think Squirrel might.  if it doesn't, it should.) also support a different tempo for each channel.

I seem to recall messing around with it once.   It's not a common thing to want to do and really is for when you do SFX on a channel, or when you want to do arps or weird effects on a channel.

You can crank the tempo through the tits and get stranger sounds while the rest of the song plays at a tempo that is conducive to coherent music.

I'll have to see if it was Squirrel that was also doing that, or if that was around when I started Inferno and was doing this on MSX.

I think though, that with a little bit of fiddling around, Squirrel will be able to do some new things.

It hasn't exactly been touched or updated since before Atlantean.  The last time it was updated was for Pyramid Plunder. 
[Fri 19:34]<nectarsis> been wanting to try that one for awhile now Ope
[Fri 19:33]<Opethian> l;ol huge dong

I'm a max level Forum Warrior.  I'm immortal.
If you're not ready to defend your claims, don't post em.

Bonknuts

  • Hero Member
  • *****
  • Posts: 3292
Re: MML: What are people's actual complaints with the damn thing
« Reply #131 on: December 12, 2016, 05:50:28 AM »

Hahaha!  :lol:

That's one brilliantly OCD post full of wonderful information, before finally getting around to the "what was your question, again?"  :wink:

 In my defense, I had a 14 page ethnographic paper I was trying to get done in order to turn it in by mid-night on Sunday. So I had a number of glasses of alcohol to get things.. flowing.  :-"

elmer

  • Hero Member
  • *****
  • Posts: 2153
Re: MML: What are people's actual complaints with the damn thing
« Reply #132 on: December 12, 2016, 06:12:27 AM »
To play a sample via writing to a single DDA channel, at 6991 calls per second, takes 11% cpu resource. It's 5% if no sample is playing (just down counting).

I take it that you have a timing setup in place.

Are you able to run a simple 6991Hz timer IRQ and tell us what the CPU cost (in cycles-per-frame) of the basic IRQ overhead?

That's on a HuCard, with a direct hardware vector (at $FFFA) to this IRQ routine ...

tirq_null:      stz     $1403                   ; 5
                rti                             ; 14


Arkhan

  • Hero Member
  • *****
  • Posts: 14142
  • Fuck Elmer.
    • Incessant Negativity Software
Re: MML: What are people's actual complaints with the damn thing
« Reply #133 on: December 12, 2016, 06:41:11 AM »
Why do you have ; 14 for the cycle count of RTI? 

I thought it was like 6. 

6502.org says 6.  ArchaicPixels says 7.   

Where did 14 come from?
[Fri 19:34]<nectarsis> been wanting to try that one for awhile now Ope
[Fri 19:33]<Opethian> l;ol huge dong

I'm a max level Forum Warrior.  I'm immortal.
If you're not ready to defend your claims, don't post em.

elmer

  • Hero Member
  • *****
  • Posts: 2153
Re: MML: What are people's actual complaints with the damn thing
« Reply #134 on: December 12, 2016, 07:01:31 AM »
Where did 14 come from?

It came from the IRQ example code that bonknuts posted ... I was too lazy to look it up.

Yep, it's listed as 7 cycles in my docs.

Perhaps the other 7 cycles are the cost for the IRQ itself? If so, that would be the information that I'm looking for!