コード例 #1
0
ファイル: TripleOscillator.cpp プロジェクト: StCyr/lmms
OscillatorObject::OscillatorObject( Model * _parent, int _idx ) :
    Model( _parent ),
    m_volumeModel( DefaultVolume / NUM_OF_OSCILLATORS, MinVolume,
                   MaxVolume, 1.0f, this, tr( "Osc %1 volume" ).arg( _idx+1 ) ),
    m_panModel( DefaultPanning, PanningLeft, PanningRight, 1.0f, this,
                tr( "Osc %1 panning" ).arg( _idx+1 ) ),
    m_coarseModel( -_idx*KeysPerOctave,
                   -2 * KeysPerOctave, 2 * KeysPerOctave, 1.0f, this,
                   tr( "Osc %1 coarse detuning" ).arg( _idx+1 ) ),
    m_fineLeftModel( 0.0f, -100.0f, 100.0f, 1.0f, this,
                     tr( "Osc %1 fine detuning left" ).arg( _idx+1 ) ),
    m_fineRightModel( 0.0f, -100.0f, 100.0f, 1.0f, this,
                      tr( "Osc %1 fine detuning right" ).arg( _idx + 1 ) ),
    m_phaseOffsetModel( 0.0f, 0.0f, 360.0f, 1.0f, this,
                        tr( "Osc %1 phase-offset" ).arg( _idx+1 ) ),
    m_stereoPhaseDetuningModel( 0.0f, 0.0f, 360.0f, 1.0f, this,
                                tr( "Osc %1 stereo phase-detuning" ).arg( _idx+1 ) ),
    m_waveShapeModel( Oscillator::SineWave, 0,
                      Oscillator::NumWaveShapes-1, this,
                      tr( "Osc %1 wave shape" ).arg( _idx+1 ) ),
    m_modulationAlgoModel( Oscillator::SignalMix, 0,
                           Oscillator::NumModulationAlgos-1, this,
                           tr( "Modulation type %1" ).arg( _idx+1 ) ),

    m_sampleBuffer( new SampleBuffer ),
    m_volumeLeft( 0.0f ),
    m_volumeRight( 0.0f ),
    m_detuningLeft( 0.0f ),
    m_detuningRight( 0.0f ),
    m_phaseOffsetLeft( 0.0f ),
    m_phaseOffsetRight( 0.0f )
{
    // Connect knobs with Oscillators' inputs
    connect( &m_volumeModel, SIGNAL( dataChanged() ),
             this, SLOT( updateVolume() ) );
    connect( &m_panModel, SIGNAL( dataChanged() ),
             this, SLOT( updateVolume() ) );
    updateVolume();

    connect( &m_coarseModel, SIGNAL( dataChanged() ),
             this, SLOT( updateDetuningLeft() ) );
    connect( &m_coarseModel, SIGNAL( dataChanged() ),
             this, SLOT( updateDetuningRight() ) );
    connect( &m_fineLeftModel, SIGNAL( dataChanged() ),
             this, SLOT( updateDetuningLeft() ) );
    connect( &m_fineRightModel, SIGNAL( dataChanged() ),
             this, SLOT( updateDetuningRight() ) );
    updateDetuningLeft();
    updateDetuningRight();

    connect( &m_phaseOffsetModel, SIGNAL( dataChanged() ),
             this, SLOT( updatePhaseOffsetLeft() ) );
    connect( &m_phaseOffsetModel, SIGNAL( dataChanged() ),
             this, SLOT( updatePhaseOffsetRight() ) );
    connect( &m_stereoPhaseDetuningModel, SIGNAL( dataChanged() ),
             this, SLOT( updatePhaseOffsetLeft() ) );
    updatePhaseOffsetLeft();
    updatePhaseOffsetRight();

}
コード例 #2
0
/** Play some music (.ogg etc...)
 *	NB: if an old music was played, it is first stop with stopMusic()
 *	\param filepath file path, CPath::lookup is done here
 *  \param async stream music from hard disk, preload in memory if false
 *	\param loop must be true to play the music in loop. 
 */
