[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Gap-dev-discuss] Cynthiune : add an alsa backend for linux
From: |
Sebastian Reitenbach |
Subject: |
Re: [Gap-dev-discuss] Cynthiune : add an alsa backend for linux |
Date: |
Sat, 05 May 2012 14:27:22 +0200 |
User-agent: |
SOGoMail 1.3.14 |
On Saturday, May 5, 2012 14:06 CEST, Philippe Roussel <address@hidden> wrote:
> Le 05/05/2012 13:51, Sebastian Reitenbach a écrit :
> >
> > On Thursday, May 3, 2012 21:53 CEST, Philippe Roussel <address@hidden>
> > wrote:
> >
> >> Le 03/05/2012 19:26, Philippe Roussel a écrit :
> >>>> The test FLAC file I use can be found here.
> >>>> http://code.google.com/p/cs-4244-mkl/source/browse/trunk/project-4/GSTT/mike-test.flac?r=202
> >>>
> >>> I'll try to reproduce this tonight and hopefully fix the problem.
> >>>
> >>> We may have other problems like this with files not using 16 bits per
> >>> sample, I guess you was the FIXME in the code. We would have to get this
> >>> information from the song but in the backend we only have access to raw
> >>> data.
> >>
> >> Can you test with the attached file instead of the first one I sent ?
> >>
> >> When the sample rate changes we have to close end reopen the device but
> >> the player only calls prepareDeviceWithChannels:andRate:
> >>
> >> And there's one more problem : with this new version I can listen to the
> >> flac file after one my files at 44100 but I had to configure libao to
> >> use PulseAudio, it doesn't work with ALSA...
> >
> > It does work for me on OpenBSD. On OpenBSD, libao directly uses
> > sndio. The libao package is configured with the following parameters:
> >
> > --disable-arts \
> > --disable-esd \
> > --disable-nas \
> > --disable-pulse
>
> Cool !
>
> Could you commit the new ao.m to the repository ?
>
> Or you could apply the following patch.
Done, thanks! I also included the change from AO_FMT_NATIVE
to AO_FMT_LITTLE
Sebastian
>
> Thanks,
> Philippe
>
> RCS file: /sources/gap/gap/user-apps/Cynthiune/Bundles/AO/ao.m,v
> retrieving revision 1.1
> diff -u -r1.1 ao.m
> --- Bundles/AO/ao.m 3 May 2012 13:21:24 -0000 1.1
> +++ Bundles/AO/ao.m 5 May 2012 12:05:13 -0000
> @@ -65,9 +65,11 @@
> - (id) init
> {
> if ((self = [super init])) {
> - ao_initialize();
> stopRequested = NO;
> + memset(&format, 0, sizeof(format));
> devlock = [NSLock new];
> + ao_initialize();
> + driver = ao_default_driver_id();
> }
> return self;
> }
> @@ -88,23 +90,25 @@
> /* FIXME : this should somehow come from the input bundle */
> format.bits = 16;
> format.byte_format = AO_FMT_NATIVE;
> + if (dev) {
> + [devlock lock];
> + ao_close(dev);
> + dev = ao_open_live(driver, &format, NULL);
> + [devlock unlock];
> + return ((dev == NULL) ? NO : YES);
> + }
> return YES;
> }
>
> - (BOOL) openDevice
> {
> - [devlock lock];
> - driver = ao_default_driver_id();
> dev = ao_open_live(driver, &format, NULL);
> - [devlock unlock];
> return ((dev == NULL) ? NO : YES);
> }
>
> - (void) closeDevice
> {
> - [devlock lock];
> ao_close(dev);
> - [devlock unlock];
> }
>
> - (void) threadLoop
> @@ -112,18 +116,18 @@
> int bufferSize;
> NSAutoreleasePool *pool = [NSAutoreleasePool new];
>
> - [devlock lock];
> while (!stopRequested) {
> bufferSize = [parentPlayer readNextChunk: buffer
> withSize: DEFAULT_BUFFER_SIZE];
> + [devlock lock];
> if (bufferSize > 0)
> ao_play(dev, (char *)buffer, (uint_32)bufferSize);
> + [devlock unlock];
> /* FIXME : copied from ALSA.m, I'm not sure this is needed */
> if ([pool autoreleaseCount] > 50)
> [pool emptyPool];
> }
> stopRequested = NO;
> - [devlock unlock];
> [pool release];
> }
- Re: [Gap-dev-discuss] Cynthiune : add an alsa backend for linux, (continued)
- Re: [Gap-dev-discuss] Cynthiune : add an alsa backend for linux, Sebastian Reitenbach, 2012/05/03
- Re: [Gap-dev-discuss] Cynthiune : add an alsa backend for linux, Sebastian Reitenbach, 2012/05/03
- Re: [Gap-dev-discuss] Cynthiune : add an alsa backend for linux, Philippe Roussel, 2012/05/03
- Re: [Gap-dev-discuss] Cynthiune : add an alsa backend for linux, Philippe Roussel, 2012/05/03
- Re: [Gap-dev-discuss] Cynthiune : add an alsa backend for linux, Philippe Roussel, 2012/05/03
- Re: [Gap-dev-discuss] Cynthiune : add an alsa backend for linux, Sebastian Reitenbach, 2012/05/05
- Re: [Gap-dev-discuss] Cynthiune : add an alsa backend for linux, Philippe Roussel, 2012/05/05
- Re: [Gap-dev-discuss] Cynthiune : add an alsa backend for linux,
Sebastian Reitenbach <=
Re: [Gap-dev-discuss] Cynthiune : add an alsa backend for linux, Riccardo Mottola, 2012/05/02