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

C++ pa_simple_free函数代码示例

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

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



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

示例1: pa_simple_free

static PyObject *simple_disconnect(simple *self) {
    if (self->s)
        pa_simple_free(self->s);
    self->s = NULL;

    return Py_BuildValue("i", 0);
}
开发者ID:poljar,项目名称:python-pulsesimple,代码行数:7,代码来源:pulsesimple.c


示例2: pulse_thread

static void pulse_thread(void *context)
{
#ifdef __linux__
    prctl(PR_SET_NAME, "deadbeef-pulse", 0, 0, 0, 0);
#endif

    trace ("pulse thread started \n");
    while (!pulse_terminate)
    {
        if (state != OUTPUT_STATE_PLAYING || !deadbeef->streamer_ok_to_read (-1))
        {
            usleep(10000);
            continue;
        }

        int sample_size = plugin.fmt.channels * (plugin.fmt.bps / 8);
        char buf[buffer_size];

        in_callback = 1;
        int bytesread = deadbeef->streamer_read(buf, buffer_size);
        in_callback = 0;
        if (pulse_terminate) {
            break;
        }
        if (bytesread < 0) {
            bytesread = 0;
        }

        int error;

        int res = 0;
        if (bytesread > 0) {
            deadbeef->mutex_lock (mutex);
            res = pa_simple_write(s, buf, bytesread, &error);
            deadbeef->mutex_unlock(mutex);
        }

        if (pulse_terminate) {
            break;
        }

        if (res < 0)
        {
            usleep(10000);
        }
    }

    deadbeef->mutex_lock (mutex);
    state = OUTPUT_STATE_STOPPED;
    if (s)
    {
        pa_simple_drain (s, NULL);
        pa_simple_free(s);
        s = NULL;
    }
    pulse_terminate = 0;
    pulse_tid = 0;
    deadbeef->mutex_unlock (mutex);
    trace ("pulse_thread finished\n");
}
开发者ID:Alexey-Yakovenko,项目名称:deadbeef,代码行数:60,代码来源:pulse.c


示例3: 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


示例4: pulseaudio_deallocate_recorder

static void pulseaudio_deallocate_recorder(ALLEGRO_AUDIO_RECORDER *r)
{
   PULSEAUDIO_RECORDER *pa = (PULSEAUDIO_RECORDER *) r->extra;
   
   pa_simple_free(pa->s);
   al_free(r->extra);
}
开发者ID:BorisCarvajal,项目名称:allegro5,代码行数:7,代码来源:pulseaudio.c


示例5: 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


示例6: pa_simple_free

void PulseThread::Close()
{
	if(this->connection) {
		pa_simple_free(this->connection);
		this->connection = nullptr;
	}
}
开发者ID:cjpeterson,项目名称:rpcs3,代码行数:7,代码来源:PulseThread.cpp


示例7: myshutdown

static void myshutdown()
{
	xmp_smix_off();

	if (s)
		pa_simple_free(s);
}
开发者ID:ProjectZeroSlackr,项目名称:XMP,代码行数:7,代码来源:pulseaudio.c


示例8: sound_close

