Added MP3 and OGG support
This commit is contained in:
parent
023e4ca5bd
commit
1d08fd9587
2
control
2
control
|
|
@ -4,6 +4,6 @@ Section: graphics
|
||||||
Priority: optional
|
Priority: optional
|
||||||
Architecture: all
|
Architecture: all
|
||||||
Installed-size: 27000
|
Installed-size: 27000
|
||||||
Depends: bash, python, python-imaging, imagemagick, libzzip-0-13, sox, python-numpy
|
Depends: bash, python, python-imaging, imagemagick, libzzip-0-13, sox, python-numpy, mplayer
|
||||||
Maintainer: skycooler@gmail.com
|
Maintainer: skycooler@gmail.com
|
||||||
Description: Lightningbeam is an open-source animated content creation tool.
|
Description: Lightningbeam is an open-source animated content creation tool.
|
||||||
|
|
|
||||||
|
|
@ -685,7 +685,7 @@ def save_file_as(widget=None):
|
||||||
pass
|
pass
|
||||||
def import_to_stage(widget=None):
|
def import_to_stage(widget=None):
|
||||||
try:
|
try:
|
||||||
thefile = svlgui.file_dialog("open",None,["jpg","png","bmp","wav"]).path
|
thefile = svlgui.file_dialog("open",None,["jpg","png","bmp","wav","mp3","ogg"]).path
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
# User cancelled
|
# User cancelled
|
||||||
return
|
return
|
||||||
|
|
@ -716,7 +716,12 @@ def import_to_stage(widget=None):
|
||||||
root.descendItem().add(im)
|
root.descendItem().add(im)
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
if thefile.endswith("wav"):
|
for i in ("wav", "mp3", "ogg"):
|
||||||
|
if thefile.endswith(i):
|
||||||
|
if i in ("mp3", "ogg"):
|
||||||
|
theorigfile = thefile
|
||||||
|
thefile = svlgui.SECURETEMPDIR+"/"+thefile.split('/')[-1]+'.wav'
|
||||||
|
os.system('mplayer -srate 48000 -vo null -vc null -ao pcm:fast:file="'+thefile+'" "'+theorigfile+'"')
|
||||||
if svlgui.PLATFORM=="osx":
|
if svlgui.PLATFORM=="osx":
|
||||||
if not os.path.exists('sox/sox'):
|
if not os.path.exists('sox/sox'):
|
||||||
try:
|
try:
|
||||||
|
|
@ -762,8 +767,12 @@ def import_to_stage(widget=None):
|
||||||
data = NP.fromstring(subprocess.check_output(cmd),'<i%d'%(out_byps))
|
data = NP.fromstring(subprocess.check_output(cmd),'<i%d'%(out_byps))
|
||||||
data = data.reshape(len(data)/num_channels, num_channels)
|
data = data.reshape(len(data)/num_channels, num_channels)
|
||||||
info = subprocess.check_output([SOX_EXEC,'--i',thefile])
|
info = subprocess.check_output([SOX_EXEC,'--i',thefile])
|
||||||
sound = svlgui.Sound(data, name=thefile.split('/')[-1], path=thefile, info=info)
|
if i=="mp3":
|
||||||
|
sound = svlgui.Sound(data, name=thefile.split('/')[-1], path=theorigfile, info=info, type=i)
|
||||||
|
else:
|
||||||
|
sound = svlgui.Sound(data, name=thefile.split('/')[-1], path=thefile, info=info, type=i)
|
||||||
root.descendItem().add(sound)
|
root.descendItem().add(sound)
|
||||||
|
break
|
||||||
|
|
||||||
MainWindow.stage.draw()
|
MainWindow.stage.draw()
|
||||||
def import_to_library(widget=None):
|
def import_to_library(widget=None):
|
||||||
|
|
|
||||||
|
|
@ -1977,7 +1977,7 @@ class Text (object):
|
||||||
|
|
||||||
class Sound:
|
class Sound:
|
||||||
"""Class for storing sounds in."""
|
"""Class for storing sounds in."""
|
||||||
def __init__(self, data, name, path, info):
|
def __init__(self, data, name, path, info, type):
|
||||||
global Library
|
global Library
|
||||||
Library.append(self)
|
Library.append(self)
|
||||||
self.data = data
|
self.data = data
|
||||||
|
|
@ -1989,6 +1989,7 @@ class Sound:
|
||||||
self.yscale = 0
|
self.yscale = 0
|
||||||
self.path = path
|
self.path = path
|
||||||
self.iname = None
|
self.iname = None
|
||||||
|
self.type = type
|
||||||
reading_comments_flag = False
|
reading_comments_flag = False
|
||||||
other = ''
|
other = ''
|
||||||
for l in info.splitlines():
|
for l in info.splitlines():
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue