PDA

View Full Version : Python And Audio?


Gauranga
04-20-2007, 05:18 PM
Hi, I downloaded Google Desktop SDK, it works with Python Prog Lang.

I never did it before till now. (prog I mean).

I searched Google (lol) is that funny? And can't find anything on doing
anything with Audio, (specifically play diff tracks) this is the script
that comes with Google SDK:

main.js



// Copyright (c) 2006 Google Inc.
// All rights reserved
//
// This file is part of the Google Desktop SDK and may be freely copied and used.
// To download the latest version of the SDK please visit
// http://desktop.google.com/

var curAudioClip_ = null;

var AUDIO_CLIP_URI = "track01.mp3";
var AUDIO_CLIP_URI = "track11.mp3";

function onTextClick() {
if (curAudioClip_ == null) { // Not playing anything
// Create a new clip and start playing immediately. Using
// framework.audio.open, you can open a sound file but only play it when
// you use the .play method on the returned object. The callback method
// parameter is optional here and when using .open. One final note, the URI
// can be a file in your GG package, a local file on your computer, or an
// internet URL to download and play.
curAudioClip_ = framework.audio.play(AUDIO_CLIP_URI, onAudioStateChange);
startedAudio();
} else { // Already playing something
curAudioClip_.stop();
curAudioClip_ = null;
stoppedAudio();
}
}

function onAudioStateChange(audioClip, state) {
// This function is called whenever the audio clip starts or stops. See
// the gddSoundState enumeration for all possible states.
if (state == gddSoundStateStopped) {
stoppedAudio();
curAudioClip_ = null;
} else if (state == gddSoundStatePlaying) {
startedAudio();
}
}

function startedAudio() {
playStopLabel.innerText = STOP;
}

function stoppedAudio() {
playStopLabel.innerText = PLAY;
}





main.xml

<!-- Copyright (c) 2006 Google Inc. -->
<!-- All rights reserved -->
<!-- -->
<!-- This file is part of the Google Desktop SDK and may be freely copied and used. -->
<!-- To download the latest version of the SDK please visit -->
<!-- http://desktop.google.com/ -->

<view width="250" height="150">
<script src="main.js" />

<img src="background.png" />
<label name="playStopLabel" x="0" y="60" align="center" width="250" size="15"
enabled="true" onclick="onTextClick();">&Play;</label>
</view>




How do I get it to play different tracks not just the same one.
Where do I find (REALLY GOOD SITE), which has pre-made
scripts.?

I'm just messing around with it, not so serious. But I heard
python is meant to be good, might as well learn it.