How to perform a recording session
Before starting a recording session, the component needs to be initialised: for this purpose it's mandatory a call to the
InitRecorder method; the best place to call this initialisation method is usually the container form initialisation function: for example, when using Visual Basic 6, it will be the
Form_Load subroutine.
The purposes of calling the
InitRecorder method are the following:
Synchronising the component with its container form
Choosing an alternative input device to the default one currently selected through the system control panel and, eventually, its input channel that will perform the sound recording.
The number and friendly descriptions of available input devices (intended as sound cards) can be obtained through a prior call to the
GetInputDevicesCount and
GetInputDeviceDesc methods. The selected input device can be changed at a later time, but not during a recording session, using the
ChangeInputDevice method.
Once decided the control's input source, it's time to decide where and how the control will store recorded sound data; the first thing to decide is the
output format of the recorded sound: for this purpose you need to set the
EncodeFormats.ForRecording property to one of the available encoding formats.
Each encoding format set into the
EncodeFormats.ForRecording property have its own settings which can be controlled through sub-properties of the
EncodeFormats property: for example, if the chosen encoding format should be ENCODING_FORMAT_WAV you would have to modify settings of the
EncodeFormats.WAV property, if chosen encoding format should be ENCODING_FORMAT_MP3 you would have to modify settings of the
EncodeFormats.MP3 property and so on for the remaining accepted encoding formats.
Before starting a recording session, you could have the need to resample incoming sound data, for example for reducing the final recording size: for this purpose you should check the
EncodeFormats.ResampleMode property and choose which of the available resample modes would best fit your needs.
At this point we can start the recording session calling the
StartFromInputDevice method which needs to know the output file location: if an absolute pathname is specified, it can be a file on the system hard disk or, if the pathname is left empty, a memory file that could be used at a later time, for example in order to perform a custom encrypting before saving it to a file on disk: it's highly suggested avoiding the use of memory based recording sessions for a duration longer than 5 minutes because they could require a huge amount of memory: for a longer duration the output on files should be preferred.
During the recording session, the container application can be notified about the current duration through the
RecordingDuration event and about the current disk or memory occupation through the
RecordingSize event: note that, for reducing the amount of bytes requested for storing sound data, the control gives the possibility to discard silent data, i.e. portions of sounds that cannot be heard: see section
How the Sound Activation System works for further details about this feature.
The current recording session can be stopped at any time through the
Stop method.
The current recording session can be paused through the
Pause method and resumed through the
Resume method.
After stopping the current recording session, you have the possibility to start a new one without discarding the existing one: for this purpose you need to define how the new recording session will behave through a call to the
SetRecordingMode method: this will allow appending the new recording session to the existing one or inserting/mixing/overwriting the new recording session to a given position of the existing one: see the
SetInsertPos,
SetMixingPos and
SetOverwritePos methods for defining where the new recording session will be inserted/mixed/overwritten.
It's important to note that, after stopping a restarted recording session, the total recorded sound will not be immediately available because there will be the need to finalize and join the new recording session with the previous one: the container application will be informed about the start/end of the automatic finalization process through the
RecordingFinalizationStarted and
RecordingFinalizationDone events.
Once a recording session has been stopped, the control can manage recorded sound data, stored on a disk file or inside a memory buffer, through the following methods:
Note that playback capabilities are very limited: if you need
more sophisticated playback features consider using this control in conjunction with our
Active DJ Studio ActiveX control.
The recorded sound can be edited through one of the following methods:
Note that editing capabilities are quite limited: if you need
more sophisticated editing features consider using this control in conjunction with our
Active Sound Editor ActiveX control.
As already stated before, if the
strOutputPath parameter of the
StartFromInputDevice method has been left blank, recorded sound data will be stored inside a memory buffer; the operation that can be performed on this memory buffer are the following:
While performing a recording session whose output will be stored inside a file on the hard disk, it could be useful having the possibility to save the recording session in more than one file without any interruption of the audio flow: for this purpose you can use the
SwitchOutputFile method.