Click here to Skip to main content
15,896,111 members
Home / Discussions / C#
   

C#

 
QuestionVery simple ProgressBar Pin
DFlat4Now30-Sep-08 12:56
DFlat4Now30-Sep-08 12:56 
GeneralRe: Very simple ProgressBar Pin
nelsonpaixao30-Sep-08 15:06
nelsonpaixao30-Sep-08 15:06 
AnswerRe: Very simple ProgressBar Pin
blackjack215030-Sep-08 22:46
blackjack215030-Sep-08 22:46 
QuestionHow to draw a line outside of onPaint event handler? Pin
amin_dorost30-Sep-08 11:08
amin_dorost30-Sep-08 11:08 
AnswerRe: How to draw a line outside of onPaint event handler? Pin
DaveyM6930-Sep-08 11:18
professionalDaveyM6930-Sep-08 11:18 
AnswerRe: How to draw a line outside of onPaint event handler? Pin
Guffa1-Oct-08 1:10
Guffa1-Oct-08 1:10 
GeneralRe: How to draw a line outside of onPaint event handler? Pin
DaveyM691-Oct-08 1:54
professionalDaveyM691-Oct-08 1:54 
GeneralRe: How to draw a line outside of onPaint event handler? Pin
Guffa1-Oct-08 2:58
Guffa1-Oct-08 2:58 
QuestionEventargs click event runtime created labels Pin
RobScripta30-Sep-08 9:37
professionalRobScripta30-Sep-08 9:37 
AnswerRe: Eventargs click event runtime created labels Pin
Wendelius30-Sep-08 9:42
mentorWendelius30-Sep-08 9:42 
GeneralRe: Eventargs click event runtime created labels Pin
Mbah Dhaim30-Sep-08 10:15
Mbah Dhaim30-Sep-08 10:15 
GeneralRe: Eventargs click event runtime created labels Pin
RobScripta30-Sep-08 10:38
professionalRobScripta30-Sep-08 10:38 
GeneralRe: Eventargs click event runtime created labels Pin
Dan Neely30-Sep-08 10:52
Dan Neely30-Sep-08 10:52 
GeneralRe: Eventargs click event runtime created labels Pin
Mycroft Holmes30-Sep-08 22:58
professionalMycroft Holmes30-Sep-08 22:58 
GeneralRe: Eventargs click event runtime created labels Pin
DaveyM691-Oct-08 2:05
professionalDaveyM691-Oct-08 2:05 
QuestionHow store formatted text [modified] Pin
sepel30-Sep-08 9:05
sepel30-Sep-08 9:05 
AnswerRe: How store formatted text Pin
User 665830-Sep-08 10:07
User 665830-Sep-08 10:07 
QuestionRecording Voice from microphone Pin
Ha ha ha ha ha ha ha ha30-Sep-08 8:12
Ha ha ha ha ha ha ha ha30-Sep-08 8:12 
Hi Everyone.
I'm developing an application which needs to record voice from microphone and save it in a wav file.
But the voice being recorded, isn't clear, it's lost some part something like 1-0-1-0-1-0-1...
which the 1s indicate the voice is present and the 0s indicate that there's no voice present, each ones duration is about 500ms.
Here is my code. Where is the problem?

mem2Write[uu] = new MemoryStream();
captureDeviceCollection = new CaptureDevicesCollection();

DeviceInformation deviceInfo = captureDeviceCollection[sh];

CaptureBufferDescription captureBufferDescription = new CaptureBufferDescription();
captureBufferDescription.BufferBytes = waveFormat.AverageBytesPerSecond / 5;
captureBufferDescription.Format = waveFormat;

BufferDescription playbackBufferDescription = new BufferDescription();
playbackBufferDescription.BufferBytes = waveFormat.AverageBytesPerSecond / 5;
playbackBufferDescription.Format = waveFormat;
SecondaryBuffer playbackBuffer = new SecondaryBuffer(playbackBufferDescription, device);

int bufferSize = captureBufferDescription.BufferBytes;


Capture capture = new Capture(deviceInfo.DriverGuid);

CaptureBuffer captureBuffer = new CaptureBuffer(captureBufferDescription, capture);
CreateNotifyPositions(captureBuffer, bufferSize);
//int halfBuffer = bufferSize / 2;
int tenBuffer = bufferSize / 10;

//int halfBuffer = bufferSize;
captureBuffer.Start(true);

//bool readFirstBufferPart = true;
int readFirstBufferPart = 0;
int offset = 0;
mem2Write[uu].Position = 0;
MemoryStream memStream = new MemoryStream(tenBuffer);

bStop = false;

while (!bStop)
{
autoResetEvent.WaitOne();
memStream.Seek(0, SeekOrigin.Begin);
captureBuffer.Read(offset, memStream, tenBuffer, LockFlag.None);
//readFirstBufferPart = !readFirstBufferPart;
readFirstBufferPart= (readFirstBufferPart+1)% 10;
//offset = readFirstBufferPart ? 0 : thirdBuffer;
offset = tenBuffer * readFirstBufferPart;
//TODO: Fix this ugly way of initializing differently.
//Choose the vocoder. And then send the data to other party at port 1550.
//dataToWrite
mem2Write[uu].Write(memStream.GetBuffer(), 0, (Int32)memStream.Length);

mem2Write[uu].Position += (Int32)memStream.Length;

}
AnswerRe: Recording Voice from microphone Pin
Mbah Dhaim30-Sep-08 10:29
Mbah Dhaim30-Sep-08 10:29 
GeneralRe: Recording Voice from microphone Pin
Ha ha ha ha ha ha ha ha30-Sep-08 22:25
Ha ha ha ha ha ha ha ha30-Sep-08 22:25 
GeneralRe: Recording Voice from microphone Pin
fiko851-Oct-08 7:05
fiko851-Oct-08 7:05 
GeneralRe: Recording Voice from microphone Pin
Ha ha ha ha ha ha ha ha2-Oct-08 22:15
Ha ha ha ha ha ha ha ha2-Oct-08 22:15 
QuestionMultiple Threads Pin
Ha ha ha ha ha ha ha ha30-Sep-08 8:10
Ha ha ha ha ha ha ha ha30-Sep-08 8:10 
AnswerRe: Multiple Threads Pin
Ashfield30-Sep-08 21:20
Ashfield30-Sep-08 21:20 
GeneralRe: Multiple Threads Pin
Ha ha ha ha ha ha ha ha30-Sep-08 22:35
Ha ha ha ha ha ha ha ha30-Sep-08 22:35 

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.