/** * \brief Application entry point for ssc_dam_audio example. * * \return Unused (ANSI-C compatibility). */ int main( void ) { uint16_t data = 0; /* Disable watchdog */ WDT_Disable( WDT ) ; /* Enable I and D cache */ SCB_EnableICache(); SCB_EnableDCache(); /* Output example information */ printf("-- SSC DMA Audio Example %s --\n\r", SOFTPACK_VERSION); printf("-- %s\n\r", BOARD_NAME); printf("-- Compiled: %s %s --\n\r", __DATE__, __TIME__); /* Configure systick for 1 ms. */ printf( "Configure system tick to get 1ms tick period.\n\r" ) ; if ( TimeTick_Configure( ) ) { printf("-F- Systick configuration error\n\r" ) ; } /* Configure all pins */ PIO_Configure(pinsSsc, PIO_LISTSIZE(pinsSsc)); /* Configure SSC */ SSC_Configure(AUDIO_IF , 0 , SSC_MCK ); SSC_ConfigureReceiver(AUDIO_IF,I2S_SLAVE_RX_SETTING,I2S_SLAVE_RX_FRM_SETTING); SSC_DisableReceiver(AUDIO_IF); SSC_ConfigureTransmitter(AUDIO_IF,I2S_SLAVE_TX_SETTING,I2S_SLAVE_TX_FRM_SETTING); SSC_DisableTransmitter(AUDIO_IF); /* Configure DMA */ Dma_configure(); /* Configure and enable the TWI (required for accessing the DAC) */ PMC_EnablePeripheral(ID_TWIHS0); TWI_ConfigureMaster(TWIHS0, TWI_CLOCK, BOARD_MCK); TWID_Initialize(&twid, TWIHS0); /* Configure TWI interrupts */ NVIC_ClearPendingIRQ(TWIHS0_IRQn); NVIC_EnableIRQ(TWIHS0_IRQn); /* check that WM8904 is present */ WM8904_Write(&twid, WM8904_SLAVE_ADDRESS, 22, 0); data=WM8904_Read(&twid, WM8904_SLAVE_ADDRESS, 0); if( data != 0x8904){ printf("WM8904 not found!\n\r"); while(1); } /* Initialize the audio DAC */ WM8904_Init(&twid, WM8904_SLAVE_ADDRESS, PMC_MCKR_CSS_SLOW_CLK); /* Enable the DAC master clock */ PMC_ConfigurePCK2(PMC_MCKR_CSS_SLOW_CLK, PMC_MCKR_PRES_CLK_1 ); printf("Insert Line-in cable with PC Headphone output\n\r"); PlayRecording(); while ( 1 ); }
bool CPVRGUIActions::ResumePlayRecording(const CFileItemPtr &item, bool bPlayMinimized, bool bFallbackToPlay) const { bool bCanResume = !GetResumeLabel(*item).empty(); if (bCanResume) { item->m_lStartOffset = STARTOFFSET_RESUME; } else { if (bFallbackToPlay) item->m_lStartOffset = 0; else return false; } return PlayRecording(item, bPlayMinimized, false); }
bool CPVRGUIActions::PlayMedia(const CFileItemPtr &item) const { CFileItemPtr pvrItem(item); if (URIUtils::IsPVRChannel(item->GetPath()) && !item->HasPVRChannelInfoTag()) pvrItem = g_PVRChannelGroups->GetByPath(item->GetPath()); else if (URIUtils::IsPVRRecording(item->GetPath()) && !item->HasPVRRecordingInfoTag()) pvrItem = g_PVRRecordings->GetByPath(item->GetPath()); if (pvrItem->HasPVRChannelInfoTag()) { return SwitchToChannel(pvrItem, CServiceBroker::GetSettings().GetBool(CSettings::SETTING_PVRPLAYBACK_PLAYMINIMIZED), true); } else if (pvrItem->HasPVRRecordingInfoTag()) { return PlayRecording(pvrItem, CServiceBroker::GetSettings().GetBool(CSettings::SETTING_PVRPLAYBACK_PLAYMINIMIZED), true); } return false; }
bool CPVRGUIActions::SwitchToChannel(const CFileItemPtr &item, bool bPlayMinimized, bool bCheckResume) const { if (item->m_bIsFolder) return false; const CPVRChannelPtr channel(CPVRItem(item).GetChannel()); if ((channel && g_PVRManager.IsPlayingChannel(channel)) || (channel && channel->HasRecording() && g_PVRManager.IsPlayingRecording(channel->GetRecording()))) { CGUIMessage msg(GUI_MSG_FULLSCREEN, 0, g_windowManager.GetActiveWindow()); g_windowManager.SendMessage(msg); return true; } CMediaSettings::GetInstance().SetVideoStartWindowed(bPlayMinimized); // switch to channel or if recording present, ask whether to switch or play recording... bool bSwitchSuccessful(false); if (channel && g_PVRManager.CheckParentalLock(channel)) { const CPVRRecordingPtr recording(channel->GetRecording()); if (recording) { bool bCancel(false); bool bPlayRecording = CGUIDialogYesNo::ShowAndGetInput(CVariant{19687}, // "Play recording" CVariant{""}, CVariant{12021}, // "Play from beginning" CVariant{recording->m_strTitle}, bCancel, CVariant{19000}, // "Switch to channel" CVariant{19687}, // "Play recording" 0); // no autoclose if (bCancel) return false; if (bPlayRecording) { const CFileItemPtr recordingItem(new CFileItem(recording)); return PlayRecording(recordingItem, CServiceBroker::GetSettings().GetBool(CSettings::SETTING_PVRPLAYBACK_PLAYMINIMIZED), bCheckResume); } } /* try a fast switch */ if ((g_PVRManager.IsPlayingTV() || g_PVRManager.IsPlayingRadio()) && (channel->IsRadio() == g_PVRManager.IsPlayingRadio())) { if (channel->StreamURL().empty()) bSwitchSuccessful = g_application.m_pPlayer->SwitchChannel(channel); } if (!bSwitchSuccessful) { CApplicationMessenger::GetInstance().PostMsg(TMSG_MEDIA_PLAY, 0, 0, static_cast<void*>(new CFileItem(channel))); return true; } } if (!bSwitchSuccessful) { std::string channelName = g_localizeStrings.Get(19029); // Channel if (channel) channelName = channel->ChannelName(); std::string msg = StringUtils::Format(g_localizeStrings.Get(19035).c_str(), channelName.c_str()); // CHANNELNAME could not be played. Check the log for details. CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Error, g_localizeStrings.Get(19166), msg); // PVR information return false; } return true; }
void MenuBar::AddMovieMenu() { auto* movie_menu = addMenu(tr("&Movie")); m_recording_start = AddAction(movie_menu, tr("Start Re&cording Input"), this, [this] { emit StartRecording(); }); m_recording_play = AddAction(movie_menu, tr("P&lay Input Recording..."), this, [this] { emit PlayRecording(); }); m_recording_stop = AddAction(movie_menu, tr("Stop Playing/Recording Input"), this, [this] { emit StopRecording(); }); m_recording_export = AddAction(movie_menu, tr("Export Recording..."), this, [this] { emit ExportRecording(); }); m_recording_start->setEnabled(false); m_recording_play->setEnabled(false); m_recording_stop->setEnabled(false); m_recording_export->setEnabled(false); m_recording_read_only = movie_menu->addAction(tr("&Read-Only Mode")); m_recording_read_only->setCheckable(true); m_recording_read_only->setChecked(Movie::IsReadOnly()); connect(m_recording_read_only, &QAction::toggled, [](bool value) { Movie::SetReadOnly(value); }); movie_menu->addSeparator(); auto* pause_at_end = movie_menu->addAction(tr("Pause at End of Movie")); pause_at_end->setCheckable(true); pause_at_end->setChecked(SConfig::GetInstance().m_PauseMovie); connect(pause_at_end, &QAction::toggled, [](bool value) { SConfig::GetInstance().m_PauseMovie = value; }); auto* lag_counter = movie_menu->addAction(tr("Show Lag Counter")); lag_counter->setCheckable(true); lag_counter->setChecked(SConfig::GetInstance().m_ShowLag); connect(lag_counter, &QAction::toggled, [](bool value) { SConfig::GetInstance().m_ShowLag = value; }); auto* frame_counter = movie_menu->addAction(tr("Show Frame Counter")); frame_counter->setCheckable(true); frame_counter->setChecked(SConfig::GetInstance().m_ShowFrameCount); connect(frame_counter, &QAction::toggled, [](bool value) { SConfig::GetInstance().m_ShowFrameCount = value; }); auto* input_display = movie_menu->addAction(tr("Show Input Display")); input_display->setCheckable(true); input_display->setChecked(SConfig::GetInstance().m_ShowInputDisplay); connect(frame_counter, &QAction::toggled, [](bool value) { SConfig::GetInstance().m_ShowInputDisplay = value; }); auto* system_clock = movie_menu->addAction(tr("Show System Clock")); system_clock->setCheckable(true); system_clock->setChecked(SConfig::GetInstance().m_ShowRTC); connect(system_clock, &QAction::toggled, [](bool value) { SConfig::GetInstance().m_ShowRTC = value; }); movie_menu->addSeparator(); auto* dump_frames = movie_menu->addAction(tr("Dump Frames")); dump_frames->setCheckable(true); dump_frames->setChecked(SConfig::GetInstance().m_DumpFrames); connect(dump_frames, &QAction::toggled, [](bool value) { SConfig::GetInstance().m_DumpFrames = value; }); auto* dump_audio = movie_menu->addAction(tr("Dump Audio")); dump_audio->setCheckable(true); dump_audio->setChecked(SConfig::GetInstance().m_DumpAudio); connect(dump_audio, &QAction::toggled, [](bool value) { SConfig::GetInstance().m_DumpAudio = value; }); }