05 January 2021, 23:01 | #1 |
Registered User
Join Date: Nov 2019
Location: Croydon
Posts: 580
|
Load Protracker file in Blitz?
Is there any free code out there to be able to load a protracker file in Blitz?
I'm not looking for player code necessarily, but something that can take a protracker file as input, load its samples in memory and access its sequence, but not necessarilty play it. I guess as such it should not have any assembler in it to do this unless it is impossible to do without assembler. I'm trying to make some analytics. |
06 January 2021, 01:37 | #2 |
Gets there in the end...
Join Date: Sep 2005
Location: Wales
Posts: 862
|
If you're not looking to play it you could load it into a bank?
http://eab.abime.net/showthread.php?t=61648 |
06 January 2021, 15:41 | #3 |
Registered User
Join Date: Nov 2019
Location: Croydon
Posts: 580
|
That seems a bit crazy, is there really no protracker player source?
I know exactly what data I want to get out of the file for my analysis, I don't need to plonk the whole module in RAM and then read memory addresses. |
06 January 2021, 18:58 | #5 |
Registered User
Join Date: Nov 2019
Location: Croydon
Posts: 580
|
Hold on a second, will have to say I am a total Blitz noob first to not get hammered :P
Now, I was reading again through the Blitz manual and I see Blitz already has a way to load MODs and MEDs into your program. I also see you can load a sample from disk, and create sound data, but I cannot see how you would access the data loaded by LoadModule or LoadMedModule directly. Would Bank allow me to do what I want? I want to: - read module name and display it - read sample name and display it - create sound object from sample data loaded by module - play that sound object ? |
06 January 2021, 19:35 | #6 |
Gets there in the end...
Join Date: Sep 2005
Location: Wales
Posts: 862
|
Haha no hammering here. I'm a noob when it comes to many things Amiga. I had fun trying to access modules. At one point I was loading them into a bank , saving them to RAM and then loading them using the player code!
I don't think the built in commands give you much access to the mod data itself. At least the PHXplayer loads into banks and plays from there meaning you can peek and poke whatever you want and still play it. 1 and 2 definitely. 3 not so easily as I don't think you can play a sound from a memory location in Blitz using Blitz commands normally. A botch could be to add a pattern with the sample you want to play triggered and then jump to that pattern when the mod is played... not an elegant solution and there may well be a better answer. |
06 January 2021, 20:41 | #7 |
Registered User
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,334
|
To play a sound, once you know where in memory it's stored, you could create a dummy sound object and either copy the data into the object, or modify the object's pointer to point at the data. It's unlikely the sound data will be in the Blitz internal sound object format, so you might need to do some basic decoding and manually set the other parameters in the sound object structure. You can see the sound object structure here: http://www.amigacoding.com/index.php...ct_types#sound and include the definition in your code by adding the bb2objtypes.res resident file to the compiler options.
|
06 January 2021, 21:03 | #8 |
Gets there in the end...
Join Date: Sep 2005
Location: Wales
Posts: 862
|
You see, that's a much more proper way of doing it.
|
07 January 2021, 00:44 | #9 | |
Registered User
Join Date: Nov 2019
Location: Croydon
Posts: 580
|
So how to know where the sample data will be at?
Would loading the MOD file as a Bank as Coagulus mentioned work? The Protracker MOD file format is well documented and if I can put the MOD file at a certain memory location, offsetting from there should be kinda trivial. Can this be done with LoadModule or LoadMedModule at all? Do I need to include PHX's routine at all if all I want is to load the sample data in memory and then play it off using regular Blitz sound procedures? As for the sound data itself, wouldn't using the SoundData procedure be good for this? The manual says "altering IFF sounds is OK" but doesn't detail how. Oh, seems like DecodeSound might be what I need to use, actually. Thanks both for your valuable help (and Dastardly for the Blitz wiki on Amigacoding, been reading all day ) Quote:
|
|
07 January 2021, 17:29 | #10 | |||||
Registered User
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,334
|
Quote:
Quote:
Quote:
Quote:
Quote:
|
|||||
08 January 2021, 15:32 | #11 |
Registered User
Join Date: Nov 2019
Location: Croydon
Posts: 580
|
|
08 January 2021, 15:57 | #12 |
Registered User
Join Date: May 2001
Location: ?
Posts: 19,644
|
Well this is wild, I'm looking to do something similar here, will be reading up on this thread. Thanks to all.
|
12 January 2021, 22:41 | #13 | |
Registered User
Join Date: May 2001
Location: ?
Posts: 19,644
|
Quote:
Document says "allows to include sounds inside code", but I am assuming this is if you incbin an iff file? So DecodeSound would be useless in this scenario, and SoundData is exactly what you'd want to use. Please correct me if I am wrong. |
|
13 January 2021, 10:30 | #14 |
Registered User
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,334
|
Ah, that's a good point actually (I haven't tried it myself) - DecodeSound probably does expect an IFF header on the sound data that the Protracker file doesn't contain. Apologies!
Some additional manual interpretation of the ProTracker format is needed then, so you can get the necessary details from the file and manually copy the sound data over to a new sound object. |
13 January 2021, 17:38 | #15 |
Registered User
Join Date: May 2001
Location: ?
Posts: 19,644
|
I just realized that this could easily land into a memory nightmare because DecodeSound would make a copy of the sample data into a new sound object, so you'd need a lot more RAM than the module takes just to be able to do this.
Unless there's a way to make the sound objects just reference the sound data via a pointer instead of having the actual sound data in them... |
13 January 2021, 17:42 | #16 |
Banana
Join Date: Jul 2016
Location: Darmstadt
Posts: 1,213
|
You can create a pointer to a sound type and point it to the memory address. Getting the syntax right will be the tricky bit...
|
13 January 2021, 19:24 | #17 |
Registered User
Join Date: May 2001
Location: ?
Posts: 19,644
|
|
14 January 2021, 02:28 | #18 |
Registered User
Join Date: Sep 2007
Location: Stockholm
Posts: 4,332
|
|
14 January 2021, 09:42 | #19 |
Banana
Join Date: Jul 2016
Location: Darmstadt
Posts: 1,213
|
I guess you could test the pointer address to see if it's under $20 0000, then it must be in chip and thus avoid having to do a copy.
|
14 January 2021, 13:52 | #20 |
Registered User
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,334
|
AmiBlitz3 includes the "Chip" compiler directive for locating chunks of the executable in chip RAM, but I've never tried using it. in theory it would allow you to Incbin data that will be always loaded into chip RAM. It can only be used once though, so you would put it at the end of the actual program, and put all your Incbin chunks after that.
Under Blitz 2 it would always end up in fast RAM if there's fast RAM available. That's a nice suggestion, to check if it's in chip RAM first and then do a copy if needed. |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Protracker file format, number of samples | phx | Coders. General | 21 | 02 August 2019 22:45 |
Blitz Basic 2 and Protracker mods | Radertified | Coders. Blitz Basic | 3 | 13 September 2018 22:55 |
Can't Create File error using Protracker 2.3d | ViLXDRYAD | support.Apps | 5 | 09 December 2016 15:44 |
Protracker 3.xx Load Sample | womagrid | support.Apps | 3 | 27 May 2016 06:28 |
Load Cubase made sample in protracker | Brick Nash | support.Other | 4 | 26 May 2016 18:28 |
|
|