Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
M

Moonis Ahmed

@Moonis Ahmed
About
Posts
13
Topics
6
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Java convert uLaw encoded audio file to PCM ecoded
    M Moonis Ahmed

    Hi, I was able to solve it using the inherent java audio class javax.sound.sampled. I convert an input audio file encoded in uLaw to PCM and then write the PCM file into an Audiostream. Code is given below.

    try{
    File filein = new File("C:/sourcefile.wav");
    File fileout = new File("C:/PCMfile.wav");
    AudioInputStream sourceaudio = AudioSystem.getAudioInputStream(filein);
    AudioFormat format = sourceaudio.getFormat();
    if (format.getEncoding() != AudioFormat.Encoding.PCM_SIGNED) {
    format = new AudioFormat(
    AudioFormat.Encoding.PCM_SIGNED,
    format.getSampleRate(),
    format.getSampleSizeInBits() * 2,
    format.getChannels(),
    format.getFrameSize() * 2,
    format.getFrameRate(),
    true);
    }
    AudioFileFormat.Type targettype = AudioFileFormat.Type.WAVE;
    AudioInputStream targetaudiostream = AudioSystem.getAudioInputStream(format, sourceaudio);
    AudioSystem.write(targetaudiostream, targettype, fileout);
    System.out.println("PCM encoded file generated successfully.");
    sourceaudio.close();
    targetaudiostream.close();
    } catch (Exception e) {
    out.println("Error in audio format conversion");
    e.printStackTrace();
    }

    Java java help question

  • Java convert uLaw encoded audio file to PCM ecoded
    M Moonis Ahmed

    Hi, I want to convert a ULAW encoded .wav file into a PCM encoded one. The ULAW encoded .wav file is of 8 bit, mono with 8Khz sample rate. How can I achieve this. I have written a code below but it gives error that the conversion is not supported. I am using javax.sound.sampled class. below is the code.

    try{

    File temp = new File("C:/temp.wav");
    File fileout = new File("C:/1java.wav");
    AudioInputStream sourceaudio = AudioSystem.getAudioInputStream(temp);
    AudioFormat targetformat = new AudioFormat(new AudioFormat.Encoding("PCM\_UNSIGNED"),8000,16,0,8,8000,true);
    AudioFileFormat.Type targettype = AudioFileFormat.Type.WAVE;
    AudioInputStream targetaudiostream = AudioSystem.getAudioInputStream(targetformat,sourceaudio);
    AudioSystem.write(targetaudiostream, targettype, fileout);
    }
    catch(Exception e){
        out.println("Error in audio format conversion");
        e.printStackTrace();
        }
    
    Java java help question

  • ShellExecute Closing Application
    M Moonis Ahmed

    Hi, I have a windows service program where I use it to run another program using the ShellExecute command. However, I dont know how to terminate the spawned program as I am new to VC++ programming. Anyone has any idea? Moonis

    C / C++ / MFC c++ tutorial question

  • problem retrieving domain name [modified]
    M Moonis Ahmed

    Hi, I am using MS Visual C++ 6.0 running on Windows 2000 Server. Is the problem related to the above version that i am running? Moonis

    C / C++ / MFC help question

  • problem retrieving domain name [modified]
    M Moonis Ahmed

    Hi, I did the above settings to enable the macro but the problem still persists.:sigh: My modified code is here:

    #define _WIN32_WINNT 0x0500
    #include "windows.h"
    #include "stdio.h"
    #include "iostream.h"
    #include "tchar.h"

    int main()
    {
    LPTSTR lpszSystemInfo;// pointer to system information string

    DWORD cchBuff=sizeof(lpszSystemInfo);// size of domain name
    
    // Get domain.
    if (GetComputerNameEx(ComputerNameDnsDomain, lpszSystemInfo, &cchBuff))
    cout<<"Domain Name is : "< 
    

    I am new to VC++ programming so please point out any other errors if there are.

    Moonis

    C / C++ / MFC help question

  • problem retrieving domain name [modified]
    M Moonis Ahmed

    hi, i am trying to retrieve domain and user name by the following code

    #include "windows.h"

    LPTSTR lpszSystemInfo; // pointer to system information string
    DWORD cchBuff = BUFSIZE; // size of domain name
    TCHAR tchBuffer[bufsize]; // buffer for string

    lpszSystemInfo = tchBuffer;

    // Get machine name
    if( GetComputerName(lpszSystemInfo, &cchBuff) )
    m_machineName = _bstr_t(lpszSystemInfo);

    // Get domain.
    cchBuff = BUFSIZE;
    if (GetComputerNameEx(ComputerNameDnsDomain, lpszSystemInfo, &cchBuff))
    m_domain = _bstr_t(lpszSystemInfo);

    // Get user name.

    cchBuff = BUFSIZE;
    if( GetUserName(lpszSystemInfo, &cchBuff) )
    m_osUsername = _bstr_t(lpszSystemInfo);

    This is a part of the code. When i compile it, I get the following error: error C2065: 'GetComputerNameEx' : undeclared identifier error C2065: 'ComputerNameDnsDomain' : undeclared identifier Can anyone help me solve it? Moonis -- modified at 21:39 Sunday 3rd June, 2007

    C / C++ / MFC help question

  • Detecting the end of the file
    M Moonis Ahmed

    Hi, There is an end of file function eof() which you can use. It is a boolean function which returns a non-zero number when the end of file is reached otherwise it returns zero (meaning false). You will have to use a stream variable to use the function. A very simple article explaining the function is here: http://www.mathbits.org/MathBits/CompSci/Files/End.htm Hope this helps. - Moonis

    C / C++ / MFC css help question

  • memory heap problem
    M Moonis Ahmed

    hi, i have an application which generates a signature for a file. the problem i am facing is when i run it, it gives the error : User breakpoint called from code at 0X77fcb940 and in the output window i get the following error: HEAP[UsageInstanceTool.exe]: Invalid Address specified to RtlFreeHeap( 3c0000, 818d58 ) I am testing the application in Release mode. There seems to be no problem in debug mode. I have no idea what the problem is since i am new to VC++ programming. waiting for help! - Moonis

    C / C++ / MFC help debugging c++ testing beta-testing

  • SQL transaction rollback problem
    M Moonis Ahmed

    hey, thanks for your advice. i solved the problem myself. as you see in my code, i was using an array. i didnt need to use that. i used only a single object and treated the three transactions as a single transaction. it works now.!! - Moonis

    C / C++ / MFC c++ database help sql-server sysadmin

  • return program
    M Moonis Ahmed

    since you are returning an integer data type, you can call the function to an integer like: int s; s=add(2,3); where you pass 2 and 3 as integers and get 5 as the sum which is stored in the variable s. The add function can be called from any other function or main method. hope that helps.

    C / C++ / MFC

  • SQL transaction rollback problem
    M Moonis Ahmed

    hi, i used the settings you told me. The problem is still there. The rollback does not remove the previous two entries. This time it also shows some 'Detected Memory Leaks!' error. What does that mean?

    C / C++ / MFC c++ database help sql-server sysadmin

  • SQL transaction rollback problem
    M Moonis Ahmed

    hi,i am new to visual C++ programming. i have a simple visual C++ program that involves basic sql transactions and if a query fails then i have tried to rollback all the previous transactions as well. I am using MS SQL Server. the problem is that the rollback is not working in the tables in the server while when i run the program in the debug mode it shows that the rollback feature is working as it returns a positive integer from the rollback() function. the program shows no errors or warnings. Can anyone provide some suggestions? For testing i have used three queries in which the third one has been intentionally left wrong. I need the first two queries to be rollbacked when the error occurs in the third query. Would be glad if you can point out other errors as i am still learning C++ programming... Attached is the code: class test { public: void testmethod() { CDatabase dbobject[100]; static int counter=0; char query [3][100]={{"Insert into product values (1,'keyboard')"},{"Insert into product values (2,'mouse')"},{"Insert into product values (2,'cable')"}}; try { for(int i=0;i<(sizeof(dbobject)/sizeof(dbobject[0]));i++) { dbobjectIdea.OpenEx(_T( "DSN=mytest" ),CDatabase::noOdbcDialog ); dbobjectIdea.BeginTrans(); dbobjectIdea.ExecuteSQL(queryIdea); dbobjectIdea.CommitTrans(); cout<<"Query Execution Successful\n"; counter++; dbobjectIdea.Close(); } } catch (CDBException *pEx) { pEx->ReportError(); dbobject[counter].Close(); for(int j=counter-1;j>=0;j--) { dbobject[j].OpenEx(_T( "DSN=mytest" ),CDatabase::noOdbcDialog ); dbobject[j].BeginTrans(); int c = dbobject[j].Rollback(); dbobject[j].Close(); cout<<"SQL Query Rollbacked!\n"; } } } }; void main() { test t; t.testmethod(); }

    C / C++ / MFC c++ database help sql-server sysadmin

  • problem in remote desktop in VC++
    M Moonis Ahmed

    hi, i am new to visual C++ programming. i have a problem. i have a windows hooks service that runs on a local machine. however, when i try to run it from a remote desktop it does not work. i plan to develop a C++ application which can solve the above problem. Can anyone help me with code to create a remote desktop connection? i would be extremely thankful for the help.... - Moonis

    C / C++ / MFC c++ help question
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups