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: 27883 $
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     m_pPlayerHeapDataManager = NULL;
70 }
71 
Finalize()72 void BasicSoundPlayer::Finalize()
73 {
74     m_Event.Signal();
75 }
76 
SetFxSend(AuxBus bus,float send)77 void BasicSoundPlayer::SetFxSend( AuxBus bus, float send )
78 {
79     NW_MINMAXLT_ASSERT( bus, AUX_BUS_A, AUX_BUS_A + AUX_BUS_NUM );
80     m_PlayerParamSet.fxSend[ bus ] = send;
81 }
82 
GetFxSend(AuxBus bus) const83 float BasicSoundPlayer::GetFxSend( AuxBus bus ) const
84 {
85     NW_MINMAXLT_ASSERT( bus, AUX_BUS_A, AUX_BUS_A + AUX_BUS_NUM );
86     return m_PlayerParamSet.fxSend[ bus ];
87 }
88 
SetBiquadFilter(int type,float value)89 void BasicSoundPlayer::SetBiquadFilter( int type, float value )
90 {
91     NW_MINMAX_ASSERT( type, 0, BIQUAD_FILTER_TYPE_USER_MAX );
92     NW_MINMAX_ASSERT( value, 0.0f, 1.0f );
93 
94     m_PlayerParamSet.biquadType = static_cast<u8>( type );
95     m_PlayerParamSet.biquadValue = value;
96 }
97 
98 } // namespace nw::snd::internal::driver
99 } // namespace nw::snd::internal
100 } // namespace nw::snd
101 } // namespace nw
102 
103