コード例 #1
0
void
MidiPlayerWindow::MessageReceived(BMessage* msg)
{
	switch (msg->what) {
		case MSG_PLAY_STOP:
			OnPlayStop();
			break;

		case MSG_SHOW_SCOPE:
			OnShowScope();
			break;

		case MSG_INPUT_CHANGED:
			OnInputChanged(msg);
			break;

		case MSG_REVERB_NONE:
			OnReverb(B_REVERB_NONE);
			break;

		case MSG_REVERB_CLOSET:
			OnReverb(B_REVERB_CLOSET);
			break;

		case MSG_REVERB_GARAGE:
			OnReverb(B_REVERB_GARAGE);
			break;

		case MSG_REVERB_IGOR:
			OnReverb(B_REVERB_BALLROOM);
			break;

		case MSG_REVERB_CAVERN:
			OnReverb(B_REVERB_CAVERN);
			break;

		case MSG_REVERB_DUNGEON:
			OnReverb(B_REVERB_DUNGEON);
			break;

		case MSG_VOLUME:
			OnVolume();
			break;

		case B_SIMPLE_DATA:
			OnDrop(msg);
			break;

		default:
			super::MessageReceived(msg);
			break;
	}
}
コード例 #2
0
ファイル: mainwindowimpl.cpp プロジェクト: RyanNerd/finny
bool  MainWindowImpl::CheckRadioshark(void)
{
	string dev;
	if( FindRadioshark(dev) == false )
	{
		Logger::Write("ERROR:Could not find radioSHARK device. I'll keep looking...");
		ERRORS->setText("NO RADIOSHARK");
		return false;
	}
	//Found the device. If necessary initialize HID
	if(!m_pRadioshark)
	{
		Logger::Write("Created radioshark HID device.");
		m_pRadioshark = new Radioshark::Radioshark2Interface();
	}
	if( m_pRadioshark )
	{
		if( m_pRadioshark->Open() == false)
		{
			Logger::Write("ERROR: Problem opening HID device.");
			ERRORS->setText("HID PROBLEM");
			return false;
		}
		this->UpdateFrequencyDisplay();
	}else{
		Logger::Write("ERROR: The hid device pointer is undefined.");
		ERRORS->setText("HID ABSENT");
		return false;
	}
	
	//Set the start frequency
	if(m_Settings.StartFreq.GetBand() == Preset::AM)
	{
		m_pRadioshark->SetAMFreq(m_Settings.StartFreq.GetFreq());
	}else{
		m_pRadioshark->SetFMFreq(m_Settings.StartFreq.GetFreq());
	}
	
	//Open the actual audio capture.
	Visualization->setAttribute(Qt::WA_PaintOnScreen);
	Visualization->setAttribute(Qt::WA_OpaquePaintEvent);
	Visualization->setAttribute(Qt::WA_NoSystemBackground);
	if( m_AudioInterface.Open(dev,string("PULSE"),Visualization->winId(),
													m_Settings.UseXvimagesink) )
	{
		//Set the start volume
		OnVolume((int)m_Settings.StartVolume);
		Volume->setValue((int)m_Settings.StartVolume);
	}else{
		//Uh-oh.
		ERRORS->setText("GSTREAMER PROBLEM");
		return false;
	}
	//One last thing to do. Try to start the device.
	if( !m_AudioInterface.run() )
	{
		Logger::Write("ERROR: Can't run the audio interface.");
		return false;
	}
	ERRORS->setText("");
	this->UpdateFrequencyDisplay();
	//Perhaps LAME is unavilaible, so disable recording button.
	if(!m_AudioInterface.CanRecord())
	{
		Record->setDisabled(true);
	}
	return true;
}