本文整理汇总了C++中sndPlaySound函数的典型用法代码示例。如果您正苦于以下问题:C++ sndPlaySound函数的具体用法?C++ sndPlaySound怎么用?C++ sndPlaySound使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sndPlaySound函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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
}
示例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 );
}
示例4: sndPlaySound
void CWaveOpen::OnBtnPlay() {
sndPlaySound( NULL, NULL );
CString str = GetPathName();
if( str.GetLength() > 0 ) {
sndPlaySound( str, SND_FILENAME | SND_ASYNC );
}
}
示例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 );
}
示例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);
}
示例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;
}
示例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);
}
示例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);
}
}
示例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;
}
}
示例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(""));
}
示例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();
}
}
示例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;
}
示例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 );
}
}
示例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
}