• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ pa_simple_new函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中pa_simple_new函数的典型用法代码示例。如果您正苦于以下问题:C++ pa_simple_new函数的具体用法?C++ pa_simple_new怎么用?C++ pa_simple_new使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了pa_simple_new函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: pulse_initialize

int pulse_initialize(struct iaxc_audio_driver *d, int sample_rate)
{
  pa_simple *sp = NULL;
  pa_simple *sr = NULL;
  
  if (!sample_rate || sample_rate < 8000)
    sample_rate = 8000;

  ss.channels = 1; 
  ss.rate = sample_rate; 
  ss.format = PA_SAMPLE_S16LE; 

  // record stream pointer
  sr = pa_simple_new(NULL,
    "QRadioLink",
    PA_STREAM_RECORD, 
    NULL, 
    "Iax2-Client", 
    &ss, 
    NULL, 
    NULL, 
    NULL 
  );
  // playback stream pointer
  sp = pa_simple_new(NULL, 
    "QRadioLink", 
    PA_STREAM_PLAYBACK, 
    NULL, 
    "Iax2-Client", 
    &ss, 
    NULL, 
    NULL, 
    NULL 
  );
  d->priv = sr;
  d->priv2 = sp;
  d->initialize = pulse_initialize; /* This function */
  d->destroy = pulse_destroy; /* Implemented to flush buffers and then free resources */
  d->select_devices = pulse_select_devices; /* Bogey function, pulse audio connects via resource thread */
  d->selected_devices = pulse_selected_devices; /* Same as above */
  d->start = pulse_start; 
  d->stop = pulse_stop; 
  d->output = pulse_output; /* playback stream */
  d->input = pulse_input; /* record stream */
  d->input_level_get = pulse_input_level_get;
  d->input_level_set = pulse_input_level_set;
  d->output_level_get = pulse_output_level_get;
  d->output_level_set = pulse_output_level_set;
  d->play_sound = pulse_play_sound;
  d->stop_sound = pulse_stop_sound;

  return 0;
}
开发者ID:QDeltaSoft,项目名称:iaxclient,代码行数:53,代码来源:audio_pulseaudio.c


示例2: pulse_thread

static void* pulse_thread(void* context)
{
	sem_t* init = (sem_t*)context;

	pa_sample_spec ss;
	ss.format = PA_SAMPLE_S16LE;
	ss.channels = 2;
	ss.rate = g_sample_rate;

	int err;
	g_pulse = pa_simple_new(NULL, g_appname, PA_STREAM_PLAYBACK, NULL, g_appname, &ss, NULL, NULL, &err);
	if (!g_pulse) {
		snprintf(g_lasterror, c_nlasterror, "failed to connect to pulse server: %d", err);
	}

	sem_post(init);
	if (!g_pulse)
		return 0;

	pa_simple* s = g_pulse;
	short samples[c_nsamples*2];

	g_running = true;
	while (g_running) {
		g_callback(samples, c_nsamples);
		if (0 > pa_simple_write(s, samples, sizeof(samples), NULL))
			break;
	}

	pa_simple_flush(s, NULL);
	pa_simple_free(s);
	g_pulse = 0;
	return 0;
}
开发者ID:DevonJWells,项目名称:tinyaudio,代码行数:34,代码来源:tinyaudio_pulse.cpp


示例3: pa_simple_new

Dialup::Dialup(int len) {
    buffsize = len;
    buffind = 0;
    buffer = new unsigned char[len];

    int err;
    pa_sample_spec spec;
    pa_buffer_attr bfat;

    bfat.maxlength = -1;
    bfat.fragsize = -1;

    spec.format = PA_SAMPLE_U8;
    spec.channels = 2;
    spec.rate = 44100;

    

    audiosrv = pa_simple_new(
        0, // default pulseaudio server
        "phone_dialup", // app name
        PA_STREAM_RECORD,
        0, // default device
        "phone dialup rosnode", //description
        &spec,
        0, // default channel map
        &bfat,
        &err  // get error codes
    );

    if (!audiosrv) throw pa_exception(err);
}
开发者ID:thecheatscalc,项目名称:IGVC2013,代码行数:32,代码来源:dialup.cpp


示例4: pulse_setup

