Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "Chopper.h"
- #include <iostream>
- #include <string>
- #include <vector>
- #include <thread>
- #include <chrono>
- void wait(int milliseconds){
- std::this_thread::sleep_for(std::chrono::milliseconds(milliseconds));
- }
- int main(){
- Chopper recorder;
- std::vector<RtAudio::DeviceInfo> devInfo = recorder.getDevices();
- int index = 0;
- for ( auto &i : devInfo ) {
- std::cout << index << ": " << i.name << std::endl;
- index++;
- }
- int devNum;
- std::cout << "Type the device number you wish to use: ";
- std::cin >> devNum;
- recorder.setDevice(devNum);
- std::string inp;
- recorder.startRecording();
- std::cout << "\nRecording Started. This will not be included in the wav file." << std::endl; // It's actually almost 2 seconds from when this line prints to when the hardware starts recording
- std::cout << "\nType anything and then press enter to mark the start of the wav file: ";
- std::cin >> inp;
- std::cout << "Recorded start time" << std::endl;
- unsigned int start = getTimeMillis();
- std::cout << "\nType anything and the press enter to mark the end of the wav file: ";
- std::cin >> inp;
- std::cout << "Recorded stop time" << std::endl;
- unsigned int end = getTimeMillis();
- std::cout << "\nThe wav file is ended, but this will record until you specifically stop it by typing something: ";
- std::cin >> inp;
- recorder.stopRecording();
- std::cout << "Recording stopped" << std::endl;
- recorder.chopAudio("final.wav", start, end);
- std::cout << "\nFile Rendered" << std::endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement