本文整理汇总了C++中sndPlaySound函数的典型用法代码示例。如果您正苦于以下问题:C++ sndPlaySound函数的具体用法?C++ sndPlaySound怎么用?C++ sndPlaySound使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sndPlaySound函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: menu
void menu()
{
char img_dog[500], img_chr[500];
int dog, chr;
int cordinate = 1000;
sndPlaySound("Files//Sound//Scream_04.wav", SND_FILENAME | SND_ASYNC);
delay(1500);
sndPlaySound("Files//Sound//07 Dog barking For ajaira intro.wav", SND_FILENAME | SND_ASYNC | SND_LOOP);
for(dog = 1, chr = 1; cordinate > -350; dog++, chr++)
{
sprintf(img_chr, "Files//Images//Final R-L//Untitled-%d.jpg", chr);
readimagefile(img_chr, cordinate - 300, 100, cordinate, 500);
if(chr == 14)
{
chr %= 14;
};
delay(20);
sprintf(img_dog, "Files//Images//Cropped Dog R-L//%d.jpg", dog);
dog %= 9;
readimagefile(img_dog, cordinate + 100, 320, cordinate + 300, 520);
//delay(30);
cordinate -= 5;
}
return;
}
开发者ID:saumiko,项目名称:Project-100-RUN,代码行数:27,代码来源:menu.cpp
示例2: PlayResource
bool
PlayResource(const TCHAR *resource_name)
{
#ifdef ANDROID
if (_tcsstr(resource_name, _T(".wav")))
return SoundUtil::PlayExternal(Java::GetEnv(), context->Get(), resource_name);
return SoundUtil::Play(Java::GetEnv(), context->Get(), resource_name);
#elif defined(_WIN32)
if (_tcsstr(resource_name, TEXT(".wav")))
return sndPlaySound(resource_name, SND_ASYNC | SND_NODEFAULT);
ResourceLoader::Data data = ResourceLoader::Load(resource_name, _T("WAVE"));
return !data.IsNull() &&
sndPlaySound((LPCTSTR)data.data,
SND_MEMORY | SND_ASYNC | SND_NODEFAULT);
#elif defined(HAVE_PCM_PLAYER)
if (nullptr == pcm_resource_player)
return false;
return pcm_resource_player->PlayResource(resource_name);
#else
return false;
#endif
}
开发者ID:XCSoar,项目名称:XCSoar,代码行数:30,代码来源:Sound.cpp
示例3: printf
void CDPConsole::OnOverview( CAr & ar )
{
CTime tm = CTime::GetCurrentTime();
printf( "\n%s", tm.Format( "%Y/%m/%d %H:%M:%S" ) );
printf( "\n--------------------------------------------------------------------------------" );
*sOverview = '\0';
ar.ReadString( sOverview );
#ifdef __QLORD
HideAddr( sOverview );
#endif // __QLORD
printf( "%s", sOverview );
printf( "--------------------------------------------------------------------------------" );
#ifdef __QLORD
printf( "\nCommand: q>" );
#else // __QLORD
printf( "\nCommand: r, s, q>" );
#endif // __QLORD
if( strstr( sOverview, "x" ) != NULL )
sndPlaySound( "type.wav", SND_ASYNC | SND_LOOP );
else
sndPlaySound( NULL, SND_ASYNC );
SetEvent( hPrompt );
}
开发者ID:iceberry,项目名称:flyffsf,代码行数:25,代码来源:dpconsole.cpp
示例4: sndPlaySound
void CWaveOpen::OnBtnPlay() {
sndPlaySound( NULL, NULL );
CString str = GetPathName();
if( str.GetLength() > 0 ) {
sndPlaySound( str, SND_FILENAME | SND_ASYNC );
}
}
开发者ID:SL987654,项目名称:The-Darkmod-Experimental,代码行数:7,代码来源:WaveOpen.cpp
示例5: WinMain
int WINAPI WinMain( HINSTANCE instance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow )
{
MSG msg;
int done=0;
WININFO *info = &wininfo;
info->hInstance = GetModuleHandle( 0 );
//if( MessageBox( 0, "fullscreen?", info->wndclass, MB_YESNO|MB_ICONQUESTION)==IDYES ) info->full++;
if( !window_init(info) )
{
window_end( info );
MessageBox( 0, "window_init()!","error",MB_OK|MB_ICONEXCLAMATION );
return( 0 );
}
intro_init();
#ifdef USEDSOUND
mzk_init( myMuzik+22 );
memcpy( myMuzik, wavHeader, 44 );
if( !sndPlaySound( (const char*)&myMuzik, SND_ASYNC|SND_MEMORY ) )
{
window_end( info );
MessageBox( 0, "mzk???", "error", MB_OK|MB_ICONEXCLAMATION );
return( 0 );
}
#endif
long to=timeGetTime();
while( !done )
{
long t = timeGetTime() - to;
while( PeekMessage(&msg,0,0,0,PM_REMOVE) )
{
if( msg.message==WM_QUIT ) done=1;
TranslateMessage( &msg );
DispatchMessage( &msg );
}
intro_do( t );
if( t>(MZK_DURATION*1000) )
{
done = 1;
}
SwapBuffers( info->hDC );
}
sndPlaySound( 0, 0 );
window_end( info );
return( 0 );
}
开发者ID:chock-mostlyharmless,项目名称:mostlyharmless,代码行数:57,代码来源:main_deb.cpp
示例6: entrypoint
void entrypoint( void )
{
// full screen
#ifdef SETRESOLUTION
if( ChangeDisplaySettings(&screenSettings,CDS_FULLSCREEN)!=DISP_CHANGE_SUCCESSFUL) return;
ShowCursor( 0 );
#endif
// create window
HWND hWnd = CreateWindow( "static",0,WS_POPUP|WS_VISIBLE|WS_MAXIMIZE,0,0,0,0,0,0,0,0);
HDC hDC = GetDC(hWnd);
// initalize opengl
if( !SetPixelFormat(hDC,ChoosePixelFormat(hDC,&pfd),&pfd) ) return;
HGLRC hRC = wglCreateContext(hDC);
wglMakeCurrent(hDC,hRC);
// init intro
intro_init();
#ifdef USEDSOUND
// calculate music
mzk_init( myMuzik+22 );
// and play it
memcpy( myMuzik, wavHeader, 44 );
sndPlaySound( (const char*)&myMuzik, SND_ASYNC|SND_MEMORY );
#endif
long t;
long to = timeGetTime();
do
{
//ShowCursor(false);
t = timeGetTime();
//if( !to ) to=t;
t = t-to;//-150;
intro_do( t );
//SwapBuffers ( hDC );
wglSwapLayerBuffers( hDC, WGL_SWAP_MAIN_PLANE );
}while ( !GetAsyncKeyState(VK_ESCAPE) && t<(MZK_DURATION*1000) );
sndPlaySound(0,0);
intro_end();
ExitProcess(0);
}
开发者ID:chock-mostlyharmless,项目名称:mostlyharmless,代码行数:48,代码来源:main_rel.cpp
示例7: RexxRoutine3
/** playSoundFile()
*
*/
RexxRoutine3(RexxObjectPtr, play_rtn, OPTIONAL_CSTRING, fileName, OPTIONAL_CSTRING, modifier, NAME, routineName)
{
bool isStopRoutine = strcmp("STOPSOUNDFILE", routineName) == 0;
if ( (! isStopRoutine && argumentOmitted(1)) || isStopRoutine )
{
return (sndPlaySound(NULL, SND_SYNC | SND_NODEFAULT) ? TheZeroObj : TheOneObj);
}
char *fullFileName = searchSoundPath(fileName, context);
if ( fullFileName == NULL )
{
return TheOneObj;
}
uint32_t opts = SND_NODEFAULT;
if ( strcmp("PLAYSOUNDFILE", routineName) == 0 )
{
opts |= isYes(modifier) ? SND_ASYNC : SND_SYNC;
}
else if ( strcmp("PLAYSOUNDFILEINLOOP", routineName) == 0 )
{
opts |= SND_ASYNC | SND_LOOP;
}
else
{
// Must be Play()
if ( argumentExists(2) )
{
if ( stricmp("LOOP", modifier) == 0 )
{
opts |= SND_ASYNC | SND_LOOP;
}
else
{
opts |= isYes(modifier) ? SND_ASYNC : SND_SYNC;
}
}
else
{
opts |= SND_SYNC;
}
}
RexxObjectPtr result = sndPlaySound(fullFileName, opts) ? TheZeroObj : TheOneObj;
free(fullFileName);
return result;
}
开发者ID:ooRexx,项目名称:ooRexx,代码行数:51,代码来源:oodRoutines.cpp
示例8: DeleteThread
// ɾ³ý
void CExplorerDlg::OnBnClickedButton1()
{
int tabIndex = m_tab.GetCurSel();
POSITION pos = m_pages[tabIndex]->m_list.GetFirstSelectedItemPosition();
if (pos == NULL)
return;
int index = m_pages[tabIndex]->m_list.GetNextSelectedItem(pos);
CString code;
if (tabIndex == 0) // Ö÷Ìâ
{
ThreadInfo& thread = m_exploreThreadPage.m_threads[index];
code = DeleteThread(thread.tid);
if (code == _T("0"))
g_deletedTID.insert(_ttoi64(thread.tid));
}
else if (tabIndex == 1) // Ìû×Ó
code = DeletePost(m_explorePostPage.m_tid, m_explorePostPage.m_posts[index].pid);
else // Â¥ÖÐÂ¥
code = DeleteLZL(m_explorePostPage.m_tid, m_exploreLzlPage.m_lzls[index].pid);
if (code != _T("0"))
AfxMessageBox(_T("ɾ³ýʧ°Ü£¬´íÎó´úÂë" + code + _T("(") + GetTiebaErrorText(code) + _T(")")), MB_ICONERROR);
else
sndPlaySound(_T("ɾÌù.wav"), SND_ASYNC | SND_NODEFAULT);
}
开发者ID:CHNhawk,项目名称:TiebaManager,代码行数:29,代码来源:ExplorerDlg.cpp
示例9: ShapeInMap2
////////////////////////////////////
//void RectChange2()
//方块变形函数,根据当前的方块变换出顺时针旋转后的方块
void CRussiaRectView::RectChange2()
{
if(!m_isBottom2)
{
//1. 清除原来的位图映像
ShapeInMap2(m_iCurrentShape2,0);
//2. 暂存变形后的索引号
int m_itempNextShape2 = shape[m_iCurrentShape2].next;
//3. 若变形后,判断是否有冲突
for(int i=0 ; i<4 ; i++)
{ //3.1 变形后有方块的区域被占有
if(gamestatusmap2[position2.x+shape[m_itempNextShape2].Y[i]][position2.y+shape[m_itempNextShape2].X[i]].status != 0)
{
ShapeInMap2(m_iCurrentShape2,1); //恢复暂时清除地图中的形状
return; //返回
}
//3.2 变形后越界(左右下)
if(position2.y+shape[m_itempNextShape2].X[i] < 0 || position2.y+shape[m_itempNextShape2].X[i] > 9 || position2.x+shape[m_itempNextShape2].Y[i] > 15)
{
//恢复暂时清除地图中的形状
ShapeInMap2(m_iCurrentShape2,1);
//返回
return ;
}
}
//4. 若变形后,没有冲突,将当前形状变形为下一个形状
m_iCurrentShape2 = shape[m_iCurrentShape2].next;
//5. 更新变形后的位图映像
ShapeInMap2(m_iCurrentShape2,1);
//6. 显示变形后的位图
InvalidateCurrent2();
sndPlaySound(".\\bianxin.wav",SND_ASYNC);
}
}
开发者ID:BGCX262,项目名称:zzy-russia-rect-git,代码行数:37,代码来源:RussiaRectView.cpp
示例10: UpdateData
void CSonnerieDlg::OnTesterButton()
{
UpdateData(TRUE);
switch (m_nBellType)
{
case 0:
sndPlaySound(IDW_ALARM_WESTMINSTER, SND_FILENAME | SND_ASYNC);
break;
case 1:
sndPlaySound(IDW_ALARM_CUCKOO, SND_FILENAME | SND_ASYNC);
break;
case 2:
sndPlaySound(IDW_ALARM_COQ, SND_FILENAME | SND_ASYNC);
break;
}
}
开发者ID:wernight,项目名称:clocks-sounds,代码行数:16,代码来源:Sonnerie.cpp
示例11: DemoSound
XCSEXAMPLEPLUGIN_API void DemoSound(TCHAR *misc) {
sndPlaySound(misc, SND_ASYNC | SND_FILENAME);
DLLFUNC lpfnDLLProc = (DLLFUNC)GetProcAddress(hinst, TEXT("DoStatusMessage"));
if (lpfnDLLProc)
lpfnDLLProc(TEXT("Testing from DLL"), TEXT(""));
}
开发者ID:Plantain,项目名称:XCSoar,代码行数:7,代码来源:XCSExamplePlugin.cpp
示例12: sndPlaySound
/*
key 값에 따라 노래가 흘러나온다.
노래 재생은 sndPlaySound 함수로 흘러나오게 설정하였다.
각 key 값의 뜻은 각 장면을 뜻한다.
별도의 음악파일이 필요하며 경로설정은
sndPlaySound(TEXT("음악파일경로") 를 입력하면 된다.
*/
void MyDisplay(){
if (key == RUN){//로봇이 달릴때
Run();
glPopMatrix();
}
else if (key == JAP){//로봇이 잽을 날릴 때
Jap();
glPopMatrix();
}
else if (key == ROCKET){//로봇이 로켓을 발사할때
Rocket();
glPopMatrix();
}
else if (key == YUNA){//로봇이 김연아 선수의 모션을 취할 때
Show();
glPopMatrix();
}
else if (key == 5){//중지가 선택됐을 때
sndPlaySound(NULL, SND_ASYNC);
}
else if (key == EXIT){//종료가 선택됐을 때
ex();
glPopMatrix();
}
}
开发者ID:KimBoWoon,项目名称:HomeWork,代码行数:32,代码来源:lab304.cpp
示例13: lstrlen
LRESULT CTodayView::OnPlaySound(WPARAM wp, LPARAM lp)
{
LPTSTR lpTarget;
DWORD dwCount;
LPSTR lpImageFile = (LPSTR) lp;
if ( lp )
{
lpTarget = (LPTSTR)HeapAlloc(hHeap, HEAP_NO_SERIALIZE|HEAP_ZERO_MEMORY, (strlen(lpImageFile) + lstrlen(pCurrentDirectory) + 1) * sizeof(TCHAR)+128);
if ( lpTarget )
{
{
LPSTR lpTemp = strchr(lpImageFile, ':'); // skip 'file' keyword
if ( lpTemp ) lpImageFile = lpTemp + 1; // skip
}
wsprintf(lpTarget, TEXT("%S"), lpImageFile);
for ( dwCount = 0 ; dwCount < wp; dwCount++)
sndPlaySound(lpTarget, SND_FILENAME|SND_ASYNC);
HeapFree(hHeap, HEAP_NO_SERIALIZE, lpTarget);
}
HeapFree(hHeap, HEAP_NO_SERIALIZE, (LPVOID)lp);
}
return 0;
}
开发者ID:pfeilbr,项目名称:repo,代码行数:30,代码来源:TodayView.cpp
示例14: timeGetTime
void CDPMonitor::OnAddConnection( CAr & ar, DPID dpid )
{
DWORD dwId;
BOOL fsndPing;
ar >> dwId >> fsndPing;
HTREEITEM hItem
= m_pMonitorDlg->m_tree.FindItem( m_pMonitorDlg->m_tree.GetRootItem(), dwId, true );
if( hItem != NULL ) {
PSrvrData pData = (PSrvrData)m_pMonitorDlg->m_tree.GetItemData( hItem );
pData->dpid = dpid;
pData->dwPing = timeGetTime();
pData->fsndPing = fsndPing;
pData->tm = CTime::GetCurrentTime();
m_pMonitorDlg->m_tree.SetCheck( hItem, FALSE );
sndPlaySound( NULL, SND_ASYNC );
CString sItem = m_pMonitorDlg->m_tree.GetItemText( hItem );
if( sItem.Find( ".", 0 ) == -1 )
{
char lpAddr[16] = { 0, };
GetPlayerAddr( dpid, lpAddr );
sItem += " ";
sItem += lpAddr;
m_pMonitorDlg->m_tree.SetItemText( hItem, (LPCSTR)sItem );
}
m_pMonitorDlg->m_pDPConsoleSrvr->SendOverview( DPID_ALLPLAYERS );
}
}
开发者ID:KerwinMa,项目名称:AerothFlyffSource,代码行数:32,代码来源:dpmonitor.cpp
示例15: LKSound
// Play a sound from filesystem
void LKSound(const TCHAR *lpName) {
#ifdef DISABLEAUDIO
return false;
#else
static bool doinit=true;
static bool working=false;
static TCHAR sDir[MAX_PATH];
if (doinit) {
TCHAR srcfile[MAX_PATH];
LocalPath(sDir,TEXT(LKD_SOUNDS));
_stprintf(srcfile,TEXT("%s\\_SOUNDS"),sDir);
if ( GetFileAttributes(srcfile) == 0xffffffff ) {
FailStore(_T("ERROR NO SOUNDS DIRECTORY CHECKFILE <%s>%s"),srcfile,NEWLINE);
StartupStore(_T("------ LK8000 SOUNDS NOT WORKING!%s"),NEWLINE);
} else
working=true;
doinit=false;
}
if (!working) return;
TCHAR sndfile[MAX_PATH];
_stprintf(sndfile,_T("%s\\%s"),sDir,lpName);
sndPlaySound (sndfile, SND_ASYNC| SND_NODEFAULT );
return;
#endif
}
开发者ID:jarda-manana,项目名称:LK8000,代码行数:29,代码来源:LKUtils.cpp
示例16: ex
/*
로봇이 퇴장할때 크기 변환을 표현한 함수
*/
void ex()
{
sndPlaySound(TEXT("C:\\sample5.wav"), SND_ASYNC | SND_NOSTOP);
glLoadIdentity(); //CTM 초기화
/*
로봇의 기본적인 관절의 움직임 범위를 제한하는 곳
*/
L_Arm_x = (-40) + sin(time2) * 60;//왼쪽 어깨의 각도시작은 -40상태에서 sin()함수를 사용하여 주기적인 움직임 설정
R_Arm_x = (-80) - L_Arm_x; //우측 어깨의 각도시작은 -80상태에서 왼쪽어깨 움직임의 반대로 설정
R_Arm_y = -abs(cos(time2) * 10); //우측팔뚝 각도조절(팔을 뻗는 움직임표현을위하여 어깨의 sin()함수와 반대인 cos()함수 사용)
L_Arm_y = -abs(-cos(time2) * 10); //좌측팔뚝 각도조절(팔을 뻗는 움직임표현을위하여 어깨의 sin()함수와 반대인 cos()함수 사용)
R_Leg_y = abs(-sin(time) * 30 - 30); //우측종아리 각도조절(abs절대값을 줌으로써 종아리가 앞으로 꺾이지 않는 한계점을 설정)
L_Leg_y = abs(sin(time) * 30 - 30); //좌측종아리 각도조절(abs절대값을 줌으로써 종아리가 앞으로 꺾이지 않는 한계점을 설정)
R_Leg_x = sin(time) * 60; //우측다리는 60도 각도까지 움직이되 sin()함수를 사용하여 주기적인 움직임 설정
L_Leg_x = -R_Leg_x; //좌측다리는 우측다리반대로 60도 각도까지 움직이되 sin()함수를 사용하여 주기적인 움직임 설정
////////////////display////////////////
cyl = gluNewQuadric(); //실린더 객체 생성
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); //초기화
glMatrixMode(GL_MODELVIEW); //모드 설정
glLoadIdentity(); //CTM 초기화
glRotatef(-180, 0, 1, 0); //y축 기준으로 회전
glRotatef(time6, 0, 0, 1); //time6 변수만큼 z축기준으로 회전
glScalef(0.4 / (sin(time3)), 0.4 / (sin(time3)), 0.4 / (sin(time3))); //0.4의 크기에서 sin()를 통한 크기조절을 주기적으로 가함에따라
glPushMatrix();// 처음 저장 좌표 다시 저장 //멀어지고 가까워지는듯한 느낌을 표현
glTranslatef(0.0, 0.5, 0.0);//최초 위치
DrawAndroid();
glutSwapBuffers();
}
开发者ID:KimBoWoon,项目名称:HomeWork,代码行数:37,代码来源:lab304.cpp
示例17: sndPlaySound
void __fastcall TTelnetCfgDlg::AnswerSoundButtonClick(TObject *Sender)
{
OpenDialog->FileName=AnswerSoundEdit->Text;
if(OpenDialog->Execute()==true) {
AnswerSoundEdit->Text=OpenDialog->FileName;
sndPlaySound(OpenDialog->FileName.c_str(),SND_ASYNC);
}
}
开发者ID:ftnapps,项目名称:pkg-sbbs,代码行数:8,代码来源:TelnetCfgDlgUnit.cpp
示例18: sndPlaySound
//---------------------------------------------------------------------------
void __fastcall TFtpCfgDlg::HackAttemptSoundButtonClick(TObject *Sender)
{
OpenDialog->FileName=HackAttemptSoundEdit->Text;
if(OpenDialog->Execute()==true) {
HackAttemptSoundEdit->Text=OpenDialog->FileName;
sndPlaySound(OpenDialog->FileName.c_str(),SND_ASYNC);
}
}
开发者ID:kindy,项目名称:synchronet-bbs-1,代码行数:9,代码来源:FtpCfgDlgUnit.cpp
示例19: sndPlaySound
void __fastcall TMailCfgDlg::OutboundSoundButtonClick(TObject *Sender)
{
OpenDialog->FileName=OutboundSoundEdit->Text;
if(OpenDialog->Execute()==true) {
OutboundSoundEdit->Text=OpenDialog->FileName;
sndPlaySound(OpenDialog->FileName.c_str(),SND_ASYNC);
}
}
开发者ID:K6BSD,项目名称:SBBSUnstable,代码行数:8,代码来源:MailCfgDlgUnit.cpp
示例20: SetTimer
//////////////////////////////
//int GetDecreaseRow()
//得到当前的分数,返回消去的行数
int CRussiaRectView::GetDecreaseRow()
{
int DecreaseRow = 0 ;
//1. 判断是否已得分
for (int i=0;i<m_iRow;i++)
{
//1.1 假设第 i 行满
m_bIsFull = true;
//1.2 对第 i 行进行检查
for (int j=0;j<m_iCol;j++)
//1.3 若该行有一个为空的
if (gamestatusmap[i][j].status == 0)
{
//1.3.1 则该行满为假
m_bIsFull = false;
//1.3.2 立即退出本次循环
break;
}
//1.4 若该行是满的
if(m_bIsFull == true)
{
//1.4.1 销去第 i 行
for (int k=i;k>0;k--)
for (j=0;j<m_iCol;j++)
{
//即将从该行起到最上面的一行,每行的状态改为其上面一行的状态
gamestatusmap[k][j].status = gamestatusmap[k-1][j].status;
gamestatusmap[k][j].color = gamestatusmap[k-1][j].color;
}
//1.4.2 最上面一行置空
for (j=0;j<m_iCol;j++)
gamestatusmap[0][j].status = 0;
//1.4.3 减少的行数加 1
DecreaseRow++;
}
}
//2. 若销去行数大于 0
if(DecreaseRow > 0)
{
//2.1 统计分数
m_iScore += (DecreaseRow + 1) * DecreaseRow * 100 / 2;
//2.2 根据分数更改等级
if(m_iScore >= (m_iLevel+1)* m_iLevel* 100 * 3)
{
m_iLevel++;
SetTimer(1,1600-250*m_iLevel,NULL);
}
sndPlaySound(".\\xiaoqu.wav",SND_ASYNC); //销行的声音
//2.3 更新视图
InvalidateCurrent();
//2.4 返回销去的行数
return DecreaseRow ;
}
//3. 否则没有销去方块
return 0 ;
}
开发者ID:BGCX262,项目名称:zzy-russia-rect-git,代码行数:61,代码来源:RussiaRectView.cpp
注:本文中的sndPlaySound函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论