Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Micrium provides a demo application that lets you test and evaluate the class implementation. Source template files are provided.

Note that the demo application provided by Micriµm is only an example and is intended to be used as a starting point to develop your own application.

Configuring Device Application

The audio class provides two demos:

  • Microphone demo exercises isochronous IN transfers and consequently the record stream and some class-specific requests.
  • Loopback demo exercises isochronous IN and OUT transfers, that is respectively record and playback streams. Loopback demo can be thought as a headset demo.

The demo application files offering the two audio demos are provided for µC/OS-II and µC/OS-III and should be considered as example that you can modify. The files composing the demo application are:

FileDescriptionLocation
app_cfg.hContains a few constants to configure its internal tasks.Not provided in package.
app_usbd_cfg.hContains constants related to audio class demos.\Micrium\Software\uC-USB-Device-V4\App\Device\
app_usbd_audio.cAllows to initialize audio class. Refer to section Audio Class Instance Configuration for more details.\Micrium\Software\uC-USB-Device-V4\App\Device\
usbd_audio_drv_simulation.c
usbd_audio_drv_simulation.h
Simulates a microphone and a headset used as a loopback.\Micrium\Software\uC-USB-Device-V4\App\Device\
usbd_audio_drv_simulation_data.cDefines audio data waveforms samples used by the microphone demo.\Micrium\Software\uC-USB-Device-V4\App\Device\

The use of these constants usually defined in app_cfg.h or app_usbd_cfg.h allow you to use one of the audio demos.

Stream Correction

 It is possible to enable the stream correction for the microphone and loopback demos, that is constants USBD_AUDIO_CFG_RECORD_CORR_EN, USBD_AUDIO_CFG_PLAYBACK_CORR_EN and/or USBD_AUDIO_CFG_PLAYBACK_FEEDBACK_EN. But keep in mind that it does NOT represent a real situation of stream correction usage as both demos simulate the codec behavior using a task and consequently does not represent a real audio timing.

Running the Demo Application 

For demos explanation purpose, we will consider the operating system Microsoft Windows 7 or later.  

Microphone demo

The microphone demo requires the following components on the host PC side:

  • USB or jack headphone, speaker or headset with built-in speaker.
  • Sound Manager (accessible via menu Start > Control Panel > Sound).

The microphone demo is built using an audio function topology defined in the file usbd_audio_dev_cfg.c and composed of:

  • 1 Input Terminal of type analog mic IN,
  • 1 Output Terminal of type USB IN,
  • 1 Feature Unit to manage volume and mute controls,
  • 1 record AudioStreaming interface associated to the Input Terminal.

Refer to  for a visual representation of this audio function. 

 shows the principle of the microphone demo.

Upon connection of your audio device, the simulated microphone device should appear in the recording devices list of the Sound Manager as shown in . In this example, the recording device is identified as "Micrium Audio Product" (ProductStrPtr field of  USBD_DEV_CFG set to this string).

In order to listen to the waveform signal, you need to ensure that:

  • the volume level is different from 0 and the microphone is not muted. Select your microphone, click the button "Properties", go to the tab "Levels" and check the settings. It should look like
  • the playthrough feature is enabled. Select your microphone, click the button "Properties", go to the tab "Listen" and select "Listen to this device". Ensure that the Windows audio driver will playback the record data through your headphone by looking at the "Playback through this device" list (cf. ). 

Loopback demo

The loopback demo requires the following components on the host PC side:

  • USB or jack headphone, speaker or headset with built-in speaker.
  • Music Player (for example, Windows Media Player).
  • Sound Manager (accessible via menu Start > Control Panel > Sound).

The loopback demo is built using an audio function topology defined in the file usbd_audio_dev_cfg.c and composed of:

  • Two Input terminals of type analog mic IN and USB OUT,
  • Two Output terminals of type USB IN and speaker,
  • Two Feature units to manage volume and mute controls for microphone and speaker parts.
  • Two AudioStreaming interfaces (one record and one playback). Each associated to one of the Input terminals.

Refer to  for a visual representation of this audio function. 

 shows the principle of the loopback demo which can be seen as a simulated headset.

Upon connection of your audio device, the simulated headset device should appear in two lists. The microphone should be listed in the recording devices list of the Sound Manager as shown in , whereas the speaker part should be listed in the playback devices list as shown in . In this example, the playback and recording device are identified as "Micrium Audio Product" (ProductStrPtr field of  USBD_DEV_CFG set to this string).

In order to listen to the song played by the music player, you need to ensure that:

  • Speaker: the speaker appears in the list as the "Default Device" as shown in . If it is not the case, right-click on the "Micrium Audio Product" speaker and select "Set as Default Device". 
  • Microphone: the volume level is different from 0 and the microphone is not muted. Refer to
  • Microphone: the playthrough feature is enabled. Select your microphone, click the button "Properties", go to the tab "Listen" and select "Listen to this device". Ensure that the Windows audio driver will playback the record data through your headphone by looking at the "Playback through this device" list (cf. ). Do not select "Default Playback Device" as it could be the "Micrium Audio Product" speaker. In that case you won't hear anything as the music player and the microphone share the same speaker of your audio device. Explicitly select another speaker device (for example, your jack headphone).
  • No labels