Changeset 5408

Show
Ignore:
Timestamp:
10/13/07 19:24:49 (6 years ago)
Author:
jgaeddert
Message:

adding tests for audio playback and capture

Location:
experimental/components/rc2007_gui
Files:
2 added
2 modified

Legend:

Unmodified
Added
Removed
  • experimental/components/rc2007_gui/WorkModules.py

    r5401 r5408  
    3838 
    3939import cvsd     # this is in my rc2007_gui package directory 
     40 
     41def pack_audio(v, num_channels=1): 
     42    '''packs a list of signed shorts into a string which can be read by 
     43    the audio device''' 
     44    s = '' 
     45    for i in v: 
     46        s += struct.pack('h', i) 
     47        if num_channels==2: 
     48            s+= '\0\0' 
     49    return s 
     50 
     51def unpack_audio(s, num_channels=1): 
     52    '''unpacks a string into a vector''' 
     53    v = [] 
     54    if num_channels==2: 
     55        d = 4 
     56    else: 
     57        d = 2 
     58 
     59    for i in range(0,len(s),d): 
     60        v.append( struct.unpack('h', s[i:(i+2)])[0] ) 
     61    return v 
     62 
    4063 
    4164class txWorkClass: 
  • experimental/components/rc2007_gui/test_mic.py

    • Property svn:eol-style set to native