RadioGram

This software is set to become a fully fucntional radio automation software and program scheduler for rotations and live programming. It is not fully developed yet awaiting a sponsor to give this project going. Below is the source code developed so far, mostly just the UI:

' RadioGram is a radio broadcast system for console Linux written by Jason 
' Page at the end of 2020, starting on Thanks Giving day.
' Initially the program maintains three files to define the program's function:
' 1. Scheduler - Set times for when an item is added to queue
' 2. Active Rotation - Automated rotation of music / podcasts using Music Player Demean MPD/MPC
' 3. 0-9 Programmable Sound Pad - Live sound effects using MPV
' 
' In addition the space bar de/activates the microphone input and pauses the
' rotation.
' Hiting keys 0-9 will produce a sound program to that macro number.
' [Shift] + (0-9) will allow programming a sound file to that macro number.
' [Enter] will prompt for date/time and sound file for that time to scheduler.
' [UP/DOWN] Change Output Device
' [LEFT/RIGHT] Change Input Device

dim shared sch$(255,255,255)      ' Schedule files, date$, time$
dim shared pad$(8)                ' Pad files 
dim shared playlist$(11)          ' Clockwheel playlist 12 at a time; 11 displayed
dim sdate$		          ' Next scheduled date in queue
dim stime$		          ' Next scheduled time in queue
dim sfile$                        ' Next file in queue that is scheduled

dim pfile$                        ' Active file/device currently playing
dim bpfile$                       ' Set to compare if file/device changed

dim lfile$                        ' Current Playlist file
dim ext$                          ' Value 1 is exit program, default 0
dim devce$                        ' The Aux or Mic Device setup in Config

ext$="0"

call io(sdate$,stime$,sfile$,pfile$,lfile$)

sub io(sdate$,stime$,sfile$,pfile$,lfile$)
cls
locate 1,1
print "| RADIOGRAM V1.0a - Written by Jason Page for Console Radio Management |"
locate 2,1
print "|--------------------------------------------------------------------- |"
locate 3,1
print "|  Da-Pad-Gram  |\ | Da-Schedule || date / time    |    Da-Playlist    |"
locate 4,1
print "| ------------- | /| ----------- || -------------- \___________________|"
locate 5,1
print "| | 7 | 8 | 9 | |\ | *********** |< ********/****                      |"
locate 6,1
print "| | 4 | 5 | 6 | | /| *********** |< ********/****                      |"
locate 7,1
print "| | 1 | 2 | 3 | |\ | *********** |< ********/****                      |"
locate 8,1
print "| ------------- | /| *********** |< ********/****                      |"
locate 9,1
print "|  Dis-Playing  |\ | *********** |< ********/****                      |"
locate 10,1
print "| ************* | /| *********** |< ********/****                      |"
locate 11,1
print "|  In-Da-Queue  |\ | *********** |< ********/****                      |"
locate 12,1
print "| ************* | /| *********** |< ********/****                      |"
locate 13,1
print "| Next-In-Queue |\ | *********** |< ********/****                      |"
locate 14,1
print "| ************* | /| *********** |< ********/****                      |"
locate 15,1
print "|---------------|\ | *********** |< ********/****                      |"
locate 16,1
print "|   |MIC|OFF|   | /| *********** |< ********/****                      |"
locate 17,1
print "|-----------------------------------------------------------------------"
locate 18,1
print "|> [C]onfig IO |--| [S]et Lock |--| [H]elp |--| [Q]uit |--| [A]bout |--|"
locate 19,1
print "|> [SPACEBAR]=Mic[ON:OFF] |-| [ENTER]=Schedule Add |-| [SHIFT(1-9)=Pad |"
end sub

sub miconoff(onoff$)
if onoff$="ON " then onoff$="OFF" else onoff$="ON "
 locate 16, 10
 print onoff$
 locate 20,1
end sub

sub plays(pfile$)
locate 20,1
shell "pkill mpv"
shell "mpv "+pfile$+" &&"
call io(sdate$,stime$,sfile$,pfile$,lfile$)
end sub

					 ' Main Program


do

                                         ' Capture Keyboard Events...

 select case ucase$(inkey$)
  case chr$(27): ext$="1"                ' [ESC] key exit program
  case chr$(32):                         ' [SPACE] key Mic On/Off
    call miconoff(onoff$)
     if onoff$="ON " then
       ext$="2"                          ' Turn Mic On Active
     else
       ext$="0"                          ' Resume Playlist Default Active
     end if
  case chr$(18):			 ' [ENTER] key schedule program
  
  case "1"
  case "2"
  case "3"
  case "4"
  case "5"
  case "6"
  case "7"
  case "8"
  case "9"

  case "!"                              ' Program Pad 1
  case "@"                              ' Program Pad 2
  case "#"                              ' Program Pad 3
  case "$"                              ' Program Pad 4
  case "%"                              ' Program Pad 5
  case "^"                              ' Program Pad 6
  case "&"                              ' Program Pad 7
  case "*"                              ' Program Pad 8
  case "("                              ' Program Pad 9

  case "A","a": pfile$="*.mp3": call plays(pfile$)
  case "C","c": locate 20,1: print " * You can change input device with right/left arrows and output device with up/down arrow keys. *"   
  case chr$(0)+"M":
    locate 20,1: print "M Right"
  case chr$(0)+"H"
     locate 20,1: print "H Up"
  case chr$(0)+"P"
    locate 20,1: print "P Down"
  case chr$(0)+"K"
    locate 20,1: print "K Left"
 end select


                                         ' Capture Input States....
 select case ext$
  case "0":       
                                         ' 0=Active Rotation
    
   if bpfile$<>pfile$ then
     call plays(pfile$)
   end if

   bpfile$=pfile$

  case "1": system                       ' 1=Exit Program
  case "2":                              ' 2=Mic Active
    pfile$=devce$                        ' Set pfile$ to aux/mic device set in config

  case "3":				 ' 3=Scheduled Content

 end select

loop