Csound Csound-dev Csound-tekno Search About

[Csnd] Android Csound Widget Tester

Date2023-09-15 20:36
FromArthur Hunkins <000001e1d761dea2-dmarc-request@LISTSERV.HEANET.IE>
Subject[Csnd] Android Csound Widget Tester
Here is an Android Csound Widget Tester.

It should work on any Android Csound out there (way back to CSD Player).

Developed originally to test Michael's latest (6.18) Csound for Android widgets.

Thanks to Scott for the latched button code.

------------------------------------

CSOUND FOR ANDROID WIDGET TESTER

; This .csd tests Csound for Android widget functionality - buttons, sliders and trackpad. One button, one slider and the trackpad can be tested at a time.

; Select a BUTT (button) and SLIDER for testing below, changing only the numerical value. Buttons are latched on, initiating a tone and allowing the sliders and trackpad to be tested. The specified slider controls pitch, trackpad.x controls tone color, and trackpad.y, amplitude.

; A single-line console message monitors widget behavior, regardless of whether or not a button is latched.

<CsoundSynthesizer>
<CsOptions>

-odac -m0d

</CsOptions>
<CsInstruments>

      sr = 44100
      ksmps = 32
      nchnls = 2
      0dbfs  = 1

#define     BUTT #butt1# ; valid button number
#define     SLIDER  #slider1# ; valid slider number

      instr 1

kfreq init 400
kamp  init 0
kOnOff      init 0
kpw   init .5
kamp2 init 0
kfreq chnget "$SLIDER"
kfreq = 400 + (kfreq * 400)
kamp  chnget "$BUTT"
ktrig trigger kamp, .5, 0
      if  ktrig == 1 then
kOnOff      = kOnOff + 1
      endif
      if kOnOff %2 == 0 then
kamp  = 0
      else
kamp  = .3
      endif
kpw   chnget "trackpad.x"
kpw   = .5 + (kpw * .45)
kamp2 chnget "trackpad.y"
      if kamp > 0 then
kamp  = kamp + (kamp2 * .3)
      endif
      printks "  amp=%.2f freq=%d x=%.2f y=%.2f\\n", 1, kamp, kfreq, kpw, kamp2 * .3
a1    vco2 kamp, kfreq, 4, kpw
      outs a1, a1

      endin

</CsInstruments>
<CsScore>

i1 0 z
e

</CsScore>
</CsoundSynthesizer>


abhunkin@uncg.edu
http://www.arthunkins.com