Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
miniaudio
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
miniaudio
Commits
a26c210d
Commit
a26c210d
authored
Jun 25, 2017
by
David Reid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
OSS: Make logging consistent with other backends.
parent
0414907e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
8 deletions
+8
-8
mini_al.h
mini_al.h
+8
-8
No files found.
mini_al.h
View file @
a26c210d
...
@@ -5108,7 +5108,7 @@ static mal_result mal_device_init__oss(mal_context* pContext, mal_device_type ty
...
@@ -5108,7 +5108,7 @@ static mal_result mal_device_init__oss(mal_context* pContext, mal_device_type ty
pDevice
->
oss
.
fd
=
open
(
deviceName
,
(
type
==
mal_device_type_playback
)
?
O_WRONLY
:
O_RDONLY
,
0
);
pDevice
->
oss
.
fd
=
open
(
deviceName
,
(
type
==
mal_device_type_playback
)
?
O_WRONLY
:
O_RDONLY
,
0
);
if
(
pDevice
->
oss
.
fd
==
-
1
)
{
if
(
pDevice
->
oss
.
fd
==
-
1
)
{
return
mal_post_error
(
pDevice
,
"
OSS:
Failed to open device."
,
MAL_NO_DEVICE
);
return
mal_post_error
(
pDevice
,
"
[OSS]
Failed to open device."
,
MAL_NO_DEVICE
);
}
}
// The OSS documantation is very clear about the order we should be initializing the device's properties:
// The OSS documantation is very clear about the order we should be initializing the device's properties:
...
@@ -5129,14 +5129,14 @@ static mal_result mal_device_init__oss(mal_context* pContext, mal_device_type ty
...
@@ -5129,14 +5129,14 @@ static mal_result mal_device_init__oss(mal_context* pContext, mal_device_type ty
int
result
=
ioctl
(
pDevice
->
oss
.
fd
,
SNDCTL_DSP_SETFMT
,
&
ossFormat
);
int
result
=
ioctl
(
pDevice
->
oss
.
fd
,
SNDCTL_DSP_SETFMT
,
&
ossFormat
);
if
(
result
==
-
1
)
{
if
(
result
==
-
1
)
{
close
(
pDevice
->
oss
.
fd
);
close
(
pDevice
->
oss
.
fd
);
return
mal_post_error
(
pDevice
,
"
OSS:
Failed to set format."
,
MAL_FORMAT_NOT_SUPPORTED
);
return
mal_post_error
(
pDevice
,
"
[OSS]
Failed to set format."
,
MAL_FORMAT_NOT_SUPPORTED
);
}
}
switch
(
ossFormat
)
{
switch
(
ossFormat
)
{
case
AFMT_U8
:
pDevice
->
internalFormat
=
mal_format_u8
;
break
;
case
AFMT_U8
:
pDevice
->
internalFormat
=
mal_format_u8
;
break
;
case
AFMT_S16_LE
:
pDevice
->
internalFormat
=
mal_format_s16
;
break
;
case
AFMT_S16_LE
:
pDevice
->
internalFormat
=
mal_format_s16
;
break
;
case
AFMT_S32_LE
:
pDevice
->
internalFormat
=
mal_format_s32
;
break
;
case
AFMT_S32_LE
:
pDevice
->
internalFormat
=
mal_format_s32
;
break
;
default:
mal_post_error
(
pDevice
,
"
OSS:
The device's internal format is not supported by mini_al."
,
MAL_FORMAT_NOT_SUPPORTED
);
default:
mal_post_error
(
pDevice
,
"
[OSS]
The device's internal format is not supported by mini_al."
,
MAL_FORMAT_NOT_SUPPORTED
);
}
}
...
@@ -5145,7 +5145,7 @@ static mal_result mal_device_init__oss(mal_context* pContext, mal_device_type ty
...
@@ -5145,7 +5145,7 @@ static mal_result mal_device_init__oss(mal_context* pContext, mal_device_type ty
result
=
ioctl
(
pDevice
->
oss
.
fd
,
SNDCTL_DSP_CHANNELS
,
&
ossChannels
);
result
=
ioctl
(
pDevice
->
oss
.
fd
,
SNDCTL_DSP_CHANNELS
,
&
ossChannels
);
if
(
result
==
-
1
)
{
if
(
result
==
-
1
)
{
close
(
pDevice
->
oss
.
fd
);
close
(
pDevice
->
oss
.
fd
);
return
mal_post_error
(
pDevice
,
"
OSS:
Failed to set channel count."
,
MAL_FORMAT_NOT_SUPPORTED
);
return
mal_post_error
(
pDevice
,
"
[OSS]
Failed to set channel count."
,
MAL_FORMAT_NOT_SUPPORTED
);
}
}
pDevice
->
internalChannels
=
ossChannels
;
pDevice
->
internalChannels
=
ossChannels
;
...
@@ -5156,7 +5156,7 @@ static mal_result mal_device_init__oss(mal_context* pContext, mal_device_type ty
...
@@ -5156,7 +5156,7 @@ static mal_result mal_device_init__oss(mal_context* pContext, mal_device_type ty
result
=
ioctl
(
pDevice
->
oss
.
fd
,
SNDCTL_DSP_SPEED
,
&
ossSampleRate
);
result
=
ioctl
(
pDevice
->
oss
.
fd
,
SNDCTL_DSP_SPEED
,
&
ossSampleRate
);
if
(
result
==
-
1
)
{
if
(
result
==
-
1
)
{
close
(
pDevice
->
oss
.
fd
);
close
(
pDevice
->
oss
.
fd
);
return
mal_post_error
(
pDevice
,
"
OSS:
Failed to set sample rate."
,
MAL_FORMAT_NOT_SUPPORTED
);
return
mal_post_error
(
pDevice
,
"
[OSS]
Failed to set sample rate."
,
MAL_FORMAT_NOT_SUPPORTED
);
}
}
pDevice
->
sampleRate
=
ossSampleRate
;
pDevice
->
sampleRate
=
ossSampleRate
;
...
@@ -5183,7 +5183,7 @@ static mal_result mal_device_init__oss(mal_context* pContext, mal_device_type ty
...
@@ -5183,7 +5183,7 @@ static mal_result mal_device_init__oss(mal_context* pContext, mal_device_type ty
result
=
ioctl
(
pDevice
->
oss
.
fd
,
SNDCTL_DSP_SETFRAGMENT
,
&
ossFragment
);
result
=
ioctl
(
pDevice
->
oss
.
fd
,
SNDCTL_DSP_SETFRAGMENT
,
&
ossFragment
);
if
(
result
==
-
1
)
{
if
(
result
==
-
1
)
{
close
(
pDevice
->
oss
.
fd
);
close
(
pDevice
->
oss
.
fd
);
return
mal_post_error
(
pDevice
,
"
OSS:
Failed to set fragment size and period count."
,
MAL_FORMAT_NOT_SUPPORTED
);
return
mal_post_error
(
pDevice
,
"
[OSS]
Failed to set fragment size and period count."
,
MAL_FORMAT_NOT_SUPPORTED
);
}
}
int
actualFragmentSizeInBytes
=
1
<<
(
ossFragment
&
0xFFFF
);
int
actualFragmentSizeInBytes
=
1
<<
(
ossFragment
&
0xFFFF
);
...
@@ -5202,7 +5202,7 @@ static mal_result mal_device_init__oss(mal_context* pContext, mal_device_type ty
...
@@ -5202,7 +5202,7 @@ static mal_result mal_device_init__oss(mal_context* pContext, mal_device_type ty
pDevice
->
oss
.
pIntermediaryBuffer
=
mal_malloc
(
fragmentSizeInBytes
);
pDevice
->
oss
.
pIntermediaryBuffer
=
mal_malloc
(
fragmentSizeInBytes
);
if
(
pDevice
->
oss
.
pIntermediaryBuffer
==
NULL
)
{
if
(
pDevice
->
oss
.
pIntermediaryBuffer
==
NULL
)
{
close
(
pDevice
->
oss
.
fd
);
close
(
pDevice
->
oss
.
fd
);
return
mal_post_error
(
pDevice
,
"
OSS:
Failed to allocate memory for intermediary buffer."
,
MAL_OUT_OF_MEMORY
);
return
mal_post_error
(
pDevice
,
"
[OSS]
Failed to allocate memory for intermediary buffer."
,
MAL_OUT_OF_MEMORY
);
}
}
return
MAL_SUCCESS
;
return
MAL_SUCCESS
;
...
@@ -5252,7 +5252,7 @@ static mal_result mal_device__stop_backend__oss(mal_device* pDevice)
...
@@ -5252,7 +5252,7 @@ static mal_result mal_device__stop_backend__oss(mal_device* pDevice)
int
result
=
ioctl
(
pDevice
->
oss
.
fd
,
SNDCTL_DSP_HALT
,
0
);
int
result
=
ioctl
(
pDevice
->
oss
.
fd
,
SNDCTL_DSP_HALT
,
0
);
if
(
result
==
-
1
)
{
if
(
result
==
-
1
)
{
return
mal_post_error
(
pDevice
,
"
OSS:
Failed to stop device. SNDCTL_DSP_HALT failed."
,
MAL_ERROR
);
return
mal_post_error
(
pDevice
,
"
[OSS]
Failed to stop device. SNDCTL_DSP_HALT failed."
,
MAL_ERROR
);
}
}
return
MAL_SUCCESS
;
return
MAL_SUCCESS
;
...
...
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