示例#1
0
 def process_project(self):
     if self.current_open_proj is None:
         err_mess("No project is currently open! Open or create one")
     else:
         process(self.current_open_proj)
         self.current_open_proj.save()
         self.current_open_proj = None
示例#2
0
 def control(self):
     """
     cat: edit
     desc: turn this property's value into a controller, which allows it to be changed over time
     """
     val = self.get_val()
     if self.cont_type == "c":
         if val is not None:
             markers = {0: ContinuousMarker(Units.beats("0b"), val, "hard")}
         else:
             markers = None
         cont = ContinuousController(
             name=self.name,
             val_units=self.inpt_mode,
             val_allowed=self.allowed,
             markers=markers,
             change_types=self.change_types,
             parent=self.caller
         )
     else:
         if val is not None:
             markers = {0: DiscreteMarker(Units.beats("0b"), val)}
         else:
             markers = None
         cont = Controller(
             name=self.name,
             val_units=self.inpt_mode,
             val_allowed=self.allowed,
             markers=markers,
             parent=self.caller
         )
     setattr(self.caller, self.attrname(), cont)
     add_reldata(cont.rename, "public", False)
     process(cont)
示例#3
0
 def process_child(self, child_name=None):
     """
     cat: edit
     desc: edit a child member of this object
     args:
         [child_name: name of child to edit, omit to list children]
     """
     if len(self.children) == 0:
         err_mess("This Project has no children to process!")
     if child_name is None:
         self.list_children()
         p("Enter the name of the child you wish to edit")
         child_name = inpt("name")
     else:
         child_name = inpt_validate(child_name, "name")
     try:
         child_name = autofill(child_name, [i.name for i in self.children])
     except AutofillError as e:
         err_mess("Child name '{0}' not found".format(e.word))
         self.process_child()
         return
     child = None
     for i in self.children:
         if i.name == child_name:
             if child is not None:
                 raise UnexpectedIssue("Multiple children with name {0}".format(child_name))
             child = i
     process(child)
     child.save()
示例#4
0
 def process(self):
     if self.caller is None:
         raise PropertyError("Property is not bound to a caller. Make sure to call properties at the time of access")
     try:
         val = self.get_val()
     except AttributeError:
         setattr(self.caller, self.attrname(), None)
         val = None
     if isinstance(val, Controller):
         process(val)
     else:
         process(self)
示例#5
0
 def edit_sample(self):
     """
     cat: edit
     desc: select sample to process
     """
     while True:
         print(
             "\n  Which sample of {0} '{1}' would you like to edit? ('q' to cancel, 'list' to list samples): "
             .format(self.reltype, self.name),
             end="")
         sample = self.choose("sample")
         process(sample)
示例#6
0
    def add_rhythm(self, new_rhythm=None):
        if not isinstance(new_rhythm, Rhythm):
            p("Create new rhythm (C) or Load from another sampler (L)?")
            source = inpt("letter", allowed="cl")
            if source == 'c':
                new_rhythm = Rhythm()
            else:
                # load from sampler
                raise NotImplementedError

        self.rhythms.append(new_rhythm)
        self.list_rhythms()
        p("Process this rhythm? y/n")
        if inpt("yn"):
            process(new_rhythm)
示例#7
0
 def add_sample(self, new_samp=None):
     """
     desc: add a sample from file, project, or another sampler
     cat: edit
     """
     if isinstance(new_samp, Recording):
         new_samp.reltype = "Sample"
     else:
         new_samp = Recording(reltype="Sample", parent=self)
     self.smps.append(new_samp)
     self.list_samples()
     nl()
     p("Process this sample? y/n")
     if inpt("yn"):
         process(new_samp)
示例#8
0
 def process_child_sample(self, name=None):
     """
     desc: process a sample contained in this group
     """
     while True:
         if name is None:
             self.list_samples()
             p("Enter the name of the Sample to process")
             name = inpt('name')
         else:
             name = inpt_validate(name, 'name')
         try:
             self.samples[name]
             break
         except KeyError:
             err_mess("> Sample '{0}' does not exist!".format(name))
     process(self.samples[name])
示例#9
0
 def __process(self) -> None:
     '''Checking incorrected actions and processing'''
     table = self.tableWidget
     row_count = table.rowCount()
     if row_count == 0:
         self.__show_error_message("Don't selected mp3 files",
                                   "Please, add mp3 files")
     else:
         check_errors = True
         rows: List[Tuple[str, str, str, str, str, str, str]] = []
         for row_index in range(row_count):
             row = self.__get_row(row_index)
             try:
                 self.__check_row(row)
             except Exception as e:
                 check_errors = False
                 self.__show_error_message(str(e),
                                           'Please fill in all the gaps')
                 table.selectRow(row_index)
             if check_errors:
                 rows.append(row)
             else:
                 break
         if check_errors:
             if not self.__check_base_dir_path():
                 self.__show_error_message("No save path selected",
                                           "Please select a path to save")
                 self.__load_path_directory_to_save()
             else:
                 baseDir = self.pathLine.text()
                 combobox_index = self.__get_combobox_index()
                 schema = self.schems[combobox_index]
                 prepare_rows = self.__unite_table_records(
                     rows, self.schems_numfields[combobox_index])
                 self.progressBar.setValue(0)
                 onepart = 100 / len(prepare_rows)
                 completed = 0
                 sleep(1)
                 for row in prepare_rows:
                     if completed < 100:
                         completed += onepart
                         self.progressBar.setValue(completed)
                     tags = new_build_tags(row, self.builder)
                     mp3s = new_build_fiels(row)
                     process(tags, mp3s, baseDir, schema)
示例#10
0
def _run_processing(args):
    process(input_filepath=args.input_filepath, output_folderpath=args.output_folderpath, pipeline=args.pipeline)
示例#11
0
def main_rec_obj():
    
    a = Recording(source='sources/t.wav', name='test')

    process(a)
示例#12
0
 def edit_rhythm(self):
     rhythm = self.choose("rhythm")
     process(rhythm)