Click here to Skip to main content
15,886,860 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
GeneralRe: XML Serialization Problem with properties that when set change object status Pin
Moreno Airoldi4-Jun-09 4:47
Moreno Airoldi4-Jun-09 4:47 
QuestionPlaying smoothly small pieces with DirectSound Pin
Andrey U2-Jun-09 0:09
Andrey U2-Jun-09 0:09 
AnswerRe: Playing smoothly small pieces with DirectSound Pin
molesworth2-Jun-09 3:31
molesworth2-Jun-09 3:31 
GeneralRe: Playing smoothly small pieces with DirectSound Pin
Andrey U2-Jun-09 4:18
Andrey U2-Jun-09 4:18 
GeneralRe: Playing smoothly small pieces with DirectSound Pin
molesworth2-Jun-09 6:58
molesworth2-Jun-09 6:58 
AnswerRe: Playing smoothly small pieces with DirectSound Pin
Mark Salsbery2-Jun-09 8:26
Mark Salsbery2-Jun-09 8:26 
GeneralRe: Playing smoothly small pieces with DirectSound Pin
Andrey U2-Jun-09 22:37
Andrey U2-Jun-09 22:37 
GeneralRe: Playing smoothly small pieces with DirectSound Pin
molesworth3-Jun-09 0:58
molesworth3-Jun-09 0:58 
Andrey U wrote:
Am I right up to this point?


Yep, that looks like a good way to do things. As Mark says, threading is definitely the right approach (I previously just posted a simplistic method since your original post just had a simple closed play loop). Threading may look complicated, but once you've done a couple of trials you'll probably see that it's fairly simple really Smile | :)

You should perhaps zero-fill your empty buffer in the case where there's no received data, however. It may be cleared in debug builds, but probably will be full of random data (noise) in release.

Andrey U wrote:
Maybe I should only drop a packet from the queue when there are a lot? (What bothers me about the threads is that I manipulate playBuffer from 2 threads in this case. Am I supposed to do it?)


You definitely shouldn't operate on the play buffer in anything other than your play thread. I'd also advise against moving the play cursor, since this will definitely cause glitches, and may also cause other problems in playback.

For overruns you can either drop packets, which will also give glitches, although more manageable ones, or you can just play all data - ideally your transmitting app should detect silence and stop sending data, giving the receiver time to catch up during those pauses.

Your buffer size and the reliability of the connection will determine how often you get overruns or underruns, and it's a trade-off between several factors to determine the best size to use. As Mark mentioned, you need to deal with all of these to make a reliable application.

Andrey U wrote:
And my last question: should I rely on the notification from a secondary buffer? I've read several times that there are bugs with it.


I've had problems with notifications myself. My last DirectSound system used GetCurrentPosition to check the play cursor at regular intervals, and I found this was much more reliable. (My current project is using XAudio2, which seems to be a lot better.)

There are three kinds of people in the world - those who can count and those who can't...

GeneralRe: Playing smoothly small pieces with DirectSound Pin
supercat93-Jun-09 7:07
supercat93-Jun-09 7:07 
GeneralRe: Playing smoothly small pieces with DirectSound Pin
molesworth3-Jun-09 8:47
molesworth3-Jun-09 8:47 
GeneralRe: Playing smoothly small pieces with DirectSound Pin
Mark Salsbery3-Jun-09 9:53
Mark Salsbery3-Jun-09 9:53 
GeneralRe: Playing smoothly small pieces with DirectSound Pin
Mark Salsbery3-Jun-09 9:35
Mark Salsbery3-Jun-09 9:35 
GeneralRe: Playing smoothly small pieces with DirectSound Pin
molesworth3-Jun-09 22:33
molesworth3-Jun-09 22:33 
QuestionRe: Playing smoothly small pieces with DirectSound Pin
BenjoD10-Aug-09 18:31
BenjoD10-Aug-09 18:31 
Questionproblem solving in MDAC ver2.6 Pin
RAJAGOPALMS761-Jun-09 21:54
RAJAGOPALMS761-Jun-09 21:54 
AnswerRe: problem solving in MDAC ver2.6 Pin
Jimmanuel2-Jun-09 1:17
Jimmanuel2-Jun-09 1:17 
GeneralRe: problem solving in MDAC ver2.6 Pin
RAJAGOPALMS762-Jun-09 18:54
RAJAGOPALMS762-Jun-09 18:54 
QuestionHow to Use Network Sniffer Pin
amit512811-Jun-09 20:57
amit512811-Jun-09 20:57 
AnswerRe: How to Use Network Sniffer Pin
Simon P Stevens1-Jun-09 23:43
Simon P Stevens1-Jun-09 23:43 
Questionclient server communication Pin
yrishi1-Jun-09 19:58
yrishi1-Jun-09 19:58 
AnswerRe: client server communication Pin
rohitissharma2-Jun-09 18:07
rohitissharma2-Jun-09 18:07 
QuestionHow to build an IE toolbar that doesn't require installation Pin
zwlei1-Jun-09 17:23
zwlei1-Jun-09 17:23 
AnswerRe: How to build an IE toolbar that doesn't require installation Pin
leo_5551-Jun-09 19:16
leo_5551-Jun-09 19:16 
QuestionInstalling NETCFv35 in Windows Mobile 6 Classic [modified] Pin
Marije1-Jun-09 0:17
Marije1-Jun-09 0:17 
AnswerRe: Installing NETCFv35 in Windows Mobile 6 Classic Pin
leeky__5-Aug-09 17:59
leeky__5-Aug-09 17:59 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.