newLISP Fan Club

Forum => newLISP and the O.S. => Topic started by: pjot on June 01, 2006, 02:23:26 PM

Title: Linux CD player
Post by: pjot on June 01, 2006, 02:23:26 PM
Hi,



In the world of Linux, CD-players are almost always bound to a windowmanager. KDE ships one, GNOME also. There is an alternative by using XMMS, but this program renders the audio over PCM, which causes some CPU load. Finally there is a commandline tool called "DCD" but it is... well, console-based, so no GUI.



As I am using XFCE it was kind of annoying not to be able to play audio CD's. Therefore I programmed a genuine CD-player with newLisp, which plays the audio over the CD audio channel.



(//%3C/s%3E%3CURL%20url=%22http://www.turtle.dds.nl/newlisp/cdplayer.jpg%22%3Ehttp://www.turtle.dds.nl/newlisp/cdplayer.jpg%3C/URL%3E%3Ce%3E)



Code here:



http://www.turtle.dds.nl/newlisp/cdplayer.lsp



It will lookup the track titles with CDDA2WAV, and add them to the drop-down list below, which can be used to select some other track.



Especially for this tool I adapted the GTK-server in a way that it is able to handle async events while waiting for events from the user. This 2.0.11 release will become available at the end of this week.



Regards

Peter
Title:
Post by: Dmi on June 02, 2006, 01:00:21 AM
Nice.

Btw, (just in case if you wrote xml code by hands) you may use something like:
(context 'GTK)
(define (property pname pvalue)
  (string "<property name="" pname "">" pvalue "</property>n"))

(define (child )
  (string "<child>n" (join (args)) "</child>n"))

(define (widget wclass wid)
  (string "<widget Class="" wclass "" id="" wid "">n"
           (join (args))
           "</widget>n"))

> (println (widget "wcl" "wn1"
>                  (property "p1" "v1")
>                  (property "p2" "v2")
>                  (child
>                    (widget "wcl2" "wn2"
>                            (property "p3" "p4")
>                            (property "p5" "p6")))))
<widget Class="wcl" id="wn1">
<property name="p1">v1</property>
<property name="p2">v2</property>
<child>
<widget Class="wcl2" id="wn2">
<property name="p3">p4</property>
<property name="p5">p6</property>
</widget>
</child>
</widget>
Title:
Post by: pjot on June 02, 2006, 03:32:49 AM
Thanks DMI.



The XML code was generated automagically by Glade. I did not perform any further modifications there. :-)



Peter
Title:
Post by: pjot on June 18, 2006, 04:01:21 PM
With a little delay GTK-server 2.0.11 was released today. Now everybody can enjoy this wonderful CD player! Unless there is no audio cable between your CD drive and soundcard... :-)



Peter