mirror of
https://github.com/overte-org/overte.git
synced 2025-04-23 06:53:46 +02:00
add option to audio menu to stop the mixed audio
This commit is contained in:
parent
d56b715432
commit
d259180778
4 changed files with 30 additions and 9 deletions
|
@ -1793,7 +1793,7 @@ void Application::initMenu() {
|
|||
|
||||
QMenu* audioMenu = menuBar->addMenu("Audio");
|
||||
(_echoAudioMode = audioMenu->addAction("Echo Audio"))->setCheckable(true);
|
||||
audioMenu->addAction("Mix RAW Audio", this, SLOT(importMixSong()));
|
||||
_rawAudioMicrophoneMix = audioMenu->addAction("Mix RAW Song", this, SLOT(toggleMixedSong()));
|
||||
|
||||
QMenu* renderMenu = menuBar->addMenu("Render");
|
||||
(_renderVoxels = renderMenu->addAction("Voxels", this, SLOT(setRenderVoxels(bool)), Qt::SHIFT | Qt::Key_V))->setCheckable(true);
|
||||
|
@ -1963,13 +1963,20 @@ void Application::setListenModeSingleSource() {
|
|||
}
|
||||
}
|
||||
|
||||
void Application::importMixSong() {
|
||||
QString filename = QFileDialog::getOpenFileName(_glWidget,
|
||||
tr("Choose RAW Audio file"),
|
||||
QStandardPaths::writableLocation(QStandardPaths::DesktopLocation),
|
||||
tr("RAW Audio file (*.raw)"));
|
||||
|
||||
_audio.importSongToMixWithMicrophone(filename.toLocal8Bit().data());
|
||||
void Application::toggleMixedSong() {
|
||||
if (_audio.getSongFileBytes() == 0) {
|
||||
QString filename = QFileDialog::getOpenFileName(_glWidget,
|
||||
tr("Choose RAW Audio file"),
|
||||
QStandardPaths::writableLocation(QStandardPaths::DesktopLocation),
|
||||
tr("RAW Audio file (*.raw)"));
|
||||
|
||||
QByteArray filenameArray = filename.toLocal8Bit();
|
||||
_audio.importSongToMixWithMicrophone(filenameArray.data());
|
||||
_rawAudioMicrophoneMix->setText("Stop Mixing Song");
|
||||
} else {
|
||||
_audio.stopMixingSongWithMicrophone();
|
||||
_rawAudioMicrophoneMix->setText("Mix RAW Song");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -177,7 +177,7 @@ private slots:
|
|||
void setListenModeNormal();
|
||||
void setListenModePoint();
|
||||
void setListenModeSingleSource();
|
||||
void importMixSong();
|
||||
void toggleMixedSong();
|
||||
|
||||
|
||||
void renderCoverageMap();
|
||||
|
@ -287,6 +287,7 @@ private:
|
|||
QAction* _fullScreenMode; // whether we are in full screen mode
|
||||
QAction* _frustumRenderModeAction;
|
||||
QAction* _settingsAutosave; // Whether settings are saved automatically
|
||||
QAction* _rawAudioMicrophoneMix; // Mixing of a RAW audio file with microphone stream for rave gloves
|
||||
|
||||
QAction* _renderCoverageMapV2;
|
||||
QAction* _renderCoverageMap;
|
||||
|
|
|
@ -168,6 +168,10 @@ inline void Audio::performIO(int16_t* inputLeft, int16_t* outputLeft, int16_t* o
|
|||
outputLeft[i] = outputLeft[i] + songSample;
|
||||
outputRight[i] = outputLeft[i] + songSample;
|
||||
}
|
||||
} else if (_songFileStream) {
|
||||
_songFileStream->close();
|
||||
delete _songFileStream;
|
||||
_songFileStream = NULL;
|
||||
}
|
||||
|
||||
// copy the audio data to the last BUFFER_LENGTH_BYTES bytes of the data packet
|
||||
|
@ -488,6 +492,10 @@ void Audio::importSongToMixWithMicrophone(const char* filename) {
|
|||
_songFileBytes = end - begin;
|
||||
}
|
||||
|
||||
void Audio::stopMixingSongWithMicrophone() {
|
||||
qDebug("Stop mixing called!");
|
||||
_songFileBytes = 0;
|
||||
}
|
||||
|
||||
void Audio::addReceivedAudioToBuffer(unsigned char* receivedData, int receivedBytes) {
|
||||
const int NUM_INITIAL_PACKETS_DISCARD = 3;
|
||||
|
|
|
@ -53,6 +53,8 @@ public:
|
|||
void startCollisionSound(float magnitude, float frequency, float noise, float duration);
|
||||
float getCollisionSoundMagnitude() { return _collisionSoundMagnitude; };
|
||||
|
||||
int getSongFileBytes() { return _songFileBytes; }
|
||||
|
||||
void ping();
|
||||
|
||||
// Call periodically to eventually perform round trip time analysis,
|
||||
|
@ -67,6 +69,9 @@ public:
|
|||
void clearListenSources();
|
||||
|
||||
void importSongToMixWithMicrophone(const char* filename);
|
||||
|
||||
public slots:
|
||||
void stopMixingSongWithMicrophone();
|
||||
|
||||
private:
|
||||
PaStream* _stream;
|
||||
|
|
Loading…
Reference in a new issue