static void
pulse_setup (sw_handle * handle, sw_format * format)
{
  struct pa_sample_spec ss;
  pa_stream_direction_t dir;
  int error;

  if (format->channels > PA_CHANNELS_MAX) {
    fprintf(stderr, __FILE__": pulse_setup(): The maximum number of channels supported is %d, while %d have been requested.\n", PA_CHANNELS_MAX, format->channels);
    return;
  }

  ss.format = PA_SAMPLE_FLOAT32;
  ss.rate = format->rate;
  ss.channels = format->channels;

  if (handle->driver_flags == O_RDONLY) {
    dir = PA_STREAM_RECORD;
  } else if (handle->driver_flags == O_WRONLY) {
    dir = PA_STREAM_PLAYBACK;
  } else {
    return;
  }

  if (!(handle->custom_data = pa_simple_new(NULL, "Sweep", dir, NULL, "Sweep Stream", &ss, NULL, NULL, &error))) {
    fprintf(stderr, __FILE__": pa_simple_new() failed: %s\n", pa_strerror(error));
    return;
  }

  handle->driver_rate = ss.rate;
  handle->driver_channels = ss.channels;
}
开发者ID:JamesLinus,项目名称:sweep,代码行数:32,代码来源:driver_pulseaudio.c


示例5: mexFunction

void mexFunction(int nlhs, mxArray *plhs[],
    int nrhs, const mxArray *prhs[])
{
    const mxArray *Data = prhs[0];
    int16_t *data = (int16_t*)mxGetData(prhs[0]);
    size_t r = mxGetN(Data);
    
    // PA code
    pa_simple *s;
    pa_sample_spec ss;

    ss.format = PA_SAMPLE_S16LE;
    ss.channels = 1;
    ss.rate = 22050;
    
    s = pa_simple_new(NULL,               // Use the default server.
                      "knife-alien",      // Our application's name.
                      PA_STREAM_PLAYBACK,
                      NULL,               // Use the default device.
                      "Music",            // Description of our stream.
                      &ss,                // Our sample format.
                      NULL,               // Use default channel map
                      NULL,               // Use default buffering attributes.
                      NULL                // Ignore error code.
                      );
    
    pa_simple_write(s,data,(size_t)r,NULL);
}
开发者ID:Risca,项目名称:knife-alien,代码行数:28,代码来源:foo.c


示例6: pa_simple_new

/**
    \fn init
    \brief Take & initialize the device

*/
uint8_t pulseSimpleAudioDevice::init(uint8_t channels, uint32_t fq) 
{

pa_simple *s;
pa_sample_spec ss;
int er;
 
#ifdef ADM_PULSE_INT16
  ss.format = PA_SAMPLE_S16NE;
#else
    ss.format = PA_SAMPLE_FLOAT32NE;//PA_SAMPLE_S16NE; //FIXME big endian
#endif
  ss.channels = channels;
  ss.rate =fq;
 
  instance= pa_simple_new(NULL,               // Use the default server.
                    "Avidemux2",           // Our application's name.
                    PA_STREAM_PLAYBACK,
                    NULL,               // Use the default device.
                    "Sound",            // Description of our stream.
                    &ss,                // Our sample format.
                    NULL,               // Use default channel map
                    NULL ,             // Use default buffering attributes.
                    &er               // Ignore error code.
                    );
  if(!instance)
    {
        printf("[PulseSimple] open failed\n");
        return 0;
    }
    printf("[PulseSimple] open ok\n");
    return 1;

}
开发者ID:BackupTheBerlios,项目名称:avidemux-svn,代码行数:39,代码来源:ADM_devicePulseSimple.cpp


示例7: sound_pulse_init

void sound_pulse_init()
{
    pa_sample_spec ss;
    pa_buffer_attr ba;

    ss.format = PA_SAMPLE_S16NE;
    ss.channels = 2;
    ss.rate = 48000;

    g_setenv("PULSE_PROP_media.role", "game", TRUE);

    ba.minreq = -1;
    ba.maxlength = -1;
    ba.prebuf = -1;
    ba.tlength = (1024*8)/2;

    s = pa_simple_new(NULL,               // Use the default server.
                   "PerfectZX",           // Our application's name.
                   PA_STREAM_PLAYBACK,
                   NULL,               // Use the default device.
                   "Sound",            // Description of our stream.
                   &ss,                // Our sample format.
                   NULL,               // Use default channel map
                   &ba,               // Use custom buffering attributes.
                   NULL               // Ignore error code.
                   );

	bufferFrames = SNDFRAME_LEN * ss.rate / 1000;
	sound_buffer = calloc( bufferFrames, sizeof(SNDFRAME) );
}
开发者ID:Tallefer,项目名称:perfectzx,代码行数:30,代码来源:sound_pulse.c


