22 June 2009, 15:36 | #1 |
Registered User
Join Date: Jan 2009
Location: Göteborg / Sweden
Posts: 25
|
extracting sampledata from P61
yo!
i am about to code some visuals which will change according to the volume of the tune playing (protracker/P61).. therefore i need to extract the amplitude of the sample currently being played on each channel.. how to i get a proper offset to the sampledata to update my amplitude-values each frame? i see there are 2 offsets defined for each channel-block but i guess those offsets are reffering to manual offsets using the 9xx-command and not the offset the player uses when playing the samples.. help will be much appreciated cheers! |
22 June 2009, 16:24 | #2 |
move.l #$c0ff33,throat
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,863
|
You can get the volume of each channel by reading P61_tempx+P61_Volume. x=0-3. Dunno if that's exactly what you need/want though and I can't test it either atm but it should work.
|
22 June 2009, 16:31 | #3 |
Registered User
Join Date: Jan 2009
Location: Göteborg / Sweden
Posts: 25
|
stingray: that is the volume specified in the patterndata, i am after the actual amplitude in the sampledata which is relative to the P61_Volume..
|
22 June 2009, 16:42 | #4 |
move.l #$c0ff33,throat
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,863
|
P61_tempx+P61_Sample will give you a ptr to the current sample. P61_SampleVolume should be what you need then I think.
Edit: or maybe not, might be it's just the base volume of the sample. |
22 June 2009, 16:55 | #5 |
Registered User
Join Date: Jan 2009
Location: Göteborg / Sweden
Posts: 25
|
yeah, it is the base vol of the sample..
P61_Sample points to the SampleBlock which has a pointer to the actual sampledata, what i want is an offset to that last pointer that points to the amplitude of the current played sample.. edit: basically what i want is the data that is needed to do stuff like the oscilloscopes in pt |
23 June 2009, 02:47 | #6 |
Moderator
Join Date: Nov 2004
Location: Eksjö / Sweden
Posts: 5,652
|
To make correct oscilloscope waveforms, you need to know
a) the address of the first sample byte played this frame b) the address of the sample byte that will be played last this frame, calculated from the current period Loops can make it even more tricky But loops are seldom close to 20ms, except maybe if someone uses tiny sawtooth samples and so on... Scale the range of sample bytes in X to fit the width of your oscilloscope, and scale the bytes in Y according to the current main-volume and instrument volume. That's the ambitious way, if you just want something decent, just get the address and show "width" bytes and scale them as you like. But only the chipset knows the current address, if you remove all loops and changes in period (pitch) in the module it's easier, but you still have to calc the address. Put a copy of the sample start address in a counter register where it's being copied to the chip registers and use the period and a formula from HRM to add a constant to the counter address each frame. |
23 June 2009, 13:21 | #7 |
Registered User
Join Date: Jan 2009
Location: Göteborg / Sweden
Posts: 25
|
@photon: makes sense.. thanks!!
coding the amiga would be 2x as nice if all those registers weren't read-only, its a bit like reinventing the wheel to spend rastertime (and freetime) on calculating values that the chipset already has access to.. well well, nothing comes free it seems |
26 June 2009, 10:00 | #8 |
Moderator
Join Date: Nov 2004
Location: Eksjö / Sweden
Posts: 5,652
|
Yeah, that would have been good.
Custom chips were rare and expensive then, every register cost money. It's not like now where you can have an FPGA with a gazillion gates and 1GB RAM for $60. I'm just glad they did such a great job of it, it was the early 80s and nobody else were into it. Even the big arcade PCB manufs (who made bejillions of dollars and could certainly afford to "chipset" their chunky sandwiches of hundreds of standard chips) sucked. Remember, it took the remaining staff at Atari 4.5 years to do a half as decent chipset. But Commodore just ... "WHAM! In yer face wannabes!". Awesome. |
28 June 2009, 09:51 | #9 |
Registered User
Join Date: Jan 2009
Location: Göteborg / Sweden
Posts: 25
|
that is very true for the a1000/a500 and the original amiga team.. but the chipset deserved more than it got from commodore over the years.. :/
|
01 July 2009, 01:04 | #10 |
Moderator
Join Date: Nov 2004
Location: Eksjö / Sweden
Posts: 5,652
|
Yeah, they should have gotten a chipset upgrade in early, I think. Like 8 pannable channels, twice as fast blitter, and the rest like A1200. If such a beast had been released early on, maybe software devs had jumped to compatible programming and HD installs sooner, and it would have wowed more people before the console invasion and kept the interest. Over 7 years from A1000 to A1200 is way too long.
If a machine like the above had come before 1990, I'd have upgraded and kept my interest A1200 was too little too late. (Sounds like a verdict easily said with the gift of hindsight, but I still think the Amiga was phenomenal, and certainly it was an achievement to make the A500 as cheap as it was.) |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Any way of extracting PC and ST images out of an FDI yet? | MethodGit | support.Other | 0 | 17 June 2012 20:45 |
extracting/mounting adfs | Twiggy | New to Emulation or Amiga scene | 15 | 22 December 2009 18:46 |
Extracting Wav Files | yugioh | Retrogaming General Discussion | 3 | 17 December 2008 09:11 |
extracting a trainer | Asle | Coders. General | 5 | 05 August 2007 19:25 |
Extracting .lzx files | oldpx | support.Apps | 6 | 29 April 2002 12:21 |
|
|