C# Class Bloom.Edit.AudioRecording

This is a clean back-end service that provides recording to files via some http requests from the server. It also delivers real time microphone peak level numbers over a WebSocket. The client can be found at audioRecording.ts.
Inheritance: IDisposable
Show file Open project: BloomBooks/BloomDesktop

Public Properties

Property Type Description
PathToCurrentAudioSegment string
PathToTemporaryWav string

Private Properties

Property Type Description
CleanUpAfterPressTooShort void
CreateRecorder void
GetPathToSegment string
HandleCheckForSegment void
HandleDeleteSegment void
HandleEnableListenButton void
HandleEndRecord void
OnStartRecordingTimer_Elapsed void
Recorder_Stopped void
ReportNoMicrophone void
SetPeakLevel void
TestForTooShortAndSendFailIfSo bool

Public Methods

Method Description
AudioRecording ( BookSelection bookSelection, BloomWebSocketServer bloomWebSocketServer ) : SIL.Media.Naudio
BeginMonitoring ( ) : void

Used to initiate sending the PeakLevelChanged notifications. Currently this typically happens when the Recorder instance is created, which is usually when the talking book tool asks for the AudioDevicesJson. This is not very intuitive, but it's the most easily detectable event that indicates that the talking book tool is actually active.

Dispose ( ) : void
HandleAudioDevices ( ApiRequest request ) : void

Returns a json string like {"devices":["microphone", "Logitech Headset"], "productName":"Logitech Headset", "genericName":"Headset"}, except that in practice currrently the generic and product names are the same and not as helpful as the above. Devices is a list of product names (of available recording devices), the productName and genericName refer to the current selection (or will be null, if no current device).

HandleCurrentRecordingDevice ( ApiRequest request ) : void
HandleStartRecording ( ApiRequest request ) : void
RegisterWithServer ( EnhancedImageServer server ) : void

Protected Methods

Method Description
Dispose ( bool disposing ) : void

Private Methods

Method Description
CleanUpAfterPressTooShort ( ) : void
CreateRecorder ( ) : void
GetPathToSegment ( string segmentId ) : string
HandleCheckForSegment ( ApiRequest request ) : void
HandleDeleteSegment ( ApiRequest request ) : void

Delete a file (typically a recording, as requested by the Clear button in the talking book tool)

HandleEnableListenButton ( ApiRequest request ) : void
HandleEndRecord ( ApiRequest request ) : void
OnStartRecordingTimer_Elapsed ( object sender, EventArgs e ) : void
Recorder_Stopped ( IAudioRecorder arg1, ErrorEventArgs arg2 ) : void
ReportNoMicrophone ( ) : void
SetPeakLevel ( SIL.Media.Naudio.PeakLevelEventArgs args ) : void
TestForTooShortAndSendFailIfSo ( ApiRequest request ) : bool

Method Details

AudioRecording() public method

public AudioRecording ( BookSelection bookSelection, BloomWebSocketServer bloomWebSocketServer ) : SIL.Media.Naudio
bookSelection Bloom.Book.BookSelection
bloomWebSocketServer Bloom.Api.BloomWebSocketServer
return SIL.Media.Naudio

BeginMonitoring() public method

Used to initiate sending the PeakLevelChanged notifications. Currently this typically happens when the Recorder instance is created, which is usually when the talking book tool asks for the AudioDevicesJson. This is not very intuitive, but it's the most easily detectable event that indicates that the talking book tool is actually active.
public BeginMonitoring ( ) : void
return void

Dispose() public method

public Dispose ( ) : void
return void

Dispose() protected method

protected Dispose ( bool disposing ) : void
disposing bool
return void

HandleAudioDevices() public method

Returns a json string like {"devices":["microphone", "Logitech Headset"], "productName":"Logitech Headset", "genericName":"Headset"}, except that in practice currrently the generic and product names are the same and not as helpful as the above. Devices is a list of product names (of available recording devices), the productName and genericName refer to the current selection (or will be null, if no current device).
public HandleAudioDevices ( ApiRequest request ) : void
request Bloom.Api.ApiRequest
return void

HandleCurrentRecordingDevice() public method

public HandleCurrentRecordingDevice ( ApiRequest request ) : void
request Bloom.Api.ApiRequest
return void

HandleStartRecording() public method

public HandleStartRecording ( ApiRequest request ) : void
request Bloom.Api.ApiRequest
return void

RegisterWithServer() public method

public RegisterWithServer ( EnhancedImageServer server ) : void
server Bloom.Api.EnhancedImageServer
return void

Property Details

PathToCurrentAudioSegment public property

public string PathToCurrentAudioSegment
return string

PathToTemporaryWav public property

The file we want to record to
public string PathToTemporaryWav
return string