示例8: init

static int init(struct xmp_context *ctx)
{
	struct xmp_options *o = &ctx->o;
	pa_sample_spec ss;
	int error;

	ss.format = PA_SAMPLE_S16NE;
	ss.channels = o->outfmt & XMP_FMT_MONO ? 1 : 2;
	ss.rate = o->freq;

	s = pa_simple_new(NULL,		/* Use the default server */
		"xmp",			/* Our application's name */
		PA_STREAM_PLAYBACK,
		NULL,			/* Use the default device */
		"Music",		/* Description of our stream */
		&ss,			/* Our sample format */
		NULL,			/* Use default channel map */
		NULL,			/* Use default buffering attributes */
		&error);		/* Ignore error code */

	if (s == 0) {
		fprintf(stderr, "pulseaudio error: %s\n", pa_strerror(error));
		return XMP_ERR_DINIT;
	}

	return xmp_smix_on(ctx);
}
开发者ID:ProjectZeroSlackr,项目名称:XMP,代码行数:27,代码来源:pulseaudio.c


示例9: main

int main(int argc, char*argv[]) {
    /* The sample type to use */
    static const pa_sample_spec ss = {
        .format = PA_SAMPLE_S16LE,
        .rate = 44100,
        .channels = 2
    };
    pa_simple *s = NULL;
    int ret = 1;
    int error;
    /* Create the recording stream */
    if (!(s = pa_simple_new(NULL, argv[0], PA_STREAM_RECORD, NULL, "record", &ss, NULL, NULL, &error))) {
        fprintf(stderr, __FILE__": pa_simple_new() failed: %s\n", pa_strerror(error));
        goto finish;
    }
    for (;;) {
        uint8_t buf[BUFSIZE];
        /* Record some data ... */
        if (pa_simple_read(s, buf, sizeof(buf), &error) < 0) {
            fprintf(stderr, __FILE__": pa_simple_read() failed: %s\n", pa_strerror(error));
            goto finish;
        }
        /* And write it to STDOUT */
        if (loop_write(STDOUT_FILENO, buf, sizeof(buf)) != sizeof(buf)) {
            fprintf(stderr, __FILE__": write() failed: %s\n", strerror(errno));
            goto finish;
        }
    }
    ret = 0;
finish:
    if (s)
        pa_simple_free(s);
    return ret;
}
开发者ID:cshengqun,项目名称:raop,代码行数:34,代码来源:capture.c


示例10: sound_init_pulse

int sound_init_pulse() {

	pa_sample_spec ss;
	pa_buffer_attr buf;

	ss.format = PA_SAMPLE_U8;
	ss.channels = 1;
	ss.rate = 48000;

	buf.maxlength=8192;
	buf.tlength=4096;
	buf.prebuf=4096;
	buf.minreq=4096;
	buf.fragsize=4096;

	pulse_s = pa_simple_new(NULL,"fbzx",PA_STREAM_PLAYBACK,NULL,"Spectrum",&ss,NULL,&buf,NULL);
	if (pulse_s==NULL) {
		return -1;
	}
	ordenador.sign=0;
	ordenador.format=0;
	ordenador.channels=1;
	ordenador.freq=48000;
	ordenador.buffer_len=4096;

	return 0;

}
开发者ID:Oibaf66,项目名称:fbzx-wii,代码行数:28,代码来源:sound.c


示例11: RTC_DEBUG

