File: stkinit.cpp

package info (click to toggle)
audacity 3.2.4%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 106,704 kB
  • sloc: cpp: 277,038; ansic: 73,623; lisp: 7,761; python: 3,305; sh: 2,715; perl: 821; xml: 275; makefile: 119
file content (50 lines) | stat: -rw-r--r-- 1,252 bytes parent folder | download | duplicates (17)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/* stk path initialization */

#include "stdlib.h"
#include "string.h"
// #include "instr.h"
#include "Stk.h"
#include "stkinit.h"

#ifdef __cplusplus
extern "C" {
#endif

#include "xlisp.h"

#ifdef __cplusplus
}
#endif

using namespace Nyq;

const char *rawwave_path = NULL;

extern "C" void stk_init()
{
    /* wherever the sinewave.raw file is, that will become 
     * the rawwave_path for STK 
     */
    char filename[32];
    strcpy(filename, "rawwaves");
    filename[8] = os_pathchar;
    filename[9] = '\0';
    strcat(filename, "sinewave.raw");
    /* find_in_xlisp_path returns const char *, but we're going to
     * alter it to get just the path, so we have to coerce out the
     * const attribute
     */
    char *path = (char *) find_in_xlisp_path(filename);
    if (!path) {
        errputstr("\nERROR: Could not find sinewave.raw in rawwaves. Something is wrong with the installation or configuration.\n\n");
        rawwave_path = "";
        return;
    }
    /* remove sinewave.raw to get just the path */
    path[strlen(path) - 12] = '\0'; 
    rawwave_path = strcpy((char *) malloc(strlen(path) + 1), path); /* keep a copy */
    /* note: rawwave_path is allocated but never freed */
   Stk::setRawwavePath(path); // PJM
}