/* ----------------------------------------------------------------------------
 * This file was automatically generated by SWIG (http://www.swig.org).
 * Version: 1.3.21
 *
 * Do not make changes to this file unless you know what you are doing--modify
 * the SWIG interface file instead.
 * ----------------------------------------------------------------------------- */


Class name: Buffer extends: SwigProxy fields: swigCPtrForBuffer, swigCMemoryOwn {

  Method [ pvtSetCPtr: newCPtr memoryOwn: newCMemoryOwn
    swigCMemoryOwn := newCMemoryOwn.
    swigCPtrForBuffer := newCPtr.
  ]

  Method [ getCPtrForBuffer
    ^swigCPtrForBuffer
  ]


  Method[ swigFinalize
    super swigFinalize.
    self delete.
  ]

  Method [ delete 
    (swigCMemoryOwn and:[ swigCPtrForBuffer ~~ 0 ]) ifTrue:[
      swigCMemoryOwn := false.
      CslNI cslNI_delete_Buffer: swigCPtrForBuffer.
    ].
    swigCPtrForBuffer := 0.
  ]

  Function[ getCPtr: obj
     obj isNil ifTrue:[^0].
     ^obj getCPtrForBuffer
  ]

  Function [ numChannels: numChannels numFrames: numFrames
    ^self fromPointer: (CslNI cslNI_new_Buffer__SWIG_0: numChannels, numFrames) memoryOwn: true
  ]

  Function [ numChannels: numChannels
    ^self fromPointer: (CslNI cslNI_new_Buffer__SWIG_1: numChannels) memoryOwn: true
  ]

  Function [ new
    ^self fromPointer: (CslNI cslNI_new_Buffer__SWIG_2) memoryOwn: true
  ]

  Method [ setMMonoBuffers: mMonoBuffers 
    CslNI cslNI_set_Buffer_mMonoBuffers: swigCPtrForBuffer with: (SwigTypePstdvectorTfloatpstdallocatorTfloatptt getCPtr: mMonoBuffers)
  ]

  Method [ getMMonoBuffers 
    |cPtr|
    cPtr := CslNI cslNI_get_Buffer_mMonoBuffers: swigCPtrForBuffer .
    ^(cPtr == 0) ifTrue:[ nil ] ifFalse:[ SwigTypePstdvectorTfloatpstdallocatorTfloatptt fromPointer: cPtr memoryOwn: false ]
  ]

  Method [ setMNumChannels: mNumChannels 
    CslNI cslNI_set_Buffer_mNumChannels: swigCPtrForBuffer with: mNumChannels
  ]

  Method [ getMNumChannels 
    ^CslNI cslNI_get_Buffer_mNumChannels: swigCPtrForBuffer 
  ]

  Method [ setMNumFrames: mNumFrames 
    CslNI cslNI_set_Buffer_mNumFrames: swigCPtrForBuffer with: mNumFrames
  ]

  Method [ getMNumFrames 
    ^CslNI cslNI_get_Buffer_mNumFrames: swigCPtrForBuffer 
  ]

  Method [ setMMonoBufferByteSize: mMonoBufferByteSize 
    CslNI cslNI_set_Buffer_mMonoBufferByteSize: swigCPtrForBuffer with: mMonoBufferByteSize
  ]

  Method [ getMMonoBufferByteSize 
    ^CslNI cslNI_get_Buffer_mMonoBufferByteSize: swigCPtrForBuffer 
  ]

  Method [ setMSequence: mSequence 
    CslNI cslNI_set_Buffer_mSequence: swigCPtrForBuffer with: mSequence
  ]

  Method [ getMSequence 
    ^CslNI cslNI_get_Buffer_mSequence: swigCPtrForBuffer 
  ]

  Method [ setMTimestamp: mTimestamp 
    CslNI cslNI_set_Buffer_mTimestamp: swigCPtrForBuffer with: mTimestamp
  ]

  Method [ getMTimestamp 
    ^CslNI cslNI_get_Buffer_mTimestamp: swigCPtrForBuffer 
  ]

  Method [ setMAreBuffersAllocated: mAreBuffersAllocated 
    CslNI cslNI_set_Buffer_mAreBuffersAllocated: swigCPtrForBuffer with: mAreBuffersAllocated asBooleanParameter
  ]

  Method [ getMAreBuffersAllocated 
	^(CslNI cslNI_get_Buffer_mAreBuffersAllocated: swigCPtrForBuffer ) asBoolean
  ]

  Method [ setMDidIAllocateBuffers: mDidIAllocateBuffers 
    CslNI cslNI_set_Buffer_mDidIAllocateBuffers: swigCPtrForBuffer with: mDidIAllocateBuffers asBooleanParameter
  ]

  Method [ getMDidIAllocateBuffers 
	^(CslNI cslNI_get_Buffer_mDidIAllocateBuffers: swigCPtrForBuffer ) asBoolean
  ]

  Method [ setMIsPopulated: mIsPopulated 
    CslNI cslNI_set_Buffer_mIsPopulated: swigCPtrForBuffer with: mIsPopulated asBooleanParameter
  ]

  Method [ getMIsPopulated 
	^(CslNI cslNI_get_Buffer_mIsPopulated: swigCPtrForBuffer ) asBoolean
  ]

  Method [ setMAreBuffersZero: mAreBuffersZero 
    CslNI cslNI_set_Buffer_mAreBuffersZero: swigCPtrForBuffer with: mAreBuffersZero asBooleanParameter
  ]

  Method [ getMAreBuffersZero 
	^(CslNI cslNI_get_Buffer_mAreBuffersZero: swigCPtrForBuffer ) asBoolean
  ]

  Method [ setMType: mType 
    CslNI cslNI_set_Buffer_mType: swigCPtrForBuffer with: mType
  ]

  Method [ getMType 
    ^CslNI cslNI_get_Buffer_mType: swigCPtrForBuffer 
  ]

  Method [ setSize: numChannels numFrames: numFrames 
    CslNI cslNI_Buffer_setSize: swigCPtrForBuffer with: numChannels with: numFrames
  ]

  Method [ setSizeOnly: numChannels numFrames: numFrames 
    CslNI cslNI_Buffer_setSizeOnly: swigCPtrForBuffer with: numChannels with: numFrames
  ]

  Method [ allocateMonoBuffers 
    CslNI cslNI_Buffer_allocateMonoBuffers: swigCPtrForBuffer 
  ]

  Method [ freeMonoBuffers 
    CslNI cslNI_Buffer_freeMonoBuffers: swigCPtrForBuffer 
  ]

  Method [ zeroBuffers 
    CslNI cslNI_Buffer_zeroBuffers: swigCPtrForBuffer 
  ]

  Method [ fillWith: value 
    CslNI cslNI_Buffer_fillWith: swigCPtrForBuffer with: value
  ]

  Method [ copySamplesFrom: src 
    CslNI cslNI_Buffer_copySamplesFrom: swigCPtrForBuffer with: (Buffer getCPtr: src)
  ]

  Method [ monoBuffer: bufNum 
    |cPtr|
    cPtr := CslNI cslNI_Buffer_monoBuffer: swigCPtrForBuffer with: bufNum.
    ^(cPtr == 0) ifTrue:[ nil ] ifFalse:[ SwigTypePfloat fromPointer: cPtr memoryOwn: false ]
  ]

  Method [ rms: chan 
    ^CslNI cslNI_Buffer_rms: swigCPtrForBuffer with: chan
  ]

  Method [ avg: chan 
    ^CslNI cslNI_Buffer_avg: swigCPtrForBuffer with: chan
  ]

  Method [ max: chan 
    ^CslNI cslNI_Buffer_max: swigCPtrForBuffer with: chan
  ]

  Method [ min: chan 
    ^CslNI cslNI_Buffer_min: swigCPtrForBuffer with: chan
  ]

  Method [ zeroX: chan 
    ^CslNI cslNI_Buffer_zeroX: swigCPtrForBuffer with: chan
  ]

  Method [ indexOfPeak: chan 
    ^CslNI cslNI_Buffer_indexOfPeak__SWIG_0: swigCPtrForBuffer with: chan
  ]

  Method [ indexOfPeak: chan low: low hi: hi 
    ^CslNI cslNI_Buffer_indexOfPeak__SWIG_1: swigCPtrForBuffer with: chan with: low with: hi
  ]

  Method [ indexOfMin: chan 
    ^CslNI cslNI_Buffer_indexOfMin__SWIG_0: swigCPtrForBuffer with: chan
  ]

  Method [ indexOfMin: chan low: low hi: hi 
    ^CslNI cslNI_Buffer_indexOfMin__SWIG_1: swigCPtrForBuffer with: chan with: low with: hi
  ]

  Method [ autocorrelation: chan result: result 
    CslNI cslNI_Buffer_autocorrelation: swigCPtrForBuffer with: chan with: (SwigTypePfloat getCPtr: result)
  ]

}
