From: Takashi Iwai Subject: Re: Need help developing an ALSA plugin for FreeBob (firewire audio) Date: Thu, 23 Mar 2006 14:55:43 +0100 Message-ID: References: <441F3CDB.7040906@joow.be> <44226915.1090906@joow.be> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Return-path: In-Reply-To: <44226915.1090906@joow.be> Sender: alsa-devel-admin@lists.sourceforge.net Errors-To: alsa-devel-admin@lists.sourceforge.net List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , List-Archive: To: Pieter Palmers Cc: alsa-devel@lists.sourceforge.net, linux-audio-developers@lists.sourceforge.net, freebob-devel@lists.sourceforge.net List-Id: alsa-devel@alsa-project.org At Thu, 23 Mar 2006 10:23:33 +0100, Pieter Palmers wrote: > > >If non-local buffers are required, we'd need to extend the ioplug API > >and a bit some internals in alsa-lib, too. It won't be hard, though. > > > > > The freebob API allows the use of buffers allocated by the client (in > this case the ALSA API). That is the most efficient case. The flow I > discribed in my mail used fixed buffers for audio I/O, but that isn't > nescessary. One can also set new buffer addresses each 'period'. > Something like this would probably do the trick: > > snd_pcm_freebob_write(snd_pcm_ioplug_t *io, > const snd_pcm_channel_area_t *areas, > snd_pcm_uframes_t offset, > snd_pcm_uframes_t size) { > > for (i=0;i switch (freebob_streaming_get_playback_stream_type(dev,i)) { > case freebob_stream_type_audio: > /* assign the audiobuffer to the stream */ > freebob_streaming_set_playback_stream_buffer(dev, i, > (char *) areas[i], freebob_buffer_type_uint24); This should be; freebob_streaming_set_playback_stream_buffer(dev, i, areas[i].addr + (offset * areas[i].step / 8), freebob_buffer_type_uint24); > > Assuming that the buffer locations can change every call to the plugin > _write callback. Yes, it may happen although in most cases only offset argument is changed. > >>- what would be the best type of SND_PCM_IOPLUG_HW_ACCESS mode? > >> > >> > > > >SND_PCM_ACCESS_RW_NONINTERLEAVED looks best. Later we can add a > >support of pseudo mmap (SND_PCM_ACCESS_MMAP_NONITERLEAVED). > > > > > What would be the difference? It's different to the apps, but less changes in the driver side. With ACCESS_MMAP_*, the app calls snd_pcm_mmap() and do mmap-style procedure, i.e. snd_pcm_avail_update(), modify, then snd_pcm_mmap_commit(). > >>- where do I put the freebob_streaming_wait(dev) call that blocks until > >>a period of samples is present? > >> > >> > > > >It's a good question. > >Basically, the style like freebob_streaming_wait() isn't preferred for > >the driver since apps use poll/select in normal cases. If freebob API > >doesn't provide a poll/select interface, we might need a workaround > >using a thread with a pipe as jack plugin does. > > > > > Do you mean that the plugin should provide some file descriptor that > apps can directly use to poll on? Yes, exactly. > >>- in firewire audio, midi and audio streams are interleaved, meaning > >>that you can't have one without the other. therefore I would like to > >>know if there is a possibility to implement midi I/O into the same plugin. > >> > >> > > > >Currently, no midi plugin SDK is provided (yet). So, we'll need to > >create such one. > > > > > At present I'll probably implement a workaround like I did for the jackd > backend: just spawn a thread that exports the physical midi ports as > alsa seq devices. The midi would only be available when the plugin is > open, but that beats not having MIDI. > > If you would design/implement a midi plugin SDK, please make sure it can > be implemeted in the same plugin as PCM and that it accepts raw MIDI > bytes. thx;) OK :) Takashi ------------------------------------------------------- This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642