# Commands covered: sound cut
#

package require -exact snack 2.2

if {[lsearch [namespace children] ::tcltest] == -1} {
    package require tcltest
    namespace import ::tcltest::*
}

test cut-1.1 {cut command} {
  set s [snack::sound snd]
  $s length 300000
  $s sample 999 17
  $s sample 299001 17
  $s cut 1000 299000
  set res [list [$s sample 999] [$s sample 1000]]
  $s destroy
  set res
} {17 17}

test cut-1.2 {cut command, stereo} {
  set s [snack::sound snd -channels 2]
  $s length 300000
  $s sample 999 17 4711
  $s sample 299001 17 4711
  $s cut 1000 299000
  set res [list [$s sample 999] [$s sample 1000]]
  $s destroy
  set res
} {{17 4711} {17 4711}}

test cut-1.3 {cut command, 3 channels} {
  set s [snack::sound snd -channels 3]
  $s length 300000
  $s sample 999 17 1 4711
  $s sample 299001 17 -1 4711
  $s cut 1000 299000
  set res [list [$s sample 999] [$s sample 1000]]
  $s destroy
  set res
} {{17 1 4711} {17 -1 4711}}


# cleanup
::tcltest::cleanupTests
return