RTC::ReturnCode_t PulseAudioInput::onActivated(RTC::UniqueId ec_id)
{
  RTC_DEBUG(("onActivated start"));
  try {
    pa_cvolume cv;
//    mp_vol = pa_cvolume_reset(&cv, 1);
//    pa_cvolume_init(mp_vol);
    m_spec.format = getFormat(m_formatstr);
    m_spec.channels = (uint8_t)m_channels;

    m_simple = pa_simple_new(
                  NULL,               //!< Server name, or NULL for default
                  "PulseAudioInput",  //!< A descriptive name for this client (application name, ...)
                  PA_STREAM_RECORD,   //!< Open this stream for recording or playback?
                  NULL,               //!< Sink (resp. source) name, or NULL for default
                  "record",           //!< A descriptive name for this client (application name, song title, ...)
                  &m_spec,            //!< The sample type to use
                  NULL,               //!< The channel map to use, or NULL for default
                  NULL,               //!< Buffering attributes, or NULL for default
                  &m_err );           //!< A pointer where the error code is stored when the routine returns NULL. It is OK to pass NULL here.
    if ( m_simple == NULL ) {
      throw m_err;
    }
  } catch (...) {
    std::string error_str = pa_strerror(m_err);
    RTC_WARN(("pa_simple_new() failed onActivated:%s", error_str.c_str()));
  }
  is_active = true;

  RTC_DEBUG(("onActivated finish"));
  return RTC::RTC_OK;
}
开发者ID:SeishoIrie,项目名称:OpenHRIAudio,代码行数:32,代码来源:PulseAudioInput.cpp


示例12: ad_open_dev

ad_rec_t *
ad_open_dev(const char *dev, int32 samples_per_sec)
{
    ad_rec_t *handle;
    pa_simple *pa;
    pa_sample_spec ss;
    int error;

    ss.format = PA_SAMPLE_S16LE;
    ss.channels = 1;
    ss.rate = 16000; //samples_per_sec;
    
    pa = pa_simple_new(NULL, "ASR", PA_STREAM_RECORD, dev, "Speech", &ss, NULL, NULL, &error);
    if (pa == NULL) {
        fprintf(stderr, "Error opening audio device %s for capture: %s\n", dev, pa_strerror(error));
        return NULL;
    }

    if ((handle = (ad_rec_t *) calloc(1, sizeof(ad_rec_t))) == NULL) {
        fprintf(stderr, "Failed to allocate memory for ad device\n");
	return NULL;
    }

    handle->pa = pa;
    handle->recording = 0;
    handle->sps = samples_per_sec;
    handle->bps = sizeof(int16);

    return handle;
}
开发者ID:DanBuehrer,项目名称:pocketsphinx.js,代码行数:30,代码来源:ad_pulse.c


示例13: _openPlay

int _openPlay(char *identificacion)
{
    int error;

    if (!(sp = pa_simple_new(NULL, identificacion, PA_STREAM_PLAYBACK, NULL, "record", &ss, NULL, NULL, &error)))
        return error;
    return 0;
}
开发者ID:padsof-uam,项目名称:redes2,代码行数:8,代码来源:sound.c


示例14: _openRecord

int _openRecord(char *identificacion)
{
    int error;

    if (!(sr = pa_simple_new(NULL, identificacion, PA_STREAM_RECORD, NULL, "record", &ss, NULL, NULL, &error)))
        return error;
    return 0;
}
开发者ID:padsof-uam,项目名称:redes2,代码行数:8,代码来源:sound.c


示例15: pulseaudio_allocate_voice

static int pulseaudio_allocate_voice(ALLEGRO_VOICE *voice)
{
   PULSEAUDIO_VOICE *pv = al_malloc(sizeof(PULSEAUDIO_VOICE));
   pa_sample_spec ss;
   pa_buffer_attr ba;

   ss.channels = al_get_channel_count(voice->chan_conf);
   ss.rate = voice->frequency;

   if (voice->depth == ALLEGRO_AUDIO_DEPTH_UINT8)
      ss.format = PA_SAMPLE_U8;
   else if (voice->depth == ALLEGRO_AUDIO_DEPTH_INT16)
      ss.format = PA_SAMPLE_S16NE;
#if PA_API_VERSION > 11
   else if (voice->depth == ALLEGRO_AUDIO_DEPTH_INT24)
      ss.format = PA_SAMPLE_S24NE;
#endif
   else if (voice->depth == ALLEGRO_AUDIO_DEPTH_FLOAT32)
      ss.format = PA_SAMPLE_FLOAT32NE;
   else {
      ALLEGRO_ERROR("Unsupported PulseAudio sound format.\n");
      al_free(pv);
      return 1;
   }

   ba.maxlength = 0x10000; // maximum length of buffer
   ba.tlength   = 0x2000;  // target length of buffer
   ba.prebuf    = 0;       // minimum data size required before playback starts
   ba.minreq    = 0;       // minimum size of request 
   ba.fragsize  = -1;      // fragment size (recording)

   pv->s = pa_simple_new(NULL,         // Use the default server.
                   al_get_app_name(),     
                   PA_STREAM_PLAYBACK,
                   NULL,               // Use the default device.
                   "Allegro Voice",    
                   &ss,                
                   NULL,               // Use default channel map
                   &ba,                
                   NULL                // Ignore error code.
   );

   if (!pv->s) {
      al_free(pv);
      return 1;
   }

   voice->extra = pv;

   pv->frame_size = ss.channels * al_get_audio_depth_size(voice->depth);
   pv->status = PV_STOPPED;
   pv->buffer_mutex = al_create_mutex();

   pv->poll_thread = al_create_thread(pulseaudio_update, (void*)voice);
   al_start_thread(pv->poll_thread);

   return 0;
}
开发者ID:Frozenhorns,项目名称:project,代码行数:58,代码来源:pulseaudio.c


示例16: LOG

bool WaveOutPulseAudio::OpenWaveOutDevice(int pSampleRate, int pOutputChannels)
{
    pa_sample_spec     tOutputFormat;
    int                tRes;
    pa_usec_t          tLatency;

    LOG(LOG_VERBOSE, "Trying to open the wave out device");

    if (mWaveOutOpened)
        return false;

    mSampleRate = pSampleRate;
    mAudioChannels = pOutputChannels;

    LOG(LOG_VERBOSE, "Desired device is %s", mDesiredDevice.c_str());

    if ((mDesiredDevice == "") || (mDesiredDevice == "auto") || (mDesiredDevice == "automatic"))
    {
        LOG(LOG_VERBOSE, "Using default audio device");
        mDesiredDevice = "";
    }

    tOutputFormat.format = PA_SAMPLE_S16LE;
    tOutputFormat.rate = mSampleRate;
    tOutputFormat.channels = mAudioChannels;

    // create a new playback stream
    if (!(mOutputStream = pa_simple_new(NULL, "Homer-Conferencing", PA_STREAM_PLAYBACK, (mDesiredDevice != "" ? mDesiredDevice.c_str() : NULL) /* dev Name */, GetStreamName().c_str(), &tOutputFormat, NULL, NULL, &tRes)))
    {
        LOG(LOG_ERROR, "Couldn't create PulseAudio stream because %s(%d)", pa_strerror(tRes), tRes);
        return false;
    }

    if ((tLatency = pa_simple_get_latency(mOutputStream, &tRes)) == (pa_usec_t) -1)
    {
        LOG(LOG_ERROR, "Couldn't determine the latency of the output stream because %s(%d)", pa_strerror(tRes), tRes);
        pa_simple_free(mOutputStream);
        mOutputStream = NULL;
        return false;
    }

    mCurrentDevice = mDesiredDevice;

    //######################################################
    //### give some verbose output
    //######################################################
    LOG(LOG_INFO, "PortAudio wave out opened...");
    LOG(LOG_INFO,"    ..sample rate: %d", mSampleRate);
    LOG(LOG_INFO,"    ..channels: %d", pOutputChannels);
    LOG(LOG_INFO,"    ..desired device: %s", mDesiredDevice.c_str());
    LOG(LOG_INFO,"    ..selected device: %s", mCurrentDevice.c_str());
    LOG(LOG_INFO,"    ..latency: %"PRIu64" seconds", (uint64_t)tLatency * 1000 * 1000);
    LOG(LOG_INFO,"    ..sample format: %d", PA_SAMPLE_S16LE);

    mWaveOutOpened = true;

    return true;
}
开发者ID:Lethea,项目名称:Homer-Conferencing,代码行数:58,代码来源:WaveOutPulseAudio.cpp


示例17: qDebug

