multichannel recordings

Hi,

First, of course many thanks for a great music player. It's a good job to write something so simple and intuitively to use.

Lately I have been looking into getting some multichannel recordings, as these start to be available for online purchase. As moc does not support over 2 channels I have been looking a bit into the code, but so far have not found where this limitation is coming from. Do you have any idea how and where to change the code to get multichannel to work? I have some programming experience, but not with sound-related applications. I'm using alsa as back-end.

By the way, the flac file plugin does not check for multichannel, so moc freezes (the server thread actually) when you try to play a multichannel file. If you want I could write a small patch to introduce this check.

I'm also finishing my PhD thesis, so I won't have as much time as I'd like the coming months, but I would really like to get multichannel to work.

Thanks again for moc and for your help
Maarten

There really is no hardcoded limit for the number of channels beside the "[STEREO]" indicator. MOC doesn't support multichannel files because I don't have such a hardware (just a laptop with a stereo soundcard) and could never test that. If there are problems with such files, there are probably some small fixes that needs to be done in few places, so just debugging should be needed to get this work.

Patches are welcome :)

--
Damian Pietras - MOC developer

Check your email at this site for the patch. The issue was that one chunk of audio data was bigger than the alsa buffer, causing the server process to freeze until there was enough space in the buffer. I increased the size to 512 kB, which is enough for 6 channel, 32 bit and 192 kHz.
I included a second patch which removes the check for maximum 2 channels in the sndfile plugin as I can confirm multi channel waves work correctly now (and none of the other plugins check for the number of channels).

Maarten

Thanks, applied :)

--
Damian Pietras - MOC developer

Did something change? I just recently tried to play 5.1 wavs and flacs and all I got was "Can't change number of channels".

I don't think anything changed wrt multichannel playback. Does your hardware allow multichannel playback? No ac3 pass through, but really play back 5.1? What backend are you using, which device if alsa?

Maarten

You're right, ALSA was/is at blame here. For some reason it accepts 16/44 6-channel audio and 24/96 2-channel, while it fails on 24/96 6-channel. Hardware (asus xonar dx) supports it:
Cirrus-Logic CS4398*1 for Front-Out (120dB SNR, Max. 192kHz/24bit)
Cirrus-Logic CS4362A*1 for other 6 channels (114dB SNR, Max. 192kHz/24bit)

Even aplay fails on this file:

Playing WAVE 'track-01-01[1]-03-[Lf-Rf-C-LFE-Ls-Rs]-24-96000.wav' : Signed 24 bit Little Endian in 3bytes, Rate 96000 Hz, Channels 6
aplay: set_params:1116: Unable to install hw params:
ACCESS: RW_INTERLEAVED
FORMAT: S24_3LE
SUBFORMAT: STD
SAMPLE_BITS: 24
FRAME_BITS: 144
CHANNELS: 6
RATE: 96000
PERIOD_TIME: (21333 21334)
PERIOD_SIZE: NONE
PERIOD_BYTES: (36846 36864)
PERIODS: NONE
BUFFER_TIME: (341333 341334)
BUFFER_SIZE: 32768
BUFFER_BYTES: 589824
TICK_TIME: 0

BTW - It would be a nice idea to wire MOC with aften to be able to easily encode such files to ac-3 on the fly without playing with .asoundrc and devices.