<br><br><div class="gmail_quote">---------- Forwarded message ----------<br>From: <b class="gmail_sendername">Ümit Uzun</b> <span dir="ltr"><<a href="mailto:umituzun84@gmail.com">umituzun84@gmail.com</a>></span><br>Date: 2009/4/16<br>
Subject: Re: [Openal] How can I play mono wav sound in specific channel?<br>To: Chris Robinson <<a href="mailto:chris.kcat@gmail.com">chris.kcat@gmail.com</a>><br><br><br>Hi Chris;<div class="im"><br><div class="gmail_quote">
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
<br>
ALshort monodata[samples];<br>
<br>
you can fill it into a 7.1 buffer like this:<br>
<br>
ALshort data71[samples*8];<br>
for(int i = 0;i < samples;i++) {<br>
data71[i*8 + 0] = 0; // front-left<br>
data71[i*8 + 1] = 0; // front-right<br>
data71[i*8 + 2] = 0; // front-center<br>
data71[i*8 + 3] = 0; // lfe (sub-woofer)<br>
data71[i*8 + 4] = 0; // back-left<br>
data71[i*8 + 5] = 0; // back-right<br>
data71[i*8 + 6] = monodata[i]; // side-left<br>
data71[i*8 + 7] = monodata[i]; // side-right<br>
}<br>
alBufferData(bID, alGetEnumValue("AL_FORMAT_71CHN16"), data71,<br>
samples*8*sizeof(ALshort), frequency);<br>
<br>
</blockquote></div></div>I have look at the Framework and there is ALFWLoadWaveToBuffer;<br><br>ALboolean ALFWLoadWaveToBuffer(const char *szWaveFile, ALuint uiBufferID, ALenum eXRAMBufferMode)<br>{<br> WAVEID WaveID;<br>
ALint iDataSize, iFrequency;<br> ALenum eBufferFormat;<br> ALchar *pData;<br> ALboolean bReturn;<br><br> bReturn = AL_FALSE;<br> if(g_pWaveLoader)<br> {<br> if(SUCCEEDED(g_pWaveLoader->LoadWaveFile(szWaveFile, &WaveID)))<br>
{<br> if((SUCCEEDED(g_pWaveLoader->GetWaveSize(WaveID, (unsigned long*)&iDataSize))) &&<br> (SUCCEEDED(g_pWaveLoader->GetWaveData(WaveID, (void**)&pData))) &&<br>
(SUCCEEDED(g_pWaveLoader->GetWaveFrequency(WaveID, (unsigned long*)&iFrequency))) &&<br> (SUCCEEDED(g_pWaveLoader->GetWaveALBufferFormat(WaveID, &alGetEnumValue, (unsigned long*)&eBufferFormat))))<br>
{<br> // Set XRAM Mode (ifapplication)<br> if(eaxSetBufferMode && eXRAMBufferMode)<br> {<br> eaxSetBufferMode(1, &uiBufferID, eXRAMBufferMode);<br>
}<br><br> alGetError();<br> alBufferData(uiBufferID, eBufferFormat, pData, iDataSize, iFrequency);<br><br> if(alGetError() == AL_NO_ERROR)<br> {<br>
bReturn = AL_TRUE;<br> }<br><br> g_pWaveLoader->DeleteWaveFile(WaveID);<br> }<br> }<br> }<br><br> return bReturn;<br>}<br><br>You have given ALshort monodata[samples]; but in this code ALchar *pData; This variable are same or not. because alBufferData takes void format and ALchar is 1 byte and ALshort 2 byte. I can't get what should I do. <br>
<br>And you have talk about samples. I have an iDataSize, How I get samples size? I have open up the sound properties and in Summary tab there is Audio Sample Size is 16 bit information. Should I divide iDataSize to 16 and then get samples value?<br>
<br>Thanks for valueable informations.<br>Best wishes.<br><br>-- <br><font color="#888888">Ümit Uzun<br>
</font></div><br><br clear="all"><br>-- <br>Ümit Uzun<br>