Halyri - Mobiili  0.9
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events
Halyri.AudioVideoManagers.WavAudioSampleCapturer Class Reference

Class for capturing PCM audio fragments from XNA microphone and processing them as WAVE files. More...

Public Member Functions

 WavAudioSampleCapturer (Microphone mic)
 Instantializes a new WavAudioSampleCapturer using the provided Microphone instance. The Microphone must new initalized, but not in use or started. More...
 
void StartCapture ()
 Stars capturing from the XNA Microphone. FrameworkDispatcher.Update needs to have been called at least once prior to this operation and needs to be called reqularly during recording. More...
 
void StopCapture ()
 Stops capturing from the XNA Microphone. More...
 
void UpdateSampleParameters (int sampleLengthMilliSeconds)
 Sets the length of fragments to be captured from the Microphone. Valid range is 50 to 1000 milliseconds. More...
 

Public Attributes

WaveSegmentCaptured WaveSegmentCapturedEvent
 
PcmSegmentCaptured PcmSegmentCapturedEvent
 

Properties

int AudioSampleMilliSeconds [get]
 
int SampleRate [get]
 
int SampleSizeBytes [get]
 

Private Member Functions

int CalculateSampleSize ()
 Gets bytes per 200ms and samples per 200ms and then calculates bytes per sample. More...
 
void Microphone_BufferReady (object sender, EventArgs e)
 Handles new audio PCM buffers from the XNA Microphone. Adds WAVE header to the using the WaveFileHeader class and generates the AudioFrameCapturedHandler event. More...
 

Private Attributes

int maxAudioSampleMilliSeconds = 1000
 
int minAudioSampleMilliSeconds = 100
 
int audioSampleMilliSeconds = 500
 
int sampleRate
 
int sampleSizeBytes
 
byte[] microphoneBuffer
 
Microphone microphone
 
Boolean started
 

Detailed Description

Class for capturing PCM audio fragments from XNA microphone and processing them as WAVE files.

<author>Veli-Mikko Puupponen</author>

Constructor & Destructor Documentation

Halyri.AudioVideoManagers.WavAudioSampleCapturer.WavAudioSampleCapturer ( Microphone  mic)

Instantializes a new WavAudioSampleCapturer using the provided Microphone instance. The Microphone must new initalized, but not in use or started.

Parameters
mic

Member Function Documentation

int Halyri.AudioVideoManagers.WavAudioSampleCapturer.CalculateSampleSize ( )
private

Gets bytes per 200ms and samples per 200ms and then calculates bytes per sample.

Returns
Bytes per sample
void Halyri.AudioVideoManagers.WavAudioSampleCapturer.Microphone_BufferReady ( object  sender,
EventArgs  e 
)
private

Handles new audio PCM buffers from the XNA Microphone. Adds WAVE header to the using the WaveFileHeader class and generates the AudioFrameCapturedHandler event.

Parameters
senderObject sending the event
eEventargs for the event, not used
void Halyri.AudioVideoManagers.WavAudioSampleCapturer.StartCapture ( )

Stars capturing from the XNA Microphone. FrameworkDispatcher.Update needs to have been called at least once prior to this operation and needs to be called reqularly during recording.

void Halyri.AudioVideoManagers.WavAudioSampleCapturer.StopCapture ( )

Stops capturing from the XNA Microphone.

void Halyri.AudioVideoManagers.WavAudioSampleCapturer.UpdateSampleParameters ( int  sampleLengthMilliSeconds)

Sets the length of fragments to be captured from the Microphone. Valid range is 50 to 1000 milliseconds.

Parameters
sampleLengthMilliSecondsLength of single captured audio fragment in milliseconds

Member Data Documentation

int Halyri.AudioVideoManagers.WavAudioSampleCapturer.audioSampleMilliSeconds = 500
private
int Halyri.AudioVideoManagers.WavAudioSampleCapturer.maxAudioSampleMilliSeconds = 1000
private
Microphone Halyri.AudioVideoManagers.WavAudioSampleCapturer.microphone
private
byte [] Halyri.AudioVideoManagers.WavAudioSampleCapturer.microphoneBuffer
private
int Halyri.AudioVideoManagers.WavAudioSampleCapturer.minAudioSampleMilliSeconds = 100
private
PcmSegmentCaptured Halyri.AudioVideoManagers.WavAudioSampleCapturer.PcmSegmentCapturedEvent
int Halyri.AudioVideoManagers.WavAudioSampleCapturer.sampleRate
private
int Halyri.AudioVideoManagers.WavAudioSampleCapturer.sampleSizeBytes
private
Boolean Halyri.AudioVideoManagers.WavAudioSampleCapturer.started
private
WaveSegmentCaptured Halyri.AudioVideoManagers.WavAudioSampleCapturer.WaveSegmentCapturedEvent

Property Documentation

int Halyri.AudioVideoManagers.WavAudioSampleCapturer.AudioSampleMilliSeconds
get
int Halyri.AudioVideoManagers.WavAudioSampleCapturer.SampleRate
get
int Halyri.AudioVideoManagers.WavAudioSampleCapturer.SampleSizeBytes
get

The documentation for this class was generated from the following file: