[Openal] AL_FORMAT Types and Meanings
Daniel PEACOCK
dpeacock at creativelabs.com
Fri Oct 2 06:29:53 PDT 2009
>> My all wavefiles are mono channel. What I am trying to do is I want to
hear each sound from specified channel. Actually extracting mono sound to
particular channel only.
OK.
The LoadData function looks like it does the right thing (I didn't test it)
- but you will need to be aware that the channel locations will differ for
each wave format. e.g.
Quad = FL FR RL RR
5.1 = FL FR FC LFE RL RR
So the index of the Rear Left (RL) speaker is 2 for Quad but 4 for 5.1.
(The channel orders can be found by looking at the WAVEFORMATEXTENSIBLE
structure). So, you if you wanted audio from the RL, you can convert the
mono audio stream to a 4.0 audio stream with channels="0010", but if you
want to output a 5.1 audio stream you would need to set channels="000010".
Note, that if your end goal is to take 8 mono audio streams and play each
one in 1 of the 8 channels of a 7.1 speaker system, it would be much more
optimal to put all the data into a single 7.1 stream rather than having
multiple multi-channel streams each of which has most of it's channels set
to silence and just one channel filled with audible samples. It would
also give you the advantage of guaranteed synchronous start if that was
important.
I'm not sure what the second section of code is trying to accomplish.
Dan
Creative Labs (UK) Ltd.
Notice
The information in this message is confidential and may be legally
privileged. It is intended solely for the addressee. Access to this
message by anyone else is unauthorized. If you are not the intended
recipient, any disclosure, copying or distribution of the message, or
any action taken by you in reliance on it, is prohibited and may be
unlawful. If you have received this message in error, please delete it
and contact the sender immediately. Thank you.
Creative Labs UK Ltd company number 2658256 registered in England and Wales
at 79 Knightsbridge, London SW1X 7RB
Ümit Uzun
<umituzun84 at gmail
.com> To
Sent by: OpenAL
openal-bounces at op <openal at opensource.creative.com>
ensource.creative cc
.com
Subject
Re: [Openal] AL_FORMAT Types and
10/02/2009 01:30 Meanings
PM
Hi Danial,
>>What is your goal with this algorithm? Are you trying to extract
particular channels from a wavefile, or are you attempting to mix >>several
channels into one or more channels (downmixing)?
My all wavefiles are mono channel. What I am trying to do is I want to hear
each sound from specified channel. Actually extracting mono sound to
particular channel only.
>>Does this mean you want to hear the front-left channel only (and remove
the other 5 channels of data),
Yes I want to hear my mono sound only from front-left or assigned channels
and the other would be silent on 5.1 6.1 or 7.1 speaker system.
Think that, I have 7.1 speaker system and I have 7+1 room in my home. And
every channel located to each room one by one. I mean every room has one
channel of speaker system. And My central computer plays 8 music and each
music will be played only assigned channel or channels.
How can I do, or Does my algorithm really support this capability?
Thanks and Regards.
Ümit Uzun
2009/10/2 Daniel PEACOCK <dpeacock at creativelabs.com>
Hi Ümit,
What is your goal with this algorithm? Are you trying to extract
particular channels from a wavefile, or are you attempting to mix several
channels into one or more channels (downmixing)?
>> I mean for example we have 16 bit sampled 5.1 sound which will be
played only front left
e..g. Does this mean you want to hear the front-left channel only (and
remove the other 5 channels of data), or do you want to mix all 6
channels together into a mono file?
Dan
Creative Labs (UK) Ltd.
Notice
The information in this message is confidential and may be legally
privileged. It is intended solely for the addressee. Access to this
message by anyone else is unauthorized. If you are not the intended
recipient, any disclosure, copying or distribution of the message, or any
action taken by you in reliance on it, is prohibited and may be unlawful.
If you have received this message in error, please delete it and contact
the sender immediately. Thank you.
Creative Labs UK Ltd company number 2658256 registered in England and
Wales at 79 Knightsbridge, London SW1X 7RB
(Embedded image moved to file: pic18619.gif)Inactive hide details for
Ümit Uzun <umituzun84 at gmail.com>Ümit Uzun <umituzun84 at gmail.com>
Ümit Uzun <
umituzun84 at gmai
l.com>
Sent by: (Embedded image moved to file:
openal-bounces@ pic19802.gif)
opensource.crea To
tive.com (Embedded image
moved to file:
pic03897.gif)
10/01/2009 OpenAL <
02:17 PM openal at opensource.c
reative.com>
(Embedded image moved to file:
pic02329.gif)
cc
(Embedded image
moved to file:
pic04341.gif)
(Embedded image moved to file:
pic15646.gif)
Subject
(Embedded image
moved to file:
pic16600.gif)
[Openal] AL_FORMAT
Types and Meanings
(Embedded image moved to file:
pic25274.gif)
(Embedded image moved to
file: pic25815.gif)
Hi All,
I have needed to control every channel manually so I have injected
Framework.cpp of OpenAL SDK.
I added
template<typename T> T *LoadData(const T *data, int size, const char
*channels, short channelType)
{ size /= sizeof(T); T *multData = new T[size * channelType];
for(int i = 0; i < size; i++) { for(int k = 0; k < channelType;
k++) { multData[i * channelType + k] = channels[k] ==
'1' ? data[i] : 0; } } return multData;
}
const char *channels; // For example 110010
// Find channelType by counting channels value for example 5.1's
channelType == 6
short channelType;
for(channelType = 0; channels[channelType] != NULL; channelType++);
if(fmt.wBitsPerSample == 16) // assumes 16-bit short
{ ALshort *data = LoadData((const ALshort*)pData, iDataSize, channels,
channelType); switch(channelType) { case 2:
alBufferData(uiBufferID, alGetEnumValue("AL_FORMAT_MONO16"), data,
iDataSize * channelType, iFrequency); break; case 4:
alBufferData(uiBufferID, alGetEnumValue("AL_FORMAT_QUAD16"), data,
iDataSize * channelType, iFrequency); break; case 6:
alBufferData(uiBufferID, alGetEnumValue("AL_FORMAT_51CHN16"), data,
iDataSize * channelType, iFrequency); break; case 7:
alBufferData(uiBufferID, alGetEnumValue("AL_FORMAT_61CHN16"), data,
iDataSize * channelType, iFrequency); break; case 8:
alBufferData(uiBufferID, alGetEnumValue("AL_FORMAT_71CHN16"), data,
iDataSize * channelType, iFrequency); break; } delete[] data;
}
instead of
alBufferData(uiBufferID, eBufferFormat, pData, iDataSize, iFrequency);
command.
With this changing I can specify each channel for related buffer's will
be played.
I specify each sounds channel value by;
<!-- Channels Enum for 5.1 123456 -->
<!-- 1 : Front Left Speaker -->
<!-- 2 : Front Right Speaker -->
<!-- 3 : Front Center Speaker -->
<!-- 4 : Low Frequency Speaker -->
<!-- 5 : Back Left Speaker -->
<!-- 6 : Back Right Speaker -->
In LoadData template function I create the multData sound buffer data in
this sequence. I mean for example we have 16 bit sampled 5.1 sound which
will be played only front left(this sound's channels:100000) I send the
raw pData sound buffer to LoadData function and multiplex this sound data
for 6 channel in given sequence order. Create new multData array for 6
channel and start to set this sound array firstly Front Left and Front
Right and so on.
So do you think this operation right or now?
With all those changing I want to control channels. Because I have some
sounds which only must played on rear left channel and some sounds only
front right and etc.
Do you think this approach is suitable?
And another question I want to handle 2.0 speaker like 5.1 and as you can
see I use AL_FORMAT_MONO16 for 2 channel. Do you think it's right or not?
Should I use AL_FORMAT_STEREO16? Or which enumeration do I need?
If I am so complex, please ask me question to lead you right direction.
Regards.
Ümit Uzun_______________________________________________
Openal mailing list
Openal at opensource.creative.com
http://opensource.creative.com/mailman/listinfo/openal
ForwardSourceID:NT000754CE
_______________________________________________
Openal mailing list
Openal at opensource.creative.com
http://opensource.creative.com/mailman/listinfo/openal
ForwardSourceID:NT0007554E
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pic18619.gif
Type: image/gif
Size: 105 bytes
Desc: not available
Url : http://opensource.creative.com/pipermail/openal/attachments/20091002/0c01fbf4/pic18619-0001.gif
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pic19802.gif
Type: image/gif
Size: 45 bytes
Desc: not available
Url : http://opensource.creative.com/pipermail/openal/attachments/20091002/0c01fbf4/pic19802-0001.gif
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pic03897.gif
Type: image/gif
Size: 45 bytes
Desc: not available
Url : http://opensource.creative.com/pipermail/openal/attachments/20091002/0c01fbf4/pic03897-0001.gif
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pic02329.gif
Type: image/gif
Size: 45 bytes
Desc: not available
Url : http://opensource.creative.com/pipermail/openal/attachments/20091002/0c01fbf4/pic02329-0001.gif
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pic04341.gif
Type: image/gif
Size: 45 bytes
Desc: not available
Url : http://opensource.creative.com/pipermail/openal/attachments/20091002/0c01fbf4/pic04341-0001.gif
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pic15646.gif
Type: image/gif
Size: 45 bytes
Desc: not available
Url : http://opensource.creative.com/pipermail/openal/attachments/20091002/0c01fbf4/pic15646-0001.gif
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pic16600.gif
Type: image/gif
Size: 45 bytes
Desc: not available
Url : http://opensource.creative.com/pipermail/openal/attachments/20091002/0c01fbf4/pic16600-0001.gif
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pic25274.gif
Type: image/gif
Size: 45 bytes
Desc: not available
Url : http://opensource.creative.com/pipermail/openal/attachments/20091002/0c01fbf4/pic25274-0001.gif
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pic25815.gif
Type: image/gif
Size: 45 bytes
Desc: not available
Url : http://opensource.creative.com/pipermail/openal/attachments/20091002/0c01fbf4/pic25815-0001.gif
More information about the Openal
mailing list