Kevin McKinnon wrote:
> 'input?/'input don't seem to be working all that well for the piped input
from xaudio. Can read-io be used for STDIN?
REBOL's automatic translation of CRLF may affect this. You might have to
open the console in binary?
Instead of:
> ... make function! ...
how about:
func
or
function
?
Instead of:
> mp3cue: make function! [filename] [
> mp3play: make function! [] [
> mp3stop: make function! [] [
> mp3close: make function! [] [
Why not:
MP3: make object! [
Cue: func [filename] ...
Play: func [] ...
Stop: func [] ...
Close: func [] ...
...
]
And, instead of:
> doplayer: make function! [musicfile] [
Player: func [MusicFile [file!]] ...
Then:
Play: func [MusicFiles [block!]] [foreach File MusicFiles [Player File]]
So, instead of this:
> doplayer %"/mnt/mp3/PaulMcCartney/PaulMcCartney-BandOnTheRun.mp3"
> doplayer %"/mnt/mp3/Journey/Journey-SeparateWays(WorldsApart).mp3"
> doplayer %"/mnt/mp3/TomPetty/TomPetty-Refugee.mp3"
> doplayer %"/mnt/mp3/DireStraits/DireStraits-Twistin'ByThePool.mp3"
Play [
%"/mnt/mp3/PaulMcCartney/PaulMcCartney-BandOnTheRun.mp3"
%"/mnt/mp3/Journey/Journey-SeparateWays(WorldsApart).mp3"
%"/mnt/mp3/TomPetty/TomPetty-Refugee.mp3"
%"/mnt/mp3/DireStraits/DireStraits-Twistin'ByThePool.mp3"
]
Andrew Martin
[EMAIL PROTECTED]
http://members.xoom.com/AndrewMartin/
-><-
----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, 9 January 2000 10:19 AM
Subject: [REBOL] Music (MP3) on REBOL Re:(2)
> > [EMAIL PROTECTED] wrote:
> >
> > > Any plans for REBOL to support MP3?
> >
>
> Petr wrote:
> > ... but maybe there is another way ... REBOL/Command should support
REBOL
> > embedding into custom apps. So let's ask mp3 players authors to add
rebol
> > port into it and you can link your rebol to such app. Another solution
is
> > - REBOL/Command is supposed to support external apps execution at least,
> > so you will be able to start your favourite mp3 player ...
>
> Why wait? A REBOL port is just a standard TCP/IP port, and there
> already MP3 players that can be controlled via TCP.
>
> I'm in the (slow) process of building a standalone/dedicated MP3
> player into an old CD player chassis I had laying around. See the
> attached code. I welcome any comments or feedback.
>
> Cheers,
> Kev
>
> ------------------------------------------------------------------------
> Kevin McKinnon, Network Engineer [EMAIL PROTECTED]
> Sunshine Communications http://www.sunshinecable.com
> **NOTE NEW E-MAIL ADDRESS**
> PGP Public Key: http://www.dockmaster.net/pgp.html PGP 6.0 www.pgp.com
>
>
----------------------------------------------------------------------------
----
> #!/usr/local/rebol/rebol -s
>
> REBOL [
> Title: "MP3 Controller"
> Date: 29-Dec-1999
> Author: "Kevin McKinnon"
> File: %mp3.r
> Email: [EMAIL PROTECTED]
> Purpose: {
> Controller for a stand-alone MP3 player which is being
> built with a P233MMX motherboard mounted inside a gutted
> Pioneer PDM-401 6-pack CD Player chassis. The LCD routines
> control a Matrix Orbital LK204-25 serial LCD display.
> (www.matrixorbital.com, Cdn distrib: www.hvwtech.com)
> Operating system: Linux 2.2.13 (Slackware 7.0)
> MP3 player: www.mpegtv.com
> This script is called via a shell script that pipes the output
> of the MP3 player into Rebols STDIN.
> All song filenames are formatted "Artist-Title.mp3" for easy parsing.
>
> 'input?/'input don't seem to be working all that well for the piped
> input from xaudio. Can read-io be used for STDIN?
>
> }
> ]
>
> com: open/binary/direct %/dev/ttyS1
> cmd: to-string #{FE}
> lcdclear: rejoin [cmd "X"]
> lcdhome: rejoin [cmd "H"]
> lcdcurson: rejoin [cmd "J"]
> lcdcursoff: rejoin [cmd "K"]
> lcdcursblinkon: rejoin [cmd "S"]
> lcdcursblinkoff: rejoin [cmd "T"]
> lcdwrapon: rejoin [cmd "C"]
> lcdwrapoff: rejoin [cmd "D"]
> lcdscrollon: rejoin [cmd "Q"]
> lcdscrolloff: rejoin [cmd "R"]
> lcdbacklighton: rejoin [cmd "B" ^@]
> lcdbacklightoff: rejoin [cmd "F"]
> lcdinit: rejoin [lcdwrapon lcdscrollon lcdbacklighton lcdcursoff
> lcdcursblinkoff lcdclear]
> runtime: 0:00:01
>
> append com lcdinit
>
> titleartistdisplay: make function! [filename] [
> tasplit: parse first parse last parse to-string filename "/" "." "-"
> artist: copy/part join first tasplit [" "] 20
> title: copy/part join second tasplit [" "] 20
> duration: rejoin [" " counter]
> display: rejoin [lcdhome title artist duration]
> append com display
> ]
>
> mp3cue: make function! [filename] [
> mp3ctlport: open tcp://127.0.0.1:9717
> print rejoin ["open " to-string filename crlf]
> insert mp3ctlport rejoin ["open " to-string filename crlf]
> close mp3ctlport
> while [input?] [
> a: input
> if (find a "duration") [
> runtime: to-time to-integer last parse a "[]"
> ]
> if ((copy/part a 22) = "MSG notify stream info") [break]
> print a
> ]
> ; print "broke with ack"
> ]
>
> mp3play: make function! [] [
> mp3ctlport: open tcp://127.0.0.1:9717
> print rejoin ["play" crlf]
> insert mp3ctlport rejoin ["play" crlf]
> close mp3ctlport
> ]
>
> mp3stop: make function! [] [
> mp3ctlport: open tcp://127.0.0.1:9717
> print rejoin ["stop" crlf]
> insert mp3ctlport rejoin ["stop" crlf]
> close mp3ctlport
> ]
>
> mp3close: make function! [] [
> mp3ctlport: open tcp://127.0.0.1:9717
> print rejoin ["close" crlf]
> insert mp3ctlport rejoin ["close" crlf]
> close mp3ctlport
> ]
>
> comment {
> getkeypad: make function! [
> buffer: make string! 16
> result: make string! 16
> while [(read-io com buffer 16) <> 0] [
> append result buffer
> clear buffer
> ]
> ]
> }
>
> doplayer: make function! [musicfile] [
> mp3cue musicfile
> endtime: (to-time runtime) + now/time
> counter: endtime - now/time
> titleartistdisplay musicfile
> mp3play
> until [retport: wait [1]
> counter: endtime - now/time
> titleartistdisplay musicfile
> lesser-or-equal? (counter) 0:00:00
> ]
> mp3stop
> mp3close
> ]
>
> doplayer %"/mnt/mp3/PaulMcCartney/PaulMcCartney-BandOnTheRun.mp3"
> doplayer %"/mnt/mp3/Journey/Journey-SeparateWays(WorldsApart).mp3"
> doplayer %"/mnt/mp3/TomPetty/TomPetty-Refugee.mp3"
> doplayer %"/mnt/mp3/DireStraits/DireStraits-Twistin'ByThePool.mp3"
>
> close com
>