|
12 | 12 | * See the License for the specific language governing permissions and |
13 | 13 | * limitations under the License. */ |
14 | 14 |
|
15 | | - |
16 | 15 | #include "tonePlayer.h" |
17 | 16 |
|
| 17 | +using namespace trikControl; |
18 | 18 |
|
19 | | -namespace trikControl{ |
| 19 | +// This file is temporary commented out to remove dependence from QtMumtimedia. |
| 20 | +// TODO: Restore is as quickly as possible |
20 | 21 |
|
21 | 22 | TonePlayer::TonePlayer() |
| 23 | + : mDevice(nullptr) |
22 | 24 | { |
23 | 25 | mTimer.setSingleShot(true); |
24 | 26 | initializeAudio(); |
25 | | - mDevice = new AudioSynthDevice(this, mFormat.sampleRate(), mFormat.sampleSize()); |
26 | | - mOutput = new QAudioOutput(mFormat, this); |
| 27 | +// mDevice = new AudioSynthDevice(this, mFormat.sampleRate(), mFormat.sampleSize()); |
| 28 | +// mOutput = new QAudioOutput(mFormat, this); |
27 | 29 | } |
28 | 30 |
|
29 | 31 | void TonePlayer::initializeAudio() |
30 | 32 | { |
| 33 | +// mFormat.setChannelCount(1); |
| 34 | +// mFormat.setSampleRate(16000); |
| 35 | +// mFormat.setSampleSize(16); |
| 36 | +// mFormat.setSampleType(QAudioFormat::SampleType::SignedInt); |
| 37 | +// mFormat.setCodec("audio/pcm"); |
31 | 38 |
|
32 | | - mFormat.setChannelCount(1); |
33 | | - mFormat.setSampleRate(16000); |
34 | | - mFormat.setSampleSize(16); |
35 | | - mFormat.setSampleType(QAudioFormat::SampleType::SignedInt); |
36 | | - mFormat.setCodec("audio/pcm"); |
37 | | - |
38 | | - connect(&mTimer, SIGNAL(timeout()), this, SLOT(stop())); |
| 39 | +// connect(&mTimer, SIGNAL(timeout()), this, SLOT(stop())); |
39 | 40 |
|
40 | | - QAudioDeviceInfo info(QAudioDeviceInfo::defaultOutputDevice()); |
41 | | - if (!info.isFormatSupported(mFormat)) { |
42 | | - mFormat = info.nearestFormat(mFormat); |
43 | | - } |
| 41 | +// QAudioDeviceInfo info(QAudioDeviceInfo::defaultOutputDevice()); |
| 42 | +// if (!info.isFormatSupported(mFormat)) { |
| 43 | +// mFormat = info.nearestFormat(mFormat); |
| 44 | +// } |
44 | 45 | } |
45 | 46 |
|
| 47 | +#include<QDebug> |
46 | 48 | void TonePlayer::play(int hzFreq, int msDuration) |
47 | 49 | { |
48 | | - mDevice->start(hzFreq); |
49 | | - switch (mOutput->state()) { |
50 | | - case QAudio::ActiveState: |
51 | | - mOutput->suspend(); |
52 | | - mDevice->reset(); |
53 | | - mOutput->resume(); |
54 | | - break; |
55 | | - case QAudio::SuspendedState: mOutput->resume(); break; |
56 | | - case QAudio::StoppedState: mOutput->start(mDevice); break; |
57 | | - case QAudio::IdleState: mOutput->start(mDevice); break; |
58 | | - default: break; |
59 | | - } |
| 50 | + Q_UNUSED(hzFreq) |
| 51 | + Q_UNUSED(msDuration) |
| 52 | + qWarning() << "Sorry, brick::playTone is not implemented yet!"; |
| 53 | +// mDevice->start(hzFreq); |
| 54 | +// switch (mOutput->state()) { |
| 55 | +// case QAudio::ActiveState: |
| 56 | +// mOutput->suspend(); |
| 57 | +// mDevice->reset(); |
| 58 | +// mOutput->resume(); |
| 59 | +// break; |
| 60 | +// case QAudio::SuspendedState: mOutput->resume(); break; |
| 61 | +// case QAudio::StoppedState: mOutput->start(mDevice); break; |
| 62 | +// case QAudio::IdleState: mOutput->start(mDevice); break; |
| 63 | +// default: break; |
| 64 | +// } |
60 | 65 |
|
61 | | - mTimer.setInterval(msDuration); |
62 | | - mTimer.start(); |
| 66 | +// mTimer.setInterval(msDuration); |
| 67 | +// mTimer.start(); |
63 | 68 | } |
64 | 69 |
|
65 | 70 | void TonePlayer::stop() |
66 | 71 | { |
67 | | - mDevice->stop(); |
68 | | - mTimer.stop(); |
69 | | -} |
| 72 | +// mDevice->stop(); |
| 73 | +// mTimer.stop(); |
70 | 74 | } |
0 commit comments