Skip to content

Commit

Permalink
comments added
Browse files Browse the repository at this point in the history
  • Loading branch information
mattrust committed Jan 5, 2025
1 parent 339079e commit 89397bf
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
9 changes: 9 additions & 0 deletions internal/chunks/handle_8svx.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,36 +25,42 @@ func handle8svxVhdr(data []byte) (StructResult, error) {
var offset uint32
var result StructResult

// handle oneShotHiSamples
oneShotHiSamples, err := getBeUlong(data, &offset)
if err != nil {
return result, err
}
result = append(result, [2]string{"One Shot Hi Samples", fmt.Sprintf("%d", oneShotHiSamples)})

// handle repeatHiSamples
repeatHiSamples, err := getBeUlong(data, &offset)
if err != nil {
return result, err
}
result = append(result, [2]string{"Repeat Hi Samples", fmt.Sprintf("%d", repeatHiSamples)})

// handle samplesPerHiCycle
samplesPerHiCycle, err := getBeUlong(data, &offset)
if err != nil {
return result, err
}
result = append(result, [2]string{"Samples Per Hi Cycle", fmt.Sprintf("%d", samplesPerHiCycle)})

// handle samplesPerSec
samplesPerSec, err := getBeUword(data, &offset)
if err != nil {
return result, err
}
result = append(result, [2]string{"Samples Per Sec", fmt.Sprintf("%d", samplesPerSec)})

// handle ctOctave
ctOctave, err := getUbyte(data, &offset)
if err != nil {
return result, err
}
result = append(result, [2]string{"Octave", fmt.Sprintf("%d", ctOctave)})

// handle sCompression
sCompression, err := getUbyte(data, &offset)
if err != nil {
return result, err
Expand All @@ -66,6 +72,7 @@ func handle8svxVhdr(data []byte) (StructResult, error) {
result = append(result, [2]string{"Compression", "Fibonacci-Delta-Encoded"})
}

// handle volume
volume, err := getBeLong(data, &offset) // TODO: handle Fixed type (16 bit left, 16 bit right)
if err != nil {
return result, err
Expand All @@ -87,12 +94,14 @@ func handle8svxAtakRlse(data []byte) (StructResult, error) {
var offset uint32
var result StructResult

// handle duration
duration, err := getBeUword(data, &offset)
if err != nil {
return result, err
}
result = append(result, [2]string{"Duration", fmt.Sprintf("%d", duration)})

// handle dest
dest, err := getBeLong(data, &offset) // TODO: handle Fixed type (16 bit left, 16 bit right)
if err != nil {
return result, err
Expand Down
10 changes: 10 additions & 0 deletions internal/chunks/handle_anim.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ func handleAnimAnhd(data []byte) (StructResult, error) {
var offset uint32
var result StructResult

// handle operation
operation, err := getUbyte(data, &offset)
if err != nil {
return result, nil
Expand Down Expand Up @@ -59,6 +60,7 @@ func handleAnimAnhd(data []byte) (StructResult, error) {
}
result = append(result, [2]string{"Mask", fmt.Sprintf("%d", mask)})

// handle w,h
w, err := getBeUword(data, &offset)
if err != nil {
return result, err
Expand All @@ -69,6 +71,7 @@ func handleAnimAnhd(data []byte) (StructResult, error) {
}
result = append(result, [2]string{"Width : Height", fmt.Sprintf("%d : %d", w, h)})

// handle x,y
x, err := getBeWord(data, &offset)
if err != nil {
return result, err
Expand All @@ -79,18 +82,21 @@ func handleAnimAnhd(data []byte) (StructResult, error) {
}
result = append(result, [2]string{"Position x : y", fmt.Sprintf("%d : %d", x, y)})

// handle abstime
abstime, err := getBeUlong(data, &offset)
if err != nil {
return result, err
}
result = append(result, [2]string{"Absolute Time", fmt.Sprintf("%d", abstime)})

// handle reltime
reltime, err := getBeUlong(data, &offset)
if err != nil {
return result, err
}
result = append(result, [2]string{"Relative Time", fmt.Sprintf("%d", reltime)})

// handle interleave
interleave, err := getUbyte(data, &offset)
if err != nil {
return result, err
Expand All @@ -99,6 +105,7 @@ func handleAnimAnhd(data []byte) (StructResult, error) {

offset++ // ignore pad0

// handle bits
bits, err := getBeUlong(data, &offset)
if err != nil {
return result, err
Expand Down Expand Up @@ -165,18 +172,21 @@ func handleAnimDpan(data []byte) (StructResult, error) {
var offset uint32
var result StructResult

//
version, err := getBeUword(data, &offset)
if err != nil {
return result, err
}
result = append(result, [2]string{"Version", fmt.Sprintf("%d", version)})

// handle nframes
nframes, err := getBeUword(data, &offset)
if err != nil {
return result, err
}
result = append(result, [2]string{"Number of Frames", fmt.Sprintf("%d", nframes)})

// handle flags
flags, err := getBeUlong(data, &offset)
if err != nil {
return result, err
Expand Down
15 changes: 15 additions & 0 deletions internal/chunks/handle_ilbm.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ func handleIlbmBmhd(data []byte) (StructResult, error) {
var offset uint32
var result StructResult

// handle w, h
w, err := getBeUword(data, &offset)
if err != nil {
return result, err
Expand All @@ -37,6 +38,7 @@ func handleIlbmBmhd(data []byte) (StructResult, error) {
}
result = append(result, [2]string{"Width : Height", fmt.Sprintf("%d : %d", w, h)})

// handle x, y
x, err := getBeWord(data, &offset)
if err != nil {
return result, err
Expand All @@ -47,12 +49,14 @@ func handleIlbmBmhd(data []byte) (StructResult, error) {
}
result = append(result, [2]string{"Position x : y", fmt.Sprintf("%d : %d", x, y)})

// handle nPlanes
nPlanes, err := getUbyte(data, &offset)
if err != nil {
return result, err
}
result = append(result, [2]string{"Number of planes", fmt.Sprintf("%d", nPlanes)})

// handle masking
masking, err := getUbyte(data, &offset)
if err != nil {
return result, err
Expand All @@ -68,6 +72,7 @@ func handleIlbmBmhd(data []byte) (StructResult, error) {
result = append(result, [2]string{"Masking", "Lasso"})
}

// handle compression
compression, err := getUbyte(data, &offset)
if err != nil {
return result, err
Expand All @@ -81,12 +86,14 @@ func handleIlbmBmhd(data []byte) (StructResult, error) {

offset++ // ignore pad1

// handle transparentColor
transparentColor, err := getBeUword(data, &offset)
if err != nil {
return result, err
}
result = append(result, [2]string{"Transparent Color", fmt.Sprintf("%d", transparentColor)})

// handle xAspect, yAspect
xAspect, err := getUbyte(data, &offset)
if err != nil {
return result, err
Expand All @@ -97,6 +104,7 @@ func handleIlbmBmhd(data []byte) (StructResult, error) {
}
result = append(result, [2]string{"Aspect Ratio x : y", fmt.Sprintf("%d : %d", xAspect, yAspect)})

// handle pageWidth, pageHeight
pageWidth, err := getBeWord(data, &offset)
if err != nil {
return result, err
Expand Down Expand Up @@ -227,18 +235,21 @@ func handleIlbmDest(data []byte) (StructResult, error) {

offset++ // ignore pad1

// handle planePick
planePick, err := getBeUword(data, &offset)
if err != nil {
return result, err
}
result = append(result, [2]string{"Plane Pick", fmt.Sprintf("%032b", planePick)})

// handle planeOnOff
planeOnOff, err := getBeUword(data, &offset)
if err != nil {
return result, err
}
result = append(result, [2]string{"Plane On/Off", fmt.Sprintf("%032b", planeOnOff)})

// handle planeMask
planeMask, err := getBeUword(data, &offset)
if err != nil {
return result, err
Expand Down Expand Up @@ -282,12 +293,14 @@ func handleIlbmCrng(data []byte) (StructResult, error) {

offset += 2 // ignore pad1

// handle rate
rate, err := getBeWord(data, &offset)
if err != nil {
return result, err
}
result = append(result, [2]string{"Rate", fmt.Sprintf("%d", rate)})

// handle flags
flags, err := getBeWord(data, &offset)
if err != nil {
return result, err
Expand All @@ -299,12 +312,14 @@ func handleIlbmCrng(data []byte) (StructResult, error) {
result = append(result, [2]string{"Flags", "Reverse"})
}

// handle low
low, err := getUbyte(data, &offset)
if err != nil {
return result, err
}
result = append(result, [2]string{"Low", fmt.Sprintf("%d", low)})

// handle high
high, err := getUbyte(data, &offset)
if err != nil {
return result, err
Expand Down

0 comments on commit 89397bf

Please sign in to comment.