Compare commits
2 changed files with 188 additions and 260 deletions
119
cimp.bas
119
cimp.bas
|
|
@ -36,16 +36,16 @@ if ipc_status=0 then
|
|||
' --- CLIENT MODE ---
|
||||
dim cmd_msg as string
|
||||
|
||||
select case command$(1)
|
||||
case "--soundbank"
|
||||
Select Case command$(1)
|
||||
Case "--soundbank"
|
||||
cmd_msg = "SOUNDBANK:" + _cwd$ + slash + command$(2)
|
||||
case "--next"
|
||||
Case "--next"
|
||||
cmd_msg = "NEXT"
|
||||
|
||||
case "--prev"
|
||||
Case "--prev"
|
||||
cmd_msg = "PREV"
|
||||
|
||||
case "-v","--volume"
|
||||
Case "-v", "--volume"
|
||||
cmd_msg = "VOL:" + command$(2)
|
||||
|
||||
case "--pause"
|
||||
|
|
@ -62,34 +62,30 @@ if ipc_status=0 then
|
|||
cmd_msg = "REPEAT"
|
||||
case "--repeat-1"
|
||||
cmd_msg = "REPEAT1"
|
||||
case "--repeat-off"
|
||||
cmd_msg="REPEATOFF"
|
||||
case "--nyan"
|
||||
cmd_msg = "NYAN"
|
||||
case "--nyan-off"
|
||||
cmd_msg="NYANOFF"
|
||||
case "--add"
|
||||
for i=2 to _commandcount
|
||||
Case "--add"
|
||||
For i = 2 To _commandcount
|
||||
cmd_msg = "ADD:" + _cwd$ + slash + command$(i)
|
||||
ipc_send_message cmd_msg
|
||||
next i
|
||||
system
|
||||
Next i
|
||||
System
|
||||
|
||||
case "--playlist"
|
||||
Case "--playlist"
|
||||
cmd_msg = "GET_PLAYLIST"
|
||||
|
||||
case else
|
||||
Case Else
|
||||
' Default behavior: Resolve target file/playlist and replace active queue
|
||||
cmd_msg = "PLAY:" + _cwd$ + slash + command$(1)
|
||||
ipc_send_message cmd_msg
|
||||
if _commandcount>1 then
|
||||
for i=2 to _commandcount
|
||||
If _commandcount > 1 Then
|
||||
For i = 2 To _commandcount
|
||||
cmd_msg = "ADD:" + _cwd$ + slash + command$(i)
|
||||
ipc_send_message cmd_msg
|
||||
next i
|
||||
system
|
||||
end if
|
||||
end select
|
||||
Next i
|
||||
System
|
||||
End If
|
||||
End Select
|
||||
|
||||
' Send instruction to the main player instance
|
||||
ipc_send_message cmd_msg
|
||||
|
|
@ -137,8 +133,6 @@ dim shuffle as integer
|
|||
dim nooutput as integer
|
||||
dim timevis as integer
|
||||
dim nyan as integer
|
||||
dim server as integer
|
||||
|
||||
dim marqueeoffset as integer
|
||||
dim i as integer
|
||||
|
||||
|
|
@ -173,40 +167,6 @@ timevis=1
|
|||
nyan=0
|
||||
marqueeoffset=0
|
||||
|
||||
|
||||
dim config as string
|
||||
config=GetConfig("cimp.conf")
|
||||
if _fileexists(config) then
|
||||
dim li as string
|
||||
dim fh as integer
|
||||
fh=freefile
|
||||
open config for input as fh
|
||||
while not eof(fh)
|
||||
line input #fh,li
|
||||
if left$(li,1)="#" then _continue
|
||||
select case _trim$(left$(li,instr(li,"=")-1))
|
||||
case "volume"
|
||||
volume=val(_trim$(mid$(li,instr(li,"=")+1)))/100
|
||||
case "shuffle"
|
||||
if _trim$(mid$(li,instr(li,"=")+1))="true" then shuffle=-1 else shuffle=0
|
||||
case "repeat"
|
||||
if _trim$(mid$(li,instr(li,"=")+1))="true" then repeat=-1 else repeat=0
|
||||
if _trim$(mid$(li,instr(li,"=")+1))="1" then repeat=1
|
||||
case "server"
|
||||
if _trim$(mid$(li,instr(li,"=")+1))="true" then server=-1 else server=0
|
||||
case "nyan"
|
||||
if _trim$(mid$(li,instr(li,"=")+1))="true" then nyan=-1 else nyan=0
|
||||
case "nooutput"
|
||||
if _trim$(mid$(li,instr(li,"=")+1))="true" then nooutput=-1 else nooutput=0
|
||||
case ""
|
||||
case else
|
||||
print "Config not understood:"
|
||||
print li
|
||||
end select
|
||||
wend
|
||||
close fh
|
||||
end if
|
||||
|
||||
for i=1 to _commandcount
|
||||
select case command$(i)
|
||||
case "-v","--volume"
|
||||
|
|
@ -283,18 +243,14 @@ while keyin<>27
|
|||
repeat=-1
|
||||
elseif client_cmd = "REPEAT1" then
|
||||
repeat=1
|
||||
elseif client_cmd="REPEATOFF" then
|
||||
repeat=0
|
||||
elseif client_cmd = "SHUFFLE" then
|
||||
keyin=asc("s")
|
||||
elseif client_cmd = "NYAN" then
|
||||
nyan = not nyan
|
||||
elseif client_cmd="NYANOFF" then
|
||||
nyan=0
|
||||
elseif left$(client_cmd, 10) = "SOUNDBANK:" then
|
||||
if client_cmd="default" then loadsoundbank "" else loadsoundbank mid$(client_cmd,11)
|
||||
|
||||
if _sndplaying(musichandle) then
|
||||
if _SNDPLAYING(musichandle) then
|
||||
|
||||
' a hack to make qb64pe load the midi file that is already loaded.
|
||||
' qb64 can't open the same file again with a new sound bank for some reason
|
||||
|
|
@ -460,7 +416,7 @@ while keyin<>27
|
|||
if nooutput=0 then
|
||||
tw=termwidth
|
||||
fixedwidth=uwidth(state)+uwidth(progress)
|
||||
maxtitlewidth=tw-fixedwidth
|
||||
maxtitlewidth=tw-fixedwidth-2
|
||||
currentsongwidth=uwidth(songname)
|
||||
|
||||
if currentsongwidth>maxtitlewidth and maxtitlewidth>4 then
|
||||
|
|
@ -669,9 +625,12 @@ end function
|
|||
|
||||
function ulen% (txt$)
|
||||
dim count%,i%,b%
|
||||
count%=0
|
||||
for i%=1 to len(txt$)
|
||||
b%=asc(txt$,i%)
|
||||
if (b% and &h80)=0 or (b% and &hc0)=&hc0 then count%=count%+1
|
||||
if (b% and &h80)=0 or (b% and &hc0)=&hc0 then
|
||||
count%=count%+1
|
||||
end if
|
||||
next
|
||||
ulen%=count%
|
||||
end function
|
||||
|
|
@ -751,35 +710,3 @@ end function
|
|||
sub loadsoundbank (filename as string)
|
||||
_midisoundbank filename
|
||||
end sub
|
||||
|
||||
|
||||
function GetConfig$ (FileName as string)
|
||||
select case left$(_os$,instr(_os$,"]"))
|
||||
case "[WINDOWS]"
|
||||
dim appdata as string
|
||||
appdata=environ$("APPDATA")
|
||||
if appdata="" then appdata=environ$("USERPROFILE")+"\AppData\Roaming"
|
||||
if right$(appdata,1)<>"\" then appdata=appdata+"\"
|
||||
GetConfig=appdata+FileName
|
||||
|
||||
case "[MACOSX]"
|
||||
dim homemac as string
|
||||
homemac=environ$("HOME")
|
||||
if homemac="" then homemac="/tmp"
|
||||
if right$(homemac,1)="/" then homemac=left$(homemac,len(homemac)-1)
|
||||
GetConfig=homemac+"/Library/Application Support/"+FileName
|
||||
|
||||
case else ' Linux and other Unix-like systems
|
||||
dim xdg as string,baseDir as string,homelinux as string
|
||||
xdg=environ$("XDG_CONFIG_HOME")
|
||||
if xdg<>"" then
|
||||
baseDir=xdg
|
||||
else
|
||||
homelinux=environ$("HOME")
|
||||
if homelinux="" then homelinux="/tmp"
|
||||
baseDir=homelinux+"/.config"
|
||||
end if
|
||||
if right$(baseDir,1)="/" then baseDir=left$(baseDir,len(baseDir)-1)
|
||||
GetConfig=baseDir+"/"+FileName
|
||||
end select
|
||||
end function
|
||||
|
|
|
|||
|
|
@ -129,8 +129,9 @@ When interacting directly with the player interface terminal, use these keys:
|
|||
|
||||
## Supported Audio Formats
|
||||
|
||||
All formats supported by QB64PE are supported by cimp, as it handles the
|
||||
decoding. The following formats are supported by the most recent version:
|
||||
All formats supported by QB64/QB64PE are supported by cimp, as QB64 handles the
|
||||
decoding. The following formats are supported by the most recent versions of
|
||||
both compilers:
|
||||
|
||||
Audio files:
|
||||
`mod`, `xm`, `s3m`, `it`, `mid`, `mp3`, `ogg`, and `flac`
|
||||
|
|
@ -142,7 +143,7 @@ Sound banks:
|
|||
|
||||
| File | Description |
|
||||
| ------------- | --------------------------------------------------------------------------------------- |
|
||||
| `cimp.bas` | Main player - QB64 source handling client/server states and UI |
|
||||
| `cimp.bas` | Main player — QB64-PE source handling client/server states and UI |
|
||||
| `terminkey.h` | C library for cross-platform raw keyboard input, IPC pipes/sockets, and terminal sizing |
|
||||
|
||||
## Notes
|
||||
|
|
|
|||
Loading…
Reference in a new issue