Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
e0f1aa0b
Commit
e0f1aa0b
authored
Jul 27, 2011
by
Andrew Eikum
Committed by
Alexandre Julliard
Jul 27, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wineoss.drv: Choose default device using a better method.
parent
96aa86c9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
8 deletions
+36
-8
mmdevdrv.c
dlls/wineoss.drv/mmdevdrv.c
+36
-8
No files found.
dlls/wineoss.drv/mmdevdrv.c
View file @
e0f1aa0b
...
...
@@ -233,7 +233,40 @@ BOOL WINAPI DllMain(HINSTANCE dll, DWORD reason, void *reserved)
return
TRUE
;
}
HRESULT
WINAPI
AUDDRV_GetEndpointIDs
(
EDataFlow
flow
,
WCHAR
***
ids
,
void
***
keys
,
static
UINT
get_default_index
(
EDataFlow
flow
,
char
**
keys
,
UINT
num
)
{
int
fd
=
-
1
,
err
,
i
;
oss_audioinfo
ai
;
if
(
flow
==
eRender
)
fd
=
open
(
"/dev/dsp"
,
O_WRONLY
);
else
fd
=
open
(
"/dev/dsp"
,
O_RDONLY
);
if
(
fd
<
0
){
WARN
(
"Couldn't open default device!
\n
"
);
return
0
;
}
ai
.
dev
=
-
1
;
if
((
err
=
ioctl
(
fd
,
SNDCTL_ENGINEINFO
,
&
ai
))
<
0
){
WARN
(
"SNDCTL_ENGINEINFO failed: %d (%s)
\n
"
,
err
,
strerror
(
err
));
close
(
fd
);
return
0
;
}
close
(
fd
);
TRACE
(
"Default devnode: %s
\n
"
,
ai
.
devnode
);
for
(
i
=
0
;
i
<
num
;
++
i
)
if
(
!
strcmp
(
ai
.
devnode
,
keys
[
i
]))
return
i
;
WARN
(
"Couldn't find default device! Choosing first.
\n
"
);
return
0
;
}
HRESULT
WINAPI
AUDDRV_GetEndpointIDs
(
EDataFlow
flow
,
WCHAR
***
ids
,
char
***
keys
,
UINT
*
num
,
UINT
*
def_index
)
{
int
i
,
mixer_fd
;
...
...
@@ -282,7 +315,6 @@ HRESULT WINAPI AUDDRV_GetEndpointIDs(EDataFlow flow, WCHAR ***ids, void ***keys,
*
keys
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sysinfo
.
numaudios
*
sizeof
(
char
*
));
*
num
=
0
;
*
def_index
=
-
1
;
for
(
i
=
0
;
i
<
sysinfo
.
numaudios
;
++
i
){
oss_audioinfo
ai
=
{
0
};
int
fd
;
...
...
@@ -340,18 +372,14 @@ HRESULT WINAPI AUDDRV_GetEndpointIDs(EDataFlow flow, WCHAR ***ids, void ***keys,
MultiByteToWideChar
(
CP_UNIXCP
,
0
,
ai
.
name
,
-
1
,
(
*
ids
)[
*
num
],
len
);
if
(
ai
.
caps
&
PCM_CAP_DEFAULT
)
*
def_index
=
*
num
;
(
*
num
)
++
;
}
}
if
(
*
def_index
==
-
1
)
*
def_index
=
0
;
close
(
mixer_fd
);
*
def_index
=
get_default_index
(
flow
,
*
keys
,
*
num
);
return
S_OK
;
}
...
...
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