Recent

Author Topic: How to play sound on WinCE?  (Read 23085 times)

JohnvdWaeter

  • Full Member
  • ***
  • Posts: 171
    • http://www.jvdw.nl
How to play sound on WinCE?
« on: October 09, 2007, 11:07:24 am »
Hi Group,

What is a WinCE equivalent to MessageBeep() ?

I'd like to draw the users attention with some kind of beep...

tia!
John

Marc

  • Administrator
  • Hero Member
  • *
  • Posts: 2584
RE: How to play sound on WinCE?
« Reply #1 on: October 09, 2007, 12:02:16 pm »
Indeed I cannot find beep or messagebeep for CE. I think you have to use the playsound api
//--
{$I stdsig.inc}
//-I still can't read someones mind
//-Bugs reported here will be forgotten. Use the bug tracker

JohnvdWaeter

  • Full Member
  • ***
  • Posts: 171
    • http://www.jvdw.nl
RE: How to play sound on WinCE?
« Reply #2 on: October 09, 2007, 12:09:58 pm »
>>I think you have to use the playsound api

I'd love to... maybe someone has a code snippet?

John

oraitecamonyes

  • New Member
  • *
  • Posts: 31
    • http://blog.ptvet.com
Re: RE: How to play sound on WinCE?
« Reply #3 on: March 01, 2008, 02:24:35 am »
Quote from: "JohnvdWaeter"
>>I think you have to use the playsound api

I'd love to... maybe someone has a code snippet?

John


in win32 playsound uses MMsystem.... how do i call it in wince?? :oops:

cyberhero

  • New Member
  • *
  • Posts: 12
How to play sound on WinCE?
« Reply #4 on: March 03, 2008, 11:54:08 am »
There is a little sample

unit Unit1;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, StdCtrls;

type

  { TForm1 }

  TForm1 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { private declarations }
  public
    { public declarations }
  end;

 Function PlaySoundW(x1: PWideChar; x2: HMODULE; x3: DWORD): longbool;stdcall; external 'coredll.dll' name 'PlaySoundW';

var
  Form1: TForm1;

implementation

{ TForm1 }

procedure TForm1.Button1Click(Sender: TObject);
begin
   PlaySoundW('\windows\beep.wav',0,0);
end;

initialization
  {$I unit1.lrs}

end.

oraitecamonyes

  • New Member
  • *
  • Posts: 31
    • http://blog.ptvet.com
How to play sound on WinCE?
« Reply #5 on: March 03, 2008, 12:48:03 pm »
thank you cyberhero,
you sample does play a sound, it just isnt the specified wav file...
mine always plays "loudest.wav" from windows...

donno why this happens... :(

cyberhero

  • New Member
  • *
  • Posts: 12
How to play sound on WinCE?
« Reply #6 on: March 03, 2008, 01:54:07 pm »
You have to copy a wavefile with name 'beep.wav' to the windows folder or you use a alraedy existing file like 'alarm2.wav'.

(   PlaySoundW('\windows\alarm2.wav',0,0);     )

If the wavefile not exists then the PDA plays the systemsound.

Helmut

oraitecamonyes

  • New Member
  • *
  • Posts: 31
    • http://blog.ptvet.com
How to play sound on WinCE?
« Reply #7 on: March 03, 2008, 07:47:32 pm »
thank you, it does play the wav :)

Zaher

  • Hero Member
  • *****
  • Posts: 680
    • parmaja.org
How to play sound on WinCE?
« Reply #8 on: May 28, 2008, 02:01:54 am »
This worked for me
      PlaySoundW(PWideChar(UTF8Decode(ExpandFileName(Application.location+'..\sounds\msg.wav'))), 0, 0);

sanmiolade

  • New Member
  • *
  • Posts: 19
Re: How to play sound on WinCE?
« Reply #9 on: May 24, 2012, 10:43:11 am »
I am having difficulty is Playing Sound on my Windows CE 5.0 Device.

Can you send me a Working Sample so I can test and learn from it

Thanks

 

TinyPortal © 2005-2018