Jump to content

Rainwave Player - Streaming game music and remixes


VixinG
 Share

Recommended Posts

Hi, I present you the Rainwave Player v1.2 (my first application - yay!)

Rainwave is an interactive radio website that allows users to request, rate, and vote for songs in real time.

The site hosts five separate radio streams and focuses completely on video game music. (wikipedia)

I designed it to look exactly like the Rainwave bar:

Posted Image

Features:

* You can switch between all 5 stations

* It's displaying currently playing track's Title and Album! (updating every 10 sec)

* To switch, you can click station name or use a self-customizable hotkeys (default F1 to F5)

* Application can be assigned: TopMost or not - toggle by hotkey (default F6)

* You can drag it around and place it in any place you like (it's snapping to edges and other windows)

(to drag, just hold the 'rainwave' logo picture)

It has own player, so you don't need any other (like winamp or vlc) to listen the music.

To customize the hotkeys, open "keys.ini" with a notepad and edit the {F1} etc. here's the key list:

http://pastebin.com/raw.php?i=k3WDKyw6

Please share your thoughts Posted Image

Source:

;------------------------------------------------------------;
;  Rainwave Player by VixinG
;          ver 1.2
;------------------------------------------------------------;
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Array.au3>
#include <IE.au3>
#include 'Icons.au3'
#include <Inet.au3>
#include 'WinSnap.au3'
#include <StaticConstants.au3>
#include "Marquee.au3"
#include <Timers.au3>
;------------------------------------------------------------;
; Hotkeys
;------------------------------------------------------------;
$hotkey1 = IniRead('keys.ini', 'Hotkeys', 'Omniwave', '{F1}')
$hotkey2 = IniRead('keys.ini', 'Hotkeys', 'Rainwave', '{F2}')
$hotkey3 = IniRead('keys.ini', 'Hotkeys', 'Chiptune', '{F3}')
$hotkey4 = IniRead('keys.ini', 'Hotkeys', 'Covers', '{F4}')
$hotkey5 = IniRead('keys.ini', 'Hotkeys', 'OCRradio', '{F5}')
$topmost = IniRead('keys.ini', 'Hotkeys', 'SetOnTop', '{F6}')
HotKeySet($hotkey1, "omniwave")
HotKeySet($hotkey2, "rainwave")
HotKeySet($hotkey3, "bitwave")
HotKeySet($hotkey4, "mixwave")
HotKeySet($hotkey5, "ocr_radio")
HotKeySet($topmost, "TopMost")
HotKeySet("{ESC}", "Quit")
;------------------------------------------------------------;
; Declaring, registering, etc.
;------------------------------------------------------------;
Global $SetOnTop = True
Global $title = 'Click desired station... and enjoy the music!'
Dim $nr[5] = [5, 1, 4, 3, 2]
$GUI = GUICreate('Rainwave Player', 580, 37, 0, 0, $WS_POPUP)
$oRP = ObjCreate("ShockwaveFlash.ShockwaveFlash.1")
$GUIActiveX = GUICtrlCreateObj($oRP, 300, 300, 100, 30)
GUISetState(@SW_SHOW)
Dim $png1[5] = ['.\art\aa.png', '.\art\bb.png', '.\art\cc.png', '.\art\dd.png', '.\art\ee.png']
Dim $png3[5] = ['.\art\aa.png', '.\art\bb.png', '.\art\cc.png', '.\art\dd.png', '.\art\ee.png']
Dim $png2[5] = ['.\art\aa2.png', '.\art\bb2.png', '.\art\cc2.png', '.\art\dd2.png', '.\art\ee2.png']
Global $dragLabel = GUICtrlCreateLabel('', 1, 1, 110, 33, -1, $GUI_WS_EX_PARENTDRAG)
GUICtrlSetBkColor($dragLabel, 0x000000)
_GUICtrlMarquee_SetScroll('', 'alternate', 'right', 1, 75)
_GUICtrlMarquee_SetDisplay(0, 0xf0ac20, 'black', 8, 'MS Reference Sans Serif')
Dim $pics[5] = [GUICtrlCreatePic('', 110, 1, 0, 0), GUICtrlCreatePic('', 154, 1, 0, 0), GUICtrlCreatePic('', 214, 1, 0, 0), GUICtrlCreatePic('', 310, 1, 0, 0), GUICtrlCreatePic('', 390, 1, 0, 0)]
Dim $urls[5] = ['http://omnistream.rainwave.cc:8000/omniwave.mp3', 'http://rwstream.rainwave.cc:8000/rainwave.mp3', 'http://bitstream.rainwave.cc:8000/bitwave.mp3', 'http://mwstream.rainwave.cc:8000/mixwave.mp3', 'http://ocrstream.rainwave.cc:8000/ocremix.mp3']
Local $disable
Global $00png = '.\art\00.png'
Global $00obj = GUICtrlCreatePic('', 1, 1, 0, 0)
_SetImage($00obj, $00png)
GUICtrlSetState(-1, $GUI_DISABLE)
GUISetBkColor(0x000000, $GUI)
_WinSnap_Set($GUI)
WinSetOnTop($GUI, "", 1)
;------------------------------------------------------------;
; Script
;------------------------------------------------------------;
Local $lastCursor
Refresh()
Dim $labels[5] = [GUICtrlCreateLabel('', 110, 1, 44, 23), GUICtrlCreateLabel('', 154, 1, 60, 23), GUICtrlCreateLabel('', 214, 1, 96, 23), GUICtrlCreateLabel('', 309, 1, 81, 23), GUICtrlCreateLabel('', 390, 1, 89, 23)]
For $i = 0 To 4 Step 1
GUICtrlSetBkColor($labels[$i], $GUI_BKCOLOR_TRANSPARENT)
Next
Local $highlighted = False
GUISetState(@SW_SHOW)
$marquee = _GUICtrlMarquee_Create($title, 110, 24, 369, 12, "")
While 1
$msg = GUIGetMsg()
$cursor = GUIGetCursorInfo($GUI)
If $cursor[4] >= 11 And $cursor[4] <= 15 Then
  $x = $cursor[4] - 11
  If $cursor[4] = $labels[$x] And $highlighted = False Then
   _SetImage($pics[$x], $png2[$x])
   $highlighted = True
   $oldx = $x
   $old = $cursor[4]
  EndIf
  If $highlighted = True And $cursor[4] <> $old Then
   _SetImage($pics[$oldx], $png1[$oldx])
   $highlighted = False
  EndIf
  If $msg >= 11 And $msg <= 15 Then
   $png1 = $png3
   $a = $msg - 11
   $var = $urls[$a]
   ObjectX()
   _SetImage($pics[$x], $png2[$x])
   $png1[$x] = $png2[$x]
   $x2 = $x
   $msg2 = $msg
   Refresh()
   GetName()
  EndIf
  If $msg >= 11 And $msg <= 15 And $msg <> $msg2 Then
   $png1 = $png3
   $var = $urls[$a]
   ObjectX()
   $png1[$x] = $png3[$x]
   _SetImage($pics[$x2], $png1[$x2])
   _SetImage($pics[$x], $png2[$x])
   $png1[$x] = $png2[$x]
   $x2 = $x
   $msg2 = $msg
   Refresh()
   GetName()
  EndIf
EndIf
If $cursor[4] = 0 And $highlighted = True Then
  Refresh()
EndIf
WEnd
Exit
;------------------------------------------------------------;
; Functions
;------------------------------------------------------------;
Func Refresh()
For $i = 0 To 4 Step 1
  _SetImage($pics[$i], $png1[$i])
  GUICtrlSetState($pics[$i], $GUI_DISABLE)
  $highlighted = False
Next
EndFunc   ;==>Refresh
Func TopMost()
If $SetOnTop = True Then
  WinSetOnTop($GUI, "", 0)
  $SetOnTop = False
Else
  WinSetOnTop($GUI, "", 1)
  $SetOnTop = True
EndIf
EndFunc   ;==>TopMost
Func omniwave()
$x = 0
$x2 = 0
$png1 = $png3
$var = $urls[0]
ObjectX()
_SetImage($pics[0], $png2[0])
$png1[0] = $png2[0]
Refresh()
GetName()
EndFunc   ;==>omniwave
Func rainwave()
$x = 1
$x2 = 1
$png1 = $png3
$var = $urls[1]
ObjectX()
_SetImage($pics[1], $png2[1])
$png1[1] = $png2[1]
Refresh()
GetName()
EndFunc   ;==>rainwave
Func bitwave()
$x = 2
$x2 = 2
$png1 = $png3
$var = $urls[2]
ObjectX()
_SetImage($pics[2], $png2[2])
$png1[2] = $png2[2]
Refresh()
GetName()
EndFunc   ;==>bitwave
Func mixwave()
$x = 3
$x2 = 3
$png1 = $png3
$var = $urls[3]
ObjectX()
_SetImage($pics[3], $png2[3])
$png1[3] = $png2[3]
Refresh()
GetName()
EndFunc   ;==>mixwave
Func ocr_radio()
$x = 4
$x2 = 4
$png1 = $png3
$var = $urls[4]
ObjectX()
_SetImage($pics[4], $png2[4])
$png1[4] = $png2[4]
Refresh()
GetName()
EndFunc   ;==>ocr_radio
Func Quit()
Exit
EndFunc   ;==>Quit
Func GetName()
AdlibUnRegister("Compare")
AdlibRegister("Compare", 10000)
Global $fullsource = _INetGetSource('http://rainwave.cc/async/' & $nr[$x2] & '/get', True)
$start = StringInStr($fullsource, 'sched_current') + 300
$source = StringMid($fullsource, $start, 300)
$start = StringInStr($source, 'song_title": "') + 14
$stop = StringInStr($source, '", "artists')
$length = $stop - $start
$title = StringMid($source, $start, $length)
$start = StringInStr($fullsource, 'sched_current') + 300
$source = StringMid($fullsource, $start, 750)
$start = StringInStr($source, 'album_name": "')
$source = StringMid($source, $start)
$start = StringInStr($source, 'album_name": "') + 14
$stop = StringInStr($source, '", "')
$length = $stop - $start
$album = StringMid($source, $start, $length)
$title = $title & ' - ' & $album
GUICtrlDelete($marquee)
$marquee = _GUICtrlMarquee_Create($title, 110, 24, 369, 12, "")
EndFunc   ;==>GetName
Func Compare()
Global $fullsource2 = _INetGetSource('http://rainwave.cc/async/' & $nr[$x2] & '/get', True)
If $fullsource <> $fullsource2 Then
  GetName()
EndIf
EndFunc   ;==>Compare
Func ObjectX()
GUICtrlDelete($GUIActiveX)
GUICtrlDelete($oRP)
$oRP = ObjCreate("ShockwaveFlash.ShockwaveFlash.1")
$GUIActiveX = GUICtrlCreateObj($oRP, 489, 8, 80, 20)
$LinkoRP = ObjEvent($oRP, "IEEvent_", "Preview")
GUISetState()
With $oRP
  .Movie = 'http://www.rainwave.tk/player/ffmp3-config.swf'
  .flashvars = 'url=' & $var & '&codec=mp3&volume=50&introurl=&autoplay=true&tracking=false&jsevents=true&skin=ffmp3-rainwave.xml'
  .bgcolor = "#000000"
  .wmode = "Opaque"
  .allowscriptaccess = 'always'
  .scale = 'noscale'
EndWith
EndFunc   ;==>ObjectX

Download link (32 and 64 bit) with source:

http://www.mediafire.com/?qsg11n4ho3i74ay

Known problems:

Few people have problems with 64-bit version, but for other 64-bit users it's working perfectly (strange).

More info:

For window snapping I used the by Beege

For displaying the .png images - by Yashied

For 'playing now' bar under the stations - by Melba23

Some useful scripts:

- I wanted to check a website for changes, and update the marquee, when site changes, but I didn't want to stop the script by Sleep(), so I used this little functions:

; Every time, an user picks the station, the marquee updates the currently played Song title & album:
Func GetName()
AdlibUnRegister("Compare")
AdlibRegister("Compare", 10000)
Global $fullsource = _INetGetSource('http://rainwave.cc/async/' & $nr[$x2] & '/get', True) ; this is the metadata source with current song name and artist
; searching current track
$start = StringInStr($fullsource, 'sched_current') + 300
$source = StringMid($fullsource, $start, 300)
$start = StringInStr($source, 'song_title": "') + 14
$stop = StringInStr($source, '", "artists')
$length = $stop - $start
$title = StringMid($source, $start, $length)
;searching current album
$start = StringInStr($fullsource, 'sched_current') + 300
$source = StringMid($fullsource, $start, 750)
$start = StringInStr($source, 'album_name": "')
$source = StringMid($source, $start)
$start = StringInStr($source, 'album_name": "') + 14
$stop = StringInStr($source, '", "')
$length = $stop - $start
$album = StringMid($source, $start, $length)
$title = $title & ' - ' & $album
GUICtrlDelete($marquee) ;deletes old marquee with old song title and creates new
$marquee = _GUICtrlMarquee_Create($title, 110, 24, 369, 12, "")
EndFunc   ;==>GetName
Func Compare() ; This function compares the source from old async cache with current (works in background)
Global $fullsource2 = _INetGetSource('http://rainwave.cc/async/' & $nr[$x2] & '/get', True)
If $fullsource <> $fullsource2 Then
  GetName() ; if sources are different, then it changes the marquee
EndIf
EndFunc   ;==>Compare

Rainwave is seriously great website, with cool music ;)

Best wishes,

VixinG

Edited by VixinG

[indent=3][/indent]

Link to comment
Share on other sites

  • 3 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...