|
Hi there,
I might be in the wrong place here, but lacking another idea where to post, I give it a shot.
I am presently developing in the audio/speech streaming area. I built a TTS system that works quite nicely, streaming (via RTP) the audio in small data packages, which contain the samples. Each 16-bit linear sample is stored in a short.
Now I was wondering if there is any possibility to somehow calculate how long the resulting audio file will be (or was), in miliseconds.
There are programs that do it, like Audacity, so I should be able to get there, as well. Only I don´t have a clue.
Any ideas?
Souldrift
|
|
|
|
|
If you're creating the samples in your own system, then surely you should be able to just work it out from no. samples / sample rate. (* 1000 if you want it in milliseconds.)
Or are you using an external library or app to create the audio?
There are three kinds of people in the world - those who can count and those who can't...
|
|
|
|
|
Haha, of course, it´s so easy. I found out myself just now.
But thanks a lot. Your hint was the one I was looking fro.
I am actually using an external lib to synthesize the text. But of course I have the number of samples and the sample rate.
Thanks again ... and I just found this (if anyone is interested) to verify my own calculations:
http://www.angelfire.com/ga/bunnycymru/sound.html[^]
Cheers
Souldrift
|
|
|
|
|
Hi
What kind of reason will cause program crashed at:
CWnd* CWnd::GetDlgItem(int nID) const
{
-----> ASSERT(::IsWindow(m_hWnd));
}
Thank you very much,
|
|
|
|
|
|
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Did you call GetDlgItem after CDialog::OnInitDialog processed? The m_hWnd will not be created before that called.
Check the m_hWnd value is NULL or not.
|
|
|
|
|
Yes, I call GetDlgItem in dialog implementation. But It crashed.
What is going on?
Thanks,
|
|
|
|
|
check;
1) m_hWnd was NULL or not?
- if it was NULL, dialog window has not been created yet.
- if not NULL, some other code overwrite the member. (might be memory bug)
2) GetDlgItem should not call in dialog constructor but can do in OnInitDialog or after this processed.
- this is conclusion from above NULL reason.
|
|
|
|
|
Hi,
I try to initialize an array with a function return, but i get error C2057: expected constant expression. Is there an easy solution for the following problem?
const int iRecordCountBefore = p_rs->GetRecordCount();
int iRsPositionsUpdated[iRecordCountBefore] = {-1};
Thanks you!
|
|
|
|
|
You cannot write such array code in C or C++ program syntax.
You should change like below;
const int iRecordCountBefore = p_rs->GetRecordCount();
int* iRsPositionsUpdated = new int[iRecordCountBefore];
int* iRsPositionsUpdated = (int*)malloc(sizeof(int)*iRecordCountBefore);
memset(iRsPositionsUpdated, -1, sizeof(int)*iRecordCountBefore);
|
|
|
|
|
Thank you for the working and fast answer!
|
|
|
|
|
Don't forget to delete (if you used new) or free (if you used malloc) the memory when you don't need it anymore, otherwise it might lead to memory leaks.
|
|
|
|
|
Can I suggest using a std::vector rather than an array, if only so you don't need to bother remember freeing memory? This will create a vector initialised with iRecordCountBefore integers, all set to -1.
const int iRecordCountBefore = p_rs->GetRecordCount();
std::vector<int> iRsPositionsUpdated(iRecordCountBefore, -1);
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
The VS2008 dialog event wizard has stopped working. Double-clicking on a button in an MFC dialog project does not fire the wizard as usual and a right-cliok to get to the 'Add Event Handler...' shows a dialog with no message types.
Further to this the MFC message mapping and virtual class listing that generally appears in the properties window (Alt + Enter) is now empty.
Has anyone elese seen this and if so, how'd they fix it? I have 'repaired' my VS08 installation ...
Thx++
Jerry
|
|
|
|
|
Have you recently installed IE8? That thoroughly shafted code wizards on my PC. I fixed it using this approach[^].
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
you champion, you. i spent hours trying to get the right google search phrase.
|
|
|
|
|
HI i did this :
HICON hIcon = LoadIcon(0,MAKEINTRESOURCE (IDI_ADV_DATA));
GetDlgItem(IDD_HPCR_WO_DLG ).SetIcon (hIcon ,0);
but my icon in upper left corner of my window is still showing default one.
|
|
|
|
|
GetDlgItem(IDD_HPCR_WO_DLG ).SetIcon (hIcon ,0);
Do you want to set icon to some item of dialog?
I think GetDlgItem gets an item (some control or etc.) on the dialog.
CDialog::SetIcon can change the dialog icon, I think.
|
|
|
|
|
i want to change the default icon of which appears in window title (white box icon)
|
|
|
|
|
Then try like this if you using MFC.
BOOL CMyDialog::OnInitDialog() {
...
HICON hIcon = AfxGetApp()->LoadIcon(IDI_ADV_DATA);
SetIcon (hIcon, TRUE);
SetIcon (hIcon, FALSE);
return TRUE;
}
Or you write simple win32 style code, like this.
BOOL CALLBACK DlgProc(...) {
switch (..) {
case WM_INITDIALOG:
...
{
HICON hIcon = LoadIcon(0,MAKEINTRESOURCE (IDI_ADV_DATA));
SendMessage(hDlg, WM_SETICON, ICON_BIG, (LPARAM)hIcon);
SendMessage(hDlg, WM_SETICON, ICON_SMALL, (LPARAM)hIcon);
}
return TURE;
....
|
|
|
|
|
Thanks ...your code gives success
|
|
|
|
|
Hi,
Im looking for source code for an AD snap-in that allows wake on lan, or shuting down of all or some of the machines in an ou. can find pleanty of source for the wol and shutdown parts, but im stuck on intergrating it into AD.
Any help would be much appreciated.
|
|
|
|
|
Hi,
I have an application that uses the cluster-api (clusapi.dll) on Windows Server 2003. When I run my application under the Administrator account the call to the method OpenCluster works fine, but the problem is that not all users of my application are in fact administrators and when I call GetLastError after the call fails it says: Access is denied
I realize that someone belonging to the Users group are not allowed to make that call, but I can't find in MSDN (or anywhere else) why this is the case and I'd like to check if anyone knows a way around this.
This code always returns NULL since hCluster is NULL after the call to OpenCluster:
HCLUSTER hCluster;
hCluster = OpenCluster( NULL );
if( hCluster == NULL )
{
return NULL;
}
I'm more used to C# coding, but I have written a dll in C++ containing all the cluster functionality I need (and then using that dll in my C# project via p/Invoke).
Any ideas around this would be appreciated.
Thanks!
|
|
|
|
|
Calla wrote: I'd like to check if anyone knows a way around this.
If you did find a way to circumvent security and Microsoft found out, they would likely fix the security hole and then the work around would no longer work anyway. It would be safer to just follow guidelines.
|
|
|
|