1 /*---------------------------------------------------------------------------*
2 Project: NintendoWare
3 File: snd_BasicSoundPlayer.cpp
4
5 Copyright (C)2009-2010 Nintendo Co., Ltd./HAL Laboratory, Inc. All rights reserved.
6
7 These coded instructions, statements, and computer programs contain
8 proprietary information of Nintendo of America Inc. and/or Nintendo
9 Company Ltd., and are protected by Federal copyright law. They may
10 not be disclosed to third parties or copied or duplicated in any form,
11 in whole or in part, without the prior written consent of Nintendo.
12
13 $Revision: 22340 $
14 *---------------------------------------------------------------------------*/
15
16 #include "precompiled.h"
17
18 #include <nw/snd/snd_BasicSoundPlayer.h>
19 #include <nw/assert.h>
20
21 namespace nw {
22 namespace snd {
23 namespace internal {
24 namespace driver {
25
Initialize()26 void PlayerParamSet::Initialize()
27 {
28 volume = 1.0f;
29 pitch = 1.0f;
30 pan = 0.0f;
31 surroundPan = 0.0f;
32 lpfFreq = 0.0f;
33
34 isFrontBypass = false;
35 biquadType = BIQUAD_FILTER_TYPE_NONE;
36 biquadValue = 0.0f;
37
38 mainSend = 0.0f;
39
40 panMode = PAN_MODE_DUAL;
41 panCurve = PAN_CURVE_SQRT;
42
43 for ( int i=0; i<AUX_BUS_NUM; i++ )
44 {
45 fxSend[i] = 0.0f;
46 }
47 }
48
BasicSoundPlayer()49 BasicSoundPlayer::BasicSoundPlayer()
50 : m_Event(true),
51 m_ActiveFlag(false),
52 m_StartedFlag(false),
53 m_PauseFlag(false),
54 m_FinishFlag(false)
55 {
56 m_Event.Signal();
57 }
58
Initialize()59 void BasicSoundPlayer::Initialize()
60 {
61 m_Event.ClearSignal();
62
63 m_ActiveFlag = false;
64 m_StartedFlag = false;
65 m_PauseFlag = false;
66 m_FinishFlag = false;
67
68 m_PlayerParamSet.Initialize();
69 }
70
Finalize()71 void BasicSoundPlayer::Finalize()
72 {
73 m_Event.Signal();
74 }
75
SetFxSend(AuxBus bus,float send)76 void BasicSoundPlayer::SetFxSend( AuxBus bus, float send )
77 {
78 NW_MINMAXLT_ASSERT( bus, AUX_BUS_A, AUX_BUS_A + AUX_BUS_NUM );
79 m_PlayerParamSet.fxSend[ bus ] = send;
80 }
81
GetFxSend(AuxBus bus) const82 float BasicSoundPlayer::GetFxSend( AuxBus bus ) const
83 {
84 NW_MINMAXLT_ASSERT( bus, AUX_BUS_A, AUX_BUS_A + AUX_BUS_NUM );
85 return m_PlayerParamSet.fxSend[ bus ];
86 }
87
SetBiquadFilter(int type,float value)88 void BasicSoundPlayer::SetBiquadFilter( int type, float value )
89 {
90 NW_MINMAX_ASSERT( type, 0, BIQUAD_FILTER_TYPE_USER_MAX );
91 NW_MINMAX_ASSERT( value, 0.0f, 1.0f );
92
93 m_PlayerParamSet.biquadType = static_cast<u8>( type );
94 m_PlayerParamSet.biquadValue = value;
95 }
96
97 } // namespace nw::snd::internal::driver
98 } // namespace nw::snd::internal
99 } // namespace nw::snd
100 } // namespace nw
101
102