I’m doing this for encryption.
FSOUND_Sample_Load, FSOUND_Sample_Lock, and change the data of sample, it is clear. But result is discouraging.
The sample is tested by FSOUND_PlaySoundEx. And, I found the sample isn’t changed at all. It plays just the sound loaded by FSOUND_Sample_Load.
How can I change the each data of ptr1.
FSOUND_SAMPLE* samp = FSOUND_Sample_Load(FSOUND_FREE, pathName, FSOUND_HW3D, 0, 0);
signed short* ptr1=NULL,ptr2=NULL;
unsigned int len1,len2 = 0;
FSOUND_Sample_Lock(samp, 0,441002, (void)&ptr1, (void)&ptr2, &len1, &len2);
for( int i=0; i<len1; i++)
ptr1[i] = 100*( (i/100)%2==0? 1:-1);
FSOUND_Sample_Unlock(samp, &ptr1, &ptr2, len1, len2);
FSOUND_PlaySoundEx( FSOUND_FREE, samp, NULL, FALSE);
- kiplring asked 13 years ago
I don’t understand why your application doesn’t crash when you execute that code 😉
You’ve got a pointer to the locked pcm data (Ptr1) and then you have an array called Ptr1?
I don’t program in this language, but it looks like you are confusing Ptr1 (a pointer to the data you’ve locked) with the pcm data. Try copying the locked data to an array (Ptr1 tells you where the data are), and then manipulate the array.
- stdev answered 13 years ago
Please login first to submit.