i need help figuring out what
statement i need to put in atl ine 142 to achieve playback
Code://session 3 task // Jcobb 29 Sept 2011 // PMA 2011 #include<iostream> #include<cctype>//Character handling library #include<windows.h>// WinApi header file include beep function using std::cout; using std::cin; using std::endl; int main() { //*********************************************************************************** // Set things up //*********************************************************************************** //notes constunsignedshort C = 523L; //C5 frequency in Hz constunsignedshort D = 587L; //D5 constunsignedshort E = 659L; //E5 constunsignedshort F = 698L; //F5 constunsignedshort G = 784L; //G5 constunsignedshort A = 880L; //A5 constunsignedshort B = 988L; //B5 //durations //Note durations based on a fixed 120BPM tempo // 120BPM = 2 quater notes per second so 1 quarter note = 0.5s or 500ms constunsignedlong whole_note = 2000L; //semibreve constunsignedlong half_note = 1000L; //minim constunsignedlong quarter_note = 500L; //crotchet constunsignedlong eight_note = 250L; //quaver int seq_len = 0; char note = ' '; //Temporarily holds input notes for checking int duration = 0; //Temporarily holds input duration for checking char *note_ptr = nullptr; int *note_freq_ptr = nullptr; int *duration_ptr = nullptr; char *notes_start_addr = nullptr; //Hold the start address of the notes in memory int *duration_start_addr = nullptr; int *freq_start_addr = nullptr; //*********************************************************************************** // Get the user to define the length of the sequencer in notes //*********************************************************************************** cout << "Enter a value between 4 and 20 to set the sequence length" << endl; cin >> seq_len; if ( (seq_len < 4 ) || (seq_len > 20) ) { cout << "Invalid sequence length forces exit " << endl; exit(0); } //*********************************************************************************** // Now we know the sequence length dynamically allocate the memory to hold the notes // and their durations. //*********************************************************************************** note_ptr = newchar[seq_len]; //allocate some memory depending on sequence length note_freq_ptr = newint[seq_len]; //To hold notes converted to frequencies duration_ptr = newint[seq_len]; notes_start_addr = note_ptr;//store start position of memory allocated to hold notes duration_start_addr = duration_ptr; freq_start_addr = note_freq_ptr; //*********************************************************************************** // get the user to enter the notes from a,b,c,d,e,f,g and their durations // 2000 = whole note, 1000 = half note, 500 = quater note, 250 = eighth note // store this user data in the dynamically allocated char arrays //*********************************************************************************** for(int i=0; i <= seq_len-1; i++) { cout << "Enter the note name for note number: " << i << " : "; cin >> note; *note_ptr = note; //The input values is stored in the address pointed at by note_ptr note_ptr++; //Point to next location ready for next note cout << "Enter the note duration for note number: " << i << " : "; cin >> duration; *duration_ptr = duration; duration_ptr++; cout << endl; } //*********************************************************************************** //*********************************************************************************** // Convert the char type note names entered by the user to integer frequencies //*********************************************************************************** for(int i=0; i <= seq_len-1; i++) { if ( *(notes_start_addr+i) == 'a') { *(note_freq_ptr+i) = A; } elseif ( *(notes_start_addr+i) == 'b') { *(note_freq_ptr+i) = B; } elseif ( *(notes_start_addr+i) == 'c') { *(note_freq_ptr+i) = C; } elseif ( *(notes_start_addr+i) == 'd') { *(note_freq_ptr+i) = D; } elseif ( *(notes_start_addr+i) == 'e') { *(note_freq_ptr+i) = E; } elseif ( *(notes_start_addr+i) == 'f') { *(note_freq_ptr+i) = F; } elseif ( *(notes_start_addr+i) == 'g') { *(note_freq_ptr+i) = G; } } //*********************************************************************************** //*********************************************************************************** // Print out the notes and durations loaded into the sequencer //*********************************************************************************** for(int i=0; i <= seq_len-1; i++) { cout << "Sequencer position: " << i << " Note= " << *(notes_start_addr+i); cout << " with frequency: " << *(freq_start_addr+i) << "Hz"; cout << " and duration= " << *(duration_start_addr + i) << "ms" << endl; } //*********************************************************************************** //*********************************************************************************** // Play the sequence using the Beep function //*********************************************************************************** for(int i=0; i <= seq_len-1; i++) { //**Add your playback statement here** } //*********************************************************************************** //*********************************************************************************** // Tidy things up like release any memory to the restore and eliminate dangling pointers //*********************************************************************************** note_ptr = nullptr;//Do this first otherwise assertion error as not at head of block note_freq_ptr = nullptr; duration_ptr = nullptr; notes_start_addr = nullptr; duration_start_addr = nullptr; delete [] note_ptr; delete [] note_freq_ptr; delete [] duration_ptr; return 0; }