Ejemplo n.º 1
0
 def write_setlist(self, list_to_write):
     print('>>>> SETLIST: Writing the setlist to setlist.txt')
     sysfunc.mount_samples_dir_rw()  # remount `/samples` as read-write (if using SD card)
     setlist = open(gv.SETLIST_FILE_PATH, "w")
     list_to_write = list(filter(None, list_to_write))  # remove empty strings / empty lines
     for song in list_to_write:
         setlist.write(song + '\n')
     setlist.close()
     sysfunc.mount_samples_dir_ro()  # remount as read-only
Ejemplo n.º 2
0
 def write_definition_file(self):
     print '\r#### START WRITING %s/definition.txt ####\r' % self.basename
     sysfunc.mount_samples_dir_rw(
     )  # remount `/samples` as read-write (if using SD card)
     f = open(self.definitionfname, 'w')
     for keyword, value in self.combined_patterns.iteritems():
         if 'wav_definition' not in keyword:
             line = keyword + '=' + str(value) + '\n'
             f.write(line)
             print line.strip('\n')  # debug
     for keyword, value in self.combined_patterns.iteritems(
     ):  # 2 loops so that wav_definition(s) are last lines
         if 'wav_definition_lines' in keyword:  # wav_definition_lines is a dict. ie 'wav_definition_lines': {0:'C.wav', 1:'D.wav'}
             for k, v in value.iteritems():
                 line = str(v) + '\n'
                 f.write(line)
                 print line.strip('\n')  # debug
     f.close()
     sysfunc.mount_samples_dir_ro(
     )  # remount `/samples` back to read-only (if using SD card)
     print '\r#### END WRITING %s/definition.txt ####\r' % self.basename
Ejemplo n.º 3
0
print MIDIMAPS_FILE_PATH, ' <--- MIDI maps path'

###################
# SETLIST
###################

SONG_FOLDERS_LIST = [d for d in os.listdir(SAMPLES_DIR) if os.path.isdir(os.path.join(SAMPLES_DIR, d))]

if path.basename(sys.modules['__main__'].__file__) == "samplerbox.py":
    SETLIST_FILE_PATH = SAMPLES_DIR + '/setlist.txt'
else:
    SETLIST_FILE_PATH = '../setlist/setlist.txt'  # When testing modules

if not os.path.exists(SETLIST_FILE_PATH):
    print '>>>> SETLIST: %s does not exist. Creating an empty setlist file.' % SETLIST_FILE_PATH
    sysfunc.mount_samples_dir_rw()  # remount `/samples` as read-write (if using SD card)
    f = open(SETLIST_FILE_PATH, 'w')
    sysfunc.mount_samples_dir_ro()  # remount as read-only
    f.close()

SETLIST_LIST = None  # open(SETLIST_FILE_PATH).read().splitlines()
NUM_FOLDERS = len(os.walk(SAMPLES_DIR).next()[1])

# Disable Freeverb when not on Pi
if not IS_DEBIAN:
    USE_FREEVERB = False

# ADMINISTRATION SAMPLER
samples = {}
samples_indices = []
playingnotes = {}