Author: agrundman
Date: Fri May 28 19:42:27 2010
New Revision: 8833
URL: http://svn.slimdevices.com/jive?rev=8833&view=rev
Log:
Added support for output channel flags, to play only the left or right channel
of audio
Modified:
7.6/trunk/squeezeplay/src/squeezeplay/share/jive/audio/Playback.lua
7.6/trunk/squeezeplay/src/squeezeplay/src/audio/decode/decode.c
7.6/trunk/squeezeplay/src/squeezeplay/src/audio/decode/decode.h
7.6/trunk/squeezeplay/src/squeezeplay/src/audio/decode/decode_output.c
7.6/trunk/squeezeplay/src/squeezeplay/src/audio/decode/decode_priv.h
Modified: 7.6/trunk/squeezeplay/src/squeezeplay/share/jive/audio/Playback.lua
URL:
http://svn.slimdevices.com/jive/7.6/trunk/squeezeplay/src/squeezeplay/share/jive/audio/Playback.lua?rev=8833&r1=8832&r2=8833&view=diff
==============================================================================
--- 7.6/trunk/squeezeplay/src/squeezeplay/share/jive/audio/Playback.lua
(original)
+++ 7.6/trunk/squeezeplay/src/squeezeplay/share/jive/audio/Playback.lua Fri May
28 19:42:27 2010
@@ -657,7 +657,8 @@
data.transitionPeriod,
data.replayGain,
data.outputThreshold,
- data.flags & 0x03,
+ data.flags & 0x03, -- polarity inversion
+ data.flags & 0xC, -- output channels
string.byte(data.pcmSampleSize),
string.byte(data.pcmSampleRate),
string.byte(data.pcmChannels),
Modified: 7.6/trunk/squeezeplay/src/squeezeplay/src/audio/decode/decode.c
URL:
http://svn.slimdevices.com/jive/7.6/trunk/squeezeplay/src/squeezeplay/src/audio/decode/decode.c?rev=8833&r1=8832&r2=8833&view=diff
==============================================================================
--- 7.6/trunk/squeezeplay/src/squeezeplay/src/audio/decode/decode.c (original)
+++ 7.6/trunk/squeezeplay/src/squeezeplay/src/audio/decode/decode.c Fri May 28
19:42:27 2010
@@ -240,7 +240,8 @@
static void decode_start_handler(void) {
- Uint32 decoder_id, transition_type, transition_period, replay_gain,
output_threshold, polarity_inversion;
+ Uint32 decoder_id, transition_type, transition_period, replay_gain;
+ Uint32 output_threshold, polarity_inversion, output_channels;
Uint32 i, num_params;
Uint8 params[DECODER_MAX_PARAMS];
@@ -250,6 +251,7 @@
replay_gain = mqueue_read_u32(&decode_mqueue);
output_threshold = mqueue_read_u32(&decode_mqueue);
polarity_inversion = mqueue_read_u32(&decode_mqueue);
+ output_channels = mqueue_read_u32(&decode_mqueue);
num_params = mqueue_read_u32(&decode_mqueue);
if (num_params > DECODER_MAX_PARAMS) {
@@ -278,6 +280,7 @@
decode_output_set_transition(transition_type, transition_period);
decode_output_set_track_gain(replay_gain);
decode_set_track_polarity_inversion(polarity_inversion);
+ decode_set_output_channels(output_channels);
decoder_data = decoder->start(params, num_params);
@@ -705,7 +708,8 @@
* 5: reply_gain
* 6: output_threshold
* 7: polarity_inversion
- * 8: params...
+ * 8: output_channels
+ * 9: params...
*/
/* Reset the decoder state in calling thread to avoid potential
@@ -721,11 +725,12 @@
mqueue_write_u32(&decode_mqueue, (Uint32) luaL_optinteger(L, 5,
0)); /* replay_gain */
mqueue_write_u32(&decode_mqueue, (Uint32) luaL_optinteger(L, 6,
0)); /* output_threshold */
mqueue_write_u32(&decode_mqueue, (Uint32) luaL_optinteger(L, 7,
0)); /* polarity_inversion */
-
- num_params = lua_gettop(L) - 7;
+ mqueue_write_u32(&decode_mqueue, (Uint32) luaL_optinteger(L, 8,
0)); /* output_channels */
+
+ num_params = lua_gettop(L) - 8;
mqueue_write_u32(&decode_mqueue, num_params);
for (i = 0; i < num_params; i++) {
- mqueue_write_u8(&decode_mqueue, (Uint8)
luaL_optinteger(L, 8 + i, 0));
+ mqueue_write_u8(&decode_mqueue, (Uint8)
luaL_optinteger(L, 9 + i, 0));
}
mqueue_write_complete(&decode_mqueue);
}
Modified: 7.6/trunk/squeezeplay/src/squeezeplay/src/audio/decode/decode.h
URL:
http://svn.slimdevices.com/jive/7.6/trunk/squeezeplay/src/squeezeplay/src/audio/decode/decode.h?rev=8833&r1=8832&r2=8833&view=diff
==============================================================================
--- 7.6/trunk/squeezeplay/src/squeezeplay/src/audio/decode/decode.h (original)
+++ 7.6/trunk/squeezeplay/src/squeezeplay/src/audio/decode/decode.h Fri May 28
19:42:27 2010
@@ -1,7 +1,7 @@
/*
** Copyright 2007-2008 Logitech. All Rights Reserved.
**
-** This file is licensed under BSD. Please see the LICENSE file for details.
+** This file is licensed under BSD. Please see the LICENSE file for details.
*/
@@ -24,6 +24,9 @@
#define POLARITY_INVERSION_LEFT 0x1
#define POLARITY_INVERSION_RIGHT 0x2
+/* Output channel flags */
+#define OUTPUT_CHANNEL_LEFT 0x4
+#define OUTPUT_CHANNEL_RIGHT 0x8
#define TESTTONES_OFF 0
#define TESTTONES_MULTITONE 1
Modified: 7.6/trunk/squeezeplay/src/squeezeplay/src/audio/decode/decode_output.c
URL:
http://svn.slimdevices.com/jive/7.6/trunk/squeezeplay/src/squeezeplay/src/audio/decode/decode_output.c?rev=8833&r1=8832&r2=8833&view=diff
==============================================================================
--- 7.6/trunk/squeezeplay/src/squeezeplay/src/audio/decode/decode_output.c
(original)
+++ 7.6/trunk/squeezeplay/src/squeezeplay/src/audio/decode/decode_output.c Fri
May 28 19:42:27 2010
@@ -31,8 +31,12 @@
/* Per-track gain (ReplayGain) */
static fft_fixed track_gain = FIXED_ONE;
static sample_t track_clip_range[2] = { SAMPLE_MAX, SAMPLE_MIN };
+
+/* Polarity inversion */
static s32_t track_inversion[2] = { 1, 1 };
+/* Output channels */
+static u8_t output_channels = 0;
/* Upload tests */
static int upload_fd = 0;
@@ -331,6 +335,21 @@
if (upload_samples(buffer, nsamples)) {
decode_audio_unlock();
return;
+ }
+
+ /* If output_channels is set, copy left samples to right, or vice versa
*/
+ if (output_channels) {
+ unsigned int i;
+ if (output_channels & OUTPUT_CHANNEL_LEFT) {
+ for (i = 0; i < nsamples * 2; i += 2) {
+ buffer[i+1] = buffer[i];
+ }
+ }
+ else {
+ for (i = 0; i < nsamples * 2; i += 2) {
+ buffer[i] = buffer[i+1];
+ }
+ }
}
decode_apply_track_gain(buffer, nsamples);
@@ -481,3 +500,10 @@
track_inversion[0] = (inversion & POLARITY_INVERSION_LEFT) ? -1 : 1;
track_inversion[1] = (inversion & POLARITY_INVERSION_RIGHT) ? -1 : 1;
}
+
+void decode_set_output_channels(u8_t channels) {
+ LOG_DEBUG(log_audio_decode, "Output channels left %d, right %d",
+ channels & OUTPUT_CHANNEL_LEFT ? 1 : 0, channels &
OUTPUT_CHANNEL_RIGHT ? 1 : 0);
+
+ output_channels = channels;
+}
Modified: 7.6/trunk/squeezeplay/src/squeezeplay/src/audio/decode/decode_priv.h
URL:
http://svn.slimdevices.com/jive/7.6/trunk/squeezeplay/src/squeezeplay/src/audio/decode/decode_priv.h?rev=8833&r1=8832&r2=8833&view=diff
==============================================================================
--- 7.6/trunk/squeezeplay/src/squeezeplay/src/audio/decode/decode_priv.h
(original)
+++ 7.6/trunk/squeezeplay/src/squeezeplay/src/audio/decode/decode_priv.h Fri
May 28 19:42:27 2010
@@ -107,6 +107,7 @@
extern void decode_set_track_polarity_inversion(u8_t inversion);
+extern void decode_set_output_channels(u8_t channels);
/* Audio output backends */
struct decode_audio_func {
_______________________________________________
Jive-checkins mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/jive-checkins