| oboeninja (8) | |
|
I'm writing a program and I have all of it working properly except the last part, the convert_to_wave function. The problem is that it's in a library, not one that I wrote so I'm not sure what I'm doing wrong. I'm passing in the temp file and it should be converted to my wav file but I receive the error "Error reading input file temp.tmp". It generates a .wav file but I can't get it to play the note. I'm not sure exactly where the error is, my guess is with the input to the function. Am I passing a file in correctly when I call the function? Any suggestions appreciated. If you need more details, I will try and provide them. fout.open("temp.tmp"); myfile.open("C5.wav"); for ( i = 0; i < NUM_NOTES ; i++ ) { time_new = file_contents[i][0]; for ( ; time_old < time_new; time_old++ ) { for ( j = 0; j < buffer; j++ ) { fout << notes[j]; } for ( j = 0; j < buffer -1; j++ ) { notes[j] = .996 * ( notes[j] + notes[j+1] ) / 2.0; } notes[buffer] = ( notes[buffer] + notes[0] ) / 2.0; } time_old = time_new; } convert_to_wave( "temp.tmp", "C5.wav", SAMPLE_RATE, true); fout.close(); myfile.close(); | |
|
|
|
| Ogoyant (48) | |
| Your program uses an external library like you said, so it is not clear (to me at least) how this function is supposed to work. Your library probably comes with a documentation or sample program that illustrates how it should be used. Have you checked that? | |
|
|
|
| modoran (1095) | |
| You need to close the file before passing it to convert function. | |
|
|
|