Вы посетили: emeraldplayer

Пример: EmeraldPlayer

Пример: EmeraldPlayer

Небольшой аудио проигрователь, использующий библиотеку bass.

Внимание! Для этого скрипта необходима сборка DinoLang со встроенным классом bass: Скачать (Linux и Windows)

emeraldplayer.dino
use, "bass"
use, "strings"
use, "fs"
 
 
fs:open, "volume.variable"
if returned == -1
	print, "If you see the error above when you first run the program - this is normal"
	fs:create, "volume.variable"
	file = returned
	fs:write, file, "50"
	volume = 50
	fs:close, file
else
	file = returned
	fs:readline, file, 0
	strings:atoi, returned
	volume = returned
	fs:close, file
end
bass:init, -1
if arg == "nil"
printc, "Enter music file name or URL to play: "
 
readline
filename = returned
else
filename = arg
end
printc, "Starting playing "
printc, filename,
printc, "... "
strings:index, "://", filename
if returned != -1
bass:url, filename
else
bass:file, filename
end
stream = returned
if stream == -1
	print, "Failed to open this file!"
	end
	jump, 23
end
bass:setvolume, stream, volume
bass:play, stream, 1
print, "done"
 
print, ""
print, "S - stop, P - play, A - start again, V - change volume, C - change music, Q - exit"
printc, "Enter command: "
readline
command = returned
if command == "S"
	bass:stop, stream
	print, "Stopped! Press P to start again"
elif command == "P"
	bass:play, stream, 0
	print, "Started! Press C to change music or A to start again"
elif command == "A"
	bass:stop, stream
	bass:play, stream, 1
	print, "Playback starts from the beginning!"
elif command == "C"
	bass:stop, stream
	bass:free, stream
	end
	jump, 23
elif command == "Q"
	bass:stop, stream
	print, "Goodbye!"
	exit, 0
elif command == "V"
	printc, "Enter new volume (from 0 to 100): "
	readline
	volumetowrite = returned
	strings:atoi, returned
	volume = returned
	bass:setvolume, stream, volume
	fs:open, "volume.variable", 1
	file = returned
	fs:write, file, volumetowrite
	fs:close, file
end
jump, 49