Skip to content

Commit

Permalink
testing sound.
Browse files Browse the repository at this point in the history
  • Loading branch information
LindseyB committed Oct 24, 2010
1 parent b5ee0e3 commit 397fdb1
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
14 changes: 13 additions & 1 deletion AAR.d
Original file line number Diff line number Diff line change
@@ -1,10 +1,22 @@
module AAR;

import tango.io.Stdout;
import tango.core.Thread;

import asciiSprite;
import animatedAsciiSprite;
import util.soundclip;

void main(){
Stdout ("WOOO!");
SoundClip sc = new SoundClip("music/ID__Baobinga_-_10_-_Raise_Riddim.mp3");
sc.start();
Stdout("started playing\n");
Thread.sleep(1000);
Stdout("done with sleep\n");
Stdout.format("{}\n", sc.pause());
Thread.sleep(1000);
Stdout.format("{}\n", sc.unpause());
Thread.sleep(1000);
Stdout.format("{}\n", sc.stop());

}
12 changes: 7 additions & 5 deletions util/soundclip.d
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ module util.soundclip;
import tango.stdc.posix.unistd;
import tango.stdc.posix.signal;
import tango.stdc.stringz;
import tango.std.posix.stdlib;

class SoundClip{
private:
Expand All @@ -13,6 +14,7 @@ private:

public:
this(char[] fn){
exe = "cvlc";
filename = fn;
pid = 0;
}
Expand All @@ -22,8 +24,8 @@ public:

if((pid = fork()) == 0){
char[] temp = exe ~ filename;

execlp(toStringz(exe), toStringz(filename), cast(void*)null);
execlp(toStringz(exe), toStringz(exe), toStringz(filename), cast(void*)null);

}else{
// ???
Expand All @@ -48,11 +50,11 @@ public:

bool pause(){
if(pid == 0 || paused){return false;}
return signal(SIGSTP);
return signal(SIGSTOP);
}

void unpause(){
if(pid == 0 || !paused){return false;}
bool unpause(){
if((pid == 0) || !paused){return false;}
return signal(SIGCONT);
}

Expand Down

0 comments on commit 397fdb1

Please sign in to comment.