'win32'에 해당되는 글 1건

  1. 2006/12/14 win32 console 에서 wav 파일 재생 2

관련자료를 찾기위해 한참을 찾아헤맸다

결과는 너무나도 허무한 -_-;

# SndPlaySound
WORD sndPlaySound( LPSTR lpszSound,   : 출력할 사운드 이름(파일이름, ID)
UINT  fsSound );   : 설정 플래그( |연산가능)

       fsSound   :  SND_ASYNC - 재생시 다른 작업 허용하는 비동기식 작동
                          SND_SYNC  - 재생 끝날 때까지 다른 작업 허용안함.
                          SND_LOOP  - 재상 끝나면 처음으로 가서 다시 재생.
                          SND_NODEFAULT - 재생 실패시 DEFAULT 소리 차단.
                          SND_MEMORY - 리소스에 등록된 이름을 메모리에 올려 사용.
                        ( SND_MEMORY를 제외하면 파일에 관한 처리)

VS6 Visual C++

프로젝트 setting -> link -> modules 부분에 winmm.lib 추가

[CODE type="c++"]
#include <windows.h>
#include <MMsystem.h>

int main(int argc, char* argv[])
{
[tab]if(argc<1){
[tab][tab]cout<<"wplay foo.wav"<<endl;
[tab][tab]return 1;
[tab]}
[tab]sndPlaySound(argv[1], SND_ASYNC);
[tab]return 0;
}[/HTML][/CODE]

VS.net  C++

[CODE type="c++"]
#include <windows.h>
#include <MMsystem.h>
#include <tchar.h>
#pragma comment (lib ,"winmm.lib")
int main(int argc, char* argv[])
{
[tab]if(argc<1){
[tab][tab]cout<<"wplay foo.wav"<<endl;
[tab][tab]return 1;
[tab]}
[tab]sndPlaySound(_T(argv[1]), SND_ASYNC);  // type casting !!
[tab]return 0;
}[/HTML][/CODE]

2006/12/14 03:01 2006/12/14 03:01