genode/repos/dde_bsd/include/audio/audio.h
Josef Söntgen 8a34d21577 dde_bsd: add recording support to audio driver
The driver is now able to record audio samples. In contrast
to playback it has to be enabled explicitly by setting the
configuration attribute 'recording' to 'yes'. Playback is by
default enabled but may be disabled by setting 'playback' to
'no'. Furthermore it is now possible to configure the mixer
from the configuration. For now, the interface used by vanilla
OpenBSD is just exported.

The following snippet shows how to enable and configure recording
on an Thinkpad X220 where the headset rather than the internal
mic is used as recording source:

! <start name="audio_out_drv">
!   <resource name="RAM" quantum="8M"/>
!   <provides>
!     <service name="Audio_out"/>
!     <service name="Audio_in"/>
!   </provides>
!   <config recording="yes">
!     <mixer field="outputs.master" value="255"/>
!     <mixer field="record.adc-0:1_source" value="sel2"/>
!     <mixer field="record.adc-0:1" value="255"/>
!   </config>
! </start>

In addition to selecting the recording source the playback as
well as the recording volume are set to 255 (maximum).
Information about the available mixers and settings in general
may be obtained by setting the 'verbose' to 'yes' in the config
node.

Issue #1644.
2015-08-21 10:59:46 +02:00

55 lines
1.1 KiB
C++

/*
* \brief Audio library interface
* \author Josef Soentgen
* \date 2014-12-27
*
* This header declares the private Audio namespace. It contains
* functions called by the driver frontend that are implemented
* by the driver library.
*/
/*
* Copyright (C) 2014 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU General Public License version 2.
*/
#ifndef _AUDIO__AUDIO_H_
#define _AUDIO__AUDIO_H_
#include <os/server.h>
/*****************************
** private Audio namespace **
*****************************/
namespace Audio_out {
enum Channel_number { LEFT, RIGHT, MAX_CHANNELS, INVALID = MAX_CHANNELS };
}
namespace Audio_in {
enum Channel_number { LEFT, MAX_CHANNELS, INVALID = MAX_CHANNELS };
}
namespace Audio {
void init_driver(Server::Entrypoint &ep);
bool driver_active();
void play_sigh(Genode::Signal_context_capability cap);
void record_sigh(Genode::Signal_context_capability cap);
int play(short *data, Genode::size_t size);
int record(short *data, Genode::size_t size);
}
#endif /* _AUDIO__AUDIO_H_ */