OpenGL系統設計-融合DirectXAudio(2)

來源:互聯網
上載者:User


<!--
/* Font Definitions */
@font-face
{font-family:宋體;
panose-1:2 1 6 0 3 1 1 1 1 1;
mso-font-alt:SimSun;
mso-font-charset:134;
mso-generic-font-family:auto;
mso-font-pitch:variable;
mso-font-signature:3 135135232 16 0 262145 0;}
@font-face
{font-family:"/@宋體";
panose-1:2 1 6 0 3 1 1 1 1 1;
mso-font-charset:134;
mso-generic-font-family:auto;
mso-font-pitch:variable;
mso-font-signature:3 135135232 16 0 262145 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{mso-style-parent:"";
margin:0cm;
margin-bottom:.0001pt;
mso-pagination:none;
font-size:10.5pt;
mso-bidi-font-size:12.0pt;
font-family:"Times New Roman";
mso-fareast-font-family:宋體;
mso-font-kerning:1.0pt;}
p.MsoBodyText, li.MsoBodyText, div.MsoBodyText
{margin-top:0cm;
margin-right:0cm;
margin-bottom:6.0pt;
margin-left:0cm;
mso-pagination:none;
font-size:10.5pt;
mso-bidi-font-size:12.0pt;
font-family:"Times New Roman";
mso-fareast-font-family:宋體;
mso-font-kerning:1.0pt;}
p.MsoBodyTextFirstIndent, li.MsoBodyTextFirstIndent, div.MsoBodyTextFirstIndent
{mso-style-update:auto;
mso-style-parent:本文;
mso-style-link:" Char Char";
margin:0cm;
margin-bottom:.0001pt;
text-indent:19.85pt;
mso-pagination:none;
font-size:10.5pt;
font-family:"Times New Roman";
mso-fareast-font-family:宋體;
mso-ansi-language:ZH-CN;}
span.CharChar
{mso-style-name:" Char Char";
mso-style-locked:yes;
mso-style-link:本文首行縮排;
mso-ansi-font-size:10.5pt;
mso-bidi-font-size:10.5pt;
font-family:宋體;
mso-fareast-font-family:宋體;
mso-ansi-language:ZH-CN;
mso-fareast-language:ZH-CN;
mso-bidi-language:AR-SA;}
/* Page Definitions */
@page
{mso-page-border-surround-header:no;
mso-page-border-surround-footer:no;}
@page Section1
{size:612.0pt 792.0pt;
margin:72.0pt 90.0pt 72.0pt 90.0pt;
mso-header-margin:36.0pt;
mso-footer-margin:36.0pt;
mso-paper-source:0;}
div.Section1
{page:Section1;}
-->

當對
DirectAudio設定完畢後,我們回到
OpenGL中。對
OpenGL的初始化函數
glInit和主迴圈函數
glMain不需要任何更改,需要的是對輸入響應函數
KeyPressed進行修改,當按滑鼠左鍵時開始播放音樂,按右鍵時停止播放音樂。

 

int KeyPressed()

{

   
if(buffer[DIK_ESCAPE]) 
//
這裡的值都是DIK_***
,而不是VK_***

       
return FALSE;

   

……

//
前面對鍵盤方向鍵的處理不變

 

   
//
按滑鼠左鍵開始播放音樂

   
if(mouseState.rgbButtons[MOUSE_LEFT] &
0x80)

   
{

       
//
播放音樂,迴圈次數為無限

       
DMPlay(&sound,
DMUS_SEG_REPEAT_INFINITE);

   
}

 

   
//
按滑鼠右鍵停止播放音樂

   
if(mouseState.rgbButtons[MOUSE_RIGHT] &
0x80)

   
{

       
DMStop(&sound);

   
}

 

   
return TRUE;

}

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.