GP32 Another Samplesound Question


ConsoleTom

Member
Joined
Dec 4, 2003
Messages
106
Age
47
Location
Germany
Website
Visit site
Hi !

I just want to ensure myself if this construction is ok:

A Struct:

struct samples
{
unsigned short * pSample[8];
unsigned int nSampleLen; /* you see right - 8 samples with the same size */
};

struct samples Sampleset[31];

<now i store in Sampleset[0-31].nSampleLen the size of samples>

Now i allocate memory -like this ?

for (i=0;i<31;i++)
{
for(j=0;j<8;j++)
{
SampleSet.pSample[j] = gm_malloc(sizeof(unsigned short)*SampleSet .nSampleLen)
}
}

How can i store data in the memory i allocated ? For example: how would i store these values. 00, 15000, 14, 20 in the mem allocated: Sampleset[3].pSample[2] ?

I would think like this:
*(Sampleset[3].pSample[2] + 0) = 00;
*(Sampleset[3].pSample[2] + 1) = 15000;
*(Sampleset[3].pSample[2] + 2) = 14;
*(Sampleset[3].pSample[2] + 3) = 20;

Anything i forgot ?


Greetings

Tobias
 
Back
Top