Tutorials > How to use the API in your projects


Copyright © 2006-2018 MultiMedia Soft

How to use the API in your projects

Previous pageReturn to chapter overviewNext page

First of all let us say that if this guide should not be clear to you, feel free to contact our support team for any doubt or curiosity you may have: we usually answer all of our customers questions in less than 24 hours. Note that the purpose of this guide is to give a taste of the main features available inside Audio Sound Recorder.

 

As an integration to this guide, several examples of use of this component, in C# and VB.NET languages, can be found inside the "Samples" folder: if during the setup phase you left the installation directory to its default, you will find them inside "C:\Program Files\Audio Sound Recorder API for .NET\Samples".

 

We have already seen in a previous tutorial how to add the API to various development environments like C#, Visual Basic .NET, Visual C++ (unmanaged) and Visual Basic 6, how to create a new instance of the component's class and, before starting sound recording management, how to initialize the component.

 

Before starting sounds recording, the component needs to be initialized: for this purpose it's mandatory a call to the InitRecordingSystem method; the best place to call this initialization method is usually the container form initialization function: for example, when using Visual C#, it will be the Form_Load function. When the API is no more needed, usually when the container application is closed, it's recommended invoking the Dispose method that frees all of the allocated resources and closes communication with the underlying drivers.

 

 

Important note

 

All of our audio-related components share the same instance of the multimedia engine AdjMmsEng.dll or AdjMmsEng64.dll whose initialization/disposal requires a certain amount of time because it needs to negotiate with the underlying Windows multimedia system and the sound card drivers: this operation, depending upon the system and quality of sound card drivers in use, may require some second.

In order to obtain a better efficiency when instancing the API on multiple container forms within the same application, it would be highly recommended hosting and initializing, through the InitRecordingSystem method, an instance of the API inside a form that will stay alive for the full life of the container application, for example the application's main form: although this instance of the API may stay hidden and may never be used, the memory footprint would be in any case irrelevant but it would keep the multimedia engine alive, allowing a faster loading/disposal when the container form is closed/opened.

 

 

Main features provided by this control are the following:

 

Recording from an input device, usually defined as "sound card": see the How to perform a recording session section for further details.
Recording from other sources like sound files on disk or from an Internet URL: see the How to record from files, memory or clipboard and the How to perform an Internet-based recording session sections for further details.
Ripping CD tracks: see the How to perform a CD ripping session section for further details.

 

An important topic to keep count of is how synchronization between the container application and events generated by this component works: see the How to synchronize the container application with the control tutorial for further details.

 

Further capabilities of the control, not directly related to sound recording, are the following:

 

the ExtractAudioFromVideoFile method allows extracting the audio track from a video clip and to store it inside an output sound file that may be used later for further editing.
Control of the volume through mixers: usually every sound card have a mixer which can be used in order to set the card volumes; you can access these information using the following methods:

 

MixerGetCount to get the number of mixers currently installed: usually one mixer is available for every installed sound card.

MixerGetDesc to retrieve a friendly description of a mixer.

MixerVolumeSet/MixerVolumeGet to set/get the volume of a system mixer

MixerMuteSet/MixerMuteGet to set/get the mute state of a system mixer

 

When dealing with Windows Vista and higher versions, mixers can be managed more easily through the usage of the CoreAudioDevicesMan class: see the How to access settings of audio devices in Windows Vista and later versions tutorial for further information about this feature.