Documentation
¶
Index ¶
- Constants
- func Panning(pan uint8, in int32) (left, right int32)
- type APU
- func (a *APU) Read16(addr uint32) uint16
- func (a *APU) Read32(addr uint32) uint32
- func (a *APU) Read8(addr uint32) uint8
- func (a *APU) Reset()
- func (a *APU) Run(cycles33MHz int64) (lsample, rsample int16)
- func (a *APU) Write16(addr uint32, data uint16)
- func (a *APU) Write32(addr uint32, data uint32)
- func (a *APU) Write8(addr uint32, data uint8)
- type Bus
- type Capture
- type Channel
Constants ¶
View Source
const (
CH_HOLD = 1 << 15
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type APU ¶
type APU struct {
/*
SOUNDCNT(0x0400_0500)
bit:
0-6: 音量(0: 無音, 127: 最大音量)
8-9: Left Output from (0=Left Mixer, 1=Ch1, 2=Ch3, 3=Ch1+Ch3)
10-11: Right Output from (0=Right Mixer, 1=Ch1, 2=Ch3, 3=Ch1+Ch3)
12: Output Ch1 to Mixer (0=Yes, 1=No) (both Left/Right)
13: Output Ch3 to Mixer (0=Yes, 1=No) (both Left/Right)
15: Master Enable (0=Off, 1=On)
*/
Ctrl uint16
Bias uint16 // SOUNDBIAS(0x0400_0504)
Channels [16]*Channel
Capture [2]*Capture
}
APU はARM7からしかアクセスできない (このパッケージのアドレス の アドレス空間は全てARM7のもの)
type Capture ¶
type Capture struct {
/*
SNDCAPxCNT (0x0400_0508, 0x0400_0509)
bit:
0: Control of Associated Sound Channels (ANDed with Bit7)
1: Capture Source Selection
2: Capture Repeat (0=Loop, 1=One-shot)
3: モード (0=PCM16, 1=PCM8)
7: Capture Start/Status (0=Stop, 1=Start/Busy)
*/
Cnt uint8
Dad uint32 // SNDCAPxDAD (0x0400_0510, 0x0400_0518)
ByteLen uint32 // SNDCAPxLEN (0x0400_0514, 0x0400_051C)
Pos int32 // バイト単位
// キャプチャしたデータを格納するFIFO(チャンネルのFIFOとは別物)
FIFO struct {
Buf [4]uint32 // 16バイト, 満タンになると、 .Dad + .DadOffset に書き込まれるっぽいです
Len uint8 // FIFOに入っているデータサイズ(バイト単位)
RPos uint8 // Bufの読み位置(0..3, Bufの読み取りはワード単位でしか行わない)
WPos uint8 // Bufの書き位置(0..15, Bufの書き込みは 8bit か 16bit 単位で行うのでバイト単位)
DadOffset uint32 // Dadに書き込む位置のオフセット(バイト単位)
// contains filtered or unexported fields
}
// contains filtered or unexported fields
}
type Channel ¶
type Channel struct {
/*
SOUNDxCNT(0x0400_04x0)
bit:
0-6: 音量(0: 無音, 127: 最大音量)
8-9: Volume div (0: 1/1, 1: 1/2, 2: 1/4, 3: 1/16)
15: hold (0=Normal, 1=Hold last sample after one-shot sound)
16-22: パン (0..127=左..右, 64: 両方のスピーカに50%); パンでは左右のスピーカに音を振り分ける度合いを指定する
24-26: デューティ比 (0..7) ;HIGH=(N+1)*12.5%, LOW=(7-N)*12.5% (PSG only)
27-28: リピートモード (0=Manual, 1=Loop Infinite, 2=One-Shot, 3=Prohibited)
29-30: モード (0=PCM8, 1=PCM16, 2=ADPCM, 3=PSG(矩形波/ノイズ)); PSG(矩形波) は チャンネル8-13のみ、 PSG(ノイズ) は チャンネル14-15のみで使用可能
31: 実行中かどうか
*/
Ctrl uint32
Src uint32 // SOUNDxSAD(0x0400_04x4)
Tmr uint16 // SOUNDxTMR(0x0400_04x8), 周波数を決定する
LoopPos uint32 // SOUNDxPNT(0x0400_04xA), バイト単位でのループ位置
Length uint32 // SOUNDxLEN(0x0400_04xC), PCM音源のバイト単位での長さ; PSG/ノイズでは使用しない
// チャンネルによって用途が異なる or 使われない
Pos int32 // PCM8, PCM16, ADPCMの再生位置, PSGの音量テーブルの位置
LFSR uint16
ADPCM struct {
// contains filtered or unexported fields
}
// PCM音源を読み込むためのFIFO
FIFO struct {
Buf [8]uint32 // 32バイト
Len uint8 // FIFOに入っているデータサイズ(バイト単位)
// contains filtered or unexported fields
}
// contains filtered or unexported fields
}
APU はARM7からしかアクセスできない (このパッケージのアドレス の アドレス空間は全てARM7のもの)
Click to show internal directories.
Click to hide internal directories.