void effect_init() { echo_init(&effect.echo); stereo_init(&effect.stereo); voice_init(&effect.voice); normal_init(&effect.normal); eq_init(&effect.eq); }
int emu10k1_init(struct emu10k1_card *card) { /* Init Card */ if (hw_init(card) < 0) return -1; voice_init(card); addxmgr_init(card); DPD(2, " hw control register -> %#x\n", emu10k1_readfn0(card, HCFG)); return 0; }
static int __devinit emu10k1_init(struct emu10k1_card *card) { /* Init Card */ if (hw_init(card) != CTSTATUS_SUCCESS) return CTSTATUS_ERROR; voice_init(card); timer_init(card); addxmgr_init(card); DPD(2, " hw control register -> %x\n", sblive_readfn0(card, HCFG)); return CTSTATUS_SUCCESS; }
int main( void ) { buffer_t *buffer = malloc(sizeof(buffer_t)); FILE *fd = fopen("tst.raw", "w"); struct voice_t voice; float *sinevals = malloc(sizeof(float)*(SINE_SIZE+1)); wave_generate_sine(sinevals, SINE_SIZE); struct wave_t sinetable; sinetable.vals = sinevals; sinetable.size = SINE_SIZE; float *sawvals = malloc(sizeof(float)*(SAW_SIZE+1)); wave_generate_saw(sawvals, SAW_SIZE); struct wave_t sawtable; sawtable.vals = sawvals; sawtable.size = SAW_SIZE; /* float *trivals = malloc(sizeof(float)*(TRI_SIZE+1)); wave_generate_triangle(trivals, TRI_SIZE); struct wave_t tritable; tritable.vals = trivals; tritable.size = TRI_SIZE; */ struct wavetable_t wt; struct wave_t *waves = malloc(sizeof(struct wave_t)*2); waves[0] = sinetable; waves[1] = sinetable; wavetable_init(&wt, waves, 2); voice_init(&voice, &wt); voice_trigger(&voice); while(1) { fill_buffer(*buffer, &voice); out(*buffer, fd); if (voice.ops[3].aenv.state == ENV_STOPPED) break; } return 0; }
void synth_init (synth_t *synth, int samplerate ) { synth->samplerate = samplerate; for (int i = 0; i < NUM_VOICES; i++) { voice_init (&synth->a_voices[i], samplerate); } osc_init(&synth->lfo, samplerate); synth->lfo_to_volume = 0.0; synth->lfo_to_filter = 0.0; }
static int process_incoming_call(void) { struct vboxuser vboxuser; struct vboxcall vboxcall; unsigned char line[VBOXMODEM_BUFFER_SIZE + 1]; int haverings; int waitrings; int usersetup; int ringsetup; int inputisok; unsigned char *stop; unsigned char *todo; memset(&vboxuser, 0, sizeof(vboxuser)); memset(&vboxcall, 0, sizeof(vboxcall)); haverings = 0; waitrings = -1; usersetup = 0; ringsetup = 0; while (modem_read(&vboxmodem, line, modemsetup.ringtimeout) == 0) { inputisok = 0; /* Wenn der Benutzer der angerufenen Nummer ermittelt ist und */ /* dessen Konfigurations abgearbeitet wurde, wird überprüft ob */ /* der Anruf angenommen werden soll. */ if ((usersetup) && (ringsetup)) { if (waitrings >= 0) { todo = savettydname; stop = ctrl_exists(vboxuser.home, "answer", todo); if (!stop) { todo = NULL; stop = ctrl_exists(vboxuser.home, "answer", todo); } if (stop) { log_line(LOG_D, "Control \"vboxctrl-answer\" detected: %s (%s)...\n", stop, ((char *)todo ? (char *)todo : "global")); if ((strcasecmp(stop, "no") == 0) || (strcasecmp(stop, "hangup") == 0) || (strcasecmp(stop, "reject") == 0)) { log_line(LOG_D, "Incoming call will be rejected...\n"); return(0); } if (strcasecmp(stop, "now") != 0) { vboxuser.space = 0; waitrings = xstrtol(stop, waitrings); } else { vboxuser.space = 0; waitrings = 1; } log_line(LOG_D, "Call will be answered after %d ring(s).\n", waitrings); } } if (waitrings > 0) { if (haverings >= waitrings) { return(voice_init(&vboxuser, &vboxcall)); } } } /* Ring abarbeiten: Beim ersten Ring wird die angerufene */ /* Nummer gesichert, die durch ATS13.7=1 mit einem Slash */ /* an den Ringstring angehängt ist. */ if (strncmp(line, "RING/", 5) == 0) { inputisok++; haverings++; if (!ringsetup) { xstrncpy(vboxuser.localphone, &line[5], VBOXUSER_NUMBER); ringsetup = 1; } log_line(LOG_A, "%s #%03d (%s)...\n", line, haverings, ((char *)usersetup ? (char *)vboxcall.name : "not known")); } /* CallerID aus dem Modeminput kopieren. Wenn bereits die */ /* angerufene Nummer ermittelt wurde, wird einmalig die */ /* Konfigurationsdatei des Benutzers abgearbeitet. */ if (strncmp(line, "CALLER NUMBER: ", 15) == 0) { inputisok++; if ((ringsetup) && (!usersetup)) { xstrncpy(vboxuser.incomingid, &line[15], VBOXUSER_CALLID); if (userrc_parse(&vboxuser, rc_get_entry(rc_getty_c, "spooldir")) == 0) { if ((vboxuser.uid != 0) && (vboxuser.gid != 0)) { /* Nachdem "vboxgetty.user" abgearbeitet ist und */ /* ein Benutzer gefunden wurde, werden einige der */ /* Kontrolldateien gelöscht. */ ctrl_remove(vboxuser.home, "suspend", savettydname); ctrl_remove(vboxuser.home, "suspend", NULL ); /* Die "effective Permissions" des Prozesses auf */ /* die des Benutzers setzen und dessen Konfigurat- */ /* ionsdatei abarbeiten. */ if (set_process_permissions(vboxuser.uid, vboxuser.gid, vboxuser.umask) == 0) { usersetup = 1; waitrings = vboxrc_parse(&vboxcall, vboxuser.home, vboxuser.incomingid); if (waitrings <= 0) { if (waitrings < 0) log_line(LOG_W, "Incoming call will be ignored!\n"); else log_line(LOG_D, "Incoming call will be ignored (user setup)!\n"); } else log_line(LOG_D, "Call will be answered after %d ring(s).\n", waitrings); } else return(-1); } else log_line(LOG_W, "Useing uid/gid 0 is not allowed - call will be ignored!\n", vboxuser.incomingid); } else log_line(LOG_W, "Number \"%s\" not bound to a local user - call will be ignored!\n", vboxuser.localphone); } } if (!inputisok) { log_line(LOG_D, "Got junk line \""); log_code(LOG_D, line); log_text(LOG_D, "\"...\n"); continue; } } return(-1); }