|
Thanks again for the answer
But I don't consider this solution as an appropriate one, as it plays the buffer whenever it's full, but my application already plays the buffer without any problem or any cut in the voice, the problem is high consumption of memory, which is not likely to be solved with this solution.
And yes, I'm using DirectSound. It seems I have to place the
playbackBuffer = new SecondaryBuffer(playbackBufferDescription, device) to prevent the voice to be cut up.
Anyway, I'll try to call play after some loops of filling the buffer. But the problem of disposing still remains unsolved and memory use is still too high.
Thanks again for any other help tips
|
|
|
|
|
No, your missing the point.
What you are doing is creating a new buffer every time you loop round. The sound processor is then queuing all of these buffers and playing them in order. Thus, you are getting a clear uninterrupted sound, but at the same time you are creating hundreds of buffer objects that are just forming a longer and longer queue.
What you should be doing is adding the data onto the end of the same buffer each time you go round the loop. This way the sound processor will continually play out of the same buffer as it will never run out of data because you are continually adding more data into the buffer.
My solution will stop the jittering because I am suggesting that you only need to call play once at the beginning. Provided that your source continues to send, you will never need to call play again. The 5 second counter is there to prevent play being called before there is anything in the buffer to begin with. And the flag is there so that play isn't called again. You will only need to call play again if the buffer runs out and stops (maybe you have network trouble, or the source stops for some reason, so if this happens, then flag is reset, and the code will wait until the buffer has 5 seconds in it before calling play() again)
Simon
|
|
|
|
|
what Simon's referring to is called a 'circular buffer' and is used in many communication protocols where data needs to be processed (played in your case) immediately, before the end of the stream is reached or where the end point is not known.
All live audio monitoring applications utilize this approach. Most use seperate record (receive) and playback buffers too to avoid possible data loss.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
DaveyM69 wrote: 'circular buffer'
Ahh, yes...This is what I'm talking about. For some reason the word just never came to my head. Nice one.
Simon
|
|
|
|
|
serima nazarian wrote: my application already plays the buffer without any problem or any cut in the voice
You obviously haven't let it play long enough.
The way it's coded now, aside from the memory leak, you're going to
have problems with clock drift and network jitter.
Let it go for several minutes - you'll see what I mean
Good luck.
Edit:<br />
Actually, looking at the code again, you may not have too much problem<br />
with jitter or drift, since you're using a new secondary buffer for every<br />
receive. There will probably be a problem if the GC gets around to collecting<br />
any secondary buffers that are still playing asynchronously, however.
Mark Salsbery
Microsoft MVP - Visual C++
modified on Wednesday, October 8, 2008 2:15 PM
|
|
|
|
|
Thank you all for your helpful answers, I'll try what you suggested and inform you the results.
|
|
|
|
|
Can I get a whole column in a matrix with doubles with some command? For example if I want the fifth column: something like
Matrix[(all rows), 5] ?
Thanks
|
|
|
|
|
Depends on the data structure, which Matrix class do you use? .NET does not have a built in one, but XNA for example does.
If it's just a two-dimensional array then you can simply loop over the n-th item in each nested array to get the values for one row.
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Hi all.
I am using dateset and writing the contents to xml..If there are no values to be written to xml...I want the whitespace in xml....
If i am leaving space..i.e ex string acl = " " ...in this way..
it is giving as..
<acl xml:space="preserve"> ..
i want is <acl>..
any help..
thank you
manju
Hi..
I am Mnaju.I have Completed my B.E Computers Science.Lokking for a job.I am interested in VC++
manju
|
|
|
|
|
You can declare a symbol for your whitespace, something like: "thisisawhitespace" or "nonblankspace" or ...
While (true) { Human.isLearnable = true; }
|
|
|
|
|
I am sorry i dint got u..
u mean to say..
string acl = "or"..
Hi..
I am Mnaju.I have Completed my B.E Computers Science.Lokking for a job.I am interested in VC++
manju
|
|
|
|
|
string acl = "thisisawhitespace"; or
string acl = "nonblankspace"; or
Something that you can recognize it as whitespace...
Seems forum couldn't show my post correctly, my pleasure
While (true) { Human.isLearnable = true; }
|
|
|
|
|
Pedram Behroozi wrote: string acl = "thisisawhitespace"; or
string acl = "nonblankspace"; or
I tried both..
but i am getting as
<acl>nonblankspace</acl> and
<acl>thisisawhitespace</acl>
sorry...
Hi..
I am Mnaju.I have Completed my B.E Computers Science.Lokking for a job.I am interested in VC++
manju
modified on Wednesday, October 8, 2008 3:04 AM
|
|
|
|
|
When the value of a node becomes " " in XML files, you have <YourNode /> but if it has a value it seems like <YourNode>YourValue</YourNode> so if you don't want to have <YourNode /> in your XML file, try putting a Value in it as a WhiteSpace value, Something like values I said before or anything else and while you're reading values when you reach the "thisisawhitespace" or "nonblankspace" or ... you can understand that this is a WhiteSpace,
Maybe there's some other ways to have <YourNode> </YourNode> but unfortunately I don't know anything about them.
While (true) { Human.isLearnable = true; }
|
|
|
|
|
As far as I know, if you are getting the situation as described by Pedram, from a programming point of view there should be no problem as they are equivilent, but if you need to preserve the spaces have a look at xml:space="preserve"
Alternatively, is it that your dataset has nulls in some fields and does not create the elements/attributes at all?
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Thank you!!!! I was wondering when someone will actually come up with the proper answer
xacc.ide - now with TabsToSpaces support IronScheme - 1.0 beta 1 - coming soon ((lambda (x) `((lambda (x) ,x) ',x)) '`((lambda (x) ,x) ',x))
|
|
|
|
|
Hey, tick the "Ignore HTML tags in this message (good for code snippets)" check box.
While (true) { Human.isLearnable = true; }
|
|
|
|
|
I use an attribute:
<PUlat Align="right" Hide="false" Null="true" />
then if I use XSLT to transform the XML to HTML I can insert a non-breaking space in place of the null.
|
|
|
|
|
We can browse and open the system files using OpenFileDialog Box.How can we open the selected file in a separate window?Can anyone direct me with the code for this, please.
|
|
|
|
|
Chithra Anoop wrote: How can we open the selected file in a separate window
Separate window of your application?
|
|
|
|
|
You should pass your file info into your "Other Window" (if it's in your application) by its constructor, something like this:
void Button_Click(object sender, EventArgs e)
{
if (OpenFileDialog.ShowDialog() == DialogResult.OK)
{
AnotherForm form2 = new AnotherForm(OpenFileDialog.FileName);
form2.Show();
}
}
and then in your AnotherForm:
public AnotherForm(string filename)
{
RichTextBox.LoadFile(filename);
}
While (true) { Human.isLearnable = true; }
|
|
|
|
|
Hi all
could anyone teel me how that code work in briefe plz?
<br />
using System;<br />
using System.Data;<br />
<br />
public class Account<br />
{<br />
public static DataSet GetAllAccounts()<br />
{<br />
return (new DataSet());<br />
}<br />
<br />
public void DepositMoney(decimal amount, string accountNumber)<br />
{<br />
if (this.validateAccount(accountNumber))<br />
{<br />
}<br />
}<br />
<br />
private bool validateAccount(string accountNumber)<br />
{<br />
return true;
}<br />
}<br />
<br />
public class Payments<br />
{<br />
static void Main()<br />
{<br />
DataSet dsAccountList = Account.GetAllAccounts();<br />
Account account = new Account();<br />
account.DepositMoney((decimal)249.99, "56329SVZ");<br />
}<br />
}<br />
<br />
tanx for ur help
no
|
|
|
|
|
I am not sure what you are asking. Are you confused with the static GetAllAccounts method? If yes, it is a factory method. Read about factory pattern.
|
|
|
|
|
First go through the code.It is simple.One thing is GetAllAccounts()method .it is static so it is accessed by directly Classname because a static mathod doesn't need a call from the instance of the class.
If there is any other point.Feel free to ask.
Cheers!!
Brij
|
|
|
|
|
I have created help files using HTML workshop and also WinCHM, when i try run the .chm file - it shows a "This program cannot display the webpage".. what am i doing wrong?
Thanks.
|
|
|
|