AlbumPlayer Forum Index AlbumPlayer Forum Index
AlbumPlayer
FAQ  FAQ   Search  Search   Memberlist  Memberlist   Usergroups  Usergroups
Register  ::  Log in Log in to check your private messages


Post new topic  Reply to topic Goto page 1, 2, 3  Next
 Classic serial BetaBrite support « View previous topic :: View next topic » 
Author Message
Tekman
PostPosted: Fri Jul 25, 2008 6:55 pm    Post subject: Classic serial BetaBrite support Reply with quote



Joined: 25 Jul 2008
Posts: 16
Location: North Carolina, USA

I just downloaded AlbumPlayer and was wondering if anyone has added the ability to use a serial BetaBrite LED sign. I was able to find one topic on this in the past, which discussed theory on programming an application. I have no Windows programming skills and was wondering if anything public has been offered that's ready to roll.

Thanks.

John
Back to top
View user's profile Send private message
wobbly
PostPosted: Sat Jul 26, 2008 1:50 pm    Post subject: Reply with quote



Joined: 08 Nov 2005
Posts: 235
Location: Australia

as far as i know there is no plugin for this yet
Back to top
View user's profile Send private message
Tekman
PostPosted: Sat Jul 26, 2008 5:38 pm    Post subject: Reply with quote



Joined: 25 Jul 2008
Posts: 16
Location: North Carolina, USA

Thanks for the reply wobbly.

I think ukzappa or Larrys may have some input on this.

Check this thread out -> http://forum.albumon.com/viewtopic.php?t=698&highlight=led
Back to top
View user's profile Send private message
wobbly
PostPosted: Sat Jul 26, 2008 11:45 pm    Post subject: Reply with quote



Joined: 08 Nov 2005
Posts: 235
Location: Australia

cool maybe you could ask in that thread i know that the plugin has not been uploaded for all of as to use
Back to top
View user's profile Send private message
Larrys
PostPosted: Sun Jul 27, 2008 2:26 pm    Post subject: Re: Classic serial BetaBrite support Reply with quote



Joined: 16 Jan 2007
Posts: 88

Tekman wrote:
I just downloaded AlbumPlayer and was wondering if anyone has added the ability to use a serial BetaBrite LED sign. I was able to find one topic on this in the past, which discussed theory on programming an application. I have no Windows programming skills and was wondering if anything public has been offered that's ready to roll.

Thanks.

John


I don't know these kind of display's, what is it that you want with it?
It can be done if specs of how to interface with the display (protocol etc.) and connections are known. If you can provide these it should not be a lot of work since I can use my screensaver to output the info.

Larry
Back to top
View user's profile Send private message
Tekman
PostPosted: Sun Jul 27, 2008 4:28 pm    Post subject: Reply with quote



Joined: 25 Jul 2008
Posts: 16
Location: North Carolina, USA

Thanks for the reply Larrys.

The Alpha BetaBrite uses serial communications set for 9600,N,8,1.

I want to feed the sign with track tags, mainly "Artist - Song name" (maybe even year)

The interface needs to have selectable options:

Com port 1 - 4

Sign unit ID# 0 - 255

Track tag output selections to choose from:
CD
Name
Artist
Length
Composer
Conductor
Orchestra
Rating
Comment

This indirect link explains packet info required. Section 5.1 is a standard transmission packet. Caution the PDF is 17Megs.

http://www.adaptivedisplays.com/Documentation/questions.php?questionid=149

I'm not sure what your screensaver is. It can handle custom outputs to the serial port from AP's XML message interface?

John
Back to top
View user's profile Send private message
Larrys
PostPosted: Sun Jul 27, 2008 6:05 pm    Post subject: Reply with quote



Joined: 16 Jan 2007
Posts: 88

That should be enough info.
My screensaver connects to AP and it is an easy job to send names and title to the com port too instead of just displaying it on screen.
Ill get back to you as soon as I find some time.

Larry
Back to top
View user's profile Send private message
Tekman
PostPosted: Sun Jul 27, 2008 10:45 pm    Post subject: Reply with quote



Joined: 25 Jul 2008
Posts: 16
Location: North Carolina, USA

Thanks! I'm looking forward to it.
Back to top
View user's profile Send private message
ukzappa
PostPosted: Mon Jul 28, 2008 5:16 am    Post subject: Reply with quote



Joined: 20 Jan 2007
Posts: 44
Location: London, UK

Hi,
Do you use Delphi? I did write a quick and dirty program to control my Alpha 7120C which does the job just fine. I do recall looking at the Betabrite protocol in the dim and distant but I don't recall whether they use the same protocol. Obviously you will need to check and change where/if necessary. Here is my unit1 code which should give you enough to get it up and running.