bool CMusicChannelFader::play(const std::string &filepath, uint xFadeTime, bool async, bool loop)
{
	stop(xFadeTime);

	// Find the next best free music channel
	uint nextFader = _MaxMusicFader;
	for (uint i = 0; i < _MaxMusicFader; ++i) if (!_MusicFader[i].Playing)
		{ nextFader = i; break; }
	if (nextFader == _MaxMusicFader)
	{
		nextFader = (_ActiveMusicFader + 1) % _MaxMusicFader;
		_MusicFader[nextFader].MusicChannel->stop();
		_MusicFader[nextFader].Fade = false;
		_MusicFader[nextFader].Playing = false;
	}
	_ActiveMusicFader = nextFader;

	// Play a song in it :)
	_CMusicFader &fader = _MusicFader[_ActiveMusicFader];
	if (xFadeTime) fader.fadeIn(xFadeTime);
	else fader.XFadeVolume = 1.0f;
	fader.Playing = true;
	updateVolume(); // make sure at ok volume to start :)
	fader.Playing = fader.MusicChannel->play(filepath, async, loop);
	return fader.Playing;
}
コード例 #3
0
ファイル: Snd.cpp プロジェクト: kaz-jgs/xaudio_drv
/*!
 * 実行関数
 * @retval	デルタタイムの関係で処理を打ち切った場合はfalse
 */
