audio_format: convert to C++
This commit is contained in:
Makefile.am
src
AudioConfig.cxxAudioConfig.hxxAudioFormat.cxxAudioFormat.hxxAudioParser.cxxAudioParser.hxxCheckAudioFormat.cxxCheckAudioFormat.hxxCrossFade.cxxCrossFade.hxxDecoderAPI.cxxDecoderAPI.hxxDecoderControl.hxxEncoderAPI.hxxEncoderPlugin.hxxFilterInternal.hxxMusicChunk.cxxMusicChunk.hxxMusicPipe.cxxMusicPipe.hxxOutputAPI.hxxOutputAll.cxxOutputAll.hxxOutputControl.cxxOutputControl.hxxOutputInit.cxxOutputInternal.hxxOutputPlugin.cxxOutputPlugin.hxxOutputThread.cxxPlayerCommands.cxxPlayerControl.hxxPlayerThread.cxxTimer.cxxTimer.hxxaudio_format.h
decoder
AdPlugDecoderPlugin.cxxAudiofileDecoderPlugin.cxxDsdiffDecoderPlugin.cxxDsfDecoderPlugin.cxxFaadDecoderPlugin.cxxFfmpegDecoderPlugin.cxxFfmpegMetaData.hxxFlacCommon.cxxFlacCommon.hxxFlacDecoderPlugin.cxxFlacPcm.cxxFlacPcm.hxxFluidsynthDecoderPlugin.cxxGmeDecoderPlugin.cxxMadDecoderPlugin.cxxMikmodDecoderPlugin.cxxModplugDecoderPlugin.cxxMpcdecDecoderPlugin.cxxMpg123DecoderPlugin.cxxOpusDecoderPlugin.cxxPcmDecoderPlugin.cxxSndfileDecoderPlugin.cxxVorbisDecoderPlugin.cxxWavpackDecoderPlugin.cxxWildmidiDecoderPlugin.cxxsidplay_decoder_plugin.cxx
encoder
FlacEncoderPlugin.cxxLameEncoderPlugin.cxxNullEncoderPlugin.cxxOpusEncoderPlugin.cxxTwolameEncoderPlugin.cxxVorbisEncoderPlugin.cxxWaveEncoderPlugin.cxx
filter
AutoConvertFilterPlugin.cxxChainFilterPlugin.cxxConvertFilterPlugin.cxxConvertFilterPlugin.hxxNormalizeFilterPlugin.cxxNullFilterPlugin.cxxReplayGainFilterPlugin.cxxRouteFilterPlugin.cxxVolumeFilterPlugin.cxx
output
AlsaOutputPlugin.cxxAoOutputPlugin.cxxFifoOutputPlugin.cxxHttpdInternal.hxxHttpdOutputPlugin.cxxJackOutputPlugin.cxxNullOutputPlugin.cxxOSXOutputPlugin.cxxOpenALOutputPlugin.cxxOssOutputPlugin.cxxPipeOutputPlugin.cxxPulseOutputPlugin.cxxRecorderOutputPlugin.cxxRoarOutputPlugin.cxxShoutOutputPlugin.cxxSolarisOutputPlugin.cxxWinmmOutputPlugin.cxx
pcm
test
@ -26,7 +26,7 @@
|
||||
#include "config.h"
|
||||
#include "pcm/PcmVolume.hxx"
|
||||
#include "AudioParser.hxx"
|
||||
#include "audio_format.h"
|
||||
#include "AudioFormat.hxx"
|
||||
#include "stdbin.h"
|
||||
|
||||
#include <glib.h>
|
||||
@ -37,7 +37,6 @@
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
GError *error = NULL;
|
||||
struct audio_format audio_format;
|
||||
bool ret;
|
||||
static char buffer[4096];
|
||||
ssize_t nbytes;
|
||||
@ -47,20 +46,20 @@ int main(int argc, char **argv)
|
||||
return 1;
|
||||
}
|
||||
|
||||
AudioFormat audio_format(48000, SampleFormat::S16, 2);
|
||||
if (argc > 1) {
|
||||
ret = audio_format_parse(&audio_format, argv[1],
|
||||
ret = audio_format_parse(audio_format, argv[1],
|
||||
false, &error);
|
||||
if (!ret) {
|
||||
g_printerr("Failed to parse audio format: %s\n",
|
||||
error->message);
|
||||
return 1;
|
||||
}
|
||||
} else
|
||||
audio_format_init(&audio_format, 48000, SAMPLE_FORMAT_S16, 2);
|
||||
}
|
||||
|
||||
while ((nbytes = read(0, buffer, sizeof(buffer))) > 0) {
|
||||
if (!pcm_volume(buffer, nbytes,
|
||||
sample_format(audio_format.format),
|
||||
audio_format.format,
|
||||
PCM_VOLUME_1 / 2)) {
|
||||
g_printerr("pcm_volume() has failed\n");
|
||||
return 2;
|
||||
|
Reference in New Issue
Block a user