[fpc-pascal] Re: fpc-pascal Digest, Vol 72, Issue 35
On 12 Jun 2010, at 11:00, Michael Van Canneyt wrote: TestFunction := ActualParameter ( ) ; { compiles and runs o.k. } [MVC:] The addition of () actually calls the function. TestFunction := ActualParameter ; { gives incompatible type error, but ... } [MVC:] Here you try to assign the ActualParameter (a function pointer) to the result (an integer). This of course gives a type error. TestFunction := NamedFunction ; { ... compiles and runs o.k. } [MVC:] This is simply a regular function call. Sorry, but this simply wrong. The LRG (page 95) does not require an actual parameter list for a syntactically correct function call. The call should be excecuted except in one case (LRG page 96) ... the compiler will not execute the function call ... when assigning a value to a procedural type variable. This is clearly not such a case. Roger Bailey P.S. The LRG has a minor error on page 121: out parameter appears twice as an alternative for parameter declararion ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Re: fpc-pascal Digest, Vol 72, Issue 35
On Mon, 14 Jun 2010, Roger Bailey wrote: On 12 Jun 2010, at 11:00, Michael Van Canneyt wrote: TestFunction := ActualParameter ( ) ; { compiles and runs o.k. } [MVC:] The addition of () actually calls the function. TestFunction := ActualParameter ; { gives incompatible type error, but ... } [MVC:] Here you try to assign the ActualParameter (a function pointer) to the result (an integer). This of course gives a type error. TestFunction := NamedFunction ; { ... compiles and runs o.k. } [MVC:] This is simply a regular function call. Sorry, but this simply wrong. The LRG (page 95) does not require an actual parameter list for a syntactically correct function call. What is simply wrong ? My explanation or the behaviour of the compiler ? Michael. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] playing sound files (linux and windows)
Hi, Has anybody managed to play sound files under both Linux and Windows? Does FPC have a cross-platform API or FCL class for this? If so, what sound format's are supported? ogg, wav, mp3? -- Regards, - Graeme - ___ fpGUI - a cross-platform Free Pascal GUI toolkit http://opensoft.homeip.net/fpgui/ ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] playing sound files (linux and windows)
On 14 June 2010 14:37, Graeme Geldenhuys graemeg.li...@gmail.com wrote: Hi, Has anybody managed to play sound files under both Linux and Windows? Does FPC have a cross-platform API or FCL class for this? fpc has bindings for libsndfile, which according to the website can read/write wav and ogg, among others. Henry ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] playing sound files (linux and windows)
Graeme Geldenhuys schrieb: Hi, Has anybody managed to play sound files under both Linux and Windows? Does FPC have a cross-platform API or FCL class for this? If so, what sound format's are supported? ogg, wav, mp3? We have developed some kind of API to play a .wav file on both Windows and Mac. The Windows version is easy (below), the Mac version is long (400 lines). If someone would like to add a PlaySoundFile API to LCL/FPC, drop me a note and we will donate the Mac code for it :-) ... Regards, Alexander uses windows, mmsystem; procedure PlaySoundFile(filename: string); begin PlaySound(pchar(filename), 0, SND_FILENAME + SND_ASYNC); end; ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] playing sound files (linux and windows)
On 14 June 2010 15:59, Graeme Geldenhuys graemeg.li...@gmail.com wrote: On 14/06/2010, Alexander Grau wrote: If someone would like to add a PlaySoundFile API to LCL/FPC, drop me a note and we will donate the Mac code for it :-) ... Thanks for that. A quick test removing the SND_ASYNC option plays multiple sound files in quick succession - just what I wanted. I'll experiment with libsndfile tomorrow, to see if I can accomplish the same under Linux. Note that the fpc libsndfile example is outdated (it uses oss). There is an example in the libsndfile source for how to play this with alsa. If you're not worried about gpl, then I'd probably use libao. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] playing sound files (linux and windows)
Hi Graeme Am 14.06.2010 um 15:37 schrieb Graeme Geldenhuys: Hi, Has anybody managed to play sound files under both Linux and Windows? Does FPC have a cross-platform API or FCL class for this? UltraStarDeluxe uses ffmpeg for decoding and portaudio, a C library, for playback of the stream. Corresponding headers are here: http://ultrastardx.svn.sourceforge.net/viewvc/ultrastardx/trunk/src/lib/ If so, what sound format's are supported? ogg, wav, mp3? yes, and probably even more. Regards, - Graeme - Greetings - Michael. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] playing sound files (linux and windows)
On Mon, Jun 14, 2010 at 5:37 PM, Graeme Geldenhuys graemeg.li...@gmail.com wrote: Has anybody managed to play sound files under both Linux and Windows? Does FPC have a cross-platform API or FCL class for this? I'd offer using OpenAL, however it requires proper libraries to be installed on Linux (afaik installed by default in all modern desktop distribs), and proper .dlls available for Windows. There's proper example in FCL how to use OpenAL to play .wav, .ogg .mp3 files. thanks, dmitry ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] playing sound files (linux and windows)
Has anybody managed to play sound files under both Linux and Windows? One more option I know of is Audorra (http://audorra.sourceforge.net/). I have not used it though, so no idea about its advantages/drawbacks. -- Regards, Vladimir Zhirov ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] playing sound files (linux and windows)
dmitry boyarintsev skalogryz.li...@gmail.com wrote: On Mon, Jun 14, 2010 at 5:37 PM, Graeme Geldenhuys graemeg.li...@gmail.com wrote: Has anybody managed to play sound files under both Linux and Windows? Does FPC have a cross-platform API or FCL class for this? I'd offer using OpenAL, however it requires proper libraries to be installed on Linux (afaik installed by default in all modern desktop distribs), and proper .dlls available for Windows. There's proper example in FCL how to use OpenAL to play .wav, .ogg .mp3 files. I second that, AL is worth considering. It was very easy for me to use, at least once I found a decent WAV loader. I have a little OpenAL kit for the Mac here: http://www.ragnemalm.se/lightweight/openal_fpc.zip On the Mac it it great: always installed, much better API than Core Audio, and portable. Havn't tried it on Linux och Windows though. And there is one problem that AL doesn't help me with (apart from loading WAV) and that is to play music. Uncompressed sound isn't useful for music. I can play that with Quicktime, but I'd like to use something cross-platform. /Ingemar ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] playing sound files (linux and windows)
[I don't know if a previous email of similar content got through. Sorry if this is a double post.] As libsndfile has already been recommended, I would just add that the simplest and most fool-proof way of playing back audio (once you have figured out how to load it) is PortAudio. It abstracts away from WDM, ASIO, ALSA, Jack, CoreAudio and what not. It is in my view much easier to use than OpenAL. Up-to-date PortAudio 1.9 bindings for FPC can be obtained here (not tested on MacOS): http://sourceforge.net/projects/humus/files/ Note that UltraStarDeluxe (mentioned in another reply) seems to have bindings for PA 1.7, which is outdated. It also does not provide the platform-specific extensions. Cheers! Roland On 6/14/2010 3:37 PM, Graeme Geldenhuys wrote: Hi, Has anybody managed to play sound files under both Linux and Windows? Does FPC have a cross-platform API or FCL class for this? If so, what sound format's are supported? ogg, wav, mp3? ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] Re: Bug?
Sorry, I committed the cardinal sin of getting the subject line wrong. Corrected now :-) On 14 Jun 2010, at 18:07, Michael Van Canneyt wrote: On Mon, 14 Jun 2010, Roger Bailey wrote: On 12 Jun 2010, at 11:00, Michael Van Canneyt wrote: TestFunction := ActualParameter ( ) ; { compiles and runs o.k. } [MVC:] The addition of () actually calls the function. TestFunction := ActualParameter ; { gives incompatible type error, but ... } [MVC:] Here you try to assign the ActualParameter (a function pointer) to the result (an integer). This of course gives a type error. TestFunction := NamedFunction ; { ... compiles and runs o.k. } [MVC:] This is simply a regular function call. Sorry, but this simply wrong. The LRG (page 95) does not require an actual parameter list for a syntactically correct function call. [MVC:] What is simply wrong ? My explanation or the behaviour of the compiler ? Sorry. I guess your explanation states what the compiler is doing, so in that sense your reply isn't simply wrong. However, the program fragment TestFunction := ActualParameter is a syntactically correct function call as as defined by the LRG, so the statement Here you try to assign the ActualParameter (a function pointer) to the result (an integer) is wrong. In fact I now notice you you give an almost identical example in the LRG (page 96) Type FuncType = Function: Integer; Var A : Integer; Function AddOne : Integer; begin A := A+1; AddOne := A; end; Var F : FuncType; N : Integer; begin A := 0; F := AddOne; { Assign AddOne to F, Don’t call AddOne} N := AddOne; { N := 1 !!} end. It's clear from this that the meaning of Addone depends on the context, here the type of the variable on LHS of the assigment. On this basis I think that the error message I received is either a compiler bug, or FPC implements a slightly perverse dialect of Pascal (so the LRG is wrong). Hope this helps, Roger Bailey___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal