I am trying to pass a series of 16 bit values (SHORT) to what appears to be an 8 bit pointer (BYTE). I am getting the Ptr from TAudioSample.
Here is my code:
From printing sample.samples[l_ch], and more importantly the audio that I am getting when listening to the sample, it is just putting a byte value in the Ptr array (quiet or loud, depending on if I specify Little Endian, or Big Endian).
How do I get a proper 16 bit value into memory?
Here is my code:
Local sample:TAudioSample = CreateAudioSample(44100, 44100, SF_STEREO16LE) Local x:Int Local l_ch:Int Local r_ch:Int Local freq:Float = (440 * 2 * Pi) / 44100 For x = 0 To 22100 l_ch = (x * 4) r_ch = (x * 4) + 2 sample.samples[l_ch] = Short( (Sin(freq * x) * 32767) + 32767 ) sample.samples[r_ch] = Short( (Sin(freq * x) * 32767) + 32767 ) Print sample.samples[l_ch] Next Local sound:TSound = LoadSound(sample) PlaySound sound Delay 2000
From printing sample.samples[l_ch], and more importantly the audio that I am getting when listening to the sample, it is just putting a byte value in the Ptr array (quiet or loud, depending on if I specify Little Endian, or Big Endian).
How do I get a proper 16 bit value into memory?