Версия для печати темы
Нажмите сюда для просмотра этой темы в оригинальном формате
Форум программистов > C/C++: Мультимедия, OpenGL/DirectX > Воспроизведение звука


Автор: Djaconda 8.6.2008, 16:34
Как в Borland C++ 3.1 воспроизвести любой звуковой файл.

Автор: Djaconda 8.6.2008, 18:48
по секрету сказали что 3,1 ничего не может а Borland C++ 5,2 может вопрос остаеться как.

Автор: Graf_h 12.6.2008, 10:06
Цитата(Djaconda @  8.6.2008,  18:48 Найти цитируемый пост)
по секрету сказали что 3,1 ничего не может а Borland C++ 5,2 может вопрос остаеться как.

Можно все и везде smile

PlaySound Example

PlaySound("SoundName", hInst, SND_RESOURCE | SND_ASYNC);  
 

sndPlaySound Example

The SND_MEMORY flag indicates that the lpszSoundName parameter is a pointer to an in-memory image of the WAVE file. To include a WAVE file as a resource in an application, add the following entry to the application's resource script (.RC) file. 

soundName WAVE c:\sounds\bells.wav  

Код

BOOL PlayResource(LPSTR lpName)  
{ 
    BOOL bRtn; 
    LPSTR lpRes; 
    HANDLE hResInfo, hRes; 
 
    // Find the WAVE resource. 
 
    hResInfo = FindResource(hInst, lpName, "WAVE"); 
    if (hResInfo == NULL) 
        return FALSE; 
 
    // Load the WAVE resource. 
 
    hRes = LoadResource(hInst, hResInfo); 
    if (hRes == NULL) 
        return FALSE; 
 
    // Lock the WAVE resource and play it. 
 
    lpRes = LockResource(hRes); 
    if (lpRes != NULL) { 

        bRtn = sndPlaySound(lpRes, SND_MEMORY | SND_SYNC | 
            SND_NODEFAULT); 
        UnlockResource(hRes); 
    } 
    else 
        bRtn = 0; 
 
    // Free the WAVE resource and return success or failure. 
 
    FreeResource(hRes); 
    return bRtn; 





and further:

Код

PlayResource("soundName");  


Вообщем все описано в WinSDK! + есть бесплатные библиотеки (OpenAl, FMOD)

Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)