bool Snd::exec(){
	// Ticksの更新
	if (updateTicks());
	else
		return false;

	// waveが不正ならこれ以上処理しない
	if(srcVoice_);
	else
		return true;
	
	// 再生中フラグの更新
	if(callback_->isStreamEnd()){
		isPlaying_ = false;
		stop(0.f);
		callback_->resetStreamEnd();
	}
	
	// waveが再生中でなければこれ以上処理しない
	if(isPlaying_);
	else
		return true;

	// ボリューム情報の変更
	updateVolume();

	// 停止の処理
	if (isStopping_ && volInfo_.vol <= 0.f){
		isPlaying_ = false;
		isStopping_ = false;
		srcVoice_->Stop();
	}

	return true;
}
コード例 #4
0
ファイル: Audio.cpp プロジェクト: BackupTheBerlios/sotu-svn
//----------------------------------------------------------------------------
bool Audio::update( void)
{
    if (!_sampleManager)
        return true;

    if (_unloadMusic)
    {
        if (_soundTrack)
        {
            Mix_FreeMusic(_soundTrack);
            _soundTrack = 0;
        }
        _unloadMusic = false;
    }

    updateVolume();

    static float nextTime = Timer::getTime()+0.5f;
    float thisTime = Timer::getTime();
    if( thisTime > nextTime)
    {
        updateSettings();
        nextTime = thisTime+0.5f;
    }

    return true;
}
コード例 #5
0
//==============================================================================
void ConeShape::setRadius(double radius)
{
  assert(0.0 < radius);
  mRadius = radius;
  updateBoundingBoxDim();
  updateVolume();
}
コード例 #6
0
void MediaControls::reset()
{
    double duration = mediaElement().duration();
    m_durationDisplay->setInnerText(LayoutTheme::theme().formatMediaControlsTime(duration), ASSERT_NO_EXCEPTION);
    m_durationDisplay->setCurrentValue(duration);

    updatePlayState();

    updateCurrentTimeDisplay();

    m_timeline->setDuration(duration);
    m_timeline->setPosition(mediaElement().currentTime());

    if (!mediaElement().hasAudio())
        m_volumeSlider->hide();
    else
        m_volumeSlider->show();
    updateVolume();

    refreshClosedCaptionsButtonVisibility();

    if (mediaElement().hasVideo() && fullscreenIsSupported(document()))
        m_fullScreenButton->show();
    else
        m_fullScreenButton->hide();

    refreshCastButtonVisibility();
    makeOpaque();
}
コード例 #7
0
ファイル: sound.cpp プロジェクト: cc9cii/xoreos
void OptionsSoundMenu::show() {
	_volMusic = ConfigMan.getDouble("volume_music", 1.0);
	_volSFX   = ConfigMan.getDouble("volume_sfx"  , 1.0);
	_volVoice = ConfigMan.getDouble("volume_voice", 1.0);
	_volVideo = ConfigMan.getDouble("volume_video", 1.0);

	updateVolume(_volMusic, Sound::kSoundTypeMusic, "MusicLabel");
	updateVolume(_volSFX  , Sound::kSoundTypeSFX  , "SoundFXLabel");
	updateVolume(_volVoice, Sound::kSoundTypeVoice, "VoicesLabel");

	getSlider("MusicSlider"  , true)->setState(_volMusic * 20);
	getSlider("SoundFXSlider", true)->setState(_volSFX   * 20);
	getSlider("VoicesSlider" , true)->setState(_volVoice * 20);

	GUI::show();
}
コード例 #8
0
//==============================================================================
void ConeShape::setHeight(double height)
{
  assert(0.0 < height);
  mHeight = height;
  updateBoundingBoxDim();
  updateVolume();
}
コード例 #9
0
void MediaControls::setAllowHiddenVolumeControls(bool allow)
{
    m_allowHiddenVolumeControls = allow;
    // Clear the 'keep muted flag', for tests.
    m_keepMuteButton = false;
    // Update the controls visibility.
    updateVolume();
}
コード例 #10
0
void VlcWidgetVolumeSlider::initWidgetVolumeSlider()
{
    _lock = false;

    _timer = new QTimer(this);

    connect(_timer, SIGNAL(timeout()), this, SLOT(updateVolume()));
    connect(this, SIGNAL(valueChanged(int)), this, SLOT(setVolume(int)));
}
コード例 #11
0
ファイル: CylinderShape.cpp プロジェクト: ofrei/dart
CylinderShape::CylinderShape(double _radius, double _height)
  : Shape(CYLINDER),
    mRadius(_radius),
    mHeight(_height) {
  assert(0.0 < _radius);
  assert(0.0 < _height);
  _updateBoundingBoxDim();
  updateVolume();
}
コード例 #12
0
ファイル: EllipsoidShape.cpp プロジェクト: sehoonha/dart
void EllipsoidShape::setSize(const Eigen::Vector3d& _size) {
  assert(_size[0] > 0.0);
  assert(_size[1] > 0.0);
  assert(_size[2] > 0.0);
  mSize = _size;
  mBoundingBox.setMin(-_size * 0.5);
  mBoundingBox.setMax(_size * 0.5);
  updateVolume();
}
コード例 #13
0
ファイル: BoxShape.cpp プロジェクト: sehoonha/dart
BoxShape::BoxShape(const Eigen::Vector3d& _size)
  : Shape(BOX),
    mSize(_size) {
  assert(_size[0] > 0.0);
  assert(_size[1] > 0.0);
  assert(_size[2] > 0.0);
  mBoundingBox.setMin(-_size * 0.5);
  mBoundingBox.setMax(_size * 0.5);
  updateVolume();
}
コード例 #14
0
//==============================================================================
ConeShape::ConeShape(double radius, double height)
  : Shape(CONE),
    mRadius(radius),
    mHeight(height)
{
  assert(0.0 < radius);
  assert(0.0 < height);
  updateBoundingBoxDim();
  updateVolume();
}
コード例 #15
0
aalError Source::setVolume(float v) {
	
	if(!(channel.flags & FLAG_VOLUME)) {
		return AAL_ERROR_INIT;
	}
	
	channel.volume = glm::clamp(v, 0.f, 1.f);
	
	return updateVolume();
}
コード例 #16
0
ファイル: SphereShape.cpp プロジェクト: dartsim/dart
//==============================================================================
void SphereShape::setRadius(double radius)
{
    assert(radius > 0.0);

    mRadius = radius;

    mBoundingBox.setMin(Eigen::Vector3d::Constant(-radius));
    mBoundingBox.setMax(Eigen::Vector3d::Constant(radius));

    updateVolume();
}
コード例 #17
0
ファイル: AudioData.cpp プロジェクト: Ar-es/raspivoice
bool AudioData::Speak(std::string text)
{
	updateVolume();

	char command[1023] = "";
	int status;
	snprintf(command, 1023, "espeak --stdout \"%s\" | aplay -q -D plughw:%d", text.c_str(), CardNumber);
	pthread_mutex_lock(&audio_mutex);
	int res = system(command);
	pthread_mutex_unlock(&audio_mutex);
	return (res == 0);
}
コード例 #18
0
ファイル: volumectrl.cpp プロジェクト: admiral0/Antico-Deluxe
SliderWidget::SliderWidget(QWidget *parent)
	:  QWidget(parent)
{	
	QFont f = QFont(font());
	//f.setBold(true);
	f.setWeight(75);
	f.setPointSize(14);
	setFont(f);
	
	QVBoxLayout *layout = new QVBoxLayout;
	layout->setSpacing(0);
	layout->setContentsMargins(5, 2, 5, 5);
	
	QLabel *plus = new QLabel("+");
	plus->setFont(f);
	plus->setAlignment(Qt::AlignHCenter);
	layout->addWidget(plus);
	
	slider = new QSlider(Qt::Vertical);
	QHBoxLayout *hlayout = new QHBoxLayout;
	hlayout->setSpacing(0);
	hlayout->setContentsMargins(0, 0, 0, 0);
	hlayout->addWidget(slider);
	layout->addLayout(hlayout);
	
	QLabel *minus = new QLabel("-");
	minus->setAlignment(Qt::AlignHCenter);
	minus->setFont(f);
	layout->addWidget(minus);
	
	setLayout(layout);
	setFixedWidth(28);
	
	snd = new AmeSystemSound(this);
	snd->setEmbedSound(AmeSoundTheme::Popup, true);
	
	slider->setMinimum(0);
	slider->setMaximum(100);
	if (snd->isMuted()) {
		// TODO: update icon to muted
	} else {
		// TODO:
	}
	slider->setValue(snd->volume());

	connect(slider, SIGNAL(sliderReleased()), this, SLOT(onSliderRelease()));
	connect(slider, SIGNAL(sliderMoved(int)), this, SLOT(onSliderMove(int)));
	connect(snd, SIGNAL(systemVolumeChanged(int)), this, SLOT(onSystemVolume(int)));

	timer = new QTimer();
	connect(timer, SIGNAL(timeout()), this, SLOT(updateVolume()));
	changing = false;
}
コード例 #19
0
ファイル: sound.cpp プロジェクト: cc9cii/xoreos
void OptionsSoundMenu::callbackActive(Widget &widget) {
	if ((widget.getTag() == "CancelButton") ||
	    (widget.getTag() == "XButton")) {

		revertChanges();
		_returnCode = 1;
		return;
	}

	if (widget.getTag() == "OkButton") {

		adoptChanges();
		_returnCode = 2;
		return;
	}

	if (widget.getTag() == "AdvSoundBtn") {
		sub(*_advanced);
		return;
	}

	if (widget.getTag() == "MusicSlider") {
		_volMusic = dynamic_cast<WidgetSlider &>(widget).getState() / 20.0;
		updateVolume(_volMusic, Sound::kSoundTypeMusic, "MusicLabel");
		return;
	}

	if (widget.getTag() == "VoicesSlider") {
		_volVoice = dynamic_cast<WidgetSlider &>(widget).getState() / 20.0;
		updateVolume(_volVoice, Sound::kSoundTypeVoice, "VoicesLabel");
		return;
	}

	if (widget.getTag() == "SoundFXSlider") {
		_volSFX = _volVideo = dynamic_cast<WidgetSlider &>(widget).getState() / 20.0;
		updateVolume(_volSFX  , Sound::kSoundTypeSFX  , "SoundFXLabel");
		updateVolume(_volVideo, Sound::kSoundTypeVideo, "");
		return;
	}
}
コード例 #20
0
ファイル: hfslib.c プロジェクト: boxingcow/xpwn
void grow_hfs(Volume* volume, uint64_t newSize) {
	uint32_t newBlocks;
	uint32_t blocksToGrow;
	uint64_t newMapSize;
	uint64_t i;
	unsigned char zero;
	
	zero = 0;	
	
	newBlocks = newSize / volume->volumeHeader->blockSize;
	
	if(newBlocks <= volume->volumeHeader->totalBlocks) {
		printf("Cannot shrink volume\n");
		return;
	}

	blocksToGrow = newBlocks - volume->volumeHeader->totalBlocks;
	newMapSize = newBlocks / 8;
	
	if(volume->volumeHeader->allocationFile.logicalSize < newMapSize) {
		if(volume->volumeHeader->freeBlocks
		   < ((newMapSize - volume->volumeHeader->allocationFile.logicalSize) / volume->volumeHeader->blockSize)) {
			printf("Not enough room to allocate new allocation map blocks\n");
			exit(0);
		}
		
		allocate((RawFile*) (volume->allocationFile->data), newMapSize);
	}
	
	/* unreserve last block */	
	setBlockUsed(volume, volume->volumeHeader->totalBlocks - 1, 0);
	/* don't need to increment freeBlocks because we will allocate another alternate volume header later on */
	
	/* "unallocate" the new blocks */
	for(i = ((volume->volumeHeader->totalBlocks / 8) + 1); i < newMapSize; i++) {
		ASSERT(WRITE(volume->allocationFile, i, 1, &zero), "WRITE");
	}
	
	/* grow backing store size */
	ASSERT(WRITE(volume->image, newSize - 1, 1, &zero), "WRITE");
	
	/* write new volume information */
	volume->volumeHeader->totalBlocks = newBlocks;
	volume->volumeHeader->freeBlocks += blocksToGrow;
	
	/* reserve last block */	
	setBlockUsed(volume, volume->volumeHeader->totalBlocks - 1, 1);
	
	updateVolume(volume);
}
コード例 #21
0
ファイル: LineSegmentShape.cpp プロジェクト: ayonga/dart
//==============================================================================
LineSegmentShape::LineSegmentShape(float _thickness)
  : Shape(LINE_SEGMENT),
    mThickness(_thickness),
    mDummyVertex(Eigen::Vector3d::Zero())
{
  if (_thickness <= 0.0f)
  {
    dtwarn << "[LineSegmentShape::LineSegmentShape] Attempting to set "
           << "non-positive thickness. We set the thickness to 1.0f instead."
           << std::endl;
    mThickness = 1.0f;
  }

  updateVolume();
  mVariance = DYNAMIC_VERTICES;
}
コード例 #22
0
void MediaControls::reset()
{
    const bool useNewUi = RuntimeEnabledFeatures::newMediaPlaybackUiEnabled();
    BatchedControlUpdate batch(this);

    m_allowHiddenVolumeControls = useNewUi;
    m_keepMuteButton = false;

    const double duration = mediaElement().duration();
    m_durationDisplay->setInnerText(LayoutTheme::theme().formatMediaControlsTime(duration), ASSERT_NO_EXCEPTION);
    m_durationDisplay->setCurrentValue(duration);

    if (useNewUi) {
        // Show everything that we might hide.
        // If we don't have a duration, then mark it to be hidden.  For the
        // old UI case, want / don't want is the same as show / hide since
        // it is never marked as not fitting.
        m_durationDisplay->setIsWanted(std::isfinite(duration));
        m_currentTimeDisplay->setIsWanted(true);
        m_timeline->setIsWanted(true);
    }

    updatePlayState();

    updateCurrentTimeDisplay();

    m_timeline->setDuration(duration);
    m_timeline->setPosition(mediaElement().currentTime());

    updateVolume();

    refreshClosedCaptionsButtonVisibility();

    m_fullScreenButton->setIsWanted(shouldShowFullscreenButton(mediaElement()));

    refreshCastButtonVisibilityWithoutUpdate();
    makeOpaque();

    // Set the panel width here, and force a layout, before the controls update.
    // This would be harmless for the !useNewUi case too, but it causes
    // compositing/geometry/video-fixed-scrolling.html to fail with two extra
    // 0 height nodes in the render tree.
    if (useNewUi)
        m_panelWidth = m_panel->clientWidth();
}
コード例 #23
0
void Node::getWorldVolume(BoxVolume &result)
{
    Matrix m;

    if(getParent() != NULL)
    {
        getParent()->getToWorld(m);
    }
    else
    {
        m.setIdentity();
    }

    updateVolume();

    result = getVolume();
    result.transform(m);
}
コード例 #24
0
ファイル: sound_manager.cpp プロジェクト: Tkachov/scummvm
void QSoundManager::setVolume(int handle, uint volume, uint seconds) {
	for (uint idx = 0; idx < _slots.size(); ++idx) {
		Slot &slot = _slots[idx];
		if (slot._handle == handle) {
			_channelsVolume[slot._channel] = volume;
			updateVolume(slot._channel, seconds * 1000);

			if (volume) {
				uint ticks = g_vm->_events->getTicksCount() + seconds * 1000;
				if (!slot._ticks || ticks >= slot._ticks)
					slot._ticks = ticks;
			} else {
				slot._ticks = 0;
			}
			break;
		}
	}
}
コード例 #25
0
ファイル: MediaControls.cpp プロジェクト: ollie314/chromium
void MediaControls::reset() {
  EventDispatchForbiddenScope::AllowUserAgentEvents allowEventsInShadow;
  const bool useNewUi = RuntimeEnabledFeatures::newMediaPlaybackUiEnabled();
  BatchedControlUpdate batch(this);

  m_allowHiddenVolumeControls = useNewUi;

  const double duration = mediaElement().duration();
  m_durationDisplay->setTextContent(
      LayoutTheme::theme().formatMediaControlsTime(duration));
  m_durationDisplay->setCurrentValue(duration);

  if (useNewUi) {
    // Show everything that we might hide.
    // If we don't have a duration, then mark it to be hidden.  For the
    // old UI case, want / don't want is the same as show / hide since
    // it is never marked as not fitting.
    m_durationDisplay->setIsWanted(std::isfinite(duration));
    m_currentTimeDisplay->setIsWanted(true);
    m_timeline->setIsWanted(true);
  }

  // If the player has entered an error state, force it into the paused state.
  if (mediaElement().error())
    mediaElement().pause();

  updatePlayState();

  updateCurrentTimeDisplay();

  m_timeline->setDuration(duration);
  m_timeline->setPosition(mediaElement().currentTime());

  updateVolume();

  refreshClosedCaptionsButtonVisibility();

  m_fullscreenButton->setIsWanted(shouldShowFullscreenButton(mediaElement()));

  refreshCastButtonVisibilityWithoutUpdate();

  m_downloadButton->setIsWanted(
      m_downloadButton->shouldDisplayDownloadButton());
}
コード例 #26
0
ファイル: LineSegmentShape.cpp プロジェクト: ayonga/dart
//==============================================================================
LineSegmentShape::LineSegmentShape(const Eigen::Vector3d& _v1,
                                   const Eigen::Vector3d& _v2,
                                   float _thickness)
  : Shape(LINE_SEGMENT),
    mThickness(_thickness)
{
  if (_thickness <= 0.0f)
  {
    dtwarn << "[LineSegmentShape::LineSegmentShape] Attempting to set "
           << "non-positive thickness. We set the thickness to 1.0f instead."
           << std::endl;
    mThickness = 1.0f;
  }

  addVertex(_v1);
  addVertex(_v2);
  updateVolume();
  mVariance = DYNAMIC_VERTICES;
}
コード例 #27
0
void CMusicChannelFader::update()
{
	TTime current_time = CTime::getLocalTime();
	float delta_time = (float)(current_time - _LastTime) / 1000.0f;
	_LastTime = current_time;
	for (uint i = 0; i < _MaxMusicFader; ++i)
	{
		_CMusicFader &fader = _MusicFader[i];
		if (fader.Playing)
		{
			if (fader.MusicChannel->isEnded())
			{
				fader.MusicChannel->stop();
				fader.Playing = false;
				fader.Fade = false;
			}
			else if (fader.Fade)
			{
				// wait with fading in until the song has started playing (at 0 volume)
				if (!fader.MusicChannel->isLoadingAsync())
				{
					fader.XFadeVolume += fader.XFadeDVolume * delta_time;
					if (fader.XFadeVolume <= 0.f)
					{
						// fadeout complete
						fader.MusicChannel->stop();
						fader.Fade = false;
						fader.Playing = false;
					}
					else if (fader.XFadeVolume >= 1.f)
					{
						// fadein complete
						fader.Fade = false;
						fader.XFadeVolume = 1.f;
					}
				}
			}
		}
	}
	updateVolume();
}
コード例 #28
0
ファイル: WidgetVolumeSlider.cpp プロジェクト: bratao/vlc-qt
void VlcWidgetVolumeSlider::initWidgetVolumeSlider()
{
    _lock = false;

    _slider = new QSlider(this);
    _slider->setOrientation(Qt::Horizontal);
    _slider->setMaximum(200);

    _label = new QLabel(this);
    _label->setMinimumWidth(20);
    _label->setText(QString().number(0));

    QHBoxLayout *layout = new QHBoxLayout;
    layout->addWidget(_slider);
    layout->addWidget(_label);
    setLayout(layout);

    _timer = new QTimer(this);

    connect(_timer, SIGNAL(timeout()), this, SLOT(updateVolume()));
    connect(_slider, SIGNAL(valueChanged(int)), this, SLOT(setVolume(int)));
}
コード例 #29
0
ファイル: Audio.cpp プロジェクト: BackupTheBerlios/sotu-svn
//----------------------------------------------------------------------------
void Audio::startMusic( void)
{
    if (_playMusic)
    {
        string soundtrack = "";
        if (_playDefaultSoundtrack)
        {
            //look in developer file tree first
            soundtrack = string("../data/music/lg-criti.xm");
            struct stat statInfo;
            if (stat(soundtrack.c_str(), &statInfo) == -1) //try global
                soundtrack = getDataPath()+string("lg-criti.xm");
        }
        else
            ConfigS::instance()->getString( "soundtrack", soundtrack);

        turnMusicOff();
        loadMusic(soundtrack);
        updateVolume();
    }
    else
        turnMusicOff();
}
コード例 #30
0
ファイル: AudioData.cpp プロジェクト: Ar-es/raspivoice
void AudioData::Play()
{
	updateVolume();
	
	int bytes_per_sample = (use_stereo ? 4 : 2);

	std::stringstream cmd;
	cmd << "aplay --nonblock -r" << sample_freq_Hz << " -c" << (use_stereo ? 2 : 1) << " -fS16_LE -D plughw:" << CardNumber;
	if (!Verbose)
	{
		cmd << " -q";
	}
	else
	{
		std::cout << cmd.str() << std::endl;
	}

	pthread_mutex_lock(&audio_mutex);
	FILE* p = popen(cmd.str().c_str(), "w");
	fwrite(samplebuffer.data(), bytes_per_sample, sample_count, p);
	pclose(p);
	pthread_mutex_unlock(&audio_mutex);
}