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
4a993cd7
Commit
4a993cd7
authored
Aug 15, 2012
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
decoder/fluidsynth: add "sample_rate" setting
parent
02325d2e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
6 deletions
+24
-6
NEWS
NEWS
+1
-0
user.xml
doc/user.xml
+9
-0
fluidsynth_decoder_plugin.c
src/decoder/fluidsynth_decoder_plugin.c
+14
-6
No files found.
NEWS
View file @
4a993cd7
...
...
@@ -5,6 +5,7 @@ ver 0.17.2 (2012/??/??)
- fluidsynth: remove throttle (requires libfluidsynth 1.1)
- fluidsynth: stop playback at end of file
- fluidsynth: check MIDI file format while scanning
- fluidsynth: add sample rate setting
* output:
- httpd: use monotonic clock, avoid hiccups after system clock adjustment
- httpd: fix throttling bug after resuming playback
...
...
doc/user.xml
View file @
4a993cd7
...
...
@@ -836,6 +836,15 @@ systemctl start mpd.socket</programlisting>
<tbody>
<row>
<entry>
<varname>
sample_rate
</varname>
</entry>
<entry>
The sample rate that shall be synthesized by the
plugin. Defaults to 48000.
</entry>
</row>
<row>
<entry>
<varname>
soundfont
</varname>
</entry>
<entry>
...
...
src/decoder/fluidsynth_decoder_plugin.c
View file @
4a993cd7
...
...
@@ -19,6 +19,7 @@
#include "config.h"
#include "decoder_api.h"
#include "audio_check.h"
#include "conf.h"
#include <glib.h>
...
...
@@ -28,6 +29,7 @@
#undef G_LOG_DOMAIN
#define G_LOG_DOMAIN "fluidsynth"
static
unsigned
sample_rate
;
static
const
char
*
soundfont_path
;
/**
...
...
@@ -69,6 +71,15 @@ fluidsynth_mpd_log_function(int level, char *message, G_GNUC_UNUSED void *data)
static
bool
fluidsynth_init
(
const
struct
config_param
*
param
)
{
GError
*
error
=
NULL
;
sample_rate
=
config_get_block_unsigned
(
param
,
"sample_rate"
,
48000
);
if
(
!
audio_check_sample_rate
(
sample_rate
,
&
error
))
{
g_warning
(
"%s
\n
"
,
error
->
message
);
g_error_free
(
error
);
return
false
;
}
soundfont_path
=
config_get_block_string
(
param
,
"soundfont"
,
"/usr/share/sounds/sf2/FluidR3_GM.sf2"
);
...
...
@@ -82,11 +93,6 @@ fluidsynth_init(const struct config_param *param)
static
void
fluidsynth_file_decode
(
struct
decoder
*
decoder
,
const
char
*
path_fs
)
{
static
const
struct
audio_format
audio_format
=
{
.
sample_rate
=
48000
,
.
format
=
SAMPLE_FORMAT_S16
,
.
channels
=
2
,
};
char
setting_sample_rate
[]
=
"synth.sample-rate"
;
/*
char setting_verbose[] = "synth.verbose";
...
...
@@ -104,7 +110,7 @@ fluidsynth_file_decode(struct decoder *decoder, const char *path_fs)
if
(
settings
==
NULL
)
return
;
fluid_settings_setnum
(
settings
,
setting_sample_rate
,
48000
);
fluid_settings_setnum
(
settings
,
setting_sample_rate
,
sample_rate
);
/*
fluid_settings_setstr(settings, setting_verbose, setting_yes);
...
...
@@ -158,6 +164,8 @@ fluidsynth_file_decode(struct decoder *decoder, const char *path_fs)
/* initialization complete - announce the audio format to the
MPD core */
struct
audio_format
audio_format
;
audio_format_init
(
&
audio_format
,
sample_rate
,
SAMPLE_FORMAT_S16
,
2
);
decoder_initialized
(
decoder
,
&
audio_format
,
false
,
-
1
);
while
(
fluid_player_get_status
(
player
)
==
FLUID_PLAYER_PLAYING
)
{
...
...
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