View Single Post
Old 18 January 2021, 18:03   #24
Black Lives Matter

Akira's Avatar
Join Date: May 2001
Location: New York
Posts: 19,498
Originally Posted by Daedalus View Post
If you're just loading the file and interpreting it yourself, there's no need to load it with a dedicated library. Alternatively, if you do use e.g. LoadModule, you can get the location of the Blitz object (which then contains the module address) with the Addr Module(0) function.
I don't fully understand how to use this.
There's a page in Amigacoding defining the Blitz objects, and the module object's _mt_data sub-item would have the module data.

How would I traverse through this data, for example with some "For" statement reading every byte straight?

I'm sorry if this is super newbie, but I am not sure I understand how to refer to t he module object loaded in memory exactly. For the time being, finding it in RAM and reading the module's name (which is at offset 0 and is 20 bytes long) would be enough for me to understand how to do the rest.

[edit] Well this is getting complicated fast... I don't think I can have a pointer inside a newtype definition, can I? I really don't know how to create a copy of the actual sample data, there's no variable that can hold that that I can think of, so the best choice here would be to point at the sample data already in memory thanks to LoadModule, but I wanted to create an array of sample objects where the actual sample data was one of the elements. I guess I cannot.

SoundData pushes a byte of info at a time into a sound object, so I guess I would have to make consecutive SoundData calls until "sample length" is reached, starting from the sample address in memory.
It would be easier if I could, somehow, just redirect the sound data part of a sound object to the memory location where there's already sound data, but I don't know how I could do that, feel like it has to do with the sound data type, but don't really know how I can access it, as I said before.

My mind is getting really mushy with all this

[edit 2] aghhh i am in tears haha. Sorry EAb to use you as my rubber ducky debug

So having this in mind:
 _data.l             ;00: NULL if no sound present, else pointer to sound data
 _period.w           ;04: period of sound
 _length.w           ;06: length, in words, of sound data
 _loop.l             ;08: repeat to loop position of sound
 _looplength.w       ;12: length of looping section, in words
 _pad.b[2]           ;14:
The Sound object already has a pointer to sound data and not actual sound data. So if I could change that to point instead to wherever LoadModule has put the sample, I should be done.

Assuming I am dealing with a sound that Initialized as Sound 1, how can I access this _data parameter of that sound object when I have no variable name for it? this is the part that confuses me.

Last edited by Akira; 18 January 2021 at 22:31.
Akira is offline  
Page generated in 0.04553 seconds with 11 queries