Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
0416980d
Commit
0416980d
authored
Jan 28, 2015
by
Takashi Iwai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ALSA: line6: Fix volume calculation for big-endian
Signed-off-by:
Takashi Iwai
<
tiwai@suse.de
>
parent
247d95ee
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
9 deletions
+14
-9
sound/usb/line6/playback.c
sound/usb/line6/playback.c
+14
-9
No files found.
sound/usb/line6/playback.c
View file @
0416980d
...
...
@@ -31,14 +31,16 @@ static void change_volume(struct urb *urb_out, int volume[],
return
;
/* maximum volume - no change */
if
(
bytes_per_frame
==
4
)
{
short
*
p
,
*
buf_end
;
__le16
*
p
,
*
buf_end
;
p
=
(
short
*
)
urb_out
->
transfer_buffer
;
p
=
(
__le16
*
)
urb_out
->
transfer_buffer
;
buf_end
=
p
+
urb_out
->
transfer_buffer_length
/
sizeof
(
*
p
);
for
(;
p
<
buf_end
;
++
p
)
{
int
val
=
(
*
p
*
volume
[
chn
&
1
])
>>
8
;
*
p
=
clamp
(
val
,
0x7fff
,
-
0x8000
);
short
pv
=
le16_to_cpu
(
*
p
);
int
val
=
(
pv
*
volume
[
chn
&
1
])
>>
8
;
pv
=
clamp
(
val
,
0x7fff
,
-
0x8000
);
*
p
=
cpu_to_le16
(
pv
);
++
chn
;
}
}
else
if
(
bytes_per_frame
==
6
)
{
...
...
@@ -114,15 +116,18 @@ static void add_monitor_signal(struct urb *urb_out, unsigned char *signal,
return
;
/* zero volume - no change */
if
(
bytes_per_frame
==
4
)
{
short
*
pi
,
*
po
,
*
buf_end
;
__le16
*
pi
,
*
po
,
*
buf_end
;
pi
=
(
short
*
)
signal
;
po
=
(
short
*
)
urb_out
->
transfer_buffer
;
pi
=
(
__le16
*
)
signal
;
po
=
(
__le16
*
)
urb_out
->
transfer_buffer
;
buf_end
=
po
+
urb_out
->
transfer_buffer_length
/
sizeof
(
*
po
);
for
(;
po
<
buf_end
;
++
pi
,
++
po
)
{
int
val
=
*
po
+
((
*
pi
*
volume
)
>>
8
);
*
po
=
clamp
(
val
,
0x7fff
,
-
0x8000
);
short
pov
=
le16_to_cpu
(
*
po
);
short
piv
=
le16_to_cpu
(
*
pi
);
int
val
=
pov
+
((
piv
*
volume
)
>>
8
);
pov
=
clamp
(
val
,
0x7fff
,
-
0x8000
);
*
po
=
cpu_to_le16
(
pov
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment