Skip to content

Commit

Permalink
Add test (#1).
Browse files Browse the repository at this point in the history
  • Loading branch information
gogins committed Nov 3, 2023
1 parent bbc43b8 commit 1056413
Showing 1 changed file with 82 additions and 0 deletions.
82 changes: 82 additions & 0 deletions src/jackops/jacko_test.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
<CsoundSynthesizer>
<CsLicense>

TEST JACKO OPCODES
Michael Gogins

This csd tests the Jacko opcodes.

There is a segmentation fault at the end of the performance. This does happen
in the Jacko plugin, but it does not affect the performance.

Csound not only writes a soundfile using -o, but also sends realtime audio and
MIDI to other Jack clients using Jack connections.

Test MIDI output with:

zynaddsubfx --input JACK --output JACK --auto-connect --sample-rate 48000 --buffer-size 128

</CsLicense>
<CsOptions>
;-o jacko.wav
</CsOptions>
<CsInstruments>
; Sampling rate must be the same as for Jack.
sr=48000
; ksmps must be the same as for Jack's frames/period.
ksmps=128
nchnls=2
0dbfs=40000

ga_audio_out init 0

; Initialize the Jack connections.
JackoInit "default", "csound6"
prints "Initial ports and connections:\n"
JackoInfo
JackoAudioOutConnect "audio_out_left", "system:playback_1"
JackoAudioOutConnect "audio_out_right", "system:playback_2"
JackoMidiInConnect "system:midi_capture_1", "midiin"
JackoMidiOutConnect "midiout", "zynaddsubfx:midi_input"
prints "Final ports and connections:\n"
JackoInfo
JackoOn

instr 1
print p1, p2, p3, p4, p5
i_frequency = cpsmidinn(p4)
i_amplitude = ampdb(p5)
print i_frequency, i_amplitude
prints "We want to hear something just to prove Jack is indeed routing audio."
a_out oscil i_amplitude, i_frequency
ga_audio_out += a_out;
; Uncomment the following line to test if Jacko hangs Csound.
; event "e", 0, 0, 0.1
prints "\nHi Michael!\n"
endin

; Sends notes to an external MIDI synthesizer.
instr 801
print p1, p2, p3, p4, p5
JackoNoteOut "midiout", 0, p4, p5
prints "Sent note to midiout.\n"
endin

instr 900
print p1, p2, p3
outs ga_audio_out, ga_audio_out
JackoAudioOut "audio_out_left", ga_audio_out
JackoAudioOut "audio_out_right", ga_audio_out
ga_audio_out = 0
endin

</CsInstruments>
<CsScore>
i1 5 3 63 60
i801 10 3 69 60
i1 15 3 72 60
i900 0 -1
e
</CsScore>

</CsoundSynthesizer>

0 comments on commit 1056413

Please sign in to comment.