Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
audiod
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
redox-os
audiod
Commits
b0d7fedc
Verified
Commit
b0d7fedc
authored
2 years ago
by
Jeremy Soller
Browse files
Options
Downloads
Patches
Plain Diff
Use audiohw: instead of hda:
parent
156f1d4e
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main.rs
+5
-5
5 additions, 5 deletions
src/main.rs
src/scheme.rs
+4
-4
4 additions, 4 deletions
src/scheme.rs
with
9 additions
and
9 deletions
src/main.rs
+
5
−
5
View file @
b0d7fedc
...
...
@@ -20,7 +20,7 @@ fn from_syscall_error(error: syscall::Error) -> io::Error {
extern
"C"
fn
sigusr_handler
(
_sig
:
usize
)
{}
fn
thread
(
scheme
:
Arc
<
Mutex
<
AudioScheme
>>
,
pid
:
usize
,
mut
h
da
_file
:
fs
::
File
)
->
io
::
Result
<
()
>
{
fn
thread
(
scheme
:
Arc
<
Mutex
<
AudioScheme
>>
,
pid
:
usize
,
mut
h
w
_file
:
fs
::
File
)
->
io
::
Result
<
()
>
{
// Enter null namespace
syscall
::
setrens
(
0
,
0
)
.map_err
(
from_syscall_error
)
?
;
...
...
@@ -36,12 +36,12 @@ fn thread(scheme: Arc<Mutex<AudioScheme>>, pid: usize, mut hda_file: fs::File) -
// Wake up the scheme thread
syscall
::
kill
(
pid
,
SIGUSR1
)
.map_err
(
from_syscall_error
)
?
;
h
da
_file
.write
(
&
buffer_u8
)
?
;
h
w
_file
.write
(
&
buffer_u8
)
?
;
}
}
fn
daemon
(
daemon
:
Daemon
)
->
io
::
Result
<
()
>
{
// Handle signals from the h
da
thread
// Handle signals from the h
w
thread
syscall
::
sigaction
(
SIGUSR1
,
Some
(
&
SigAction
{
sa_handler
:
Some
(
sigusr_handler
),
sa_mask
:
[
0
;
2
],
...
...
@@ -50,7 +50,7 @@ fn daemon(daemon: Daemon) -> io::Result<()> {
let
pid
=
syscall
::
getpid
()
.map_err
(
from_syscall_error
)
?
;
let
h
da
_file
=
fs
::
OpenOptions
::
new
()
.write
(
true
)
.open
(
"
hda
:"
)
?
;
let
h
w
_file
=
fs
::
OpenOptions
::
new
()
.write
(
true
)
.open
(
"
audiohw
:"
)
?
;
let
mut
scheme_file
=
fs
::
OpenOptions
::
new
()
.create
(
true
)
.read
(
true
)
.write
(
true
)
.open
(
":audio"
)
?
;
...
...
@@ -58,7 +58,7 @@ fn daemon(daemon: Daemon) -> io::Result<()> {
// Spawn a thread to mix and send audio data
let
scheme_thread
=
scheme
.clone
();
let
_thread
=
thread
::
spawn
(
move
||
thread
(
scheme_thread
,
pid
,
h
da
_file
));
let
_thread
=
thread
::
spawn
(
move
||
thread
(
scheme_thread
,
pid
,
h
w
_file
));
// Enter the null namespace - done after thread is created so
// memory: can be accessed for stack allocation
...
...
This diff is collapsed.
Click to expand it.
src/scheme.rs
+
4
−
4
View file @
b0d7fedc
...
...
@@ -3,8 +3,8 @@ use syscall::error::{EBADF, EWOULDBLOCK, Error, Result};
use
syscall
::
flag
::
O_NONBLOCK
;
use
syscall
::
scheme
::
SchemeBlockMut
;
// The strict buffer size of the
hda
: driver
const
H
DA
_BUFFER_SIZE
:
usize
=
512
;
// The strict buffer size of the
audiohw
: driver
const
H
W
_BUFFER_SIZE
:
usize
=
512
;
// The desired buffer size of each handle
const
HANDLE_BUFFER_SIZE
:
usize
=
4096
;
...
...
@@ -26,8 +26,8 @@ impl AudioScheme {
}
}
pub
fn
buffer
(
&
mut
self
)
->
[(
i16
,
i16
);
H
DA
_BUFFER_SIZE
]
{
let
mut
buffer
=
[(
0i16
,
0i16
);
H
DA
_BUFFER_SIZE
];
pub
fn
buffer
(
&
mut
self
)
->
[(
i16
,
i16
);
H
W
_BUFFER_SIZE
]
{
let
mut
buffer
=
[(
0i16
,
0i16
);
H
W
_BUFFER_SIZE
];
for
(
_id
,
handle
)
in
self
.handles
.iter_mut
()
{
let
mut
i
=
0
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment