|
I am trying to play (synthesize) some notes when user presses keyboard keys.
I use midiOutShortMsg from mmsystem.h to play notes, but there is an audible delay (about 0.1 sec) before sound starts playing.
I've heard of DirectMusic, but it is deprecated and I can't find any download link for DirectX 8 (which was the last release containing it).
Is there any workaround?
|
|
|
|
|
In case anyone is interested, I solved this problem using ASIO. There is a free driver, ASIO4ALL, that suits almost any audio card (in case your native driver does not support ASIO). The delay is unaudible now.
|
|
|
|
|
This question sounds silly.. but i am confused. i wanted to know what is the order in which the classes are called in an SDI Application.
|
|
|
|
|
Broadly speaking I think it goes like this: the CApp() derived class is created first and that then creates the CMainFrame which creates the CView . The CDocument() is then created by the framework and connected to the view. You can use the debugger to step through your application to see exactly what is the sequence of events. Don't forget to put breakpoints in the proper places so you can quickly skip over all the framework code.
[edit]spelling[/edit]
|
|
|
|
|
you can set MessageBox in your code and you will get the order,for example:
you set a messagebox in your VIEW CLASS of LBUTTONDOWN function,set messagebox in your DOC CLASS of LBUTTONDOWN function,and set a messagebox in your APP CLASS of LBUTTONDOWN function,you click the program's client,the
view box will display,then you remove the VIEW MESSAGEBOX ,then click the program's client,DOC MESSAGEBOX display........
|
|
|
|
|
creating simple dilog box without using resource script...please help urgent requitement
kir_MFC
|
|
|
|
|
This is the third time you have asked this question (or a variation of it). Try reading the documentation on MSDN[^], and using one of the examples.
|
|
|
|
|
Just check this link. [^]
Величие не Бога может быть недооценена.
|
|
|
|
|
In addition... To check this[^] won't hurt you.
Regards.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpfull answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
|
please let me know the procedure of creating modelessdilog box dynamically
kir_MFC
|
|
|
|
|
The procedure in your previous post is the correct way.
You should try the suggestions given there and follow up on that instead of posting the question again.
|
|
|
|
|
i use InternetOpenUrl (as async) to receive a file from a url.
this is the code i use :
BOOL CMyCode::RequestFile( LPCTSTR lpszUrl )<br />
{<br />
m_hInternet = InternetOpen(_T("MyCode"), INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, INTERNET_FLAG_ASYNC);<br />
if (!m_hInternet)<br />
{<br />
return FALSE;<br />
}<br />
<br />
InternetSetStatusCallback(m_hInternet, CMyCode::InternetStatusCallback);<br />
<br />
InternetOpenUrl(m_hInternet, <br />
lpszUrl, <br />
NULL,<br />
0, <br />
INTERNET_FLAG_RELOAD | INTERNET_FLAG_PRAGMA_NOCACHE | INTERNET_FLAG_NO_CACHE_WRITE, <br />
(DWORD) this);<br />
return TRUE;<br />
}<br />
<br />
void __stdcall CMyCode::InternetStatusCallback (HINTERNET hSession, DWORD Context, DWORD Status, LPVOID pInformation, DWORD InfoLength)<br />
{<br />
CMyCode* pThis = (CMyCode*) Context;<br />
if (!pThis)<br />
{<br />
return;<br />
}<br />
<br />
switch (Status) <br />
{<br />
case INTERNET_STATUS_RESPONSE_RECEIVED:<br />
m_dwNumytes2Read = (*(DWORD *)pInformation);<br />
break;<br />
case INTERNET_STATUS_HANDLE_CREATED:<br />
m_hHttpSession = * (HINTERNET *) pInformation;
break;<br />
case INTERNET_STATUS_REQUEST_COMPLETE:<br />
CompleteRequest();<br />
break;<br />
case INTERNET_STATUS_HANDLE_CLOSING:<br />
break;<br />
default:<br />
ATLTRACE(_T("Status is %ld\n"), Status);<br />
break;<br />
} <br />
}<br />
<br />
void CMyCode::CompleteRequest()<br />
{<br />
LPBYTE pBuff = new BYTE[m_dwNumytes2Read];<br />
ZeroMemory(pBuff, m_dwNumytes2Read);<br />
<br />
DWORD dwBytesRead(0);<br />
BOOL bOK(TRUE);<br />
while (bOK)<br />
{<br />
bOK = InternetReadFile (m_hHttpSession, pBuff, m_dwNumytes2Read, &dwBytesRead);<br />
if (!dwBytesRead)<br />
bOK = FALSE;<br />
}<br />
<br />
if (pBuff)<br />
delete []pBuff;<br />
<br />
Abort();<br />
<br />
}<br />
<br />
the code works ok only i have 2 major problems:
1. the file is received in a chunks of 267/268 Bytes each time i call InternetReadFile????
2. the CPU reaches 80% until the file is download completely
can any1 help me here?
thanks in advanced
Interface basics click here :
http://www.codeproject.com/com/COMBasics.asp
don't forget to vote
|
|
|
|
|
You can try URLDownloadToFile function.
|
|
|
|
|
thanks for the reply...
i can not use other methods other than what i've posted in my code (for stupid reasons go figure)
so i would still like any help regarding my issues
thanks again
Interface basics click here :
http://www.codeproject.com/com/COMBasics.asp
don't forget to vote
|
|
|
|
|
YaronNir wrote: i can not use other methods other than what i've posted in my code (for stupid reasons go figure)
so i would still like any help regarding my issues
Then You're at a dead end! We cannot help you any further!(for stupid reasons go figure).
Bram van Kampen
|
|
|
|
|
this sort of reply is in appropriate,
if you can see below i got a really good reply who took my question seriously
shame on you....
Interface basics click here :
http://www.codeproject.com/com/COMBasics.asp
don't forget to vote
|
|
|
|
|
Have you checked the value of m_dwNumytes2Read bfore your call to InternetReadFile() ?
|
|
|
|
|
what do you mean? can you give an example
Interface basics click here :
http://www.codeproject.com/com/COMBasics.asp
don't forget to vote
|
|
|
|
|
You have the following code (btw could you edit your original message and put the code between <pre></pre> tags):
case INTERNET_STATUS_RESPONSE_RECEIVED:
m_dwNumytes2Read = (*(DWORD *)pInformation);
break;
void CMyCode::CompleteRequest()
{
LPBYTE pBuff = new BYTE[m_dwNumytes2Read];
ZeroMemory(pBuff, m_dwNumytes2Read);
DWORD dwBytesRead(0);
BOOL bOK(TRUE);
while (bOK)
{
bOK = InternetReadFile (m_hHttpSession, pBuff, m_dwNumytes2Read, &dwBytesRead);
}
The value of m_dwNumytes2Read is set when you process the INTERNET_STATUS_RESPONSE_RECEIVED message and is relevant to the status information, so it is probably less than the amount of data that may be available. Try resetting it to some bigger value before calling InternetReadFile() for example:
dwNumytes2Read = 2048;
LPBYTE pBuff = new BYTE[m_dwNumytes2Read];
DWORD dwBytesRead;
BOOL bOK(TRUE);
while (bOK)
{
bOK = InternetReadFile (m_hHttpSession, pBuff, m_dwNumytes2Read, &dwBytesRead);
|
|
|
|
|
thanks for the reply - it did solve the problem now the chunck are 2048 bytes each time - good!
the second problem still remains - high CPU about 80% - how can i solve this?
thanks again for your kind reply
Interface basics click here :
http://www.codeproject.com/com/COMBasics.asp
don't forget to vote
|
|
|
|
|
First thing is to run some tests with different buffer sizes to see how that affects performance, 2048 was just a number plucked from the air.
Looking at your code I notice that you use ZeroMemory on the input buffer just before reading data into it; this is wasteful and serves no purpose, just allocate it with the new call.
Alternatively you could allocate your buffer at the beginning of the program, either via new or as a static data area. This would save repeated new delete[] pairs, and the consequent garbage collection code.
There may be other issues in the rest of your code, but I leave that for you to investigate.
|
|
|
|
|
once again - thank you!
Interface basics click here :
http://www.codeproject.com/com/COMBasics.asp
don't forget to vote
|
|
|
|
|
Hi,
I want to know how to call an Crystal report using VC++ code in Visual Studio 2008. In Visual Studio 6, we use to have Project->Add to Project->Components and Control. This will enable us to add the Crystal Report component into our application. But I couldn't find a way to add Crystal report control into my VC++ application using VS 2008.
Please help me with this. If you have a sample code for VS 2005/VS 2008 that will help.
Thanks in Advance
|
|
|
|
|
Hi,
I am trying to write a multi-line string into an edit control on a
dialog box. I am using following code however not getting any success.
CWnd *pWnd =GetDlgItem(IDC_STATIC_MSGCNT);
CRect lpRect = CRect(100,100,20,20);
pWnd->GetWindowRect(&lpRect);
CEdit *pEdit = new CEdit();
pEdit->Create(ES_MULTILINE|ES_LEFT|ES_READONLY,lpRect,this,m_iEditCTLID++);
pEdit->ShowWindow(SW_SHOW);
CString str;
str.Format("%d",pWLSErrRpt->GetWLSMessageNo());
pEdit->SetWindowTextA(str);
Appreciate your help.
Thanks
|
|
|
|