[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
19.2.4 Music Player Daemon
Music Player Daemon (MPD in short) allows remote access for playing
music http://www.musicpd.org. MPD is designed for integrating a
computer into a stereo system that provides control for music playback
over a local network. The Bigloo class mpc
implements a mpd
client. All Bigloo players can be access via the MPD protocol, using the
The following example shows how to access a MPlayer music player using the MPD protocol with a simple Bigloo program:
(module mpd (library multimedia pthread) (main main)) (define (main argv) (let ((db (instantiate::mpd-database (directories (cdr argv)))) (serv (make-server-socket 6600)) (music (instantiate::mplayer))) (let loop () (thread-start! (make-mpd-connection-thread music db sock)) (loop)))) (define (make-mpd-connection-thread music db sock) (instantiate::pthread (body (lambda () (let ((pi (socket-input sock)) (po (socket-output sock))) (input-timeout-set! pi 10000) (output-timeout-set! po 10000) (unwind-protect (mpd music pi po db) (socket-close sock)))))))
- Bigloo Multimedia procedure: mpd music input-port output-port database [:log]
The function
mpd
implements a MPD server. It reads commands from the input-port and write results to output-port. The argument database, an instance of thempd-database
class, describes the music material that can be delivered by this player.
- Bigloo Multimedia class: mpd-database
(class mpd-database (directories::pair-nil read-only)
The field
directories
contains the list of the directories that contains music files.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This document was generated on October 23, 2011 using texi2html 5.0.