From 291ea8c0692472bcf99ccd089b6de45610be85b9 Mon Sep 17 00:00:00 2001 From: Alexander Monakov Date: Mon, 3 Jan 2011 21:58:52 +0300 Subject: [PATCH] Introduce resume_stream --- Source/GameTick.cpp | 4 ++-- Source/Person.cpp | 12 ++++++++---- Source/Sounds.cpp | 12 ++++++++++++ Source/Sounds.h | 2 ++ 4 files changed, 24 insertions(+), 6 deletions(-) diff --git a/Source/GameTick.cpp b/Source/GameTick.cpp index b74cb5e..49ea5d2 100644 --- a/Source/GameTick.cpp +++ b/Source/GameTick.cpp @@ -2314,7 +2314,7 @@ void Game::Tick() } if(!mainmenu){ OPENAL_SetPaused(channels[stream_music3], true); - OPENAL_SetPaused(channels[music1], false); + resume_stream(music1); } } if(mainmenu==3){ @@ -2388,7 +2388,7 @@ void Game::Tick() //resume mainmenu=0; OPENAL_SetPaused(channels[stream_music3], true); - OPENAL_SetPaused(channels[music1], false); + resume_stream(music1); } } diff --git a/Source/Person.cpp b/Source/Person.cpp index 25713a4..a6a9c50 100644 --- a/Source/Person.cpp +++ b/Source/Person.cpp @@ -123,7 +123,8 @@ void Person::CheckKick() velocity=facing*-10; velocity.y=5; skeleton.free=0; - if(id==0)OPENAL_SetPaused(channels[whooshsound], false); + if(id==0) + resume_stream(whooshsound); award_bonus(id, cannon); } @@ -3340,7 +3341,8 @@ void Person::DoAnimations(){ targetframe=3; velocity=facing*-8; velocity.y=4; - if(id==0)OPENAL_SetPaused(channels[whooshsound], false); + if(id==0) + resume_stream(whooshsound); } if(targetanimation==walljumprightanim){ targetanimation=rightflipanim; @@ -3358,7 +3360,8 @@ void Person::DoAnimations(){ velocity=facing*8; velocity.y=4; } - if(id==0)OPENAL_SetPaused(channels[whooshsound], false); + if(id==0) + resume_stream(whooshsound); } if(targetanimation==walljumpleftanim){ if(attackkeydown){ @@ -3398,7 +3401,8 @@ void Person::DoAnimations(){ velocity=DoRotation(facing,0,-30,0)*-8; velocity.y=4; } - if(id==0)OPENAL_SetPaused(channels[whooshsound], false); + if(id==0) + resume_stream(whooshsound); } if(targetanimation==sneakattackanim){ float ycoords=oldcoords.y; diff --git a/Source/Sounds.cpp b/Source/Sounds.cpp index 96e18fd..c853553 100644 --- a/Source/Sounds.cpp +++ b/Source/Sounds.cpp @@ -107,3 +107,15 @@ emit_stream_np(int soundid, float vol) OPENAL_SetPaused (channels[soundid], false); } +void +resume_stream(int soundid) +{ + OPENAL_SetPaused (channels[soundid], false); +} + +void +pause_sound(int soundid) +{ + OPENAL_SetPaused (channels[soundid], true); +} + diff --git a/Source/Sounds.h b/Source/Sounds.h index cdf7d18..ee9eb21 100644 --- a/Source/Sounds.h +++ b/Source/Sounds.h @@ -37,6 +37,8 @@ extern void emit_sound_at(int soundid, const XYZ &pos = XYZ(), float vol = 256.f extern void emit_sound_np(int soundid, float vol = 256.f); extern void emit_stream_at(int soundid, const XYZ &pos = XYZ(), float vol = 256.f); extern void emit_stream_np(int soundid, float vol = 256.f); +extern void resume_stream(int soundid); +extern void pause_sound(int soundid); extern int footstepsound, footstepsound2, footstepsound3, footstepsound4; #endif -- 2.39.5