I understand how to play a .wav file in a program, but I am attempting to "package" the .wav file with the project so that it can be played by another person, on a different machine (namely, my professor). The way I have come to understand this is that if you use the following line of code:
The sound file would not play if it is not in the same location on the other computer. Am I correct? Assuming that I am, I have added the file that I wish to play as a resource in my project, but I can't figure out how to make it play. Looking at MSDN (and other resources) I found the following snippet:
I get no errors when I build the program, but no sound plays when I run it. I have tried for hours now to figure this out (which is usually enough time for me to sort through the problem) but I have met with no success. This leads me to believe I am either completely off in my assumptions, or I am making a silly mistake.
i want to create a program (in c++ or c#) that will play mp3 files but also display a word file with the lyrics of the mp3 song playing. so if i choose a mp3 file from a list, the lyric file for that song should also be displayed. i have all the mp3 and lyric files saved on the computer so my problem is how can i link the files?
Suppose you want to develop a program to play lottery. The program randomly generates a Lottery of a three-digit number( any number from 100 to 999), prompts the user to enter a three-digit number, and determines whether the user wins according to the following rule:
1. If the user matches the lottery in exact order , the awards is $100,000. 2. If the user input matches the lottery digits, the awards is $50,000. 3. If two digit in the user input matches a digit in the lottery, the awards is $30,000. 4. If one digit in the user input matches a digit in the lottery, the awards is $10,000.
Sample: The winning number is 865.
Your ticket is 865 then 100000 Your tickect is 686, or 568,.. all digits are right but not in order You get 50000 Your ticket is 860, or 186 .. then 30000 Your ticket is 800, 706, 600.. just one digit much you get 10000 Else 0
Im using if/else statements. Which syntax would I use to figure out the limit between 100-99?
"Write a program to play a numbers guessing game. The user thinks of a number between 1 and 100 and your program asks questions to figure out what the number is (e.g., "Is the number you are thinking of less than 50?"). Your program should be able to identify the number after asking no more than seven questions. Hint: Use < and <= opeartors and the if-else construct."
What I've managed so far, but what I have seems to be lacking
I have a Blackjack game that allows users to create a login account and it keeps track of their bet amount, and total bank,etc. How can I connect the program on 2 or more computers so that people can play together?
(A) How would I code it? (B) Can I just connect a USB or HDMI and use the appropriate code? (C) Do they need to be executables instead of just running out of Visual Studio? (D) Can this maybe done over Wi-fi? (E) Or is this something more complicated like over a VPN?
I got this code from a wiki that taught me how to make C code that plays audio, and with a few changes I was able to get it to take a command-line argument as the music file name. Here it is
The only problem is, even though I guess it needs to create a window to work with SDL, is there any way you could hide it or something so the user can't see it? I don't really want to see it ( I'm planning on running it from Batch files or C applications as an easy way to play an audio file once ), because if I did, I might as well just use a default audio player instead.
I have designed a vc++ dll for a controller. I want to add usb plug and play feature inside the dll. I searched on line and came to know:
"If the project is an unmanaged C++ DLL project, then I can only create windows in an unmanaged way, i.e. the usual Win32 API way, such as adding a new dialog box as a resource, or simply using RegisterClassEx() and CreateWindowEx() to create the window yourself, then pump messages for those windows using GetMessage(), TranslateMessage() and DispatchMessage()."
how to use this concept.
I have created a separate application (in delphi 2007) that load this Dll. But I want to add this Plug and Play feature inside me dll.
So , i had to make an rock paper scissors game . After lot of hard work and struggle ,I completed it but my professor rejected it since I didnot add option where it says "Would you like to play again .Y/N " . The code has too many brackets ! Here is my code
#include <iostream> #include <ctime> #include <cstdlib> using namespace std;
// for displaying the outputs to the user; passing string to functions void user_win() {
OK, so the program is working minus the play again loop. I even tried a goto statement for it but no luck. Basically what its doing is after the game runs its course it asks if you would like to play again? If you hit Y it starts over but if you it N it starts over. I want it to out put thank you for playing and close after user hits a button.
// C// Guess My Number // The classic number guessing game
#include <iostream> #include <cstdlib> #include <ctime> using namespace std;
I'm trying to create a program that will play scales at certain frequencies, but my arrays are not initializing correctly. I've read up to double check what i'm doing but it doesn't seem to be working. My only guess is my use of a global variable.
const int NotesInScale = 8; class Scales { private: //all Major Scales int CMajor[NotesInScale]; int GMajor[NotesInScale];
[Code] ....
i'm simply trying to put the frequencies in the scales (the numbers in the array) but I keep getting an error. I feel its a simple fix but i'm not seeing it.
I'm making an apllication which needs to play .wav file when user type something inside QTextEdit. I made some code but after minute or less the sound stops, so I made silly workarround. After 30 clicks I invoke sound->stop(); and then the loop start again, that works, but it's not good, can you give better solution. Here is my code:
I am writing an application that needs to temporarily disable the Play/Pause button that appears on multimedia keyboards.
Normally, a key can be blocked quite easily by installing a low level keyboard hook (WH_KEYBOARD_LL) where the KeyboardProc intercepts the key (in this case VK_MEDIA_PLAY_PAUSE) and returns a "1" instead of calling CallNextHookEx. I have tried this with other keys (including the Windows key VK_LWIN) and this works perfectly. I also have no problems with this method under Windows 7 where all keys, including VK_MEDIA_PLAY_PAUSE get blocked.
Windows 8 is a different story. When my application has input focus, everything works as expected, meaning the VK_MEDIA_PLAY_PAUSE key gets blocked and no other application responds to it. However, when my application loses focus, my hook procedure gets called (this was verified by sending out a OutputDebugString) but other applications respond to key even though I return a "1". As soon as my app gets focus again, everything is block as it should.
After some investigation, I found that the multimedia keys not only generate keystrokes but also generate WM_APPCOMMAND messages so I added ShellProc (WH_SHELL) hook with the following hook procedure:
LRESULT __declspec(dllexport)__stdcall CALLBACK ShellProc(int nCode,WPARAM wParam,LPARAM lParam) { // Do we have to handle this message? if (nCode == HSHELL_APPCOMMAND) { OutputDebugStringX(">>>>> HSHELL_APPCOMMAND");
[code]....
This procedure is only getting called when my app has input focus. Whenever I have input focus and return "1" the Play/Pause command gets blocked. As soon as I lose focus the procedure does not get called/hooked.
As I have mentioned, the code works for other keys, just not the multimedia keys.
Alternatively, another way of blocking the multimedia keyboards Play/Pause button?
so my homework assignment is to make a program of which removes any notes in a program file.
for example, you run my program it will ask for a filename, when entered it opens the file, copies everything in it and removes any double forward slashes (//) and anything after that up to the new line character ( ) and anything between /* and */ including the /* and */.
i created the entire program and it removed the // and anything after that up to the new line character but will not remove anything after the first / when it finds a /*. This includes the */ at the end of the comment.
the section of code that removes the comments is
//this loop removes all notes for(i=0;i<buf.st_size;i++) { if((filecontent[i]=='/')&&(filecontent[i+1]=='/'))//removes notes using // { for(i=i;filecontent[i]!=' ';i++) filecontent[i]=' ';}
[Code]....
i know that the section that removes the multi line comments would not remove the final */ at the end if it did work, i was planning to fix that later once it removed the comment.
One of my class assignments is to create a program that receive a .txt file containing a students name and their grades as follows:
John K. 99, 87, 57, 89, 90, 95 Amanda B. Jones 100, 88, 76, 99, 86, 92 etc..
The number of students is unknown until run time. You have to take those grades and average them weighing the first (4) at 10% a piece and the last (2) at 30% each.
Then return an output file with the students name and their letter grade A,B,C,D,F based on their computed score. In addition, on screen it needs to display the average scores for each Q1, Q2, etc. as well as the minimum and maximum for each test on the screen. I am having a hard time in assigning the scores to a variable so that they can then be computed as an average and then used to determine a letter grade. I have begun to write the code and am a bit stuck..here's what I have so far:
and then use that information to determine their letter grade and write that information to a .txt file. I have been able to successfully pass that information to a function to determine their letter grade and have been able to successfully compute their letter grade. However, I can get this information to successfully post within the *computeGrade () function. Yet, I don't know how to pass this information back to the main() on a student by student basis so that I can open a new .txt file and write just their name and letter grade to it.
Another issue I'm having is when it comes to computing the averages of the class. Each score is either a quiz (there are 4), a midterm (there are 2) or a final (there is 1). I'm a little stuck on how to pass say all of the quiz 1 grades as one entity to the function averagesminmax(). Is there a way to compile each of the grades for a specific quiz or midterm as one array and pass that to the function to then do the computation. Also we need the min and max so again from compiling the grades of a particular quiz or exam together as one.
Here's the code that I have so far.
#include <stdio.h> #include <stdlib.h> #include <math.h> const char *computeGrade(); int averagesminmax(); int main() { char fName[20]; char lName[20];
[code]....
Do I need to re-read the input file and assign them to different variables?
Here's a sample of the output so far:
Enter input .txt file name Graded Thui Bhu, 91, A Ariana B. Smith, 96, A Emily Gonzales, 83, B Jennifer L, 89, B Maria Jones, 67, D Bill Gates, 55, F Escobar Morris, 78, C Anne Latner, 88, B Program ended with exit code: 0
Also in my output file, the only thing that it prints will be the first name of whatever the last student in the input file list is.
error C2440: 'initializing' : cannot convert from 'void' to 'std::basic_ifstream<_Elem,_Traits>' 1> with 1> [ 1> _Elem=char, 1> _Traits=std::char_traits<char> 1> ] 1> Expressions of type void cannot be converted to other types
I'm trying to make a program that you input your login info and it writes that info to a text file. Then, later on once I get my problem fixed, the program will read the info to the user. my code is as follows(the input part is a bit lengthy):
I want to create a program that would take an AVI file, alter each frame (ex: change contrast, invert colors, etc.) and dump a new AVI. I've wrote a simple program for this experiment that loads up the header information from the video and dumps it. It also dumps a list of the frame data chunks within the 'movi' chunk.
The info I've gathered from coding this:
1. The recommended buffer size for each type of stream (vids, auds, etc.) is the size of the largest frame of corresponding type, plus 1 or two extra bytes.
2. numFrames in main header is the total number of frames for all types of data (video,audio,etc.) The 'length' value within stream header of type 'vids' is the number of video frames. The sizeImage value within BITMAPINFOHEADER is 921600 (==640*480*3) and the specification states that, quoth, "This can be set to 0 for uncompressed RGB bitmaps."
3. This video uses DIVX encoding.
Now my problem is this: How do I get the data within each video frame in a simple BMP like format? Even the uncompressed frames (with chunk id 'nndb') have variable sizes...let alone the compressed ones.
Information about a software that converts AVIs to a format with fixed sized uncompressed frames. Or at least some information about the frame decompression techniques.
Here's a dump made by the program for a 9 sec, 640x480 video I recorded from Pokemon. (Without the frame dump that is, it'd have made the post too long.)