   DirectSound buffer question
  If I have a DirectSoundBuffer, and I lock it to fill the sound buffer with data.Then I get a BYTE pointer by locking the buffer.Lets say I have set the samples to be 16 bit.So the first sample will be the first two bytes pointed by the pointer.However, which is the most significant byre? the first byte or the second?Thanks in advance.   
  You can just cast the BYTE* it to a WORD*, which implies that the first byte is the most significant byte (On a little endian system).I think...   ;  What are you trying to accomplish?   ;Quote:Original post by Evil SteveYou can just cast the BYTE* it to a WORD*, which implies that the first byte is the most significant byte (On a little endian system).I think...On a little endian system, the first byte will be the _least_ significant byte.Casting from a BYTE * to a WORD * will work, but since 16-bit samples are signed, you'd probably be better off casting to a pointer to a 16-bit signed type, eg signed short *.   ;  I was trying to set a value of a directsound buffer.However, I wanted to make the method so it suits for all possible bitper sample possibilites.How would I accomplish that? Do I need to pass this method a signed long and somehow to set the value?   ;  Okay first of all, you don't get a BYTE* from lock, you get a void*.You also have to keep in mind how many channels your buffer has been set to, so how many channels?You mainly start with 2 channels, which means you want the audio to be stereo (not mono). A buffer size is channels(usuallt 2+)*samplesize(usually 16bits)*samplespersecond(44100hz usually)*seconds so if your sample size is 16-bits each sample(whole) for a 2 channel buffer will be 32 bits. struct sample{short leftSpeaker;short rightSpeaker;};short left = 0;short right = 0;sample* sndArr = (sample*)buffer->lock(...); // or however you have it setupsndArr[0].leftChannel = left;sndArr[0].rightChannel = right;If this doesn't yeild you the results you want try unsigned shorts.Now this is just off the top of my head, I'll take another look when I get home but this is how it's done I believe.   ;Quote:Original post by The C modest godI was trying to set a value of a directsound buffer.However, I wanted to make the method so it suits for all possible bitper sample possibilites.How would I accomplish that? Do I need to pass this method a signed long and somehow to set the value?Ok...to make your life simpler, DirectSound will only work on Windows based Intel/AMD systems.  There for it's little endian aligned.   