How to Ask Questions The Smart Way in Java

Written by kishore

Alright, I realize that this topic will be read as often as the rules topic is, but it is really important to understand the best way to ask questions. What I mean by that is the proper information to get help and the right questions to ask are very important in getting advice from anyone.

Since there is such a huge suggestion list out there already, I think I'll just share the link with you all. This article was written by Eric Steven Raymond, one of the most brilliant hackers ever. He helped the start of the Linux Kernel an Open Source.

Anyway, [url="http://catb.org/~esr/faqs/smart-questions.html"]“How To Ask Questions The Smart Way”[/url]. I hope that many of you question-askers find this article useful!

Here is the original post:
How to Ask Questions The Smart Way in Java

Mar
10

Complete C++ novice :(

Written by kishore

Hi there people, i’m new to the forums, and c++ so hi all :)

First of all, sorry if this is the wrong place to put this, but it looked the most appropriate.

Basically, I got this beast of an assignment for uni, and I have no idea what I’m doing in it as I’ve never done programming of any description (save for a bit of HTML for Myspace lol).

The brief we have is :

Quote:

Your task is to create a console based “Audio & Video Sequencer” application
for this assignment. The “Audio & Video Sequencer” should have a fixed playlist
of one video track and three separate audio tracks. The video track should be a
minimum duration of one minute and a maximum of three minutes. It should also
have no audio content. The duration of the three audio tracks should add up to be
the same as the duration of the video track. (Distinctly different audio tracks will
work best. Suitable transitions will be expected.)

When the user selects play the video track should be played and whilst playing the
four audio tracks should be played, one after the other. Prior to playing the user
should be able to select a specific sequence for the audio tracks to played in. If
not the audio tracks should be played in a “default” order. The “Audio & Video
Sequencer” should also have a “shuffle” function that allows the audio tracks to be
played in a random order. It should also have a “loop” function so that the
sequence can be repeated continually.


Now, i have got the video playing, and the audio [using mciSendString]. However I have no idea how to go about making it so that you can choose an order, or to shuffle or whatever. My "tutor" [useless] decided to add loads of code to it [i.e. the "break", "switch" and the track info]. This confused the **** out of me because he told me to add stuff to it, and didn’t explain what he did…

The code i have so far:

[quote]
#include <iostream>
#include <windows.h>
#include <MMSystem.h>
#pragma comment(lib, "winmm.lib")
using namespace std;

void play (void);
void stop (void);

int main () // start of program
{
int track1, track2, track3, track4;
char answer;

track1 = 1;
track2 = 2;
track3 = 3;
track4 = 4;

do
{
cout << "This audio and video sequencer will play a video file whilst playing a series of three consecutive audio files. There is a shuffle feature available, and the files can be continuously looped if desired.\n\n"; // display what program will do
cout << "The video that will play is a collection of skateboarding accidents\n\n";
cout << "The tracks that will be played are: \n 1) ‘Bad Religion – You’\n 2) ‘Rancid – Stickin In My Eye’\n 3) ‘Marilyn Manson – The Beautiful People’\n\n"; // display tracklist
cout << "Do you want to change the order of the playlist? [If you don't, the tracks will play in the default order]\n\n";

cout<<" Please press ‘P’ to play\n\n Please press ‘S’ for a shuffle feature\n\n Please press ‘D’ for default order\n\n Please press ‘Q’ to quit\n\n";

cin>>answer;

switch (answer)
{
case ‘S’:
case ’s’:
// do shuffle code
break;

case ‘D’:
case ‘d’:
track1 = 1;
track2 = 2;
track3 = 3;
track4 = 4;
// default order code
break;

case ‘C’:
case ‘c’:
track1 = 1;
track2 = 2;
track3 = 3;
track4 = 4;
// choose order code
break;

case ‘P’:
case ‘p’:
play(track1);
play(track2);
play(track3);
play(track4);
//play code
break;
}
}
while (answer != ‘Q’ && answer != ‘q’); // quit code

fflush (stdin); // removes excess from the keyboard buffer
cin.get ();// signifies program will wait for response before executing

return 0; // ends program
}

void play(int track)
{
switch (track)
{
case 1:
mciSendString (L"play H:\\Desktop\\Movie.wmv", NULL, 0, 0); // play Skate Bails Video
break;
case 2:
mciSendString (L"play H:\\Desktop\\You.mp3 wait", NULL, 0, 0); // play Bad Religion
break;
case 3:
mciSendString (L"play H:\\desktop\\Sticking_In_My_Eye.mp3 wait", NULL, 0, 0); // play Rancid
break;
case 4:
mciSendString (L"play H:\\Desktop\\The_Beautiful_People.mp3 wait", NULL, 0, 0); // play Marilyn Manson
break;
}
}

void stop ()

{

}
[/quote

If anyone has any clue AT ALL on how to get this bad boy working you’d go down as a hero. It’s worth 50% of my mark…

Ideally if you could physically show me where to put the code instead of trying to explain it, ’cause this stuff goes straight over my head.

O and if it matters, I’m on visual studio 2008.

Cheers people.

Go to Source

Mar
09