1 /*---------------------------------------------------------------------------*
2   Project:  TwlSDK - include - snd - ARM9
3   File:     interface.h
4 
5   Copyright 2004-2008 Nintendo.  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   $Date:: 2008-11-19#$
14   $Rev: 9356 $
15   $Author: ida $
16  *---------------------------------------------------------------------------*/
17 
18 #ifndef NITRO_SND_INTERFACE_H_
19 #define NITRO_SND_INTERFACE_H_
20 
21 #include <nitro/types.h>
22 #include <nitro/snd/common/capture.h>  // for SNDCapture and SNDCaptureFormat
23 #include <nitro/snd/common/channel.h>  // for SNDWaveFormat
24 #include <nitro/snd/common/global.h>   // for SNDChannelMix and SNDOutput
25 #include <nitro/snd/common/alarm.h>    // for SNDAlarmHandler
26 #include <nitro/snd/common/seq.h>      // for SNDSeqMute
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
32 /******************************************************************************
33     structure declaration
34  ******************************************************************************/
35 
36 struct SNDBankData;
37 struct SNDSharedWork;
38 struct SNDSpCallback;
39 struct SNDDriverInfo;
40 
41 /******************************************************************************
42     public function declaration
43  ******************************************************************************/
44 
45 //-----------------------------------------------------------------------------
46 // sequence
47 
48 void    SND_StartSeq(int playerNo, const void *base, u32 offset, const struct SNDBankData *bank);
49 void    SND_PrepareSeq(int playerNo, const void *base, u32 offset, const struct SNDBankData *bank);
50 void    SND_StartPreparedSeq(int playerNo);
51 void    SND_StopSeq(int playerNo);
52 
53 void    SND_StopSeq(int playerNo);
54 void    SND_PauseSeq(int playerNo, BOOL flag);
55 
56 //-----------------------------------------------------------------------------
57 // player
58 
59 void    SND_SetPlayerTempoRatio(int playerNo, int ratio);
60 void    SND_SetPlayerVolume(int playerNo, int volume);
61 void    SND_SetPlayerChannelPriority(int playerNo, int prio);
62 void    SND_SetPlayerLocalVariable(int playerNo, int varNo, s16 var);
63 void    SND_SetPlayerGlobalVariable(int varNo, s16 var);
64 
65 //-----------------------------------------------------------------------------
66 // track
67 
68 void    SND_SetTrackMute(int playerNo, u32 trackBitMask, BOOL flag);
69 void    SND_SetTrackMuteEx(int playerNo, u32 trackBitMask, SNDSeqMute mute);
70 void    SND_SetTrackVolume(int playerNo, u32 trackBitMask, int volume);
71 void    SND_SetTrackPitch(int playerNo, u32 trackBitMask, int pitch);
72 void    SND_SetTrackPan(int playerNo, u32 trackBitMask, int pan);
73 void    SND_SetTrackPanRange(int playerNo, u32 trackBitMask, int panRange);
74 void    SND_SetTrackModDepth(int playerNo, u32 trackBitMask, int depth);
75 void    SND_SetTrackModSpeed(int playerNo, u32 trackBitMask, int speed);
76 void    SND_SetTrackAllocatableChannel(int playerNo, u32 trackBitMask, u32 chBitMask);
77 
78 //-----------------------------------------------------------------------------
79 // timer
80 
81 void    SND_StartTimer(u32 chBitMask, u32 capBitMask, u32 alarmBitMask, u32 flags);
82 void    SND_StopTimer(u32 chBitMask, u32 capBitMask, u32 alarmBitMask, u32 flags);
83 
84 //-----------------------------------------------------------------------------
85 // channel
86 
87 void    SND_LockChannel(u32 chBitMask, u32 flags);
88 void    SND_UnlockChannel(u32 chBitMask, u32 flags);
89 void    SND_StopUnlockedChannel(u32 chBitMask, u32 flags);
90 
91 void    SND_SetupChannelPcm(int chNo,
92                             SNDWaveFormat format,
93                             const void *dataAddr,
94                             SNDChannelLoop loop,
95                             int loopStart,
96                             int loopLen, int volume, SNDChannelDataShift shift, int timer, int pan);
97 void    SND_SetupChannelPsg(int chNo,
98                             SNDDuty duty,
99                             int volume, SNDChannelDataShift shift, int timer, int pan);
100 void    SND_SetupChannelNoise(int chNo, int volume, SNDChannelDataShift shift, int timer, int pan);
101 
102 void    SND_SetChannelVolume(u32 chBitMask, int volume, SNDChannelDataShift shift);
103 void    SND_SetChannelTimer(u32 chBitMask, int timer);
104 void    SND_SetChannelPan(u32 chBitMask, int pan);
105 
106 //-----------------------------------------------------------------------------
107 // capture
108 
109 void    SND_SetupCapture(SNDCapture capture,
110                          SNDCaptureFormat format,
111                          void *buffer_p,
112                          u32 length, BOOL loopFlag, SNDCaptureIn in, SNDCaptureOut out);
113 
114 //-----------------------------------------------------------------------------
115 // alarm
116 
117 void    SND_SetupAlarm(int alarmNo, u32 tick, u32 period, SNDAlarmHandler handler, void *arg);
118 
119 //-----------------------------------------------------------------------------
120 // global setting
121 
122 void    SND_SetMasterVolume(int volume);
123 
124 void    SND_SetOutputSelector(SNDOutput left,
125                               SNDOutput right, SNDChannelOut channel1, SNDChannelOut channel3);
126 
127 void    SND_SetMasterPan(int pan);
128 void    SND_ResetMasterPan(void);
129 
130 //-----------------------------------------------------------------------------
131 // invalidate data
132 
133 void    SND_InvalidateSeqData(const void *start, const void *end);
134 void    SND_InvalidateBankData(const void *start, const void *end);
135 void    SND_InvalidateWaveData(const void *start, const void *end);
136 
137 //-----------------------------------------------------------------------------
138 // driver info
139 
140 void    SND_ReadDriverInfo(struct SNDDriverInfo *info);
141 
142 /******************************************************************************
143     private function declaration
144  ******************************************************************************/
145 
146 void    SNDi_SetPlayerParam(int playerNo, u32 offset, u32 data, int size);
147 void    SNDi_SetTrackParam(int playerNo, u32 trackBitMask, u32 offset, u32 data, int size);
148 void    SNDi_SkipSeq(int playerNo, u32 tick);
149 void    SNDi_SetSurroundDecay(int decay);
150 
151 #ifdef __cplusplus
152 } /* extern "C" */
153 #endif
154 
155 #endif /* NITRO_SND_INTERFACE_H_ */
156