|
 excuse me for delay to response,
//OVERRUN is for Pitch array ....
<br />
char *BeginFile = NULL; <br />
BeginFile = new char[44]; <br />
<br />
<br />
try <br />
{<br />
File.Read(BeginFile,44);<br />
}<br />
catch(CFileException *pe) <br />
{<br />
pe->ReportError();<br />
}<br />
<br />
DWORD dwLength = (File.GetLength()-44);<br />
<br />
char *inChar ; <br />
inChar = new char[800000];<br />
<br />
<br />
try <br />
{<br />
File.Read(inChar,dwLength);<br />
}<br />
catch(CFileException *pe) <br />
{<br />
pe->ReportError();<br />
}<br />
File.Close();<br />
<br />
int tmp;<br />
unsigned char c1,c2;<br />
double *in ; <br />
in = new double[400000];<br />
<br />
<br />
int smp=dwLength/2;<br />
<br />
const int fs=22050; <br />
const int fc=7500; <br />
int kc = floor( (double)(fc * N / fs) )+1; <br />
int len=ceil((double)smp/N*2)+1;<br />
double *CBn ;<br />
CBn = new double[kc*len];<br />
<br />
int sizeCB;<br />
sizeCB = Netmfile.Feature( in , kc ,smp , CBn );<br />
<br />
<br />
int *Pitch = NULL;<br />
Pitch = new int[3000];
int LenPitch = Netmfile.PitchExtract( in ,smp ,Pitch );<br />
<br />
delete in;<br />
delete BeginFile;<br />
delete in;<br />
delete BeginFile;<br />
char weigthpath[]="text\\";
<br />
double *CB1t ;<br />
CB1t = new double [kc*len];<br />
<br />
Netmfile.net( CBn , CB1t , kc , weigthpath , sizeCB );<br />
<br />
Netmfile.z = sizeCB * N - (sizeCB-1) * (N/2);<br />
smp2 = new double [Netmfile.z];<br />
for (i=0 ; i<Netmfile.z ; i++)<br />
smp2[i]=0;<br />
<br />
delete CBn;<br />
delete CB1t;<br />
delete Pitch;
<br />
}<br />
<br />
<br />
<br />
int mfile::PitchExtract( double *input ,int lengthwav ,int *pitch )<br />
{<br />
<br />
a=49;<br />
p=0; m=0; k=0; i= 0; j=0;<br />
maxfft=0;<br />
maxpos=0;<br />
int *pichi= NULL;<br />
pichi = pitch;<br />
<br />
<br />
while ( m< lengthwav-N )<br />
{<br />
*pichi= maxpos + 1;<br />
m = m + *pichi;<br />
pichi++;<br />
p++;<br />
}<br />
<br />
<br />
m=1;<br />
i=0;<br />
pichi = pitch;<br />
while (i<p)<br />
{<br />
m=m+pichi[i];<br />
if (m>N/2)<br />
{<br />
for ( j=p ; j>=i+1 ; j--)<br />
pichi [ j ] = pichi [ j - 1 ] ;<br />
pichi [ i ] = N/2;<br />
pichi [ i + 1 ] = m - N/2;<br />
m=0;<br />
p++; <br />
}<br />
i++;<br />
}<br />
return (p);<br />
}<br />
|
|
|
|
|
First of all...what's going on in these sections....you left something out
for (i=0 ; i smp2[i]=0;
delete CBn;
delete CB1t;
delete Pitch; // have problem.......................use devpartner say OVERRUN
}
...
while (i {
m=m+pichi[i];
if ...
Mark
|
|
|
|
|
excuse me for this fault,
i do not know when i ignore HTML tags , the messeage is correct
Netmfile.z = sizeCB * N - (sizeCB-1) * (N/2);
//double *smp2;
smp2 = new double [Netmfile.z];
for (i=0 ; i<Netmfile.z ; i++)
smp2[i]=0;
delete CBn;
delete CB1t;
delete Pitch;
//second
m=1;
i=0;
pichi = pitch;
while (i<p)
{
m=m+pichi[i];
if (m>N/2)
{
for ( j=p ; j>=i+1 ; j--)
pichi [ j ] = pichi [ j - 1 ] ;
pichi [ i ] = N/2;
pichi [ i + 1 ] = m - N/2;
m=0;
p++; //beacause of increase of Pitch length in each atage
}
i++;
}
return (p);
|
|
|
|
|
mostafa_pasha wrote: delete Pitch; // have problem.......................use devpartner say OVERRUN
Use delete [] Pitch instead.
All new[] must have a matching delete[] .
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hi, but there is not diffrence , i think before i must use
delete [] when i create two dimensional array in heap such as
this:
vf_Weigth = new float* [nlayer2+1];
for ( i =0 ; i< (nlayer2+1) ; i++)
vf_Weigth[i] = new float[nlayer1];
delete [] vf_Weigth;
// but now i find i delete in these way:
for (int i = 0; i < nlayer2+1 ; i++)
delete vf_Weight[i];
is that code is correct?
at last i say again delete [] Pitch is not work & my code have that serios
error.
Best Regards.
M.J.M.
|
|
|
|
|
|
Mark Salsbery wrote: The original poster said "i allocate very large data".
Therefore, your code sample should be:
int* pnSize=new int[100];
HE HE HE!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Maybe I did something wrong, but I doubt it.
MFC8.0 MDI apps leak resources. To duplicate create a new MFC MDI app, selecting all the default settings. Start Task Manager so you can watch the number of GDI objects. Start the app, press and hold the Ctrl+N key (New document) until you get a bunch of new documents on the screen. GDI object count will climb (obviously). Now press and hold Ctrl+F4 to close all those documents. GDI object count will not go back down.
Not a huge deal for me as the app is not meant to run 24/7, but I spent a lot of time looking for where I was leaking resources, only to find out it was MFC itself that was leaking them.
You may be right I may be crazy -- Billy Joel --
Within you lies the power for good, use it!!!
|
|
|
|
|
PJ Arends wrote: MFC8.0 MDI apps leak resources.
If it's any consolation, MFC v4.2 does too.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Is the leak you are seeing related to this: http://support.microsoft.com/kb/319740/en-us[^]?
That is an older KB article that talks about how MFC leaks on Windows XP and above...
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
James R. Twine wrote: Is the leak you are seeing related to this: http://support.microsoft.com/kb/319740/en-us[^]?
Yeah, that seems to be it. When I switch the theme to windows classic the GDI count does not go up at all when creating the new documents.
Thanks for the link.
You may be right I may be crazy -- Billy Joel --
Within you lies the power for good, use it!!!
|
|
|
|
|
I had a hotfix for this bug from MS a couple of years ago. Problem with uxtheme.dll IIRC.
Kicking squealing Gucci little piggy.
|
|
|
|
|
Yeah, that is what the link James posted says anyway.
You may be right I may be crazy -- Billy Joel --
Within you lies the power for good, use it!!!
|
|
|
|
|
The hotfix to patch windows XP sp2 to fix this problem is available at WindowsXP-KB319740-v5-x86-ENU.exe[^].
You may be right
I may be crazy
-- Billy Joel --
Within you lies the power for good - Use it!
|
|
|
|
|
That's cool!
I can't believe this one's been around so long and still hasn't found its way into
updates or a service pack.
I wrote it off long ago as a TODO item...find the GDI resource leak in MFC.
I sure wasted many hours trying to find it in my code.
It was only a few handles anyway, right?
Thanks,
Mark
|
|
|
|
|
how to extract the system icons and add them to our CImageList object??
|
|
|
|
|
indra20 wrote: how to extract the system icons...
Systems icons? Are you looking for ExtractIcon() ?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Doing the following to add to my own list, AddIcon is passing
but later when i am doing:
TreeView_SetImageList(hWnd, m_clTreeImageList.GetSafeHandle(), TVSIL_NORMAL);
the icons are not getting displayed.
// Lets Add Application defined Image List.. START
IMalloc* pMalloc;
SHGetMalloc(&pMalloc);
HIMAGELIST hSysImageList = NULL;
LPITEMIDLIST pidl = NULL;
SHGetSpecialFolderLocation(NULL, CSIDL_DESKTOP, &pidl);
SHFILEINFO sfi;
ZeroMemory(&sfi, sizeof(SHFILEINFO));
hSysImageList = (HIMAGELIST) SHGetFileInfo((LPCTSTR)pidl, 0,
&sfi, sizeof(SHFILEINFO), SHGFI_PIDL | SHGFI_SYSICONINDEX | SHGFI_SMALLICON);
pMalloc->Free(pidl);
if(!pMalloc)
pMalloc->Release();
//Images for the CoolCool Folders....
CImageList* pImgList = CImageList::FromHandle(hSysImageList);
m_nImgListCnt = pImgList->GetImageCount();
m_clTreeImageList.Create(16,16,ILC_COLOR32|ILC_MASK,0,1);
m_clTreeImageList.SetBkColor(GetSysColor(COLOR_3DFACE));
//IMAGEINFO pImageInfo;
HICON hIcon;
for(long cnt = 0; cnt < m_nImgListCnt; cnt++)
{
hIcon = pImgList->ExtractIcon(cnt);
int nRet = m_clTreeImageList.Add(hIcon);
}
|
|
|
|
|
indra20 wrote: m_nImgListCnt = pImgList->GetImageCount();
What is the value of m_nImgListCnt ?
Just a guess, but what happens if you make pImgList a member variable instead? I'm just curious if m_clTreeImageList.Add(hIcon) is making its own copy of hIcon , or if by the time the icons need to be rendered in the tree control, the icon handles no longer exist.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hi David,
Thanks for having a look at the problem we are facing.
I tried making pImgList a menmber, it didn't work.
m_nImgListCnt is 5.
Strangely on the Desktop icon which is the last in the list is getting displayed.
After trying to add the system icons we are adding our own icons to the list and those are geting displayed properly.
Thanks,
Indrajit
|
|
|
|
|
indra20 wrote: ...is getting displayed.
...are geting displayed properly.
So what's the problem then?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
only five icons are there in the image list, and none of them are the icons that we want. Any way to retrive all the system icons??
thanks,
Indrajit
|
|
|
|
|
indra20 wrote: only five icons are there in the image list, and none of them are the icons that we want.
Aren't you getting five desktop icons?
indra20 wrote: ...the system icons??
Such as?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hello,
In order to open an existing project in vc++, we usually click on the .dsw file. This automatically loads all the files related to the project into vc++.
I want to create a program which saves data into a file with .spa extention. When the file is later clcked on, it should automatically opens into the program. Similar to .doc of MS Word, .m file of Matlab etc.
Please can you guide me on how to do this?
Thanks.
Fortitudine Vincimus!
|
|
|
|
|
This happens automatically if you create an SDI or MDI application. Otherwise, you'll need to create a .reg file, and then call the RegisterShellFileTypes() method in conjunction with EnableShellOpen() .
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|