void mpgplayer::run()
{
    if(mpg123_init() != MPG123_OK)
        qDebug("Error initilizing mpg123");
    const char **test = mpg123_supported_decoders();
    int error;
    mpg123_handle *mh = mpg123_new(test[0],&error);
    if(!mpg123_feature(MPG123_FEATURE_DECODE_LAYER3))
    {
        qDebug("You do not seem to have mp3 decoding support");
        return;
    }
    mpg123_format_none(mh);
    if(mpg123_format(mh,samplerate,MPG123_STEREO,MPG123_ENC_SIGNED_16)!=MPG123_OK)
        qDebug("Error in initilizing format decoder");
    qDebug(test[0]);
    mpg123_open(mh,"/home/eli/Projects/groove-evan/Animal.mp3");
    net = TData;
    pa_simple *s;
    pa_sample_spec ss;
    ss.format = PA_SAMPLE_S16NE;
    ss.rate = samplerate;
    ss.channels = 2;
    s =pa_simple_new(NULL,"Groove",PA_STREAM_PLAYBACK ,NULL,"Music",&ss,NULL,NULL,NULL);

    unsigned char bytes[1024];
    size_t bsize = 1024;
    size_t done = 0;
    bool stop = false;
    playing=true;
    while(!stop)
    {
        switch(net)
        {
        case TWait: usleep(100); break;
        case TData:
            if(mpg123_read(mh,bytes,bsize,&done)==MPG123_DONE)
            {
                net=TFinish;
            }
            pa_simple_write(s,bytes,done,&error);
            break;
        case TAbort:
            stop = true;
            break;
        case TFinish:
            pa_simple_drain(s,&error);
            stop = true;
            break;
        default: break;
        }
    }
    qDebug("Finsihed playback");
    pa_simple_free(s);

    mpg123_exit();
}
开发者ID:dotblank,项目名称:groove,代码行数:57,代码来源:mpgplayer.cpp


示例18: fprintf

/* SoundPlayer constructor */
SoundPlayer::SoundPlayer() {
    // Create a new playback
    int error;
    static const pa_sample_spec ss = {PA_SAMPLE_S16LE, 24000, 1};
    if (!(connection = pa_simple_new(NULL, NULL, PA_STREAM_PLAYBACK, NULL,
                                     "playback", &ss, NULL, NULL, &error))) {
        fprintf(stderr, __FILE__": pa_simple_new() failed: %s\n",
                pa_strerror(error));
    }
}
开发者ID:ahaug,项目名称:CamSync,代码行数:11,代码来源:SoundPlayer.cpp


示例19: initialize_pulse

int initialize_pulse(audio_format *format)
{
	if(format->bits_per_sample==16)
		audio_spec.format=PA_SAMPLE_S16LE;
	audio_spec.rate=format->sample_rate;
	audio_spec.channels=format->num_channels;
	
	handle = pa_simple_new(NULL,NULL, PA_STREAM_PLAYBACK,NULL,"playback",&audio_spec,NULL,NULL,&error);
	return 0;
}
开发者ID:sahaRatul,项目名称:sela,代码行数:10,代码来源:pulse_output.c


示例20: GLOBAL_DEF

Error AudioDriverPulseAudio::init() {

	active = false;
	thread_exited = false;
	exit_thread = false;
	pcm_open = false;
	samples_in = NULL;
	samples_out = NULL;

	mix_rate = GLOBAL_DEF("audio/mix_rate",44100);
	speaker_mode = SPEAKER_MODE_STEREO;
	channels = 2;

	pa_sample_spec spec;
	spec.format = PA_SAMPLE_S16LE;
	spec.channels = channels;
	spec.rate = mix_rate;

	int latency = GLOBAL_DEF("audio/output_latency", 25);
	buffer_size = nearest_power_of_2(latency * mix_rate / 1000);

	pa_buffer_attr attr;
	// set to appropriate buffer size from global settings
	attr.tlength = buffer_size;
	// set them to be automatically chosen
	attr.prebuf = (uint32_t)-1;
	attr.maxlength = (uint32_t)-1;
	attr.minreq = (uint32_t)-1;

	int error_code;
	pulse = pa_simple_new(	NULL,         // default server
				"Godot",      // application name
				PA_STREAM_PLAYBACK,
				NULL,         // default device
				"Sound",      // stream description
				&spec,
				NULL,         // use default channel map
				&attr,         // use buffering attributes from above
				&error_code
				);

	if (pulse == NULL) {
		fprintf(stderr, "PulseAudio ERR: %s\n", pa_strerror(error_code));\
		ERR_FAIL_COND_V(pulse == NULL, ERR_CANT_OPEN);
	}


	samples_in = memnew_arr(int32_t, buffer_size * channels);
	samples_out = memnew_arr(int16_t, buffer_size * channels);

	mutex = Mutex::create();
	thread = Thread::create(AudioDriverPulseAudio::thread_func, this);

	return OK;
}
开发者ID:pkowal1982,项目名称:godot,代码行数:55,代码来源:audio_driver_pulseaudio.cpp



注:本文中的pa_simple_new函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ pa_sink_input_assert_ref函数代码示例发布时间:2022-05-30
下一篇:
C++ pa_simple_free函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap