1
1
/*
2
- * Copyright (c) 2011-2015 , Intel Corporation
2
+ * Copyright (c) 2011-2017 , Intel Corporation
3
3
* All rights reserved.
4
4
*
5
5
* Redistribution and use in source and binary forms, with or without modification,
38
38
#define base AlsaCtlPortConfig
39
39
40
40
const AlsaCtlPortConfig::PortConfig LegacyAlsaCtlPortConfig::_defaultPortConfig = {
41
- { false , false },
42
- SND_PCM_FORMAT_S16_LE,
43
- 2 ,
44
- 48000
45
- };
41
+ {false , false }, SND_PCM_FORMAT_S16_LE, 2 , 48000 };
46
42
47
43
const uint32_t LegacyAlsaCtlPortConfig::_latencyMicroSeconds = 500000 ;
48
44
49
45
LegacyAlsaCtlPortConfig::LegacyAlsaCtlPortConfig (
50
- const std::string &mappingValue,
51
- CInstanceConfigurableElement *instanceConfigurableElement,
52
- const CMappingContext &context,
53
- core::log::Logger& logger)
54
- : base(mappingValue, instanceConfigurableElement, context, logger, _defaultPortConfig)
46
+ const std::string &mappingValue, CInstanceConfigurableElement *instanceConfigurableElement,
47
+ const CMappingContext &context, core::log::Logger &logger)
48
+ : base(mappingValue, instanceConfigurableElement, context, logger, _defaultPortConfig)
55
49
{
56
50
// Init stream handle array
57
51
_streamHandle[Playback] = NULL ;
@@ -63,11 +57,10 @@ LegacyAlsaCtlPortConfig::LegacyAlsaCtlPortConfig(
63
57
// Create device name
64
58
std::ostringstream streamName;
65
59
66
- streamName << " hw:" << snd_card_get_index (cardIndex.c_str ())
67
- << " , " << context.getItem (AlsaCtlDevice);
60
+ streamName << " hw:" << snd_card_get_index (cardIndex.c_str ()) << " , "
61
+ << context.getItem (AlsaCtlDevice);
68
62
69
63
_streamName = streamName.str ();
70
-
71
64
}
72
65
73
66
bool LegacyAlsaCtlPortConfig::doOpenStream (StreamDirection streamDirection, std::string &error)
@@ -76,10 +69,9 @@ bool LegacyAlsaCtlPortConfig::doOpenStream(StreamDirection streamDirection, std:
76
69
int32_t errorId;
77
70
78
71
if ((errorId = snd_pcm_open (
79
- &streamHandle,
80
- _streamName.c_str (),
81
- streamDirection == Capture ? SND_PCM_STREAM_CAPTURE : SND_PCM_STREAM_PLAYBACK,
82
- 0 )) < 0 ) {
72
+ &streamHandle, _streamName.c_str (),
73
+ streamDirection == Capture ? SND_PCM_STREAM_CAPTURE : SND_PCM_STREAM_PLAYBACK, 0 )) <
74
+ 0 ) {
83
75
84
76
error = formatAlsaError (streamDirection, " open" , snd_strerror (errorId));
85
77
@@ -88,13 +80,9 @@ bool LegacyAlsaCtlPortConfig::doOpenStream(StreamDirection streamDirection, std:
88
80
89
81
const AlsaCtlPortConfig::PortConfig &portConfig = getPortConfig ();
90
82
91
- if ((errorId = snd_pcm_set_params (streamHandle,
92
- static_cast <_snd_pcm_format>(portConfig.format ),
93
- SND_PCM_ACCESS_RW_INTERLEAVED,
94
- portConfig.channelNumber ,
95
- portConfig.sampleRate ,
96
- 0 ,
97
- _latencyMicroSeconds)) < 0 ) {
83
+ if ((errorId = snd_pcm_set_params (streamHandle, static_cast <_snd_pcm_format>(portConfig.format ),
84
+ SND_PCM_ACCESS_RW_INTERLEAVED, portConfig.channelNumber ,
85
+ portConfig.sampleRate , 0 , _latencyMicroSeconds)) < 0 ) {
98
86
99
87
error = formatAlsaError (streamDirection, " set params" , snd_strerror (errorId));
100
88
0 commit comments