|
hi all
i am undergoing a project which converts wave file to Mp3.
Inorder to design this audio format converter i am considering the mp3 algo which has following steps:-
1.divide the data into frames such that each frame lasts for 1 sec.
so by the field in header named bits per sample,i have divided the frames.for eg if bits per sample is 8 ie there will be 8 bits or 1 char in each frame and so on...........
in addition to this there are following steps:--
1.if two notes are played at a single time and they are exactly same,only one of them shoudl be retained.
2. if two notes are playing at the same time,but one is of higher freq and one is of lower,only higher one shoudl be retained.
i have traversed the wave header and accesed the data,but that data is in ascii form.
so on that data how can apply the above 2 steps. the wave header is also not giving me any help.
any help is welcome
|
|
|
|
|
puneet_cha wrote: i have traversed the wave header and accesed the data,but that data is in ascii form.
Huh? There may be some ASCII there, but there's more.
WAVE PCM soundfile format[^]
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
hi,
AM using Playsound to play a wave file with a click of a button,but if i want to control the volume with another button,is it possible? Pls advice for a step by step guide..
Thannks in advance
|
|
|
|
|
|
hi,
Am using PlaySound and due to some constraints am not able to use MCI.
Thanks
Pls advice
|
|
|
|
|
I successeded hooking the WSARec for read only:
I hooked the following:
INT WINAPI WSARecvHookProc(SOCKET s, LPWSABUF lpBuffers, DWORD dwBufferCount, LPDWORD lpNumberOfBytesRecvd, LPDWORD lpFlags, LPWSAOVERLAPPED lpOverlapped, LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine)
My question is how to write to the hooked buffer. I want to modify a packet with value 1 to 0
how can I rewrite the buffer with the value I want?
I am coding with c++ (VS2005)
Thanks in advance!
|
|
|
|
|
Hi, i got a problem with a program here and i cant find a good solution :/.
I have the process id's of some extern programs running, and i want to close them. But i really want to close them, no TerminateProcess(). The program should close them or send them a message to close, and then wait for the progress til it closed. Could anyone give me a hint about that? thx
|
|
|
|
|
|
but what if i dont know the name of the window, just the name of the exe file?
|
|
|
|
|
|
yes but that doesnt solve the problem, if the exe is called "something.exe", and this program creates a window with the titel "processing ...", im not able to identify the exe with a window handle. All i know is the name of the exe, and the path. With those infos i have to close the running program. Currently im using CreateToolhelp32Snapshot () to get a list of all running processes, and TerminateProcess () to close it. But thats to agressive, i want a clean close.
|
|
|
|
|
Are you spawning the .exe? If so, you should squirrel away the handle for when you are trying to close it.
Considering that it is always possible to have more than one process with the same name running, it's really a crap shoot anyway without a handle.
|
|
|
|
|
If you have the process ID, then you could use EnumWindows() to search through all top level
windows and for each window found, use GetWindowThreadProcessId() to look for a matching
process ID.
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Hello all,
I've tried to use the OnCtrlColor handler and return a different brush in order to change the background color, and also a different pen in order to change the text color, but none of them work with the checkboxes...
How should I do it in order to be able to change the text color?
As always thank you in advance.
|
|
|
|
|
Call SetTextColor() and SetBkColor() on the DC passed into OnCtlColor
Darker than a black steer's tookus on a moonless praire night
Within you lies the power for good, use it!!!
|
|
|
|
|
I was doing this and it did not worked for me...
HBRUSH CTAM_BODlgPaletStats::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
if (GetFocus() == pWnd)
{
pDC->SetTextColor(RGB(255,0,0));
pDC->SetBkColor(RGB(0,255,0));
}
return hbr;
}
I've been trying to use those two functions, and they work fine for ll the editboxes and static controls in my dialog, but not for my checkboxes...
Any idea?
|
|
|
|
|
My bad.
A checkbox is a button, so it does not respond to WM_CTLCOLOR. You have to use the BS_OWNERDRAW style and do all the drawing yourself in response to a WM_DRAWITEM message.
Darker than a black steer's tookus on a moonless praire night
Within you lies the power for good, use it!!!
|
|
|
|
|
ah.. that was it...
I knew that the checkbox was a button but then...
in the MSDN help:
nCtlColor (->one of the parametes of the OnCtlColor)
Contains one of the following values, specifying the type of control:
<code>CTLCOLOR_BTN Button control</code>
CTLCOLOR_DLG Dialog box
CTLCOLOR_EDIT Edit control
CTLCOLOR_LISTBOX List-box control
CTLCOLOR_MSGBOX Message box
CTLCOLOR_SCROLLBAR Scroll-bar control
CTLCOLOR_STATIC Static control
well, who knows...
-- modified at 14:26 Saturday 28th April, 2007
I forgot to thank you for your feedback!
I'm searching for an alternative solution, so don't worry on that, I think is strange but...
|
|
|
|
|
|
Yes, I did not remember that class, some time ago I played a little with the CButtonST from Davide Calabro, it worked great, but I wanted to stick to "standard material", but I'll consider that, it worked really well some time ago.
Thank you for your feedback!
|
|
|
|
|
When I use this class to draw a picture in a timer function.
I find my free memory lose too fast!!
Who can help me !!
Thanks!!!
(My english is not very well!)
class CCarton
{
public:
CCarton();
virtual ~CCarton();
void Init( CWnd* pWnd );
void Draw( CDC* pDC, INT iX, INT iY );
private:
CBitmap m_bmp;
CBitmap *m_pOldBmp;
CWnd* m_pDrawWnd;
CDC m_dcSrc;
BITMAP bm;
};
CCarton::CCarton()
{
m_pOldBmp = NULL;
}
CCarton::~CCarton()
{
if( m_pOldBmp != NULL )
{
m_dcSrc.SelectObject( m_pOldBmp );
m_dcSrc.DeleteDC();
}
}
void CCarton::Init( CWnd* pWnd )
{
m_pDrawWnd = pWnd;
m_bmp.LoadBitmap( IDB_BITMAP );
m_bmp.GetBitmap( & bm );
CDC* pDC = pWnd->GetDC();
m_dcSrc.CreateCompatibleDC( pDC );
m_dcSrc.SetBkMode( TRANSPARENT );
m_pOldBmp = m_dcSrc.SelectObject( &m_bmp );
}
void CCarton::Draw( CDC* pDC, INT iX = 0, INT iY = 0 )
{
pDC->BitBlt( iX, iY ,bm.bmWidth, bm.bmHeight, &m_dcSrc, 0, 0, SRCCOPY );
}
// use draw at here !
void CBmpView::OnTimer(UINT nIDEvent)
{
m_Carton.Draw( GetDC(), 0, 0 );
CView::OnTimer(nIDEvent);
}
//initializing at here
void CBmpView::OnInitialUpdate()
{
CView::OnInitialUpdate();
m_Carton.Init( this );
}
-- modified at 6:26 Sunday 29th April, 2007
|
|
|
|
|
void CBmpView::OnTimer(UINT nIDEvent)
{
// TODO: Add your message handler code here and/or call default
CDC* pDC=GetDC();
if (pDC) {
m_Carton.Draw( pDC, 0, 0 );
ReleaseDC(pDC);
}
CView::OnTimer(nIDEvent);
}
|
|
|
|
|
Thank you for you help !
I know it now.
Every times after use DC do someting must release it to free memory!
Thank you again!
|
|
|
|
|
hi!
i want to get color of the pixel, but my system sets 16 bits for color quality. what function do i call instead of calling GetPixel?
is there a sample?
thank you
Zo.Naderi-Iran
|
|
|
|
|
No matter, the same. It returns a COLORREF value which is simply an integer value containing the values for rgb [and alpha if applied].
--
=====
Arman
|
|
|
|