Util/Macros: replacement for GLib's G_N_ELEMENTS()
This commit is contained in:
@@ -23,13 +23,12 @@
|
||||
#include "DecoderAPI.hxx"
|
||||
#include "CheckAudioFormat.hxx"
|
||||
#include "util/Error.hxx"
|
||||
#include "util/Macros.hxx"
|
||||
#include "Log.hxx"
|
||||
|
||||
#include <adplug/adplug.h>
|
||||
#include <adplug/emuopl.h>
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
static unsigned sample_rate;
|
||||
@@ -65,7 +64,7 @@ adplug_file_decode(struct decoder *decoder, const char *path_fs)
|
||||
player->songlength() / 1000.);
|
||||
|
||||
int16_t buffer[2048];
|
||||
const unsigned frames_per_buffer = G_N_ELEMENTS(buffer) / 2;
|
||||
const unsigned frames_per_buffer = ARRAY_SIZE(buffer) / 2;
|
||||
DecoderCommand cmd;
|
||||
|
||||
do {
|
||||
|
@@ -23,10 +23,9 @@
|
||||
#include "CheckAudioFormat.hxx"
|
||||
#include "util/Error.hxx"
|
||||
#include "util/Domain.hxx"
|
||||
#include "util/Macros.hxx"
|
||||
#include "Log.hxx"
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
#include <fluidsynth.h>
|
||||
|
||||
static constexpr Domain fluidsynth_domain("fluidsynth");
|
||||
@@ -171,7 +170,7 @@ fluidsynth_file_decode(struct decoder *decoder, const char *path_fs)
|
||||
DecoderCommand cmd;
|
||||
while (fluid_player_get_status(player) == FLUID_PLAYER_PLAYING) {
|
||||
int16_t buffer[2048];
|
||||
const unsigned max_frames = G_N_ELEMENTS(buffer) / 2;
|
||||
const unsigned max_frames = ARRAY_SIZE(buffer) / 2;
|
||||
|
||||
/* read samples from fluidsynth and send them to the
|
||||
MPD core */
|
||||
|
@@ -25,11 +25,11 @@
|
||||
#include "tag/TagHandler.hxx"
|
||||
#include "util/Error.hxx"
|
||||
#include "util/Domain.hxx"
|
||||
#include "util/Macros.hxx"
|
||||
#include "Log.hxx"
|
||||
|
||||
#include <mpc/mpcdec.h>
|
||||
|
||||
#include <glib.h>
|
||||
#include <assert.h>
|
||||
#include <unistd.h>
|
||||
#include <math.h>
|
||||
@@ -212,7 +212,7 @@ mpcdec_decode(struct decoder *mpd_decoder, struct input_stream *is)
|
||||
mpc_uint32_t ret = frame.samples;
|
||||
ret *= info.channels;
|
||||
|
||||
int32_t chunk[G_N_ELEMENTS(sample_buffer)];
|
||||
int32_t chunk[ARRAY_SIZE(sample_buffer)];
|
||||
mpc_to_mpd_buffer(chunk, sample_buffer, ret);
|
||||
|
||||
long bit_rate = vbr_update_bits * audio_format.sample_rate
|
||||
|
@@ -26,6 +26,7 @@
|
||||
#include "OggCodec.hxx"
|
||||
#include "util/Error.hxx"
|
||||
#include "util/UriUtil.hxx"
|
||||
#include "util/Macros.hxx"
|
||||
#include "CheckAudioFormat.hxx"
|
||||
#include "tag/TagHandler.hxx"
|
||||
#include "Log.hxx"
|
||||
@@ -226,7 +227,7 @@ vorbis_stream_decode(struct decoder *decoder,
|
||||
#else
|
||||
float buffer[2048];
|
||||
const int frames_per_buffer =
|
||||
G_N_ELEMENTS(buffer) / audio_format.channels;
|
||||
ARRAY_SIZE(buffer) / audio_format.channels;
|
||||
const unsigned frame_size = sizeof(buffer[0]) * audio_format.channels;
|
||||
#endif
|
||||
|
||||
|
@@ -26,6 +26,7 @@
|
||||
#include "tag/ApeTag.hxx"
|
||||
#include "util/Error.hxx"
|
||||
#include "util/Domain.hxx"
|
||||
#include "util/Macros.hxx"
|
||||
#include "Log.hxx"
|
||||
|
||||
#include <wavpack/wavpack.h>
|
||||
@@ -173,7 +174,7 @@ wavpack_decode(struct decoder *decoder, WavpackContext *wpc, bool can_seek)
|
||||
|
||||
/* wavpack gives us all kind of samples in a 32-bit space */
|
||||
int32_t chunk[1024];
|
||||
const uint32_t samples_requested = G_N_ELEMENTS(chunk) /
|
||||
const uint32_t samples_requested = ARRAY_SIZE(chunk) /
|
||||
audio_format.channels;
|
||||
|
||||
decoder_initialized(decoder, audio_format, can_seek, total_time);
|
||||
|
Reference in New Issue
Block a user