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
2277d143
Commit
2277d143
authored
Jul 28, 2013
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
decoder/fluidsynth: convert to C++
parent
6b6d9e64
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
50 additions
and
16 deletions
+50
-16
Makefile.am
Makefile.am
+3
-1
DecoderList.cxx
src/DecoderList.cxx
+1
-1
FluidsynthDecoderPlugin.cxx
src/decoder/FluidsynthDecoderPlugin.cxx
+21
-14
FluidsynthDecoderPlugin.hxx
src/decoder/FluidsynthDecoderPlugin.hxx
+25
-0
No files found.
Makefile.am
View file @
2277d143
...
...
@@ -596,7 +596,9 @@ libdecoder_plugins_a_SOURCES += src/decoder/sidplay_decoder_plugin.cxx
endif
if
ENABLE_FLUIDSYNTH
libdecoder_plugins_a_SOURCES
+=
src/decoder/fluidsynth_decoder_plugin.c
libdecoder_plugins_a_SOURCES
+=
\
src/decoder/FluidsynthDecoderPlugin.cxx
\
src/decoder/FluidsynthDecoderPlugin.hxx
endif
if
ENABLE_WILDMIDI
...
...
src/DecoderList.cxx
View file @
2277d143
...
...
@@ -41,13 +41,13 @@
#include "decoder/MikmodDecoderPlugin.hxx"
#include "decoder/ModplugDecoderPlugin.hxx"
#include "decoder/MpcdecDecoderPlugin.hxx"
#include "decoder/FluidsynthDecoderPlugin.hxx"
#include <glib.h>
#include <string.h>
extern
const
struct
decoder_plugin
sidplay_decoder_plugin
;
extern
const
struct
decoder_plugin
fluidsynth_decoder_plugin
;
const
struct
decoder_plugin
*
const
decoder_plugins
[]
=
{
#ifdef HAVE_MAD
...
...
src/decoder/
fluidsynth_decoder_plugin.c
→
src/decoder/
FluidsynthDecoderPlugin.cxx
View file @
2277d143
/*
* Copyright (C) 2003-201
2
The Music Player Daemon Project
* Copyright (C) 2003-201
3
The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
...
...
@@ -18,6 +18,7 @@
*/
#include "config.h"
#include "FluidsynthDecoderPlugin.hxx"
#include "decoder_api.h"
#include "audio_check.h"
#include "conf.h"
...
...
@@ -65,13 +66,14 @@ fluidsynth_level_to_glib(enum fluid_log_level level)
static
void
fluidsynth_mpd_log_function
(
int
level
,
char
*
message
,
G_GNUC_UNUSED
void
*
data
)
{
g_log
(
G_LOG_DOMAIN
,
fluidsynth_level_to_glib
(
level
),
"%s"
,
message
);
g_log
(
G_LOG_DOMAIN
,
fluidsynth_level_to_glib
(
fluid_log_level
(
level
)),
"%s"
,
message
);
}
static
bool
fluidsynth_init
(
const
struct
config_param
*
param
)
{
GError
*
error
=
NULL
;
GError
*
error
=
nullptr
;
sample_rate
=
config_get_block_unsigned
(
param
,
"sample_rate"
,
48000
);
if
(
!
audio_check_sample_rate
(
sample_rate
,
&
error
))
{
...
...
@@ -85,7 +87,7 @@ fluidsynth_init(const struct config_param *param)
"/usr/share/sounds/sf2/FluidR3_GM.sf2"
);
fluid_set_log_function
(
LAST_LOG_LEVEL
,
fluidsynth_mpd_log_function
,
NULL
);
fluidsynth_mpd_log_function
,
nullptr
);
return
true
;
}
...
...
@@ -107,7 +109,7 @@ fluidsynth_file_decode(struct decoder *decoder, const char *path_fs)
/* set up fluid settings */
settings
=
new_fluid_settings
();
if
(
settings
==
NULL
)
if
(
settings
==
nullptr
)
return
;
fluid_settings_setnum
(
settings
,
setting_sample_rate
,
sample_rate
);
...
...
@@ -119,7 +121,7 @@ fluidsynth_file_decode(struct decoder *decoder, const char *path_fs)
/* create the fluid synth */
synth
=
new_fluid_synth
(
settings
);
if
(
synth
==
NULL
)
{
if
(
synth
==
nullptr
)
{
delete_fluid_settings
(
settings
);
return
;
}
...
...
@@ -135,7 +137,7 @@ fluidsynth_file_decode(struct decoder *decoder, const char *path_fs)
/* create the fluid player */
player
=
new_fluid_player
(
synth
);
if
(
player
==
NULL
)
{
if
(
player
==
nullptr
)
{
delete_fluid_synth
(
synth
);
delete_fluid_settings
(
settings
);
return
;
...
...
@@ -181,7 +183,7 @@ fluidsynth_file_decode(struct decoder *decoder, const char *path_fs)
if
(
ret
!=
0
)
break
;
cmd
=
decoder_data
(
decoder
,
NULL
,
buffer
,
sizeof
(
buffer
),
cmd
=
decoder_data
(
decoder
,
nullptr
,
buffer
,
sizeof
(
buffer
),
0
);
if
(
cmd
!=
DECODE_COMMAND_NONE
)
break
;
...
...
@@ -207,13 +209,18 @@ fluidsynth_scan_file(const char *file,
static
const
char
*
const
fluidsynth_suffixes
[]
=
{
"mid"
,
NULL
nullptr
};
const
struct
decoder_plugin
fluidsynth_decoder_plugin
=
{
.
name
=
"fluidsynth"
,
.
init
=
fluidsynth_init
,
.
file_decode
=
fluidsynth_file_decode
,
.
scan_file
=
fluidsynth_scan_file
,
.
suffixes
=
fluidsynth_suffixes
,
"fluidsynth"
,
fluidsynth_init
,
nullptr
,
nullptr
,
fluidsynth_file_decode
,
fluidsynth_scan_file
,
nullptr
,
nullptr
,
fluidsynth_suffixes
,
nullptr
,
};
src/decoder/FluidsynthDecoderPlugin.hxx
0 → 100644
View file @
2277d143
/*
* Copyright (C) 2003-2013 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef MPD_DECODER_FLUIDSYNTH_HXX
#define MPD_DECODER_FLUIDSYNTH_HXX
extern
const
struct
decoder_plugin
fluidsynth_decoder_plugin
;
#endif
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