Esempio n. 1
0
ALACSink::ALACSink(const std::wstring &path, EncoderBase &encoder)
	: m_mp4file(0),
	  m_filename(path),
	  m_closed(false)
{
    static const char * const compatibleBrands[] = { "M4A ", "mp42" };

    const AudioStreamBasicDescription &format
	= encoder.getOutputBasicDescription();
    uint32_t sample_rate = static_cast<uint32_t>(format.mSampleRate);
    try {
	m_mp4file.Create(
		w2m(path, utf8_codecvt_facet()).c_str(),
		0, // flags
		1, // add_ftypes
		0, // add_iods
		"M4A ", // majorBrand
		0, // minorVersion
		const_cast<char**>(compatibleBrands), 
		array_size(compatibleBrands));

	m_mp4file.SetTimeScale(sample_rate);
	std::vector<char> cookie;
	encoder.getMagicCookie(&cookie);
	m_track_id = m_mp4file.AddAlacAudioTrack(sample_rate,
		reinterpret_cast<uint8_t*>(&cookie[20]),
		cookie.size() - 28);
    } catch (mp4v2::impl::MP4Error *e) {
	handle_mp4error(e);
    }
}
Esempio n. 2
0
/** @brief update displayed settings
 */
void CreateVoiceWindow::updateSettings(void)
{
    // fill in language combobox
    QMap<QString, QString> languages = SystemInfo::languages();

    for(int i = 0; i < languages.keys().size(); i++) {
        QString key = languages.keys().at(i);
        ui.comboLanguage->addItem(languages.value(key), key);
    }
    // set saved lang
    int sel = ui.comboLanguage->findText(
            RbSettings::value(RbSettings::VoiceLanguage).toString());
    // if no saved language is found try to figure the language from the UI lang
    if(sel == -1) {
        QString f = RbSettings::value(RbSettings::Language).toString();
        // if no language is set default to english. Make sure not to check an empty string.
        if(f.isEmpty()) f = "english";
        sel = ui.comboLanguage->findData(f);
        qDebug() << "sel =" << sel;
        // still nothing found?
        if(sel == -1)
            sel = ui.comboLanguage->findText("english", Qt::MatchStartsWith);
    }
    ui.comboLanguage->setCurrentIndex(sel);

    QString ttsName = RbSettings::value(RbSettings::Tts).toString();
    TTSBase* tts = TTSBase::getTTS(this,ttsName);
    if(tts->configOk())
        ui.labelTtsProfile->setText(tr("Selected TTS engine: <b>%1</b>")
            .arg(TTSBase::getTTSName(ttsName)));
    else
        ui.labelTtsProfile->setText(tr("Selected TTS engine: <b>%1</b>")
            .arg("Invalid TTS configuration!"));

    QString encoder = SystemInfo::value(SystemInfo::CurEncoder).toString();
    // only proceed if encoder setting is set
    EncoderBase* enc = EncoderBase::getEncoder(this,encoder);
    if(enc != NULL) {
        if(enc->configOk())
            ui.labelEncProfile->setText(tr("Selected encoder: <b>%1</b>")
                .arg(EncoderBase::getEncoderName(encoder)));
        else
            ui.labelEncProfile->setText(tr("Selected encoder: <b>%1</b>")
                .arg("Invalid encoder configuration!"));
    }
    else
        ui.labelEncProfile->setText(tr("Selected encoder: <b>%1</b>")
            .arg("Invalid encoder configuration!"));
    ui.wavtrimthreshold->setValue(RbSettings::value(RbSettings::WavtrimThreshold).toInt());
    emit settingsUpdated();
}
Esempio n. 3
0
void Config::updateEncState()
{
    if(ui.treeDevices->selectedItems().size() == 0)
        return;

    QString devname = ui.treeDevices->selectedItems().at(0)->data(0, Qt::UserRole).toString();
    QString encoder = SystemInfo::platformValue(devname,
                        SystemInfo::CurEncoder).toString();
    ui.encoderName->setText(EncoderBase::getEncoderName(SystemInfo::platformValue(devname,
                        SystemInfo::CurEncoder).toString()));

    EncoderBase* enc = EncoderBase::getEncoder(this,encoder);

    if(enc->configOk())
    {
        ui.configEncstatus->setText(tr("Configuration OK"));
        ui.configEncstatusimg->setPixmap(QPixmap(QString::fromUtf8(":/icons/go-next.png")));
    }
    else
    {
        ui.configEncstatus->setText(tr("Configuration INVALID"));
        ui.configEncstatusimg->setPixmap(QPixmap(QString::fromUtf8(":/icons/dialog-error.png")));
    }
}