void ApplicationPlugin::startEngine() { // Initialize libaudiostream structures if(m_ctx.player) { StopAudioPlayer(m_ctx.player); CloseAudioPlayer(m_ctx.player); } GetDeviceInfo(kJackRenderer, 0, &m_ctx.device_info); auto& dev = m_ctx.device_info; qDebug() << dev.fName << dev.fMaxInputChannels << dev.fMaxOutputChannels << dev.fDefaultBufferSize << dev.fDefaultSampleRate; m_ctx.player = OpenAudioPlayer(0, 2, 44100, 512, 65536*4, 44100*60*20, kJackRenderer, 1); m_ctx.renderer = GetAudioPlayerRenderer(m_ctx.player); GetAudioRendererInfo(m_ctx.renderer, &m_ctx.renderer_info); }
void ApplicationPlugin::startEngine() { stopEngine(); auto& stngs = iscore::GUIApplicationContextPlugin::context.settings<Audio::Settings::Model>(); auto api = stngs.getDriverId(); if(api == -1) return; // Initialize libaudiostream structures auto card = CardIdFromString(api, stngs.getCard()); if(card == -1) return; GetDeviceInfo(api, card, &m_ctx.device_info); auto& dev = m_ctx.device_info; qDebug() << dev.fName << dev.fMaxInputChannels << dev.fMaxOutputChannels << dev.fDefaultBufferSize << dev.fDefaultSampleRate; qDebug() << "openign with" << stngs.getRate() << stngs.getBufferSize(); AudioGlobalsInit(2, 2, stngs.getRate(), stngs.getBufferSize(), 65536*4, 0, 1); m_ctx.renderer = MakeAudioRenderer(api); m_ctx.sample_rate = stngs.getRate(); GetAudioRendererInfo(m_ctx.renderer, &m_ctx.renderer_info); OpenAudioRenderer(m_ctx.renderer, card, card, 2, 2, stngs.getBufferSize(), stngs.getRate()); emit audioEngineRestarted(); }
void TestPlay(AudioPlayerPtr player) { float vol = 1.0f; float panLeft = 1.0f; float panRight = 1.0f; char c; AudioRendererPtr renderer = GetAudioPlayerRenderer(player); while ((c = getchar()) && (c != 'n')) { switch (c) { case 'b': StartChannel(player, 1); break; case 'p': ContChannel(player, 1); break; case 's': StopChannel(player, 1); break; case '+': vol += 0.05f; //SetVolAudioPlayer(player, vol); time_strech += 0.1; printf("time_strech %f\n", time_strech); break; case '-': vol -= 0.05f; //SetVolAudioPlayer(player, vol); time_strech -= 0.1; printf("time_strech %f\n", time_strech); break; case '1': vol += 0.05f; //SetVolAudioPlayer(player, vol); pitch_shift += 0.1; printf("pitch_shift %f\n", pitch_shift); break; case '2': vol -= 0.05f; //SetVolAudioPlayer(player, vol); pitch_shift -= 0.1; printf("pitch_shift %f\n", pitch_shift); break; case 'w': RendererInfo info; GetAudioRendererInfo(renderer, &info); printf("info.fCurFrame %lld\n", info.fCurFrame); printf("info.fCurUsec %lld\n", info.fCurUsec); break; /* case '1': panLeft += 0.05f; panRight -= 0.05f; SetPanAudioPlayer(player, panLeft, panRight); break; case '2': panLeft += 0.05f; panRight -= 0.05f; SetPanAudioPlayer(player, panLeft, panRight); break; */ case 'c': // To be used only when faust effects are running.... SetControlValueEffect(faust_effect, 1, 0.95f); SetControlValueEffect(faust_effect, 2, 0.9f); break; } } }