|
Malli_S wrote: Yes, gone through it.
And what was the result? You still have not shown any sample code to help us diagnose your problem.
The best things in life are not things.
|
|
|
|
|
I've posted the code in the earlier post.
|
|
|
|
|
Malli_S wrote: I've posted the code in the earlier post.
Wow, but this is hard work.
Please post the exact code that causes you a problem along with any and all error messages as they appear on your screen. Only then can we begin to make a guess at your problem and its resolution. Before doing this make sure that you are using the proper format of any function calls, including the correct parameters, according to both the MSDN documentation (see link I provided earlier) and the actual header files in the version of the SDK that you are using. Ensure that you have included all the correct libraries in your project properties, again in line with the MSDN documentation.
Please do not waste your or our time with one liners like the above which serve absolutely no purpose.
The best things in life are not things.
|
|
|
|
|
#include <objbase.h>
#include <audioenginebaseapo.h>
#include <stdio.h>
#include <stdlib.h>
#include <wmcodecdsp.h>
APO_CONNECTION_DESCRIPTOR inDesc = {
APO_CONNECTION_BUFFER_TYPE_EXTERNAL,
NULL,
0,
NULL,
APO_CONNECTION_DESCRIPTOR_SIGNATURE
}, *pInDesc = &inDesc,
outDesc = {
APO_CONNECTION_BUFFER_TYPE_EXTERNAL,
NULL,
0,
NULL,
APO_CONNECTION_DESCRIPTOR_SIGNATURE
}, *pOutDesc = &outDesc;
APO_CONNECTION_PROPERTY inConn = {
NULL,
0,
BUFFER_VALID,
APO_CONNECTION_PROPERTY_SIGNATURE
}, *pInConn = &inConn,
outConn = {
NULL,
0,
BUFFER_INVALID,
APO_CONNECTION_PROPERTY_SIGNATURE
}, *pOutConn = &outConn;
#define CHECKHR(x) hr = x; if (FAILED(hr)) {printf("%d: %08X\n", __LINE__, hr); goto exit;}
#define SET_I4(pkey,val) pv.vt = VT_I4; pv.lVal = val; CHECKHR(pPS->SetValue(pkey, &pv));
#define SET_BOOL(pkey,val) pv.vt = VT_BOOL; pv.boolVal = val ? VARIANT_TRUE : VARIANT_FALSE; CHECKHR(pPS->SetValue(pkey, &pv));
void useAPO()
{
IUnknown* pUnk = NULL;
IAudioProcessingObjectRT* pRT = NULL;
IAudioProcessingObjectConfiguration* pConfig = NULL;
IPropertyStore* pPS = NULL;
WAVEFORMATEXTENSIBLE wfx;
IAudioMediaType* pAMTIn = NULL, *pAMTOut = NULL;
PROPVARIANT pv;
HRESULT hr;
CHECKHR(CoCreateInstance(CLSID_CWMAudioLFXAPO, NULL, CLSCTX_INPROC_SERVER, IID_IUnknown, (void**)&pUnk));
CHECKHR(pUnk->QueryInterface(__uuidof(IAudioProcessingObjectRT), (void**)&pRT));
CHECKHR(pUnk->QueryInterface(__uuidof(IAudioProcessingObjectConfiguration), (void**)&pConfig));
CHECKHR(pUnk->QueryInterface(IID_IPropertyStore, (void**)&pPS));
SET_I4(MFPKEY_CORR_MULTICHANNEL_MODE, 2);
SET_I4(MFPKEY_CORR_BASS_MANAGEMENT_MODE, 1);
SET_I4(MFPKEY_BASSMGMT_SPKRBASSCONFIG, 0);
SET_I4(MFPKEY_BASSMGMT_CROSSOVER_FREQ, 120);
SET_BOOL(MFPKEY_CORR_LOUDNESS_EQUALIZATION_ON, TRUE);
SET_BOOL(MFPKEY_BASSMGMT_BIGROOM, TRUE);
wfx.Format.wFormatTag = WAVE_FORMAT_EXTENSIBLE;
wfx.Format.nChannels = 2;
wfx.Format.nSamplesPerSec = 44100;
wfx.Format.wBitsPerSample = 32;
wfx.Format.nBlockAlign = wfx.Format.wBitsPerSample / 8 * wfx.Format.nChannels;
wfx.Format.nAvgBytesPerSec = wfx.Format.nSamplesPerSec * wfx.Format.nBlockAlign;
wfx.Format.cbSize = 22;
wfx.Samples.wValidBitsPerSample = 32;
wfx.dwChannelMask = 3;
wfx.SubFormat.Data1 = WAVE_FORMAT_IEEE_FLOAT;
wfx.SubFormat.Data2 = 0x0000;
wfx.SubFormat.Data3 = 0x0010;
wfx.SubFormat.Data4[0] = 0x80;
wfx.SubFormat.Data4[1] = 0x00;
wfx.SubFormat.Data4[2] = 0x00;
wfx.SubFormat.Data4[3] = 0xaa;
wfx.SubFormat.Data4[4] = 0x00;
wfx.SubFormat.Data4[5] = 0x38;
wfx.SubFormat.Data4[6] = 0x9b;
wfx.SubFormat.Data4[7] = 0x71;
CHECKHR(CreateAudioMediaType(&wfx.Format, &pAMTIn));
wfx.Format.nChannels = 6;
wfx.Format.nBlockAlign = wfx.Format.wBitsPerSample / 8 * wfx.Format.nChannels;
wfx.Format.nAvgBytesPerSec = wfx.Format.nSamplesPerSec * wfx.Format.nBlockAlign;
wfx.dwChannelMask = 0x3f;
CHECKHR(CreateAudioMediaType(&wfx.Format, &pAMTOut));
pInDesc->pFormat = pAMTIn;
pOutDesc->pFormat = pAMTOut;
CHECKHR(pConfig->LockForProcess(1, &pInDesc, 1, &pOutDesc));
while (0)
{
pInConn->u32ValidFrameCount = 0;
pInConn->pBuffer = 0;
pOutConn->pBuffer = 0;
pOutConn->u32BufferFlags = BUFFER_INVALID;
pRT->APOProcess(1, &pInConn, 1, &pOutConn);
}
pConfig->UnlockForProcess();
exit:
#define SAFE_RELEASE(p) if (p) p->Release();
SAFE_RELEASE(pAMTIn);
SAFE_RELEASE(pAMTOut);
SAFE_RELEASE(pUnk);
SAFE_RELEASE(pRT);
SAFE_RELEASE(pConfig);
SAFE_RELEASE(pPS);
}
The above code gives compiler error for CreateAudioMediaType() function. The error is
error C2660: 'CreateAudioMediaType' : function does not take 2 arguments
When I modify these function calls to
hr = CreateAudioMediaType(&wfx.Format, wfx.Format.cbSize, &pAMTOut);
it gives linker error as :
error LNK2019: unresolved external symbol _CreateAudioMediaType@12 referenced in function "void __cdecl useAPO(void)" (?useAPO@@YAXXZ)
This is what all I have in my code. I hope now this will help.
Thanks in advance.
|
|
|
|
|
Malli_S wrote: The above code gives compiler error for CreateAudioMediaType() function. The error is
error C2660: 'CreateAudioMediaType' : function does not take 2 arguments
Well that's quite clear, your function call does not match the function prototype in the package header file. As far as I am able to ascertain the correct definition is as described in this page[^] in MSDN.
Malli_S wrote: error LNK2019: unresolved external symbol _CreateAudioMediaType@12 referenced in function "void __cdecl useAPO(void)" (?useAPO@@YAXXZ)
Again this message is quite clear; the function you are attempting to call exists in an external library that has not been included in your project. Unfortunately the documentation for the CreateAudioMediaType() function does not indicate which library you need to include in your project. You could try checking the header file to see if it gives any information there. Unfortunately these functions appear to be part of the Windows Driver Kit, and I do not have a copy so am unable to offer any further suggestions.
You may like to recheck the documentation you are working from, or try posting on one of the Microsoft technical forums.
The best things in life are not things.
|
|
|
|
|
Yes, I already had tried this all and then posted it here. But still thanks for your great efforts.
|
|
|
|
|
several sockets (multiple threading) on server-side share same public resource, such as user-array, for deleting, adding users etc.
sometimes, server crashes.
reason of server's crashing can't be debugged properly, but, from debug hints, I guess the reason is that when a socket is doing something on user-array but another socket start adding or deleting users on same array.
If this is real reason, how to avoid it? lock user-array? or other ways?
Thanks for comments.
|
|
|
|
|
You HAVE to use synchronization if you have multiple threads accessing the same object if that object is being altered!!!!!
You can use a critical section[^] or a mutex[^] to ensure only one thread can use the protected object at a time.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Put the code that accesses the shared resources between the EnterCriticalSection and LeaveCriticalSection APIs.
|
|
|
|
|
See also :
class CUserInfo;
typedef CUserInfoArray CArray<CUserInfo*>;
class CUserSyncArray : protected CUserInfoArray
{
CCriticalSection m_cLock;
public:
CUserSyncArray() {..}
virtual ~CUserSyncArray() {..}
CUserInfo* GetAt(INT_PTR iPos) {
CSingleLock cExceptionFreeLock(&m_cLock, true);
return CUserInfoArray::GetAt(iPos);
}
};
They sought it with thimbles, they sought it with care;
They pursued it with forks and hope;
They threatened its life with a railway-share;
They charmed it with smiles and soap.
|
|
|
|
|
includeh10 wrote: reason of server's crashing can't be debugged properly, but, from debug hints, I guess the reason is that when a socket is doing something on user-array but another socket start adding or deleting users on same array.
In continuation with Superman you can also utilize service of Events or semaphore also. the benefits of semaphore ( you can solve reader writer problem using it)
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Need a way to detect the properties of the text of any object on an application window example the displayed name of a button or a tab, label etc. Is there a means to get properties like :
1. name of the font
2. color of the font
3. size of the font
4. bold/italic/regular
etc..
|
|
|
|
|
not really.
remember, a window can draw on itself using any font, with any set of attributes, at any time. and it doesn't have to keep track of any of that.
|
|
|
|
|
How about the current set of properties for example :
the page contains a listview and the text of the listview items is set at a particular set of properties font,size,color etc.
Now can we get the properties of the currently displayed text in the listview.
|
|
|
|
|
sure, if the author of the control wants to store and report all the font usage for that control, you'll be able to get it. but in general, there's no way to know which fonts a window has used.
|
|
|
|
|
As Chris said, it is not guaranteed to get what you want.
A window or control has an associated device context and a device context has an associated font.
However, when a window draws text it can change this.
You can get the currently associated font using the GetTextMetrics[^] function.
But this may not be the expected result.
|
|
|
|
|
You could try experimenting with API hooking, however, this might prove to be quite a challange, if possible at all, and it might or might not produce the required result.
You could try hooking the GetDC[^], GetWindowDC[^], BeginPaint[^]... (and probably their counterparts also, ReleaseDC, EndPaint, ...) and the kinds, also DrawText[^], DrawTextEx[^], TextOut[^], ..., keep track of the connection between the Device Contexts and window handles, querying the font information at the right places (e.g. like when DrawText is called).
Check out this article: API hooking revealed[^] for more info on API hooking. The hooking part itself is somewhat easier if you try to hook things in your own process, no need to 'Inject' a DLL, you can simply load it.
Btw, why do you need that information? Just curious here...
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> //TODO: Implement signature here<
|
|
|
|
|
In general case, except the discovering of the font color :
void TryGetFontInfo(CWnd* pcWnd)
{
if (pcWnd->GetSafeHwnd()) {
CFont* pcFont(pcWnd->GetFont());
if (pcFont->GetSafeHandle()) {
LOGFONT sLF = {0};
pcFont->GetLogFont(&sLF);
}
}
}
They sought it with thimbles, they sought it with care;
They pursued it with forks and hope;
They threatened its life with a railway-share;
They charmed it with smiles and soap.
|
|
|
|
|
Hi all,
How to keep the Modeless dialog Active on the screen.
I have created modeless dialog,when i click outside that dialog that dialog gets disappered.
How can i make it active,even if i click outside the dialog to modify something.
I dont want to make it as Modal because,i cant go to other dialog for modification
Please let me know any suggestions
Thanks
Sharan
|
|
|
|
|
Try adding WS_TOPMOST[^] to the extended style of your dialog.
The best things in life are not things.
|
|
|
|
|
This is expected behavior, if you click outside a modeless dialog, the focus goes to whatever you selected, that's what modeless dialogs do. If you don't want to lose focus, use a modal dialog. You can use the top most approach that was suggested, but your dialog is going to always be in the way of whatever it is you're selecting behind it so this should only be done if your dialog is small.
|
|
|
|
|
Simply set the System Modal property of the dialog to True and it will get the top most style.
|
|
|
|
|
«_Superman_» wrote: Simply set the System Modal property of the dialog to True
if you put system modal property to true,it will lose it basic functionality as modeless dialog box
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
// I have created modeless dialog...
What parent was set ?
They sought it with thimbles, they sought it with care;
They pursued it with forks and hope;
They threatened its life with a railway-share;
They charmed it with smiles and soap.
|
|
|
|
|
So which C++ documentation tools have you used? I know about Doxygen, of course. I'm just wondering if there's anything better/easier to use. It doesn't have to be free.
|
|
|
|
|