From be3654723f8d9768faa9270de8b01c7bdb110216 Mon Sep 17 00:00:00 2001 From: Ralph Caraveo Date: Fri, 2 May 2014 18:38:29 -0700 Subject: [PATCH] restructuring project --- .gitignore | 1 - README.md | 38 +++++++++++-- ...SC-SBI-REMIX - Billy Idol - Rebel Yell.cdg | Bin ...SC-SBI-REMIX - Billy Idol - Rebel Yell.mp3 | Bin .../cdg_revealed.html | 0 .../HTML5-CDGPlayer.htm | 0 .../cdgmagic_cdgdecoder_lowresource.js | 0 .../cdgmagic_cdgplayer.js | 0 ...magic_cdgdecoder_lowresource.go => main.go | 51 ++---------------- screenshots/a.png | Bin 0 -> 1866 bytes screenshots/b.png | Bin 0 -> 2955 bytes screenshots/intro.png | Bin 0 -> 1819 bytes 12 files changed, 40 insertions(+), 50 deletions(-) delete mode 100644 .gitignore rename SC-SBI-REMIX - Billy Idol - Rebel Yell.cdg => cdg/SC-SBI-REMIX - Billy Idol - Rebel Yell.cdg (100%) rename SC-SBI-REMIX - Billy Idol - Rebel Yell.mp3 => cdg/SC-SBI-REMIX - Billy Idol - Rebel Yell.mp3 (100%) rename {HTML5-CDGPlayer_files => docs}/cdg_revealed.html (100%) rename HTML5-CDGPlayer.htm => html5/HTML5-CDGPlayer.htm (100%) rename {HTML5-CDGPlayer_files => html5}/cdgmagic_cdgdecoder_lowresource.js (100%) rename {HTML5-CDGPlayer_files => html5}/cdgmagic_cdgplayer.js (100%) rename HTML5-CDGPlayer_files/cdgmagic_cdgdecoder_lowresource.go => main.go (93%) create mode 100644 screenshots/a.png create mode 100644 screenshots/b.png create mode 100644 screenshots/intro.png diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 7d9c9df..0000000 --- a/.gitignore +++ /dev/null @@ -1 +0,0 @@ -HTML5-CDGPlayer_files/output \ No newline at end of file diff --git a/README.md b/README.md index 8f3de94..f2e2d63 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,38 @@ -html5-cdgplayer +karaoke4go =============== -An html5 based cdg-player for mp3+cdg karaoke files +karaoke4go is an extremely *early* alpha prototype of the CDG file format that was developed by Phillips and Sony entertainment to display timed lyrics along with music for the purpose of getting drunk with your friends and singing horribly into a mic. + +screenshots +=========== + + + +why? +==== + +Why not? Go is a fantastic language and this was an excuse to have some fun with it while exploring the image packages. Unfortunately, Go doesn't have a native package for rendering GUIs so this package currently only renders a series of .png images. Eventually, the idea is to utilize some community driven package such as GoQML to render the graphics in realtime so this thing actually works. + +a partial port +============== + +So, I've actually built this from scratch twice before once using raw C and the popular SDL library. And the second time, I built this in Flash way back when the raw bitmap api was introduced. This time around, I did get a little lazy and actually ported this version from the excellent: CDGMagic HTML5 canvas based version locatated at: http://cdgmagic.sourceforge.net/html5_cdgplayer/ This version actually works beautifully and runs smooth. Again, consider this version a fun excercize in Go...at least for now. + +caveats +======== + +* It's not a typical Go package yet, so you can't import it +* There are currently no tests +* The code in its current state is partially broken, but it does render mostly correct at this point +* The code eventually should be cleaned up and simplified with more idiomatic Go code +* It does not play in realtime, it only generates an image sequence currently +* There is no music implementation yet +* It has not been optimized yet + +contributions +============= + +* are encouraged + + -From this url: http://cdgmagic.sourceforge.net/html5_cdgplayer/ diff --git a/SC-SBI-REMIX - Billy Idol - Rebel Yell.cdg b/cdg/SC-SBI-REMIX - Billy Idol - Rebel Yell.cdg similarity index 100% rename from SC-SBI-REMIX - Billy Idol - Rebel Yell.cdg rename to cdg/SC-SBI-REMIX - Billy Idol - Rebel Yell.cdg diff --git a/SC-SBI-REMIX - Billy Idol - Rebel Yell.mp3 b/cdg/SC-SBI-REMIX - Billy Idol - Rebel Yell.mp3 similarity index 100% rename from SC-SBI-REMIX - Billy Idol - Rebel Yell.mp3 rename to cdg/SC-SBI-REMIX - Billy Idol - Rebel Yell.mp3 diff --git a/HTML5-CDGPlayer_files/cdg_revealed.html b/docs/cdg_revealed.html similarity index 100% rename from HTML5-CDGPlayer_files/cdg_revealed.html rename to docs/cdg_revealed.html diff --git a/HTML5-CDGPlayer.htm b/html5/HTML5-CDGPlayer.htm similarity index 100% rename from HTML5-CDGPlayer.htm rename to html5/HTML5-CDGPlayer.htm diff --git a/HTML5-CDGPlayer_files/cdgmagic_cdgdecoder_lowresource.js b/html5/cdgmagic_cdgdecoder_lowresource.js similarity index 100% rename from HTML5-CDGPlayer_files/cdgmagic_cdgdecoder_lowresource.js rename to html5/cdgmagic_cdgdecoder_lowresource.js diff --git a/HTML5-CDGPlayer_files/cdgmagic_cdgplayer.js b/html5/cdgmagic_cdgplayer.js similarity index 100% rename from HTML5-CDGPlayer_files/cdgmagic_cdgplayer.js rename to html5/cdgmagic_cdgplayer.js diff --git a/HTML5-CDGPlayer_files/cdgmagic_cdgdecoder_lowresource.go b/main.go similarity index 93% rename from HTML5-CDGPlayer_files/cdgmagic_cdgdecoder_lowresource.go rename to main.go index 99fc342..0a97cdb 100644 --- a/HTML5-CDGPlayer_files/cdgmagic_cdgdecoder_lowresource.go +++ b/main.go @@ -9,45 +9,6 @@ import ( "os" ) -/* - * This file is part of CD+Graphics Magic. - * - * CD+Graphics Magic is free software: you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 2 of the - * License, or (at your option) any later version. - * - * CD+Graphics Magic is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with CD+Graphics Magic. If not, see . - * - */ - -/* - * This class instantiates an HTML5/Canvas CD+Graphics decoder object. - * - * This is the "low resource" version, and should be very close - * to as fast as possible with JavaScript. - * - * The difference between the "low resource" and normal version - * is that this one packs each 6 pixel font line in to one - * array value, unrolling some loops and minimizing array lookups. - * - * The only concession made is lack of H/V "offset" support used - * for smooth scrolling. - * Block based scrolls *are* still supported, however, so the basic - * intent of the graphics is presented, but less than ideally. - * - * It is recommended for CPU constrained (eg. mobile or embedded) devices. - * - */ - -// Useful enums for CD+Graphics... - const ( VRAM_SIZE = 300 * 216 // Total linear size of VRAM, in pixels. VRAM_WIDTH = 300 // Width (or pitch) of VRAM, in pixels. @@ -97,10 +58,8 @@ func init() { func main() { - fmt.Println("Compiles baby!") - //load data - cdg_file_data, err := ioutil.ReadFile("../SC-SBI-REMIX - Billy Idol - Rebel Yell.cdg") + cdg_file_data, err := ioutil.ReadFile("cdg/SC-SBI-REMIX - Billy Idol - Rebel Yell.cdg") if err != nil { log.Fatal("Couldn't read .cdg file") } @@ -112,9 +71,9 @@ func main() { for i := 0; i < 20000; i++ { decode_packs(cdg_file_data, i) redrawCanvas() - //if i%100 == 0 { - snap(i) - //} + if i%100 == 0 { + snap(i) + } } //This command works, outputting the images as a video @@ -123,7 +82,7 @@ func main() { } func snap(count int) { - out_filename := fmt.Sprintf("output/blank-%d.png", imageCount) + out_filename := fmt.Sprintf("screenshots/blank-%d.png", imageCount) out_file, err := os.Create(out_filename) if err != nil { log.Fatal(err) diff --git a/screenshots/a.png b/screenshots/a.png new file mode 100644 index 0000000000000000000000000000000000000000..60b43c282eee9b6f8e8c21294f2d431ffb0f816c GIT binary patch literal 1866 zcmb`IeKgYx7{}+O6zz6dMwZ@`w;@+G-MpnpdO>DL-qJzZkk=X-QB+=*TTzT%mvU)r zwPrNGv2LukP+rzTnaSi1^Kxc0FT2kDxBj^==X}ohJm)#*Ip=%6=X}p|%ge(JtZASL z0)fEp$6UNYAeHT_bL%?QRfTt(4TC@$+U_pSK3516pOl4_jnFj$9NG9=AQt`?HmQJk_zcSEN7KW9a@u&^){ox$~HZ9mrf@A=AR*a{qQ%Zg<=p6G-wy@+Ct zio-+7LzK(axjf&QD~mFsRm@pzmL9!oiPIt7I>2l%NHn9H|9wMssR9RVubVj#1hlYH{ z6d#Od_8tmHZx4kriO)$LlHxqT;v8S-l@64zRplXv;bdl?$kLTG?VyiVC-FYNc`jyr zSlhMPu8}}iLLW>8x>|fBTbbs?EbDK2PSc5BN|}qcCk=Evw&2 z!z}#9PU9!*FOx&j)QhoO%X8m6+)Jyt8C~8Co@EFOd?;Wkb+QZo;bKrCC%L(07f@sS z1^?@jJDO{qRli5VpgB!ezyusNK=4J)774MoZEcSxQ$|GoeVBoIkGvaowUUlTc|9j) zr&{8u&`gm-AC* zyN=RCUQMZQ+llKTgse}T2OFJ}qrzy|x@RKG^97!)ceP=4e$bH0Ce z8T`FR9@tMiav{jttu~=rr|3@Nk-+avErNa3M+Dj{zqN{(L=P@4N;^H5nEl z$m6v9ixsy}O;x)bpPBU^{vm+XpQ1BM!HSV7K3rfYB)e=q#D`+k-c)1%x4KllRO74KJ1%_HTuc3KXG>Om zYqFgtTAoygEciZFEXwLX@h`>QDPIw!@@<6j>_IS_5=#+=;+2@my_B|vO`0op$?aFDZ9zLbHn*)@}4#jaY z_R|FeeH*Q1jqJGMC`@D17j}Y`Q69GRRu@ZCf!m5t$jH+3ST$fx@BSFHH#8TzsM2{r z&5CM-u1^G3j;h$PDRTnL9nJo;u)w{cqtGHq-*Z7}Jy%#~0D~e@37%CS@99pA z9MWPM!E4V%%!Mm@tjcy9z_y+lcWcA;dsQq`vu6ydxvb& zzviwx4e_(qCuTU``G$8S`teB=*2uLq4MmBc3 zn7*hog(h7|lj;wqo%o|ZX-mG=;LEcTD_u-o9>zDj&368(BV80#(9zd-dDH5l=)FH| ze$ie)%Ct0nMIJ7^Q_^`mH}_MLo>JJY2}8D^4c$hJD^iR@$^E~~6@g7nO&V~p&yEIE z2nEF^LO;^30~$}=_Duv7M@Gizzhn@y0Kf3aHc6LZC+=htpkXT0vGzzJUT`?zvV}Xh z#App905j4!)gn~mY%*Le8G0}$qwdc|*Euf;SFfX5o8rgbqf-z%W8?m}`NAByTPt)E zGrmly2<`yimNJU;^A|V$SmS%nlOoH?YObJjtx%(01Fq4aMfC y=C@l^e#m9s{IM$YJAr;1@qgL8OIHDbluF;5)WVGg8=$K{66Egc;ZlD%H1jW6=YG2Y literal 0 HcmV?d00001 diff --git a/screenshots/b.png b/screenshots/b.png new file mode 100644 index 0000000000000000000000000000000000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e_Ia literal 0 HcmV?d00001 diff --git a/screenshots/intro.png b/screenshots/intro.png new file mode 100644 index 0000000000000000000000000000000000000000..12f1f24148e40cecfeecd7662f5877f53481315d GIT binary patch literal 1819 zcmd6o{WlW|9LA?n8q$@JO{7i}8oh0mD`!R0yk%zIVy+_=Q(jW$WttL6xJoBe$fbng z+PuZ+-8D1Jn5!(DnvFGKHXGaZ2XyYwJ?C@2=lSXR;W_7fo*ZvaS3Qs^2mk=+xt(+N z0RS{CHhhovrj2Ved|(Oy*gWm#jP$)xI{!KB&&n1fEgbY1cy?TE3Jp5RN&jgzCZ6l|7U#XXeht`(&3!%E>t`pD6&Vc9*A6+gV~jeRVk z90ZT<&^Rde)^Ye(;)F5kSR4+mPG+dqyTMts@p%&-eir0cM8!0J3_RwFyp6wnpWk*n z&W5)~NGyx|S|=((JF#iP-C-*nRO(;X5m7z&KO2U?+p3G?Z;)U1e4UF>-HDOe0V!sJ z#O?x+3I1(ENVH!@l>mpomr;G6>kNuV(*v`8NVV|WXz0J?MDmwlwTZ|3bN)FMG>t?RbXr&)*idXTYp#^~nMJ=+fs$HgzqKtp=;qV4AM$V9hG7v^WMlzo zG_xc$@@ZPrVjgEDUgDb77kD${$#bdyoKGHzc@PpXz5Pe}DS8e&xWd@i=5*HpR zuEHV)K`j*;xO3}_wFnbQzJV9C*OAys8ysKFN7oeVVqaTF4<#~rYqP3r-}}Vj0oRXu z_f!uB68e{?PqyYsl3U7_^b8w?GnvOYPQU=t%1*J>@f10hw7+-)d0c4?o`b}&w|cEl zRI>DSLX0{R&$pmC8FteCSyx@(*MW{Q1(s)cscee0%3;n)5_%t&+hx`|5!a+&rK1xrrAnuFsiyhtUy7m#ZAP1aJXDiYiAU4rDPS3nsHC{ z^Qcu9lIRJa+Q?!WO#qV|uz9tqxHfv~pXu?(ki~uR?V%F3WlNgvF(wi6x#EY>MhY4_ zzbz=Ae@fc9K3re`Rt#_@b=gu#<4359E_%d!&=kci0Sc0OMY0D?1Hj@@V%)O@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