---------------------------------------------------------------------

unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ComPort, ActiveX, ShlObj, ShellAPI;

const
WM_SUBSCRIBE_FOR_INFO = WM_USER + 11;
Alpha_Header = #0 + #0 + #0 + #0 + #0 + SOH + 'Z00' + STX + 'AA' + ESC + ' ';

type
TForm1 = class(TForm)
Edit4: TEdit;
Edit2: TEdit;
Label2: TLabel;
Edit3: TEdit;
Label3: TLabel;
Edit5: TEdit;
Label4: TLabel;
Edit6: TEdit;
Label5: TLabel;
Label1: TLabel;
ComPort1: TComPort;
Edit1: TEdit;
Label6: TLabel;
Edit7: TEdit;
Label7: TLabel;
cbPorts: TListBox;
procedure FormCreate(Sender: TObject);
procedure AP_New_Track_Info(Sender: TObject);
procedure AP_Paused(Sender: TObject);
procedure AP_Stopped(Sender: TObject);

private
{ Private declarations }
procedure AP_Message(var Msg: TMessage); message WM_SUBSCRIBE_FOR_INFO;

public
{ Public declarations }
end;

var
Form1: TForm1;
hAPWindow: HWND;
hMyHandle: HWND;
AP_File: String;

implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
var
Allocator: IMalloc;
SpecialDir: PItemIdList;
FBuf: array[0..MAX_PATH] of Char;
loop: Integer;
begin
EnumPorts( cbPorts.Items );
if cbPorts.Items.Count > 0 then
begin
for loop := 0 to cbPorts.Items.Count-1 do
begin
if cbPorts.Items[loop]='COM1' then ComPort1.Port := 'COM1';
if cbPorts.Items[loop]='COM2' then ComPort1.Port := 'COM2';
if cbPorts.Items[loop]='COM3' then ComPort1.Port := 'COM3';
if cbPorts.Items[loop]='COM4' then ComPort1.Port := 'COM4';
if cbPorts.Items[loop]='COM5' then ComPort1.Port := 'COM5';
if cbPorts.Items[loop]='COM6' then ComPort1.Port := 'COM6';
if cbPorts.Items[loop]='COM7' then ComPort1.Port := 'COM7';
if cbPorts.Items[loop]='COM8' then ComPort1.Port := 'COM8';
if cbPorts.Items[loop]='COM9' then ComPort1.Port := 'COM9';
end;
end;
ShellExecute(Form1.Handle,'open','D:\Applications\AlbumPlayer\Albumplayer.exe',
'-normalscreen', 'D:\Applications\AlbumPlayer', SW_SHOWMAXIMIZED);
hMyHandle := FindWindow('TForm1', nil);
repeat
hAPWindow := FindWindow('TfrmPlayer', nil);
until hAPWindow<>0;
SendMessage(hAPWindow,WM_SUBSCRIBE_FOR_INFO,hMyHandle,WM_SUBSCRIBE_FOR_INFO);
if SHGetMalloc(Allocator) = NOERROR then
begin
SHGetSpecialFolderLocation(Form1.Handle, CSIDL_APPDATA, SpecialDir);
SHGetPathFromIDList(SpecialDir, @FBuf[0]);
Allocator.Free(SpecialDir);
AP_File := string(FBuf)+'\AlbumPlayer\ap_info.txt';
end;
Comport1.Open;
end;

procedure TForm1.AP_Message(var Msg: TMessage);
begin
case Msg.wParam of
0: AP_New_Track_Info(Self); //new track notification
1: case Msg.lParam of //new play state
0: AP_Stopped(Self); //stopped
1: begin
AP_New_Track_Info(Self);
Edit4.Text := 'Playing'; //playing
End;
2: AP_Paused(Self); //paused
end;
2: ;//albumplayer will be closed - not required
3: ;//new cover is accepted - not required
4: ;//track update notification - not required
5: Edit2.Text:=IntToStr(Msg.lParam); //new track progress
end; //lparam = progress in seconds
end;

procedure TForm1.AP_New_Track_Info(Sender: TObject);
var
WasteTime: integer;
AP_File_Type: TextFile;
Artist, Album, Year, Track, TrackNo, TrackText: String;
begin
for WasteTime := 1 to 20000000 do; //Allow AP time to close file - Fudge
assignfile(AP_File_Type, AP_File);
FileMode := 0;
reset(AP_File_Type);
repeat
readln(AP_File_Type, Artist)
until (copy(Artist,1,7)='Artist=') or Eof(AP_File_Type);
Artist := Copy(Artist,8,60);
Edit3.Text := Artist;
reset(AP_File_Type);
repeat
readln(AP_File_Type, Album);
until (copy(Album,1,6)='Album=') or Eof(AP_File_Type);
Album := Copy(Album,7,60);
Edit5.Text := Album;
reset(AP_File_Type);
repeat
readln(AP_File_Type, Year);
until (copy(Year,1,5)='Year=') or Eof(AP_File_Type);
if copy(Year,1,5)='Year=' then Year := ' ('+copy(Year,6,4)+')'
else Year := '';
Edit1.Text := copy(Year,3,4);
reset(AP_File_Type);
repeat
readln(AP_File_Type, Track);
until (copy(Track,1,6)='Track=') or Eof(AP_File_Type);
Track := Copy(Track,7,60);
Edit6.Text := Track;
reset(AP_File_Type);
repeat
readln(AP_File_Type, TrackNo);
until (copy(TrackNo,1,Cool='TrackNr=') or Eof(AP_File_Type);
TrackNo := Copy(TrackNo,9,60);
CloseFile(AP_File_Type);
if TrackNo = '' then
TrackText := ''
else
TrackText := 'Track ' + TrackNo + ': ';
Edit7.Text := TrackNo;
Comport1.Send(Alpha_Header + 'a' + #28 + '1' + #26 + '8' + Album + Year + '.'+
#28 + '2 ' + Artist + '.' + #28 + '3 ' + TrackText +
Track + '.' + EOT);
end;

procedure TForm1.AP_Paused(Sender: TObject);
begin
Edit4.Text := 'Paused';
Comport1.Send(Alpha_Header + 'b' + #28 + '3' + 'Paused' + EOT);
end;

procedure TForm1.AP_Stopped(Sender: TObject);
begin
Edit4.Text := 'Stopped';
Comport1.Send(Alpha_Header + 'b' + #28 + '1' + 'Stopped' + EOT);
end;
end.

---------------------------------------------------------------------

You will need to make changes as I've hard coded locations.
Also, the TComPort component may not be native Delphi - I don't have the time to check just now (building a garden shed!!) but I am happy to look into that later if needs be.

Please don't criticise the code! I'm sure there are many ways to tackle the problem and no doubt much more elegantly. However, for what its worth, it works and works well. Smile
Back to top
View user's profile Send private message
Larrys
PostPosted: Mon Jul 28, 2008 7:21 am    Post subject: Reply with quote



Joined: 16 Jan 2007
Posts: 88

Thanks ukzappa,

the protocol is the same so if you don't mind sharing the "dirty" tool with Tekman we're all happy. Razz

I'm sure he can wait until you've finished you shed. Wink

Larry

P.S. the TComPort isn't native indeed. I had one for Delphi 5 but this one doesn't like Delphi 2005 which I use now. If you don't mind sharing the Tcomport I'd be very happy!
Back to top
View user's profile Send private message
Tekman
PostPosted: Mon Jul 28, 2008 4:46 pm    Post subject: Reply with quote



Joined: 25 Jul 2008
Posts: 16
Location: North Carolina, USA

Thanks for helping out ukzappa.

The shell path is all I think needs to be changed
Quote:
ShellExecute(Form1.Handle,'open','D:\Applications\AlbumPlayer\Albumplayer.exe',
'-normalscreen', 'D:\Applications\AlbumPlayer', SW_SHOWMAXIMIZED);


Maybe the path and other options could be in an .ini file. I have the standard "C:\Program Files\AlbumPlayer\Albumplayer.exe"

I made a mock-up of what I envisioned. I just wish I had Windows programming skills.



I thought It would be fun to send a custom message to the sign when AP is in 'stopped' or 'paused' mode.

Thanks.

John
Back to top
View user's profile Send private message
ukzappa
PostPosted: Mon Jul 28, 2008 9:39 pm    Post subject: Reply with quote



Joined: 20 Jan 2007
Posts: 44
Location: London, UK

Larry,

I use Delphi Studio Architect 7 that I purchased (yep, I'm the one who actually bought it! Rolling Eyes ) back in 2003 if memory serves. It's possible the TComPort won't work in your version as it is a couple of years after mine! However, you are welcome to try it. Don't expect an all singing, all dancing component as it is Freeware. It was written by Dirk Claessens using Delphi 4. His download link is now dead so you may have trouble finding it so, if you do want to try it, PM me with an email address and I will fire it at you - it's only 22KB zipped!

Tekman,

Hold on there pardner! Now I'm writing bespoke code!?! Laughing
I really am up to my eyes in muck and bullets at the moment (well muck and concrete actually - bullets are your side of the pond (mostly) aren't they?)

Basically, as it stands, my app has no user input capability at all. In fact, it only has a visible window because I wanted to check I was getting good data. I had intended making it invisible but never got around to it.

Notes:
1: It assumes that the last COM port on your system has the sign. (For what it's worth, I only check up to COM9 as Microsoft changed the way they handle ports 10 and above!!! - However, not likely to be a problem).

2: I have also hard coded colour control codes which may not suit you and/or may not map to your sign. It uses Red for Album and Year, Green for Artist and Amber for Track. The Alpha 7120C is three colour - yours may be more or less.

3: My sign always reverts to ID00 when powered down so, for simplicity, my app only uses ID00. This seems sensible to me as you can only have one sign on an RS232 port. I suspect that ID is only of value when you connect multiple signs on the RS485 port.

Ok. If you are happy to wait a while I will add a .ini file to handle COM port, AP path, Paused and Stopped messages and colours (but you will need to tell me what colours are available on your sign together with the corresponding codes). Not ideal but a usable interim solution.

I will try and make an interface similar to your example so you can make changes on the fly but that would follow later. I make no guarantee though.

Got to mix more cement etc ...
Back to top
View user's profile Send private message
Tekman
PostPosted: Tue Jul 29, 2008 12:24 am    Post subject: Reply with quote



Joined: 25 Jul 2008
Posts: 16
Location: North Carolina, USA

ukzappa:

Quote:
bullets are your side of the pond (mostly) aren't they?

Sad but true.

I don't expect you to make anything too fancy (I consider myself lucky to get anything at all). I'm more than fine with a simple .ini file and no fancy window. The last com port is OK with me.

I realize we are probably the only two doing this right now with AP, I do expect more in the future as other Jukebox software apps support these signs natively. This will hopefully make the transition to AP easier, like in my case. You just can't live without one of these signs once you've used one.

I'm fine with ID00. I only have one sign anyway.

The betaBrite has eight colors. If you omit color, I think mine defaults to auto which does all kinds of cool colors and rainbow effects. This is the same as using "#26 + 'C'.

Here's the color chart:
1-Red
2-Green
3-Amber
4-Dim red
5-Dim green
6-Brown
7-Orange
8-Yellow
9-Rainbow 1
A-Rainbow 2
B-Color mix
C-Autocolor

One other thing I noticed in the code, is '#26 + 8' a bold font? If this is true, I would like '#26 + 9' which is a standard font.

It looks like if you were to roll one out with the AP path change and strip the colors (or change them to 'C' and change the font style, it looks like it's good to go! I know that's easy for me to say.

Thanks!
Back to top
View user's profile Send private message
ukzappa
PostPosted: Wed Jul 30, 2008 7:58 am    Post subject: Reply with quote



Joined: 20 Jan 2007
Posts: 44
Location: London, UK

Tekman,
I've made a start.
Should be able to have something for you to test in a couple of days although I don't think files can be posted here.

I've done:
Added ini file (lives in C:\Windows).
Selectable Com Port from Form (Selects highest available by default, selectable from Form).
Added Paused and Stopped messages (default in ini, editable from Form).
Tidied some really sloppy code!

To do:
Font and Colour
Select Tag
Status Options
Odd Tweaks

On Alpha:

#26 is font - 8 = Full Height Fancy (9 = Full Height Standard) plus many others.

#28 is colour - 1,2,3.9,A,B,C (I wish I had your palette - very nice).

As Larrys said, the protocols/control codes appear the same (but with some redundancy).

You may be right - just the two of us using signs. I have two. I did put one in the kitchen but my other half had me take it out when I displayed 'Bacon, Egg and Chips Please'! I couldn't see the problem but she took a dim view. Ah, well.

Builders' merchant should be delivering this morning so it's back to the shed for now!
Back to top
View user's profile Send private message
Tekman
PostPosted: Wed Jul 30, 2008 11:17 am    Post subject: Reply with quote



Joined: 25 Jul 2008
Posts: 16
Location: North Carolina, USA

ukzappa:

WOW! Thanks a lot.

I'll PM you with my e-mail address so you can make attachments.

I have no problem hosting the file to share with the AP community, if that's OK with you.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Goto page 1, 2, 3  Next Page 1 of 3

Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


DAJ Glass (1.0.8) template by Dustin Baccetti
EQ graphic based off of a design from www.freeclipart.nu
Powered by phpBB © 2001, 2005 phpBB Group