Merge pull request #779 from birarda/rave-audio

fix resetting of song mix menu item after import is done
This commit is contained in:
ZappoMan 2013-08-05 12:27:47 -07:00
commit fe877b0ec8
3 changed files with 16 additions and 6 deletions

View file

@ -2128,13 +2128,21 @@ void Application::toggleMixedSong() {
QByteArray filenameArray = filename.toLocal8Bit();
_audio.importSongToMixWithMicrophone(filenameArray.data());
_rawAudioMicrophoneMix->setText("Stop Mixing Song");
resetSongMixMenuItem();
} else {
_audio.stopMixingSongWithMicrophone();
_rawAudioMicrophoneMix->setText("Mix RAW Song");
resetSongMixMenuItem();
}
}
void Application::resetSongMixMenuItem() {
if (_audio.getSongFileBytes() == 0) {
_rawAudioMicrophoneMix->setText("Mix RAW Song");
} else {
_rawAudioMicrophoneMix->setText("Stop Mixing Song");
}
}
void Application::updateFrustumRenderModeAction() {
switch (_frustumDrawingMode) {

View file

@ -105,12 +105,12 @@ public:
QNetworkAccessManager* getNetworkAccessManager() { return _networkAccessManager; }
GeometryCache* getGeometryCache() { return &_geometryCache; }
void resetSongMixMenuItem();
public slots:
void sendAvatarFaceVideoMessage(int frameCount, const QByteArray& data);
private slots:
void timer();

View file

@ -154,7 +154,7 @@ inline void Audio::performIO(int16_t* inputLeft, int16_t* outputLeft, int16_t* o
currentPacketPtr += sizeof(headOrientation);
// check if we have a song to add to our audio
if (_songFileBytes > 0 && _songFileStream->tellg() <= _songFileBytes) {
if (_songFileBytes > 0 && _songFileStream->tellg() != -1) {
// iterate over BUFFER_LENGTH_SAMPLES_PER_CHANNEL from the song file and add that to our audio
for (int i = 0; i < BUFFER_LENGTH_SAMPLES_PER_CHANNEL; i++) {
int16_t songSample = 0;
@ -180,6 +180,9 @@ inline void Audio::performIO(int16_t* inputLeft, int16_t* outputLeft, int16_t* o
// reset the _songFileBytes back to zero
_songFileBytes = 0;
// call Application stopMixingSong method to fix menu item
Application::getInstance()->resetSongMixMenuItem();
}
// copy the audio data to the last BUFFER_LENGTH_BYTES bytes of the data packet
@ -501,7 +504,6 @@ void Audio::importSongToMixWithMicrophone(const char* filename) {
}
void Audio::stopMixingSongWithMicrophone() {
qDebug("Stop mixing called!");
_songFileBytes = 0;
}