C++ :: Play Sound On Key Press - Stops Working After A Few Seconds

Sep 15, 2012

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:

Code:

int count = 0;
bool MainWindow::eventFilter(QObject *o, QEvent *e){
if(e->type() == QEvent::KeyPress)
{
tipka->play();
tipka->seek(0);

[Code]...

View 1 Replies


ADVERTISEMENT

C++ :: How To Play Sound When The Program Ends

Jul 16, 2013

How can I play sound when the program ends? I am using Windows 7.

View 15 Replies View Related

C :: Exe File Stops Working And Not Able To Enter Data

Sep 13, 2013

I am trying to enter data to a structure some 8 times, but not able to do so. Here is my code.

Code: #include<stdio.h>
struct _Timer {
unsigned int HH;
unsigned int MM;
}Time[8];
[code]...

But when I enter any data and press enter , the .exe file stops working and not able to enter data.

View 4 Replies View Related

Visual C++ :: Find To Look For Variable Stops Working?

Oct 3, 2013

Just using Find in my source code to look for variables or whatever, works once or twice then just stops - Doesn't find anything even if it's there. If I restart VS it works again, but not for long.

View 1 Replies View Related

C++ :: Queues Program Suddenly Stops Working When Input Value

Feb 22, 2013

I'm having troubles with this program I made. Put it simply, it's a basic program using Queues. Whenever I try to input a value, my compiler(Dev C) suddenly stops working. The .exe file crashes and I've no way on how I can execute my program.

Code :
#include<iostream>
using namespace std;
int *queue;
int rear, front, queueSize;
void enqueue();
void dequeue();
void display();

[Code] ....

View 1 Replies View Related

C :: Convert Seconds Into Hours / Minutes And Seconds

Jul 10, 2013

I want to convert seconds into hours, min and seconds. I was able to test it with a small equation turning seconds into hours but now it returns zeros for every entry.

Code:
#include <stdio.h>
void secCount(int *seconds, int *hours, int *min, int *sec);
int main(int argc, const char * argv[]) {
int sec=0, hours=0, min=0, seconds =0;

[Code] .....

View 5 Replies View Related

C++ :: Beeping Sound When File Changes

Apr 22, 2013

I want to make my computer beep, when a specific file I have already created changes. The idea is this:

I have a personalized e-mail for my website.

When people send me a message, I don't know what happens at all, but at least I can create a file which leaves the comment there. How can I make a program to beep when a file changes?

View 19 Replies View Related

C# :: System Beep Sound?

Apr 22, 2014

I code login form. In the textbox I want to clear if there are some text or close form if there's nothing. The problem is System beep sound occured when the text is cleared. Here's my code

private void tbPassword_TextChanged(object sender, EventArgs e)
{
string _enteredPassword;
while (tbPassword.TextLength == 8)

[Code]....

View 2 Replies View Related

C :: How To Handle Sound And Music Files

Mar 11, 2013

I do not know any of the functions to do this, and when I looked on the internet all the functions I saw were mainly non-standard.

View 12 Replies View Related

C++ :: SDL Sound Thread Delay Between Samples?

Sep 29, 2013

When I use the following handler to handle and mix multiple channels, I get about 1 time unit sound, 5/6 time units silence.

//The volume conversion!
#define VOLUME_PER_SOUND(volume) ((SDL_MIX_MAXVOLUME / 2)*volume)
//Ammount of times to multiply the buffer!
#define MULTIPLIER_BUFFER 1
/* This function is called by SDL whenever the sound card needs more samples to play. It might be called from a separate thread, so we should be careful what we touch. */
void SDLAudioCallback(void *user_data, Uint8 *audio, int length) {

[code]....

(I'm working with 44.1kHz stereo PCM streams)... I've multiplied the stream some times, but to no effect (see the c<MULTIPLIER_BUFFER loop arround the mixing)...

View 4 Replies View Related

Visual C++ :: Cannot Get The Sound To Stop Playing CDA File

Apr 26, 2013

I can not get the sound to stop playing a cda file with MCI_CLOSE. This code works with wav and mpg and avi files.

LONG WindowProc() {
switch (msg) {
case WM_COMMAND:
if (wParam == IDC_PLAY) {
//A CDA File
SendMessage(m_hwMCI,MCIWNDM_OPENA,0,(LPARAM)&chFile);

[Code] .....

View 1 Replies View Related

C++ :: While Loop Stops Output

Jun 19, 2014

As I was testing it, the program suddenly stopped giving an output. Here is the code:

#include <iostream>
using namespace std;

int main() {
cout << "Ten people ate breakfast with you this morning. Each of them " <<
"had pancakes.
Please enter how many pancakes each of the ten people " <<
"ate.
" << endl;

[Code] ...

The while loop after int glutton does not work and seems to stop the program. I replaced the "glutton" in the cout with "testing testing" and it still did not work. However, when I commented out the loop, it appeared. Finally, it can't be what's inside the loop, because I commented that out too, and it still didn't work.

View 2 Replies View Related

C++ :: Address Book - Program Stops After Cin

Dec 6, 2013

the program is of an address book. the syntax is all fine, and the initial menu of options does show up. but once you punch in the cin, the program just stops.

View 9 Replies View Related

C++ :: Code Stops Executing After GetScores Function

Nov 11, 2014

I am currently working on a c++ project that will input students and process their grades. I encountered a problem and my code stops executing after the getScores function. Im not sure what the problem is, but im guessing its something within the function and the loops.

//Name: getScores
//Description: Will get scores for student
//Parameters: None
//Return: testScore
double getScores()

[code]....

View 6 Replies View Related

C++ :: Fseek - Program Crashes And Stops Responding

Feb 9, 2015

i wrote a little program with fseek. It works good till it reaches the first fseek(). Then it crashes and stops responding.My code:

ifstream inp("myfile.txt");
if(!inp.is_open()) return false;
inp.close();
FILE *f;
fopen("myfile.txt","rb");

[code].....

View 2 Replies View Related

C++ :: How To Add Seconds To CTime

Feb 11, 2014

how to add seconds to CTime in VC++?

Ex :

int i=0;
i=250;
CTime tm;
tm=tm+i;

View 3 Replies View Related

C# :: Transform Seconds Into HH:MM:SS?

Jun 18, 2014

I am trying to transform seconds into HH:MM:SS. I thought it would be easy using the TimeSpan functions however my hours exceed 24 hours now and then therefor it is not viable for use.

private string getFormattedTimeFromSecond(double second)
{
TimeSpan t = TimeSpan.FromSeconds( second );
string answer = string.Format("{0:D2}h:{1:D2}m:{2:D2}s",
t.Hours,
t.Minutes,
t.Seconds);
}

This is what I have tried, however it does not like it much when hours exceed 24.

View 6 Replies View Related

C++ :: Get Full Time Without Seconds

Jun 21, 2013

I have a code to check the last time modification of a file using "gmtime". Is it possible to remove the seconds in the result?

Here is my code:

struct tm* clock;// create a time structure
struct stat attrib;// create a file attribute structure
stat("test.txt", &attrib);// get the attributes of afile.txt
clock = gmtime(&(attrib.st_mtime));// Get the last modified time and put it into the time structure

View 6 Replies View Related

C++ :: Display A Table With Seconds And Distance

Mar 4, 2014

I am trying to write a program that will display a table with "seconds" and "Distance". Where Seconds goes from 1-12 and the distance is displayed according to each second. However I am having trouble getting the distance variable to display any values. By the way I am also using a second function in this program besides main(), called FallingDistance(). Below is my code for the program so far.

#include <iostream>
using namespace std;
double FallingDistance(int, double);
int main() {
int Seconds;
double Distance=0;
int distance;

[Code].....

View 6 Replies View Related

C/C++ :: Time Difference Returned In Seconds

Mar 6, 2015

I need to get the current time, have the system sleep for a period of time, then return the difference in seconds.

#include <iostream>
#include <string>
#include <ctime>
#include <time.h>
#define _CRT_SECURE_NO_WARNINGS
using namespace::std;
// in the <ctime> library is a function time(0)

[Code] ....

I'm not receiving an errors but the return value is not correct. It's returning 1.4259 no matter how long it sleeps for.

View 2 Replies View Related

C/C++ :: Conversion Of Time In Seconds Using Structure?

Sep 25, 2013

i create a structure called time. Its three members, all type int called hours, minutes, and seconds. This is in 12:59:59 format and i finally want to print out the total number of seconds represented by this time value.

long totalsecs = t1.hours*3600 + t1.minutes*60 + t1.seconds

i am using this formula but facing errors?

View 4 Replies View Related

C/C++ :: Converting Miles Per Hour To Seconds Per Mile

Oct 4, 2014

I have to program something that would convert miles per hour to seconds per mile.

I'm having an issue with something that I coded. Lines 21-23 are not showing up when I compile the program. What I'm trying to do is convert seconds into minutes.

What I have so far is

#include <iostream>
using namespace std;
int main() {
double miles_per_hour, minutes_per_hour, seconds_per_hour, seconds, minutes;
cout << "Enter the miles per hour: ";
cin >> miles_per_hour;

[Code] ....

View 14 Replies View Related

C Sharp :: How To Pick Date / Time When Serial Port Starts Reading And Also When Stops

Aug 18, 2014

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using System.IO.Ports;

[Code] ....

How to pick date / time when serial port starts reading , and also when reading stops ?

View 2 Replies View Related

C++ :: Function That Shows Elapsed Time In Seconds And Minutes

Mar 13, 2013

I am looking for a function or any example that shows elapsed time in seconds and minutes. I didn't find any solution for both OS Win and Linux. I am looking for example that works for both - win and linux.

View 14 Replies View Related

C :: System Call To Pause Execution Of Program For Few Seconds

Feb 2, 2014

I know there has to be a system call to pause (not system("pause") execution of a program for a few seconds. I would like to give the illusion that my program is 'thinking' rather than just spit out the result as soon as the user has hit the enter key.

View 5 Replies View Related

C++ :: How To Play Simple MP3 Through Mic

Jul 21, 2014

How do I play a simple mp3 through my mic. I plan on using this to just play annoying sounds through skype and games(on windows 7 btw).

View 6 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved