Example #1
0
 def _write_headers(self, fh):
   headers = ['MThd']
   headers.append(_int_to_bytes(6, 4))
   headers.append(_int_to_bytes(self.file_format, 2))
   headers.append(_int_to_bytes(len(self.tracks), 2))
   headers.append(_int_to_bytes(self.delta_ticks, 2))
   fh.write(''.join(headers))
Example #2
0
 def _write_headers(self, fh):
     headers = ['MThd']
     headers.append(_int_to_bytes(6, 4))
     headers.append(_int_to_bytes(self.file_format, 2))
     headers.append(_int_to_bytes(len(self.tracks), 2))
     headers.append(_int_to_bytes(self.delta_ticks, 2))
     fh.write(''.join(headers))
Example #3
0
 def __init__(self, modulus, exponent):
     self.n = utils.urlsafe_b64encode_as_str(utils._int_to_bytes(modulus))
     self.e = utils.urlsafe_b64encode_as_str(utils._int_to_bytes(exponent))
     self.kty = CryptoConstants.KTY_RSA
Example #4
0
 def encode(self):
   _bytes = ['MTrk', _int_to_bytes(self.len_in_bytes(), 4)]
   _bytes.extend([event.encode() for event in self.events])
   _bytes.append(TRACK_END_EVENT.encode())
   return ''.join(_bytes)
Example #5
0
 def encode(self):
     _bytes = ['MTrk', _int_to_bytes(self.len_in_bytes(), 4)]
     _bytes.extend([event.encode() for event in self.events])
     _bytes.append(TRACK_END_EVENT.encode())
     return ''.join(_bytes)
Example #6
0
 def test_bytes(self):
     self.assertEqual('\x0d\x0e\xdb', utils._int_to_bytes(0x0d0edb, 3))
Example #7
0
 def encode(self):
   _bytes = '\x00\xff' + _int_to_bytes(self._type, 1)
   _bytes += _int_to_bytes(len(self.args), 1)
   _bytes += ''.join(_int_to_bytes(a, 1) for a in self.args)
   return _bytes
Example #8
0
def encode_ticks(ticks):
  if ticks >= 0b10000000:
    raise Exception('Currently does not support waiting more than %d ticks' % (0b10000000 - 1))
  return _int_to_bytes(ticks, 1)
Example #9
0
 def encode(self):
   _bytes = self.wait_ticks
   _bytes += _int_to_bytes(self._type | self.channel, 1)
   _bytes += ''.join([_int_to_bytes(arg, 1) for arg in self.args])
   return _bytes
Example #10
0
 def encode(self):
   _bytes = '\x00\xff\x51\x03'
   _bytes += _int_to_bytes(self.mpqn, 3)
   return _bytes