2 * Copyright (c) 1999-2000, Eric Moon.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions, and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions, and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
16 * 3. The name of the author may not be used to endorse or promote products
17 * derived from this software without specific prior written permission.
19 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR
20 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
21 * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
23 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
26 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
27 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 // AudioAdapterParams.cpp
34 #include "AudioAdapterParams.h"
37 #include <ParameterWeb.h>
40 _AudioAdapterParams::store(int32 parameterID
, const void* data
, size_t size
)
42 if (size
< sizeof(int32
))
45 const uint32 d
= *(uint32
*)data
;
47 switch (parameterID
) {
48 // input format restrictions (0='wildcard')
50 inputFormat
.format
= d
;
53 case P_INPUT_CHANNEL_COUNT
:
54 inputFormat
.channel_count
= d
;
57 // output format restrictions (0='wildcard')
59 outputFormat
.format
= d
;
62 case P_OUTPUT_CHANNEL_COUNT
:
63 outputFormat
.channel_count
= d
;
73 status_t
_AudioAdapterParams::retrieve(
78 if(*ioSize
< sizeof(int32
)) {
79 *ioSize
= sizeof(int32
);
84 // input format restrictions (0='wildcard')
86 *(uint32
*)data
= inputFormat
.format
;
89 case P_INPUT_CHANNEL_COUNT
:
90 *(uint32
*)data
= inputFormat
.channel_count
;
93 // output format restrictions (0='wildcard')
95 *(uint32
*)data
= outputFormat
.format
;
96 PRINT(("P_OUTPUT_FORMAT retrieved\n")); //+++++
99 case P_OUTPUT_CHANNEL_COUNT
:
100 *(uint32
*)data
= outputFormat
.channel_count
;
110 void _AudioAdapterParams::populateGroup(
111 BParameterGroup
* group
) {
113 BParameterGroup
* inputGroup
= group
->MakeGroup("Input Format");
115 BNullParameter
* groupName
;
116 BDiscreteParameter
* param
;
118 groupName
= inputGroup
->MakeNullParameter(
119 0, B_MEDIA_NO_TYPE
, "Input Format", B_GENERIC
);
121 param
= inputGroup
->MakeDiscreteParameter(
130 media_multi_audio_format::B_AUDIO_FLOAT
,
133 media_multi_audio_format::B_AUDIO_SHORT
,
136 media_multi_audio_format::B_AUDIO_INT
,
139 media_multi_audio_format::B_AUDIO_UCHAR
,
142 param
= inputGroup
->MakeDiscreteParameter(
143 P_INPUT_CHANNEL_COUNT
,
163 BParameterGroup
* outputGroup
= group
->MakeGroup("Output Format");
165 groupName
= outputGroup
->MakeNullParameter(
166 0, B_MEDIA_NO_TYPE
, "Output Format", B_GENERIC
);
168 param
= outputGroup
->MakeDiscreteParameter(
177 media_multi_audio_format::B_AUDIO_FLOAT
,
180 media_multi_audio_format::B_AUDIO_SHORT
,
183 media_multi_audio_format::B_AUDIO_INT
,
186 media_multi_audio_format::B_AUDIO_UCHAR
,
189 param
= outputGroup
->MakeDiscreteParameter(
190 P_OUTPUT_CHANNEL_COUNT
,
211 // END -- AudioAdapterParams.cpp