* simply replacing spaces with tabs in the example files

git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/branches/sfml2@1440 4e206d99-4929-0410-ac5d-dfc041789085
This commit is contained in:
trass3r 2010-03-04 02:23:27 +00:00
parent 8390807b08
commit 4a19225764
9 changed files with 670 additions and 670 deletions

View file

@ -5,12 +5,12 @@ import dsfml.audio.all;
version (Tango)
{
import tango.io.Console;
import tango.io.Stdout;
import tango.io.Console;
import tango.io.Stdout;
}
else
{
import std.stdio;
import std.stdio;
}
// SoundStream is an abstract class.
@ -18,74 +18,74 @@ else
// Don't forget to call initialize() before any usage or playback will fail.
class MySoundStream : SoundStream
{
SoundBuffer m_buff;
short[] m_data;
size_t m_cursor;
this()
{
// We initialize the stream with some sound informations
super(1, 11025);
// We create a sound buffer to load samples from files
m_buff = new SoundBuffer("Data/car_idle.wav");
m_data = m_buff.getSamples[0..m_buff.getSamplesCount];
}
SoundBuffer m_buff;
short[] m_data;
size_t m_cursor;
this()
{
// We initialize the stream with some sound informations
super(1, 11025);
// We create a sound buffer to load samples from files
m_buff = new SoundBuffer("Data/car_idle.wav");
m_data = m_buff.getSamples[0..m_buff.getSamplesCount];
}
protected:
bool onStart()
{
// No specifics things to do, just return true.
return true;
}
bool onGetData(out short[] data)
{
// We ensure that we have enough data to send
if (m_cursor + this.getSampleRate > m_data.length)
return false;
// Assign data in the buffer ...
data = m_data[m_cursor..m_cursor + this.getSampleRate];
// ... and increment the cursor
m_cursor += this.getSampleRate;
return true;
}
bool onStart()
{
// No specifics things to do, just return true.
return true;
}
bool onGetData(out short[] data)
{
// We ensure that we have enough data to send
if (m_cursor + this.getSampleRate > m_data.length)
return false;
// Assign data in the buffer ...
data = m_data[m_cursor..m_cursor + this.getSampleRate];
// ... and increment the cursor
m_cursor += this.getSampleRate;
return true;
}
}
void main()
{
MySoundStream stream = new MySoundStream();
display("Playing sound !\n Press enter to stop playback.");
stream.play();
read();
stream.stop();
MySoundStream stream = new MySoundStream();
display("Playing sound !\n Press enter to stop playback.");
stream.play();
read();
stream.stop();
}
void display(char[] c)
{
version (Tango)
version (Tango)
{
Stdout(c).newline;
Stdout(c).newline;
}
else
else
{
writefln("%s", c);
writefln("%s", c);
}
}
/**
* Dummy function to prevent console closing on windows
* Dummy function to prevent console closing on windows
*/
void read()
{
version (Tango)
version (Tango)
{
Cin.get();
Cin.get();
}
else
else
{
readln();
readln();
}
}