//------------------------------------------------------------------------------ //------------------------------------------------------------------------------ void CricketAudioSystem::OnInit() { #if CS_TARGETPLATFORM_ANDROID auto coreJI = CSBackend::Android::JavaInterfaceManager::GetSingletonPtr()->GetJavaInterface<CSBackend::Android::CoreJavaInterface>(); CS_ASSERT(coreJI != nullptr, "Must have access to the core native interface to setup Cricket Audio."); CkConfig config(CSBackend::Android::JavaInterfaceManager::GetSingletonPtr()->GetJNIEnvironmentPtr(), coreJI->GetActivity()); CkInit(&config); #else CkConfig config; CkInit(&config); #endif //Print the license info. CS_LOG_VERBOSE("================="); CS_LOG_VERBOSE("= Cricket Audio ="); CS_LOG_VERBOSE("================="); CS_LOG_VERBOSE(" "); CS_LOG_VERBOSE("Chilli Source has obtained special permission to include Cricket Audio as"); CS_LOG_VERBOSE("part of the engine. See the documentation on CricketAudioSystem for details "); CS_LOG_VERBOSE("on how to use Cricket Audio. You are free to use Cricket Audio as part of "); CS_LOG_VERBOSE("Chilli Source within your app subject to the Cricket Audio free license"); CS_LOG_VERBOSE("(http://www.crickettechnology.com/free_license) as outline below:"); CS_LOG_VERBOSE(" "); CS_LOG_VERBOSE("Cricket Audio free license"); CS_LOG_VERBOSE(" "); CS_LOG_VERBOSE("Cricket Audio is available FREE in binary form for iOS, Android, Windows"); CS_LOG_VERBOSE("Phone 8, OS X, Windows, and Linux."); CS_LOG_VERBOSE(" "); CS_LOG_VERBOSE("This free license has a few requirements:"); CS_LOG_VERBOSE(" "); CS_LOG_VERBOSE(" * Include the following message somewhere in your app, visible to users"); CS_LOG_VERBOSE(" (for example, on a credits screen):"); CS_LOG_VERBOSE(" Built with Cricket Audio"); CS_LOG_VERBOSE(" www.crickettechnology.com"); CS_LOG_VERBOSE(" "); CS_LOG_VERBOSE(" * You may optionally include our logo (available in .svg or .png format)."); CS_LOG_VERBOSE(" "); CS_LOG_VERBOSE(" * Do not distribute our software to anyone, or post it for download on any"); CS_LOG_VERBOSE(" site; refer them to our website instead. This license does not permit"); CS_LOG_VERBOSE(" you to distribute Cricket Audio in an SDK, library, or other software"); CS_LOG_VERBOSE(" development product. Contact us at [email protected] for"); CS_LOG_VERBOSE(" additional licensing options."); CS_LOG_VERBOSE(" "); CS_LOG_VERBOSE(" * If you release an app that uses Cricket Audio, you must let Cricket"); CS_LOG_VERBOSE(" Technology know. Cricket Technology will include a link to it on our"); CS_LOG_VERBOSE(" customers page."); CS_LOG_VERBOSE(" "); CS_LOG_VERBOSE("If you do not want to include the credit in your app, or if you do not want"); CS_LOG_VERBOSE("to notify us of your app's release, or if you want the source code, you can"); CS_LOG_VERBOSE("purchase a source code license (http://www.crickettechnology.com/source_license)."); CS_LOG_VERBOSE(" "); }
void gameInit() #endif { if (!g_inited) { Timer::init(); g_timer.start(); #if CK_PLATFORM_ANDROID CkConfig config(env, activity); config.useJavaAudio = true; #else CkConfig config; #endif CkInit(&config); // mute the volume until the first update; // the volumes & pans of 3D sounds won't be correct until then. CkMixer::getMaster()->setVolume(0.0f); // sound g_music = CkSound::newStreamSound("music.cks"); g_bank = CkBank::newBank("game.ckb"); g_pointSound = CkSound::newBankSound(g_bank, "point"); g_engineSound = CkSound::newBankSound(g_bank, "engine"); g_engineSound->setLoopCount(-1); g_engineSound->setPaused(true); g_engineSound->play(); g_music->setLoopCount(-1); g_music->setVolume(0.2f); g_music->play(); g_pointSound->setVolume(0.6f); CkSound::set3dAttenuation(kCkAttenuationMode_InvDistanceSquared, 0.5f, 10.0f, 0.05f); // game objects for (int i = 0; i < kNumCubes; ++i) { // cube sits just above ground plane Cube* cube = new Cube(); placeCube(cube); g_cubes[i] = cube; } g_ground = new GroundPlane(); g_ship = new Ship(); // gameGlInit() is called when the drawing surface is created. g_inited = true; } }
void SoundSystem::Startup() { m_nextSoundID = 1; m_workingDirectory = _getcwd(NULL,0); m_workingDirectory += "/"; static CkConfig ckConfig; CkInit(&ckConfig); }
//! driver initialization void AudioDriver::Init() { #if SHOOT_PLATFORM != SHOOT_PLATFORM_ANDROID CkConfig config; CkInit(&config); #endif m_pMusicMixer = CkMixer::newMixer("MusicMixer"); m_pSoundMixer = CkMixer::newMixer("SoundMixer"); }
void Java_com_crickettechnology_samples_HelloCricketNDK_MainActivity_helloCricketNative(JNIEnv* env, jobject activity) { CkConfig config(env, activity); CkInit(&config); CkBank* bank = CkBank::newBank("hellocricket.ckb"); CkSound* sound = CkSound::newBankSound(bank, 0); sound->play(); while (sound->isPlaying()) { CkUpdate(); usleep(30000); } sound->destroy(); bank->destroy(); CkShutdown(); }
int main(int argc, char* argv[]) { CkConfig config; CkInit(&config); CkBank* bank = CkBank::newBank("hellocricket.ckb"); CkSound* sound = CkSound::newBankSound(bank, 0); sound->play(); while (sound->isPlaying()) { CkUpdate(); Sleep(30); } sound->destroy(); bank->destroy(); CkShutdown(); return 0; }