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 0000000..60b43c2 Binary files /dev/null and b/screenshots/a.png differ diff --git a/screenshots/b.png b/screenshots/b.png new file mode 100644 index 0000000..a3d2139 Binary files /dev/null and b/screenshots/b.png differ diff --git a/screenshots/intro.png b/screenshots/intro.png new file mode 100644 index 0000000..12f1f24 Binary files /dev/null and b/screenshots/intro.png differ