Beispiel #1
0
/* HTS_Audio_initialize: initialize audio */
void HTS_Audio_initialize(HTS_Audio * audio, int sampling_rate, int max_buff_size)
{
   audio->sampling_rate = 0;
   audio->max_buff_size = 0;

   audio->stream = NULL;
   audio->err = 0;
   audio->buff = NULL;
   audio->buff_size = 0;

   HTS_Audio_open(audio, sampling_rate, max_buff_size);
}
Beispiel #2
0
/* HTS_Audio_initialize: initialize audio */
void HTS_Audio_initialize(HTS_Audio * audio, int sampling_rate, int max_buff_size)
{
   audio->sampling_rate = 0;
   audio->max_buff_size = 0;

   audio->hwaveout = 0;
   audio->buff = NULL;
   audio->buff_size = 0;
   audio->which_buff = 0;
   audio->now_buff_1 = FALSE;
   audio->now_buff_2 = FALSE;

   HTS_Audio_open(audio, sampling_rate, max_buff_size);
}
Beispiel #3
0
/* HTS_Vocoder_initialize: initialize vocoder */
void HTS_Vocoder_initialize(HTS_Vocoder *v, const int m, const int stage,
                            HTS_Boolean use_log_gain, const int rate,
                            const int fperiod, int buff_size)
{
   /* set parameter */
   v->stage = stage;
   if (stage != 0)
      v->gamma = -1.0 / v->stage;
   else
      v->gamma = 0.0;
   v->use_log_gain = use_log_gain;
   v->fprd = fperiod;
   v->iprd = IPERIOD;
   v->seed = SEED;
   v->next = SEED;
   v->gauss = GAUSS;
   v->rate = rate;
   v->p1 = -1.0;
   v->sw = 0;
   v->x = 0x55555555;
   /* open audio device */
   if (0 < buff_size && buff_size <= 48000) {
      v->audio = (HTS_Audio *) HTS_calloc(1, sizeof(HTS_Audio));
      HTS_Audio_open(v->audio, rate, buff_size);
   } else
      v->audio = NULL;
   /* init buffer */
   v->freqt_buff = NULL;
   v->freqt_size = 0;
   v->gc2gc_buff = NULL;
   v->gc2gc_size = 0;
   v->lsp2lpc_buff = NULL;
   v->lsp2lpc_size = 0;
   v->postfilter_buff = NULL;
   v->postfilter_size = 0;
   v->spectrum2en_buff = NULL;
   v->spectrum2en_size = 0;
   v->pade = NULL;
   if (v->stage == 0) {         /* for MCP */
      v->c =
          (double *) HTS_calloc(m * (3 + PADEORDER) + 5 * PADEORDER + 6,
                                sizeof(double));
      v->cc = v->c + m + 1;
      v->cinc = v->cc + m + 1;
      v->d1 = v->cinc + m + 1;
      v->pade = (double *) HTS_calloc(21, sizeof(double));
      v->pade[0] = 1.00000000000;
      v->pade[1] = 1.00000000000;
      v->pade[2] = 0.00000000000;
      v->pade[3] = 1.00000000000;
      v->pade[4] = 0.00000000000;
      v->pade[5] = 0.00000000000;
      v->pade[6] = 1.00000000000;
      v->pade[7] = 0.00000000000;
      v->pade[8] = 0.00000000000;
      v->pade[9] = 0.00000000000;
      v->pade[10] = 1.00000000000;
      v->pade[11] = 0.49992730000;
      v->pade[12] = 0.10670050000;
      v->pade[13] = 0.01170221000;
      v->pade[14] = 0.00056562790;
      v->pade[15] = 1.00000000000;
      v->pade[16] = 0.49993910000;
      v->pade[17] = 0.11070980000;
      v->pade[18] = 0.01369984000;
      v->pade[19] = 0.00095648530;
      v->pade[20] = 0.00003041721;
   } else {                     /* for LSP */
      v->c = (double *) HTS_calloc((m + 1) * (v->stage + 3), sizeof(double));
      v->cc = v->c + m + 1;
      v->cinc = v->cc + m + 1;
      v->d1 = v->cinc + m + 1;
   }
}
Beispiel #4
0
/* HTS_Audio_set_parameter: set parameters for audio */
void HTS_Audio_set_parameter(HTS_Audio * audio, int sampling_rate, int max_buff_size)
{
   HTS_Audio_open(audio, sampling_rate, max_buff_size);
}