void sound_close() {

	switch(sound_type) {
	case SOUND_NO:
	break;
	case SOUND_SDL:
	SDL_CloseAudio();
	break;
#ifdef D_SOUND_OSS
	case SOUND_OSS:
		close(audio_fd);
	break;
#endif
#ifdef D_SOUND_ALSA
	case SOUND_ALSA:
		snd_pcm_drain (_soundDevice);
		snd_pcm_close (_soundDevice);
	break;
#endif
#ifdef D_SOUND_PULSE
	case SOUND_PULSEAUDIO:
		pa_simple_free(pulse_s);
	break;
#endif
#ifdef GEKKO
	case SOUND_ASND:
		ASND_End();
	break;
#endif

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


示例9: RTC_DEBUG

RTC::ReturnCode_t PulseAudioOutput::onFinalize()
{
  RTC_DEBUG(("onFinalize start"));
  is_active = false;
  m_mutex.lock();
  RTC_DEBUG(("onFinalize:mutex lock"));
  try {
    if ( !m_data.empty() ) {
      RTC_DEBUG(("onFinalize:queue buffer clear start."));
      m_data.clear();  //!< queue buffer clear
      RTC_DEBUG(("onFinalize:queue buffer clear finish."));
    }
    if ( m_simple ) {
      RTC_DEBUG(("onFinalize:simple connection object free start."));
      pa_simple_free( m_simple );
      RTC_DEBUG(("onFinalize:simple connection object free finish."));
      m_simple = NULL;
    }
  } catch (...) {
    RTC_WARN(("pa_simple_free() failed onDFinalize."));
  }
  m_mutex.unlock();
  RTC_DEBUG(("onFinalize:mutex unlock"));
  RTC_DEBUG(("onFinalize finish"));
  return RTC::RTC_OK;
}
开发者ID:Nobu19800,项目名称:OpenHRIAudio,代码行数:26,代码来源:PulseAudioOutput.cpp


示例10: pa_simple_free

 PulseAudioPCMOutputDriver::~PulseAudioPCMOutputDriver()
 {
     if(m_driver)
     {
         pa_simple_free(m_driver);
     }
 }
开发者ID:capeanalytics,项目名称:aws-sdk-cpp,代码行数:7,代码来源:PulseAudioPCMOutputDriver.cpp


示例11: LOG

bool WaveOutPulseAudio::CloseWaveOutDevice()
{
    bool     tResult = false;
    int      tRes;

    LOG(LOG_VERBOSE, "Going to close..");

    if (mWaveOutOpened)
    {
        StopFilePlayback();
        Stop();

        if (mOutputStream != NULL)
        {
            LOG(LOG_VERBOSE, "..draining stream");
            if (pa_simple_drain(mOutputStream, &tRes) < 0)
            {
                LOG(LOG_ERROR, "Couldn't drain the output stream because %s(%d)", pa_strerror(tRes), tRes);
            }
            LOG(LOG_VERBOSE, "..closing stream");
            pa_simple_free(mOutputStream);
        }

        LOG(LOG_INFO, "...closed");

        mWaveOutOpened = false;
        tResult = true;
    }else
        LOG(LOG_INFO, "...wasn't open");

     ResetPacketStatistic();

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


示例12: pulseaudio_close_audio

void	pulseaudio_close_audio(void) {
	if (!pulseaudio_audiodev_is_open) return;
	if (pa_simple_drain(s, &error) < 0) {
		fprintf(stderr, __FILE__": pa_simple_drain() failed: %s\n", pa_strerror(error));
	}
	pa_simple_free(s);
	pulseaudio_audiodev_is_open = FALSE;
}
开发者ID:BackupTheBerlios,项目名称:arnold,代码行数:8,代码来源:pulseaudiosound.c


示例13: _closeRecord

void _closeRecord()
{
    if(!sr)
        return;

    pa_simple_free(sr);
    sr = NULL;
}
开发者ID:padsof-uam,项目名称:redes2,代码行数:8,代码来源:sound.c


示例14: _closePlay

void _closePlay()
{
    if(!sp)
        return;

    pa_simple_free(sp);
    sp = NULL;
}
开发者ID:padsof-uam,项目名称:redes2,代码行数:8,代码来源:sound.c


示例15: 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


示例16: pa_simple_free

vis::PulseAudioSource::~PulseAudioSource()
{
#ifdef _ENABLE_PULSE
    if (m_pulseaudio_simple != nullptr)
    {
        pa_simple_free(m_pulseaudio_simple);
    }
#endif
}
开发者ID:HalosGhost,项目名称:cli-visualizer,代码行数:9,代码来源:PulseAudioSource.cpp


示例17: adin_close

boolean
adin_close()
{
	if(r) {
		pa_simple_free(r);
		r = NULL;
	}
	return TRUE;
}
开发者ID:patricksebastien,项目名称:kiku,代码行数:9,代码来源:adin_pulseaudiolibpd.c


示例18: qDebug

void OutputPulseAudio::uninitialize()
{
    if (m_connection)
    {
        qDebug("OutputPulseAudio: closing connection");
        pa_simple_free(m_connection);
        m_connection = 0;
    }
}
开发者ID:Greedysky,项目名称:qmmp,代码行数:9,代码来源:outputpulseaudio.cpp


示例19: pulsedrv_close

static void pulsedrv_close(void)
{
    int error = 0;
    if (pa_simple_flush(s, &error)) {
        log_error(LOG_DEFAULT, "pa_simple_flush(): %s", pa_strerror(error));
        /* don't stop */
    }
    pa_simple_free(s);
    s = NULL;
}
开发者ID:bobsummerwill,项目名称:VICE,代码行数:10,代码来源:soundpulse.c


示例20: ADM_assert

uint8_t  pulseSimpleAudioDevice::stop(void) 
{
int er;
    ADM_assert(instance);
    pa_simple_flush(INSTANCE,&er);
    pa_simple_free(INSTANCE);
    instance=NULL;
    printf("[PulseAudio] Stopped\n");
    return 1;
}
开发者ID:BackupTheBerlios,项目名称:avidemux-svn,代码行数:10,代码来源:ADM_devicePulseSimple.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ pa_simple_new函数代码示例发布时间:2022-05-30
下一篇:
C++ pa_sample_spec_valid函数代码示例发布时间: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