CsoundObject *CsoundObject_new(char *csdPath, size_t analysisSegmentFramesCount)
{
    CsoundObject *self = calloc(1, sizeof(CsoundObject));
    self->analysisSegmentFramesCount = analysisSegmentFramesCount;
    self->csound = csoundCreate(NULL);
    self->frameTimes = calloc(analysisSegmentFramesCount, sizeof(Float32));
    
    for (size_t i = 0; i < analysisSegmentFramesCount; ++i) {
        
        self->frameTimes[i] = ((1. / 44100) * 256) * i;
    }
    
    csoundPreCompile(self->csound);
    csoundSetHostImplementedAudioIO(self->csound, 1, 0);
    csoundSetHostData(self->csound, self);
    self->channelsCount = 2;
    char *parserFlag = "--new-parser";
    char *argv[3] = {
        "csound",
        parserFlag,
        csdPath
    };
    
    self->csoundResult = csoundCompile(self->csound, 3, argv);
    
    if (self->csoundResult == 0) {
        printf("success\n");
    }
    
    return self;
}
예제 #2
0
CsoundObj *CsoundObj_new()
{
	CsoundObj *self = calloc(1, sizeof(CsoundObj));
	self->csound = csoundCreate(NULL);
	self->useAudioInput = 0;
	csoundSetHostImplementedAudioIO(self->csound, 1, 0);

	return self;
}
예제 #3
0
CsoundObj *CsoundObj_new()
{
    CsoundObj *self = calloc(1, sizeof(CsoundObj));
    self->frameCount = 256;
    self->csound = csoundCreate(self);
    csoundSetHostImplementedAudioIO(self->csound, 1, 0);

    self->midiCallbackData = calloc(1, sizeof(MidiCallbackData));
    self->midiCallbackData->midiData = calloc(MIDI_QUEUE_SIZE, sizeof(MidiData));
    return self;
}