Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
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
Иван Мажукин
mpd
Commits
2650b9eb
Commit
2650b9eb
authored
Aug 26, 2008
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added inline function audio_format_time_to_size()
Make the code more readable by hiding big formulas in an inline function with a nice name.
parent
0aedf7dd
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
1 deletion
+6
-1
audio_format.h
src/audio_format.h
+5
-0
decode.c
src/decode.c
+1
-1
No files found.
src/audio_format.h
View file @
2650b9eb
...
...
@@ -27,6 +27,11 @@ typedef struct _AudioFormat {
volatile
mpd_sint8
bits
;
}
AudioFormat
;
static
inline
double
audio_format_time_to_size
(
const
AudioFormat
*
af
)
{
return
af
->
sampleRate
*
af
->
bits
*
af
->
channels
/
8
.
0
;
}
static
inline
double
audioFormatSizeToTime
(
const
AudioFormat
*
af
)
{
return
8
.
0
/
af
->
bits
/
af
->
channels
/
af
->
sampleRate
;
...
...
src/decode.c
View file @
2650b9eb
...
...
@@ -78,7 +78,7 @@ static unsigned calculateCrossFadeChunks(AudioFormat * af,
assert
(
af
->
channels
>
0
);
assert
(
af
->
sampleRate
>
0
);
chunks
=
(
af
->
sampleRate
*
af
->
bits
*
af
->
channels
/
8
.
0
/
CHUNK_SIZE
)
;
chunks
=
audio_format_time_to_size
(
af
)
/
CHUNK_SIZE
;
chunks
=
(
chunks
*
pc
.
crossFade
+
0
.
5
);
if
(
chunks
>
max_chunks
)
...
...
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