getcfg
Prev | Orchestra Opcodes and Operators | Next

## getcfg

getcfg — Return Csound settings.

## Description

Return various configuration settings in Svalue as a string at init time.

## Syntax

    Svalue getcfg iopt

## Initialization

iopt -- The parameter to be returned, can be one of:

- 1: the maximum length of string variables in characters; this is at least the value of the -+max_str_len command line option - 1

- 2: the input sound file name (-i), or empty if there is no input file

- 3: the output sound file name (-o), or empty if there is no output file

- 4: return "1" if real time audio input or output is being used, and "0" otherwise

- 5: return "1" if running in beat mode (-t command line option), and "0" otherwise

- 6: the host operating system name

- 7: return "1" if a callback function for the chnrecv and chnsend opcodes has been set, and "0" otherwise (which means these opcodes do nothing)

## Examples

Here is an example of the getcfg opcode. It uses the file getcfg.csd.

Example 326. Example of the getcfg opcode.

See the sections Real-time Audio and Command Line Flags for more information on using command line flags.

    <CsoundSynthesizer>
    <CsOptions>

    ; Select audio/midi flags here according to platform
    -odac     ;;;realtime audio out
    -iadc    ;;;uncomment -iadc if realtime audio input is needed too
    </CsOptions>
    <CsInstruments>

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

    instr 1

    S1 getcfg 1	; -+max_str_len
    S2 getcfg 2	; -i
    S3 getcfg 3	; -o
    S4 getcfg 4	; RTaudio
    S5 getcfg 5	; -t
    S6 getcfg 6	; os system host
    S7 getcfg 7	; callback

    prints "------------------------------"
    prints "\nMax string len : "
    prints	S1
    prints "\nInput file name (-i) : "
    prints	S2
    prints "\nOutput file name (-o) : "
    prints	S3
    prints "\nRTaudio (-odac) : "
    prints	S4
    prints "\nBeat mode (-t)? : "
    prints	S5
    prints "\nHost Op. Sys. : "
    prints	S6
    prints "\nCallback ? : "
    prints	S7
    prints "\n"
    prints "------------------------------\n"

    endin

    </CsInstruments>
    <CsScore>

    i 1 0 0
    e
    </CsScore>
    </CsoundSynthesizer>

The output should include lines like these:

    ------------------------------
    Max string len : 255
    Input file name (-i) : adc
    Output file name (-o) : dac
    RTaudio (-odac) : 1
    Beat mode (-t)? : 0
    Host Op. Sys. : Linux
    Callback ? : 0
    ------------------------------

## Credits

Author: Istvan Varga
2006

New in version 5.02

Prev | Up | Next
gendyx | Home | gogobel