clear on pause
This commit is contained in:
@@ -132,6 +132,7 @@ void ChatClientVoice::run() {
|
||||
SDL_SetAudioStreamGain(mic, micVol);
|
||||
} else if(!cm->isConnected()) {
|
||||
SDL_PauseAudioStreamDevice(mic);
|
||||
SDL_ClearAudioStream(mic);
|
||||
}
|
||||
|
||||
if(!SDL_AudioStreamDevicePaused(speaker)) {
|
||||
@@ -142,6 +143,8 @@ void ChatClientVoice::run() {
|
||||
SDL_SetAudioStreamGain(speaker, speakerVol);
|
||||
} else if(!cm->isConnected()) {
|
||||
SDL_PauseAudioStreamDevice(speaker);
|
||||
SDL_ClearAudioStream(speaker);
|
||||
|
||||
}
|
||||
|
||||
static int avail = 0;
|
||||
@@ -157,8 +160,10 @@ void ChatClientVoice::run() {
|
||||
// if not testing, send to server.
|
||||
|
||||
avail = SDL_min(len, SDL_GetAudioStreamAvailable(mic));
|
||||
avail = SDL_GetAudioStreamData(mic, buf, avail);
|
||||
//cm->sendReliable(buf, avail);
|
||||
if(avail > 10) {
|
||||
avail = SDL_GetAudioStreamData(mic, buf, avail);
|
||||
cm->sendReliable(buf, avail);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -212,6 +217,8 @@ bool ChatClientVoice::onEvent(const Archimedes::Event& event) {
|
||||
|
||||
SDL_PauseAudioStreamDevice(mic);
|
||||
SDL_PauseAudioStreamDevice(speaker);
|
||||
SDL_ClearAudioStream(mic);
|
||||
SDL_ClearAudioStream(speaker);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user