I was following a video tutorial for playing music in c++:
https://www.youtube.com/watch?v=tgamhuQnOkM&t=1030s
I am using Dev-C++ and I keep getting an error in the header file that "I'm not supposed to worry about"
The line is:
auto d = std::find(devices.begin(), devices.end(), sOutputDevice);
And the error says:
>92 68 C:\Users\benna\Documents\Starting Over\wave_music\olcNoiseMaker.h [Error] no matching function for call to 'find(std::vector<std::basic_string<wchar_t> >::iterator, std::vector<std::basic_string<wchar_t> >::iterator, std::wstring&)'
I am a noob here and I really don't get it.
My code is the same, and I've looked at linkers, project settings and other IDEs (VS Code & Eclipse) and nothing changes. (Especially the other IDEs, I can't even get them to run "Hello World".)
I just thought I could learn something through a little experimentation but I am getting nowhere. Is it a problem with my software?
I think it may be a problem with accessing my sound hardware.
I am still learning so any help would be appreciated, thank you!
The header file is here: https://github.com/OneLoneCoder/synth/blob/master/olcNoiseMaker.h
And my main file is this:
using namespace std;
#include "olcNoiseMaker.h"
atomic<double> dFrequencyOutput = 0.0;
double MakeNoise(double dTime)
{
return 0.5 * sin(440.0 * 2 * 3.14159 * dTime);
//double dOutput 1.0* sin(dFrequencyOutput * 2.0 * 3.14159 * dTime);
//return dOutput * 0.5;
//if (dOutput > 0.0)
// return 0.2;
//else
// return -0.2;
}
int main()
{
wcout << "onelonecoder.com - Synthesizer Part 1" << endl;
// Get all sound hardware
vector<wstring> devices = olcNoiseMaker<short>::Enumerate();
// Display findings
for (auto d : devices) wcout << "Found Output Device:" << d << endl;
// Create sound machine!!
olcNoiseMaker<short> sound(devices[0], 44100, 1, 8, 512);
// Link make noise function with sound machine
sound.SetUserFunction(MakeNoise);
while (1)
{
}
return 0;
}