diff --git a/README b/README index 27f879c91..b28812127 100644 --- a/README +++ b/README @@ -1,4 +1,4 @@ -Anki for Linux +Anki ------------------------------------- Prerequisites: @@ -14,14 +14,19 @@ For graph generation: - python-numpy (numpy) - python-matplotlib (matplotlib) +For audio playing support: + +- mplayer on Windows/Linux (Mac uses native libraries) + +For audio recording support: + +- sox +- pyaudio + For furigana generation: - kakasi -For audio support: - -- mplayer - Running / Installation ------------------------------------- diff --git a/ankiqt/ui/sound.py b/ankiqt/ui/sound.py index 987d18c46..3940f81dc 100644 --- a/ankiqt/ui/sound.py +++ b/ankiqt/ui/sound.py @@ -6,21 +6,32 @@ from PyQt4.QtCore import * import time from anki.sound import Recorder, play +from ankiqt.ui.utils import saveGeom, restoreGeom def getAudio(parent, string=""): "Record and return filename" # record first r = Recorder() mb = QMessageBox(parent) + restoreGeom(mb, "audioRecorder") + mb.setWindowTitle("Anki") + mb.setIconPixmap(QPixmap(":/icons/media-record.png")) but = QPushButton(_(" Stop")) but.setIcon(QIcon(":/icons/media-playback-stop.png")) - but.setIconSize(QSize(32, 32)) + #but.setIconSize(QSize(32, 32)) mb.addButton(but, QMessageBox.RejectRole) mb.show() - mb.setText("Recording..") - QApplication.instance().processEvents() + t = time.time() r.start() - mb.exec_() + QApplication.instance().processEvents() + while not mb.clickedButton(): + txt =_("Recording...
Time: %0.1f") + mb.setText(txt % (time.time() - t)) + QApplication.instance().processEvents() + # ensure at least a second captured + saveGeom(mb, "audioRecorder") + while time.time() - t < 1: + time.sleep(0.1) r.stop() # process r.postprocess()