replay_gain: moved code to replay_gain_info.c
This commit is contained in:
parent
0e183d3fa1
commit
1330274ffc
@ -169,6 +169,7 @@ mpd_headers = \
|
|||||||
src/queue_print.h \
|
src/queue_print.h \
|
||||||
src/queue_save.h \
|
src/queue_save.h \
|
||||||
src/replay_gain.h \
|
src/replay_gain.h \
|
||||||
|
src/replay_gain_info.h \
|
||||||
src/replay_gain_state.h \
|
src/replay_gain_state.h \
|
||||||
src/sig_handlers.h \
|
src/sig_handlers.h \
|
||||||
src/song.h \
|
src/song.h \
|
||||||
@ -296,6 +297,7 @@ src_mpd_SOURCES = \
|
|||||||
src/queue_print.c \
|
src/queue_print.c \
|
||||||
src/queue_save.c \
|
src/queue_save.c \
|
||||||
src/replay_gain.c \
|
src/replay_gain.c \
|
||||||
|
src/replay_gain_info.c \
|
||||||
src/replay_gain_state.c \
|
src/replay_gain_state.c \
|
||||||
src/sig_handlers.c \
|
src/sig_handlers.c \
|
||||||
src/song.c \
|
src/song.c \
|
||||||
@ -830,7 +832,7 @@ test_run_decoder_LDADD = $(MPD_LIBS) \
|
|||||||
test_run_decoder_SOURCES = test/run_decoder.c \
|
test_run_decoder_SOURCES = test/run_decoder.c \
|
||||||
src/conf.c src/tokenizer.c src/utils.c src/log.c \
|
src/conf.c src/tokenizer.c src/utils.c src/log.c \
|
||||||
src/tag.c src/tag_pool.c \
|
src/tag.c src/tag_pool.c \
|
||||||
src/replay_gain.c \
|
src/replay_gain_info.c \
|
||||||
src/uri.c \
|
src/uri.c \
|
||||||
src/fd_util.c \
|
src/fd_util.c \
|
||||||
src/audio_check.c \
|
src/audio_check.c \
|
||||||
@ -853,7 +855,7 @@ test_read_tags_LDADD = $(MPD_LIBS) \
|
|||||||
test_read_tags_SOURCES = test/read_tags.c \
|
test_read_tags_SOURCES = test/read_tags.c \
|
||||||
src/conf.c src/tokenizer.c src/utils.c src/log.c \
|
src/conf.c src/tokenizer.c src/utils.c src/log.c \
|
||||||
src/tag.c src/tag_pool.c \
|
src/tag.c src/tag_pool.c \
|
||||||
src/replay_gain.c \
|
src/replay_gain_info.c \
|
||||||
src/uri.c \
|
src/uri.c \
|
||||||
src/fd_util.c \
|
src/fd_util.c \
|
||||||
src/audio_check.c \
|
src/audio_check.c \
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "flac_metadata.h"
|
#include "flac_metadata.h"
|
||||||
#include "replay_gain.h"
|
#include "replay_gain_info.h"
|
||||||
#include "tag.h"
|
#include "tag.h"
|
||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
#include "pipe.h"
|
#include "pipe.h"
|
||||||
#include "chunk.h"
|
#include "chunk.h"
|
||||||
#include "replay_gain_state.h"
|
#include "replay_gain_state.h"
|
||||||
|
#include "replay_gain.h"
|
||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
#include "decoder_command.h"
|
#include "decoder_command.h"
|
||||||
#include "decoder_plugin.h"
|
#include "decoder_plugin.h"
|
||||||
#include "input_stream.h"
|
#include "input_stream.h"
|
||||||
#include "replay_gain.h"
|
#include "replay_gain_info.h"
|
||||||
#include "tag.h"
|
#include "tag.h"
|
||||||
#include "audio_format.h"
|
#include "audio_format.h"
|
||||||
#include "conf.h"
|
#include "conf.h"
|
||||||
|
@ -32,6 +32,7 @@
|
|||||||
#include "path.h"
|
#include "path.h"
|
||||||
#include "uri.h"
|
#include "uri.h"
|
||||||
#include "replay_gain_state.h"
|
#include "replay_gain_state.h"
|
||||||
|
#include "replay_gain.h"
|
||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
|
||||||
|
@ -127,26 +127,3 @@ void replay_gain_global_init(void)
|
|||||||
replay_gain_missing_preamp = pow(10, f / 20.0);
|
replay_gain_missing_preamp = pow(10, f / 20.0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct replay_gain_info *replay_gain_info_new(void)
|
|
||||||
{
|
|
||||||
struct replay_gain_info *ret = g_new(struct replay_gain_info, 1);
|
|
||||||
|
|
||||||
for (unsigned i = 0; i < G_N_ELEMENTS(ret->tuples); ++i) {
|
|
||||||
ret->tuples[i].gain = 0.0;
|
|
||||||
ret->tuples[i].peak = 0.0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct replay_gain_info *
|
|
||||||
replay_gain_info_dup(const struct replay_gain_info *src)
|
|
||||||
{
|
|
||||||
return g_memdup(src, sizeof(*src));
|
|
||||||
}
|
|
||||||
|
|
||||||
void replay_gain_info_free(struct replay_gain_info *info)
|
|
||||||
{
|
|
||||||
g_free(info);
|
|
||||||
}
|
|
||||||
|
@ -23,38 +23,15 @@
|
|||||||
#ifndef MPD_REPLAY_GAIN_H
|
#ifndef MPD_REPLAY_GAIN_H
|
||||||
#define MPD_REPLAY_GAIN_H
|
#define MPD_REPLAY_GAIN_H
|
||||||
|
|
||||||
#include <stdbool.h>
|
#include "check.h"
|
||||||
|
#include "replay_gain_info.h"
|
||||||
|
|
||||||
enum replay_gain_mode {
|
#include <stdbool.h>
|
||||||
REPLAY_GAIN_OFF = -1,
|
|
||||||
REPLAY_GAIN_ALBUM,
|
|
||||||
REPLAY_GAIN_TRACK,
|
|
||||||
};
|
|
||||||
|
|
||||||
extern enum replay_gain_mode replay_gain_mode;
|
extern enum replay_gain_mode replay_gain_mode;
|
||||||
extern float replay_gain_preamp;
|
extern float replay_gain_preamp;
|
||||||
extern float replay_gain_missing_preamp;
|
extern float replay_gain_missing_preamp;
|
||||||
|
|
||||||
struct replay_gain_tuple {
|
|
||||||
float gain;
|
|
||||||
float peak;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct replay_gain_info {
|
|
||||||
struct replay_gain_tuple tuples[2];
|
|
||||||
};
|
|
||||||
|
|
||||||
struct replay_gain_info *
|
|
||||||
replay_gain_info_new(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Duplicate a #replay_gain_info object.
|
|
||||||
*/
|
|
||||||
struct replay_gain_info *
|
|
||||||
replay_gain_info_dup(const struct replay_gain_info *src);
|
|
||||||
|
|
||||||
void replay_gain_info_free(struct replay_gain_info *info);
|
|
||||||
|
|
||||||
void replay_gain_global_init(void);
|
void replay_gain_global_init(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
48
src/replay_gain_info.c
Normal file
48
src/replay_gain_info.c
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2003-2010 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
#include "replay_gain_info.h"
|
||||||
|
|
||||||
|
#include <glib.h>
|
||||||
|
|
||||||
|
struct replay_gain_info *
|
||||||
|
replay_gain_info_new(void)
|
||||||
|
{
|
||||||
|
struct replay_gain_info *ret = g_new(struct replay_gain_info, 1);
|
||||||
|
|
||||||
|
for (unsigned i = 0; i < G_N_ELEMENTS(ret->tuples); ++i) {
|
||||||
|
ret->tuples[i].gain = 0.0;
|
||||||
|
ret->tuples[i].peak = 0.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct replay_gain_info *
|
||||||
|
replay_gain_info_dup(const struct replay_gain_info *src)
|
||||||
|
{
|
||||||
|
return g_memdup(src, sizeof(*src));
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
replay_gain_info_free(struct replay_gain_info *info)
|
||||||
|
{
|
||||||
|
g_free(info);
|
||||||
|
}
|
52
src/replay_gain_info.h
Normal file
52
src/replay_gain_info.h
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2003-2010 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_REPLAY_GAIN_INFO_H
|
||||||
|
#define MPD_REPLAY_GAIN_INFO_H
|
||||||
|
|
||||||
|
#include "check.h"
|
||||||
|
|
||||||
|
enum replay_gain_mode {
|
||||||
|
REPLAY_GAIN_OFF = -1,
|
||||||
|
REPLAY_GAIN_ALBUM,
|
||||||
|
REPLAY_GAIN_TRACK,
|
||||||
|
};
|
||||||
|
|
||||||
|
struct replay_gain_tuple {
|
||||||
|
float gain;
|
||||||
|
float peak;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct replay_gain_info {
|
||||||
|
struct replay_gain_tuple tuples[2];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct replay_gain_info *
|
||||||
|
replay_gain_info_new(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Duplicate a #replay_gain_info object.
|
||||||
|
*/
|
||||||
|
struct replay_gain_info *
|
||||||
|
replay_gain_info_dup(const struct replay_gain_info *src);
|
||||||
|
|
||||||
|
void
|
||||||
|
replay_gain_info_free(struct replay_gain_info *info);
|
||||||
|
|
||||||
|
#endif
|
@ -21,7 +21,7 @@
|
|||||||
#define MPD_REPLAY_GAIN_STATE_H
|
#define MPD_REPLAY_GAIN_STATE_H
|
||||||
|
|
||||||
#include "check.h"
|
#include "check.h"
|
||||||
#include "replay_gain.h"
|
#include "replay_gain_info.h"
|
||||||
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user