//int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR pScmdline, int iCmdshow) int main(int _argc, char** _argv) { EEMusic music; music.AsyncLoadMusic("Music/zhntn.mp3"); music.SetFrequencyRatio(1.5f); music.Start(); //music.Open("Music/zhntn.mp3"); //music.Play(); //music.Play(0.5, 0.1, 2); system("pause"); return 0; }
//int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR pScmdline, int iCmdshow) int main(int _argc, char** _argv) { EEDesc desc; desc.applicationName = L"Emerald"; //窗口名称 desc.isFullScreen = false; //是否全屏 desc.width = 800; //窗口宽度 desc.height = 450; //窗口高度 desc.isSSAA = true; //是开启抗锯齿 desc.isVsync = false; //是否垂直同步 EEInitialize(desc); EERecorder recorder((DWORD_PTR)RecorderInProc); recorder.Start(); std::map<char, EEMusic*> voices; while (EERun()) { EEBeginScene(EEColor::BLACK); std::string recv; if (g_client.Recv(recv, 61)) { std::map<char, EEMusic*>::iterator it = voices.find(recv[0]); if (it == voices.end()) { EEMusic *voice = new EEMusic(recorder.GetFormat()); voice->Play(); voices.insert(std::pair<char, EEMusic*>(recv[0], voice)); char code[960]; EEWaveCoder::WaveDecode(&recv[1], 60, code, NULL); voice->AddBuffer(code, 960); } else { char code[960]; EEWaveCoder::WaveDecode(&recv[1], 60, code, NULL); it->second->AddBuffer(code, 960); } } EEEndScene(); } EEShutdown(); return 0; }
//int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR pScmdline, int iCmdshow) int main(int _argc, char** _argv) { EEDesc desc; desc.applicationName = L"Emerald"; //窗口名称 desc.isFullScreen = false; //是否全屏 desc.width = 800; //窗口宽度 desc.height = 450; //窗口高度 desc.isSSAA = true; //是开启抗锯齿 desc.isVsync = false; //是否垂直同步 EEInitialize(desc); EETexture bgTex(L"Texture\\主界面\\主界面背景.jpg"); EELineEditor *lineEditor = new EELineEditor(Rect_Float(200.f, 300.f, 300.f, 330.f), bgTex, EEColor::BLACK); EETexture buttonTex(L"Texture/主界面/模式标签/生涯模式.png"); EEButton *button1 = new EEButton(EE_BUTTON_SCALE, Rect_Float(40.f, 380.f, 100.f, 440.f), 1.3f, 0.2f, 0.2f, buttonTex, (DWORD_PTR)ConfirmName); while (EERun()) { EEBeginScene(EEColor::BLACK); lineEditor->Process(); button1->Process(); if (flag) { g_name = lineEditor->GetText(); break; } EEEndScene(); } EERecorder recorder((DWORD_PTR)RecorderInProc); recorder.Start(); std::map<string, EEMusic*> voices; while (EERun()) { EEBeginScene(EEColor::BLACK); std::string data; int headpos = 0; int tailpos = 0; if (g_client.Recv(data)) { std::string name; if ((headpos = data.find("<name>", headpos)) != -1) { headpos += 6; if ((tailpos = data.find("<name>", headpos)) != -1) { name.assign(data, headpos, tailpos - headpos); } } std::string wave; if ((headpos = data.find("<wave>", headpos)) != -1) { headpos += 6; if ((tailpos = data.find("<wave>", headpos)) != -1) { wave.assign(data, headpos, tailpos - headpos); } } std::map<string, EEMusic*>::iterator it = voices.find(name); if (it == voices.end()) { EEMusic *voice = new EEMusic(recorder.GetFormat()); voice->Play(); voices.insert(std::pair<string, EEMusic*>(name, voice)); char code[960]; EEWaveCoder::WaveDecode(&wave[0], 60, code, NULL); voice->AddBuffer(code, 960); } else { char code[960]; EEWaveCoder::WaveDecode(&wave[0], 60, code, NULL); it->second->AddBuffer(code, 960); } } EEEndScene(); } EEShutdown(); return 0; }