| | |
DirectSound WAVEFORMATEX Problem
![]() |
•
•
Join Date: Mar 2005
Posts: 22
Reputation:
Solved Threads: 0
Hey there, I'm having a problem with the WAVEFORMATEX format, and setting my primary buffer's format. My code is below:
My error is telling me that I don't have the priority level I need to set the format. How do I get this priority level?
C Syntax (Toggle Plain Text)
void ErrorBox(string strMessage) { MessageBox(NULL, strMessage.c_str(), "Error", MB_OK | MB_ICONEXCLAMATION); return; } bool DSPlayer::SetPrimaryBuffer() { if (lpDS == NULL) { ErrorBox("Direct sound not initialized."); return false; } ZeroMemory(&dsBufferDesc, sizeof(DSBUFFERDESC)); dsBufferDesc.dwSize = sizeof(DSBUFFERDESC); dsBufferDesc.dwFlags = DSBCAPS_PRIMARYBUFFER; dsBufferDesc.dwBufferBytes = 0; dsBufferDesc.lpwfxFormat = NULL; if (FAILED(lpDS->CreateSoundBuffer(&dsBufferDesc, &lpDSPrimary, NULL))) { ErrorBox("Unable to create primary buffer."); return false; } WAVEFORMATEX wfx; ZeroMemory(&wfx, sizeof(WAVEFORMATEX)); // 1ff9fe86 wfx.wFormatTag = WAVE_FORMAT_PCM; wfx.nChannels = 2; wfx.nSamplesPerSec = 22050; wfx.wBitsPerSample = 16; wfx.nBlockAlign = ((wfx.wBitsPerSample * wfx.nChannels) / 8); wfx.nAvgBytesPerSec = (wfx.nSamplesPerSec * wfx.nBlockAlign); wfx.cbSize = 0; HRESULT hr; if (FAILED(hr = lpDSPrimary->SetFormat(&wfx))) { ErrorBox("Failed to set primary buffer's format"); return false; } return true; }
My error is telling me that I don't have the priority level I need to set the format. How do I get this priority level?
Last edited by Mr Violent; Jul 11th, 2006 at 8:09 pm.
![]() |
Similar Threads
- Problem with Windows Update and WinXP (Web Browsers)
- Installing Windows 98 On VMware. Floppy problem (Windows 95 / 98 / Me)
- Windows XP keeps restarting since a new video card (Windows NT / 2000 / XP)
- Redhat Linux 6.2 - ipop3d problem? (*nix Software)
- Problem with T720 (Cellphones, PDAs and Handheld Devices)
- Connection Problems (Networking Hardware Configuration)
- .htaccess mod_rewrite problem (Linux Servers and Apache)
- Javascript/HTML problem!!! (JavaScript / DHTML / AJAX)
Other Threads in the C Forum
- Previous Thread: To find whether Single Linked List is looped.
- Next Thread: Help with 'While' statement,Please:-)
| Thread Tools | Search this Thread |
#include * adobe ansi api array asterisks binarysearch centimeter changingto char character cm copyimagefile cprogramme creafecopyofanytypeoffileinc csyntax database directory dynamic execv feet fgets file fork function getlasterror getlogicaldrivestrin givemetehcodez global grade gtkgcurlcompiling gtkwinlinux hacking hardware highest histogram ide include incrementoperators infiniteloop input interest kernel keyboard kilometer license linked linkedlist linux linuxsegmentationfault list locate logical_drives looping loopinsideloop. lowest match matrix meter microsoft motherboard mqqueue number odf opendocumentformat opensource owf pattern pdf performance pointer posix probleminc process program programming radix recursion recv repetition research reversing segmentationfault sequential single socket socketprograming standard string systemcall threads turboc unix user voidmain() wab whythiscodecausesegmentationfault windows.h windowsapi





