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