annotate AudioProcessor.bsv @ 17:9d1f38722f5b pygar svn.18

[svn r18] changed config file to not use mit-6.375 anymore
author rlm
date Tue, 27 Apr 2010 22:55:55 -0400
parents 7e1510b47336
children
rev   line source
punk@16 1 // The MIT License
punk@16 2
punk@16 3 // Copyright (c) 2009 Massachusetts Institute of Technology
punk@16 4
punk@16 5 // Permission is hereby granted, free of charge, to any person obtaining a copy
punk@16 6 // of this software and associated documentation files (the "Software"), to deal
punk@16 7 // in the Software without restriction, including without limitation the rights
punk@16 8 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
punk@16 9 // copies of the Software, and to permit persons to whom the Software is
punk@16 10 // furnished to do so, subject to the following conditions:
punk@16 11
punk@16 12 // The above copyright notice and this permission notice shall be included in
punk@16 13 // all copies or substantial portions of the Software.
punk@16 14
punk@16 15 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
punk@16 16 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
punk@16 17 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
punk@16 18 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
punk@16 19 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
punk@16 20 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
punk@16 21 // THE SOFTWARE.
punk@16 22
punk@16 23 import Connectable::*;
punk@16 24 import GetPut::*;
punk@16 25 import ClientServer::*;
punk@16 26
punk@16 27 //AWB includes
punk@16 28 `include "asim/provides/low_level_platform_interface.bsh"
punk@16 29 `include "asim/provides/soft_connections.bsh"
punk@16 30 `include "asim/provides/common_services.bsh"
punk@16 31
punk@16 32 // Local includes
punk@16 33 `include "asim/provides/audio_processor_types.bsh"
punk@16 34 `include "asim/provides/audio_pipeline.bsh"
punk@16 35
punk@16 36 `include "asim/rrr/remote_client_stub_AUDIOPROCESSORRRR.bsh"
punk@16 37 `include "asim/rrr/remote_server_stub_AUDIOPROCESSORRRR.bsh"
punk@16 38
punk@16 39
punk@16 40 module [CONNECTED_MODULE] mkConnectedApplication ();
punk@16 41
punk@16 42 // Instantiate the rrr stubs
punk@16 43 ClientStub_AUDIOPROCESSORRRR client_stub <- mkClientStub_AUDIOPROCESSORRRR();
punk@16 44 ServerStub_AUDIOPROCESSORRRR server_stub <- mkServerStub_AUDIOPROCESSORRRR();
punk@16 45
punk@16 46 // Instantiate the audio pipeline
punk@16 47 AudioPipeline pipeline <- mkAudioPipeline();
punk@16 48
punk@16 49 rule feedInput;
punk@16 50 let command <- server_stub.acceptRequest_SendUnprocessedStream();
punk@16 51 AudioProcessorControl ctrl = unpack(truncate(command.ctrl));
punk@16 52
punk@16 53 if(ctrl == EndOfFile)
punk@16 54 begin
punk@16 55 pipeline.sampleInput.put(tagged EndOfFile);
punk@16 56 end
punk@16 57 else
punk@16 58 begin
punk@16 59 pipeline.sampleInput.put(tagged Sample unpack(truncate(command.sample)));
punk@16 60 end
punk@16 61 endrule
punk@16 62
punk@16 63 rule feedOutput;
punk@16 64 let pipelineData <- pipeline.sampleOutput.get();
punk@16 65 AudioProcessorControl endOfFileTag = EndOfFile;
punk@16 66 AudioProcessorControl sampleTag = Data;
punk@16 67
punk@16 68 case (pipelineData) matches
punk@16 69 tagged EndOfFile: client_stub.makeRequest_SendProcessedStream(zeroExtend(pack(endOfFileTag)),?);
punk@16 70 tagged Sample .sample:client_stub.makeRequest_SendProcessedStream(zeroExtend(pack(sampleTag)),
punk@16 71 zeroExtend(pack(sample)));
punk@16 72 endcase
punk@16 73 endrule
punk@16 74
punk@16 75 endmodule
punk@16 76
punk@16 77